changeset 2856:8c516da3c1f7

[project @ 1997-03-31 06:37:21 by jwe]
author jwe
date Mon, 31 Mar 1997 06:39:28 +0000
parents 1bb7dc230a4b
children 5448c8cba402
files src/ChangeLog src/help.cc src/input.cc src/lex.l src/load-save.cc src/parse.y src/pt-fcn.cc src/symtab.cc src/symtab.h src/variables.cc src/variables.h
diffstat 11 files changed, 191 insertions(+), 178 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,11 @@
+Mon Mar 31 00:37:48 1997  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
+	* symtab.h, symtab.cc: Use bool instead of int in more places.
+	* variables.h, variables.cc: Likewise.
+	* help.cc, input.cc, lex.l, load-save.cc, parse.y, pt-fcn.cc:
+	Change callers of symbol_table::lookup to use bool instead of int,
+	and to make use of default arguments.
+
 Fri Mar 28 15:33:11 1997  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* parse.y (Vwarn_comma_in_declaration): Delete.
--- a/src/help.cc
+++ b/src/help.cc
@@ -348,7 +348,7 @@
 void
 print_usage (const string& nm, int just_usage)
 {
-  symbol_record *sym_rec = global_sym_tab->lookup (nm, 0, 0);
+  symbol_record *sym_rec = global_sym_tab->lookup (nm);
   if (sym_rec)
     {
       string h = sym_rec->help ();
--- a/src/input.cc
+++ b/src/input.cc
@@ -673,9 +673,9 @@
   delete [] hint;
   hint = strsave (ptr + 1);
 
-  symbol_record *sr = curr_sym_tab->lookup (id, 0, 0);
+  symbol_record *sr = curr_sym_tab->lookup (id);
   if (! sr)
-    sr = global_sym_tab->lookup (id, 0, 0);
+    sr = global_sym_tab->lookup (id);
 
   if (sr && sr->is_defined ())
     {
@@ -689,7 +689,7 @@
 	{
 	  if (elts && *elts)
 	    {
-	      octave_value ult = def->lookup_map_element (elts, 0, 1);
+	      octave_value ult = def->lookup_map_element (elts, false, true);
 
 	      if (ult.is_map ())
 		{
@@ -767,9 +767,9 @@
       elts = ptr + 1;
     }
 
-  symbol_record *sr = curr_sym_tab->lookup (id, 0, 0);
+  symbol_record *sr = curr_sym_tab->lookup (id);
   if (! sr)
-    sr = global_sym_tab->lookup (id, 0, 0);
+    sr = global_sym_tab->lookup (id);
 
   if (sr && sr->is_defined ())
     {
@@ -783,7 +783,7 @@
 	{
 	  if (elts && *elts)
 	    {
-	      octave_value ult = def->lookup_map_element (elts, 0, 1);
+	      octave_value ult = def->lookup_map_element (elts, false, true);
 
 	      if (ult.is_map ())
 		retval = 1;
--- a/src/lex.l
+++ b/src/lex.l
@@ -1079,13 +1079,13 @@
 static symbol_record *
 lookup_identifier (const string& name)
 {
-  return curr_sym_tab->lookup (name, 1, 0);
+  return curr_sym_tab->lookup (name, true);
 }
 
 static bool
 is_variable (const string& name)
 {
-  symbol_record *sr = curr_sym_tab->lookup (name, 0, 0);
+  symbol_record *sr = curr_sym_tab->lookup (name);
 
   return sr && sr->is_variable ();
 }
@@ -1093,7 +1093,7 @@
 static void
 force_local_variable (const string& name)
 {
-  symbol_record *sr = curr_sym_tab->lookup (name, 1, 0);
+  symbol_record *sr = curr_sym_tab->lookup (name, true);
 
   if (sr)
     sr->define (octave_value ());
--- a/src/load-save.cc
+++ b/src/load-save.cc
@@ -93,7 +93,7 @@
 {
   // Is there already a symbol by this name?  If so, what is it?
 
-  symbol_record *lsr = curr_sym_tab->lookup (name, 0, 0);
+  symbol_record *lsr = curr_sym_tab->lookup (name);
 
   int is_undefined = 1;
   int is_variable = 0;
@@ -116,7 +116,7 @@
 	{
 	  if (force || is_undefined)
 	    {
-	      lsr = curr_sym_tab->lookup (name, 1, 0);
+	      lsr = curr_sym_tab->lookup (name, true);
 	      link_to_global_variable (lsr);
 	      sr = lsr;
 	    }
@@ -130,7 +130,7 @@
 	{
 	  if (force)
 	    {
-	      lsr = curr_sym_tab->lookup (name, 1, 0);
+	      lsr = curr_sym_tab->lookup (name, true);
 	      link_to_global_variable (lsr);
 	      sr = lsr;
 	    }
@@ -144,7 +144,7 @@
 	{
 	  if (force)
 	    {
-	      lsr = curr_sym_tab->lookup (name, 1, 0);
+	      lsr = curr_sym_tab->lookup (name, true);
 	      link_to_global_variable (lsr);
 	      sr = lsr;
 	    }
@@ -163,7 +163,7 @@
 	{
 	  if (force || is_undefined)
 	    {
-	      lsr = curr_sym_tab->lookup (name, 1, 0);
+	      lsr = curr_sym_tab->lookup (name, true);
 	      link_to_global_variable (lsr);
 	      sr = lsr;
 	    }
@@ -177,7 +177,7 @@
 	{
 	  if (force)
 	    {
-	      lsr = curr_sym_tab->lookup (name, 1, 0);
+	      lsr = curr_sym_tab->lookup (name, true);
 	      link_to_global_variable (lsr);
 	      sr = lsr;
 	    }
@@ -191,7 +191,7 @@
 	{
 	  if (force || is_undefined)
 	    {
-	      lsr = curr_sym_tab->lookup (name, 1, 0);
+	      lsr = curr_sym_tab->lookup (name, true);
 	      sr = lsr;
 	    }
 	  else
--- a/src/parse.y
+++ b/src/parse.y
@@ -1378,7 +1378,7 @@
       // tree_simple_assignment_expression along with a flag to not
       // delete it seems to create a memory leak.  Hmm.
 
-      static symbol_record *sr = global_sym_tab->lookup ("ans", 1, 0);
+      static symbol_record *sr = global_sym_tab->lookup ("ans", true);
       tree_identifier *ans_id = new tree_identifier (sr);
 
       int l = expr->line ();
@@ -2192,7 +2192,7 @@
 
   top_level_sym_tab->clear (id_name);
 
-  symbol_record *sr = global_sym_tab->lookup (id_name, 0, 0);
+  symbol_record *sr = global_sym_tab->lookup (id_name);
 
   if (sr)
     fcn->stash_symtab_ptr (sr);
--- a/src/pt-fcn.cc
+++ b/src/pt-fcn.cc
@@ -72,8 +72,8 @@
 void
 tree_function::install_nargin_and_nargout (void)
 {
-  nargin_sr = sym_tab->lookup ("nargin", 1, 0);
-  nargout_sr = sym_tab->lookup ("nargout", 1, 0);
+  nargin_sr = sym_tab->lookup ("nargin", true);
+  nargout_sr = sym_tab->lookup ("nargout", true);
 }
 
 void
--- a/src/symtab.cc
+++ b/src/symtab.cc
@@ -86,56 +86,56 @@
   delete definition;
 }
 
-int
+bool
 symbol_def::is_variable (void) const
 {
   return (type & USER_VARIABLE || type & BUILTIN_VARIABLE);
 }
 
-int
+bool
 symbol_def::is_function (void) const
 {
   return (type & USER_FUNCTION || type & BUILTIN_FUNCTION);
 }
 
-int
+bool
 symbol_def::is_user_variable (void) const
 {
   return (type & USER_VARIABLE);
 }
 
-int
+bool
 symbol_def::is_text_function (void) const
 {
   return (type & TEXT_FUNCTION);
 }
 
-int
+bool
 symbol_def::is_mapper_function (void) const
 {
   return (type & MAPPER_FUNCTION);
 }
 
-int
+bool
 symbol_def::is_user_function (void) const
 {
   return (type & USER_FUNCTION);
 }
 
-int
+bool
 symbol_def::is_builtin_variable (void) const
 {
   return (type & BUILTIN_VARIABLE);
 }
 
-int
+bool
 symbol_def::is_builtin_function (void) const
 {
   return (type & BUILTIN_FUNCTION);
 }
 
 // XXX FIXME XXX
-int
+bool
 symbol_def::is_map_element (const string& /* elts */) const
 {
   return 0;
@@ -261,7 +261,7 @@
 tree_fvc *
 symbol_record::def (void) const
 {
-  return definition ? definition->def () : 0;
+  return definition ? definition->def () : false;
 }
 
 void
@@ -271,82 +271,82 @@
     nm = new_name;
 }
 
-int
+bool
 symbol_record::is_function (void) const
 {
-  return definition ? definition->is_function () : 0;
+  return definition ? definition->is_function () : false;
 }
 
-int
+bool
 symbol_record::is_text_function (void) const
 {
-  return definition ? definition->is_text_function () : 0;
+  return definition ? definition->is_text_function () : false;
 }
 
-int
+bool
 symbol_record::is_mapper_function (void) const
 {
-  return definition ? definition->is_mapper_function () : 0;
+  return definition ? definition->is_mapper_function () : false;
 }
 
-int
+bool
 symbol_record::is_user_function (void) const
 {
-  return definition ? definition->is_user_function () : 0;
+  return definition ? definition->is_user_function () : false;
 }
 
-int
+bool
 symbol_record::is_builtin_function (void) const
 {
-  return definition ? definition->is_builtin_function () : 0;
+  return definition ? definition->is_builtin_function () : false;
 }
 
-int
+bool
 symbol_record::is_variable (void) const
 {
-  return definition ? definition->is_variable () : 0;
+  return definition ? definition->is_variable () : false;
 }
 
-int
+bool
 symbol_record::is_user_variable (void) const
 {
-  return definition ? definition->is_user_variable () : 0;
+  return definition ? definition->is_user_variable () : false;
 }
 
-int
+bool
 symbol_record::is_builtin_variable (void) const
 {
-  return definition ? definition->is_builtin_variable () : 0;
+  return definition ? definition->is_builtin_variable () : false;
 }
 
-int
+bool
 symbol_record::is_map_element (const string& elts) const
 {
-  return definition ? definition->is_map_element (elts) : 0;
+  return definition ? definition->is_map_element (elts) : false;
 }
 
 unsigned
 symbol_record::type (void) const
 {
-  return definition ? definition->type : 0;
+  return definition ? definition->type : false;
 }
 
-int
+bool
 symbol_record::is_defined (void) const
 {
-  return definition ? (definition->def () != 0) : 0;
+  return definition ? (definition->def () != 0) : false;
 }
 
-int
+bool
 symbol_record::is_read_only (void) const
 {
-  return definition ? definition->read_only : 0;
+  return definition ? definition->read_only : false;
 }
 
-int
+bool
 symbol_record::is_eternal (void) const
 {
-  return definition ? definition->eternal : 0;
+  return definition ? definition->eternal : false;
 }
 
 void
@@ -433,7 +433,7 @@
 }
 
 int
-symbol_record::define (tree_builtin *t, int text_fcn)
+symbol_record::define (tree_builtin *t, bool text_fcn)
 {
   if (read_only_error ("redefine"))
     return 0;
@@ -462,7 +462,7 @@
 }
 
 int
-symbol_record::define (tree_function *t, int text_fcn)
+symbol_record::define (tree_function *t, bool text_fcn)
 {
   if (read_only_error ("redefine"))
     return 0;
@@ -557,7 +557,7 @@
 }
 
 void
-symbol_record::alias (symbol_record *s, int force)
+symbol_record::alias (symbol_record *s, bool force)
 {
   sv_fcn = s->sv_fcn;
 
@@ -580,7 +580,7 @@
   formal_param = 1;
 }
 
-int
+bool
 symbol_record::is_formal_parameter (void) const
 {
   return formal_param;
@@ -592,7 +592,7 @@
   linked_to_global = 1;
 }
 
-int
+bool
 symbol_record::is_linked_to_global (void) const
 {
   return linked_to_global;
@@ -609,7 +609,7 @@
     tagged_static = 1;
 }
 
-int
+bool
 symbol_record::is_static (void) const
 {
   return tagged_static;
@@ -812,31 +812,31 @@
   return *this;
 }
 
-int
+bool
 symbol_record_info::is_defined (void) const
 {
   return initialized;
 }
 
-int
+bool
 symbol_record_info::is_read_only (void) const
 {
   return read_only;
 }
 
-int
+bool
 symbol_record_info::is_eternal (void) const
 {
   return eternal;
 }
 
-int
+bool
 symbol_record_info::hides_fcn (void) const
 {
   return (hides & SR_INFO_USER_FUNCTION);
 }
 
-int
+bool
 symbol_record_info::hides_builtin (void) const
 {
   return (hides & SR_INFO_BUILTIN_FUNCTION);
@@ -864,7 +864,7 @@
   return retval;
 }
 
-int
+bool
 symbol_record_info::is_function (void) const
 {
   return (type == symbol_def::USER_FUNCTION
@@ -898,7 +898,7 @@
 }
 
 symbol_record *
-symbol_table::lookup (const string& nm, int insert, int warn)
+symbol_table::lookup (const string& nm, bool insert, bool warn)
 {
   int index = hash (nm) & HASH_MASK;
 
@@ -960,7 +960,7 @@
 }
 
 void
-symbol_table::clear (int clear_user_functions)
+symbol_table::clear (bool clear_user_functions)
 {
   for (int i = 0; i < HASH_TABLE_SIZE; i++)
     {
@@ -980,7 +980,7 @@
 }
 
 int
-symbol_table::clear (const string& nm, int clear_user_functions)
+symbol_table::clear (const string& nm, bool clear_user_functions)
 {
   int index = hash (nm) & HASH_MASK;
 
@@ -1047,7 +1047,7 @@
 
 symbol_record_info *
 symbol_table::long_list (int& count, const string_vector& pats,
-			 int npats, int sort, unsigned type,
+			 int npats, bool sort, unsigned type,
 			 unsigned scope) const 
 {
   count = 0;
@@ -1087,7 +1087,7 @@
 
 string_vector
 symbol_table::list (int& count, const string_vector& pats, int npats,
-		    int sort, unsigned type, unsigned scope) const
+		    bool sort, unsigned type, unsigned scope) const
 {
   count = 0;
   int n = size ();
@@ -1205,20 +1205,20 @@
 
 // Return nonzero if S is a valid identifier.
 
-int
+bool
 valid_identifier (const char *s)
 {
   if (! s || ! (isalnum (*s) || *s == '_'))
-     return 0;
+     return false;
 
   while (*++s != '\0')
     if (! (isalnum (*s) || *s == '_'))
-      return 0;
+      return false;
 
-  return 1;
+  return true;
 }
 
-int
+bool
 valid_identifier (const string& s)
 {
   return valid_identifier (s.c_str ());
--- a/src/symtab.h
+++ b/src/symtab.h
@@ -68,15 +68,15 @@
 
   ~symbol_def (void);
 
-  int is_variable (void) const;
-  int is_function (void) const;
-  int is_text_function (void) const;
-  int is_mapper_function (void) const;
-  int is_user_variable (void) const;
-  int is_user_function (void) const;
-  int is_builtin_variable (void) const;
-  int is_builtin_function (void) const;
-  int is_map_element (const string& elts) const;
+  bool is_variable (void) const;
+  bool is_function (void) const;
+  bool is_text_function (void) const;
+  bool is_mapper_function (void) const;
+  bool is_user_variable (void) const;
+  bool is_user_function (void) const;
+  bool is_builtin_variable (void) const;
+  bool is_builtin_function (void) const;
+  bool is_map_element (const string& elts) const;
 
   void define (tree_constant *t);
   void define (tree_builtin *t, unsigned fcn_type = 0);
@@ -139,21 +139,21 @@
 
   void rename (const string& new_name);
 
-  int is_function (void) const;
-  int is_user_function (void) const;
-  int is_text_function (void) const;
-  int is_mapper_function (void) const;
-  int is_builtin_function (void) const;
-  int is_variable (void) const;
-  int is_user_variable (void) const;
-  int is_builtin_variable (void) const;
-  int is_map_element (const string& elts) const;
+  bool is_function (void) const;
+  bool is_user_function (void) const;
+  bool is_text_function (void) const;
+  bool is_mapper_function (void) const;
+  bool is_builtin_function (void) const;
+  bool is_variable (void) const;
+  bool is_user_variable (void) const;
+  bool is_builtin_variable (void) const;
+  bool is_map_element (const string& elts) const;
 
   unsigned type (void) const;
 
-  int is_defined (void) const;
-  int is_read_only (void) const;
-  int is_eternal (void) const;
+  bool is_defined (void) const;
+  bool is_read_only (void) const;
+  bool is_eternal (void) const;
 
   void protect (void);
   void unprotect (void);
@@ -163,8 +163,8 @@
 
   int define (tree_constant *t);
   int define (const octave_value& v);
-  int define (tree_builtin *t, int text_fcn = 0);
-  int define (tree_function *t, int text_fcn = 0);
+  int define (tree_builtin *t, bool text_fcn = false);
+  int define (tree_function *t, bool text_fcn = false);
   int define_as_fcn (const octave_value& v);
   int define_builtin_var (const octave_value& v);
 
@@ -172,16 +172,16 @@
 
   int clear (void);
 
-  void alias (symbol_record *s, int force = 0);
+  void alias (symbol_record *s, bool force = false);
 
   void mark_as_formal_parameter (void);
-  int is_formal_parameter (void) const;
+  bool is_formal_parameter (void) const;
 
   void mark_as_linked_to_global (void);
-  int is_linked_to_global (void) const;
+  bool is_linked_to_global (void) const;
 
   void mark_as_static (void);
-  int is_static (void) const;
+  bool is_static (void) const;
 
   octave_value variable_value (void) const;
   octave_value& variable_reference (void);
@@ -235,13 +235,13 @@
 
   symbol_record_info& operator = (const symbol_record_info& s);
 
-  int is_defined (void) const;
-  int is_read_only (void) const;
-  int is_eternal (void) const;
-  int hides_fcn (void) const;
-  int hides_builtin (void) const;
+  bool is_defined (void) const;
+  bool is_read_only (void) const;
+  bool is_eternal (void) const;
+  bool hides_fcn (void) const;
+  bool hides_builtin (void) const;
   string type_name (void) const;
-  int is_function (void) const;
+  bool is_function (void) const;
   int rows (void) const;
   int columns (void) const;
   string name (void) const;
@@ -255,7 +255,7 @@
 
 private:
 
-  int initialized;
+  bool initialized;
   int nr;
   int nc;
   unsigned type : 6;
@@ -290,23 +290,25 @@
 
   symbol_table (void);
 
-  symbol_record *lookup (const string& nm, int insert = 0, int warn = 0);
+  symbol_record *lookup (const string& nm, bool insert = false,
+			 bool warn = false);
 
   void rename (const string& old_name, const string& new_name);
 
-  void clear (int clear_user_functions = 1);
-  int clear (const string& nm, int clear_user_functions = 1);
+  void clear (bool clear_user_functions = true);
+  int clear (const string& nm, bool clear_user_functions = true);
 
   int size (void) const;
 
   symbol_record_info *
   long_list (int& count, const string_vector& pats = string_vector (),
-	     int npats = 0, int sort = 0, unsigned type = SYMTAB_ALL_TYPES,
+	     int npats = 0, bool sort = false,
+	     unsigned type = SYMTAB_ALL_TYPES,
 	     unsigned scope = SYMTAB_ALL_SCOPES) const;
 
   string_vector
   list (int& count, const string_vector& pats = string_vector (),
-	int npats = 0, int sort = 0, unsigned type = SYMTAB_ALL_TYPES,
+	int npats = 0, bool sort = false, unsigned type = SYMTAB_ALL_TYPES,
 	unsigned scope = SYMTAB_ALL_SCOPES) const;
 
   symbol_record **glob (int& count, const string& pat = string ("*"),
@@ -323,9 +325,9 @@
   symbol_record table[HASH_TABLE_SIZE];
 };
 
-extern int valid_identifier (const char *s);
+extern bool valid_identifier (const char *s);
 
-extern int valid_identifier (const string& s);
+extern bool valid_identifier (const string& s);
 
 #endif
 
--- a/src/variables.cc
+++ b/src/variables.cc
@@ -193,7 +193,7 @@
 bool
 is_builtin_variable (const string& name)
 {
-  symbol_record *sr = global_sym_tab->lookup (name, 0, 0);
+  symbol_record *sr = global_sym_tab->lookup (name);
   return (sr && sr->is_builtin_variable ());
 }
 
@@ -229,14 +229,14 @@
 bool
 is_globally_visible (const string& name)
 {
-  symbol_record *sr = curr_sym_tab->lookup (name, 0, 0);
+  symbol_record *sr = curr_sym_tab->lookup (name);
   return (sr && sr->is_linked_to_global ());
 }
 
 // Is this octave_value a valid function?
 
 tree_fvc *
-is_valid_function (const octave_value& arg, const string& warn_for, int warn)
+is_valid_function (const octave_value& arg, const string& warn_for, bool warn)
 {
   tree_fvc *ans = 0;
 
@@ -341,7 +341,7 @@
       return retval;
     }
 
-  symbol_record *sr = curr_sym_tab->lookup (name, 0, 0);
+  symbol_record *sr = curr_sym_tab->lookup (name);
 
   retval = static_cast<double> (sr && sr->is_linked_to_global ());
 
@@ -388,9 +388,9 @@
       symbol_name = name.substr (0, pos);
     }
 
-  symbol_record *sr = curr_sym_tab->lookup (symbol_name, 0, 0);
+  symbol_record *sr = curr_sym_tab->lookup (symbol_name);
   if (! sr)
-    sr = global_sym_tab->lookup (symbol_name, 0, 0);
+    sr = global_sym_tab->lookup (symbol_name);
 
   retval = 0.0;
 
@@ -646,7 +646,7 @@
 }
 
 static int
-parse_fcn_file (int exec_script, const string& ff)
+parse_fcn_file (bool exec_script, const string& ff)
 {
   begin_unwind_frame ("parse_fcn_file");
 
@@ -754,7 +754,7 @@
 }
 
 static bool
-load_fcn_from_file (symbol_record *sym_rec, int exec_script)
+load_fcn_from_file (symbol_record *sym_rec, bool exec_script)
 {
   bool script_file_executed = false;
 
@@ -791,7 +791,7 @@
 }
 
 bool
-lookup (symbol_record *sym_rec, int exec_script)
+lookup (symbol_record *sym_rec, bool exec_script)
 {
   bool script_executed = false;
 
@@ -823,9 +823,9 @@
 // current symbol table.
 
 symbol_record *
-lookup_by_name (const string& nm, int exec_script)
+lookup_by_name (const string& nm, bool exec_script)
 {
-  symbol_record *sym_rec = curr_sym_tab->lookup (nm, 1, 0);
+  symbol_record *sym_rec = curr_sym_tab->lookup (nm, true);
 
   lookup (sym_rec, exec_script);
 
@@ -859,7 +859,7 @@
 void
 set_global_value (const string& nm, const octave_value& val)
 {
-  symbol_record *sr = global_sym_tab->lookup (nm, 1);
+  symbol_record *sr = global_sym_tab->lookup (nm, true);
 
   if (sr)
     sr->define (val);
@@ -897,7 +897,7 @@
 string
 builtin_string_variable (const string& name)
 {
-  symbol_record *sr = global_sym_tab->lookup (name, 0, 0);
+  symbol_record *sr = global_sym_tab->lookup (name);
 
   // It is a prorgramming error to look for builtins that aren't.
 
@@ -926,7 +926,7 @@
 builtin_real_scalar_variable (const string& name, double& d)
 {
   int status = 0;
-  symbol_record *sr = global_sym_tab->lookup (name, 0, 0);
+  symbol_record *sr = global_sym_tab->lookup (name);
 
   // It is a prorgramming error to look for builtins that aren't.
 
@@ -955,7 +955,7 @@
 {
   octave_value retval;
 
-  symbol_record *sr = global_sym_tab->lookup (name, 0, 0);
+  symbol_record *sr = global_sym_tab->lookup (name);
 
   // It is a prorgramming error to look for builtins that aren't.
 
@@ -983,7 +983,7 @@
 
   string nm = sr->name ();
 
-  symbol_record *gsr = global_sym_tab->lookup (nm, 1, 0);
+  symbol_record *gsr = global_sym_tab->lookup (nm, true);
 
   if (sr->is_formal_parameter ())
     {
@@ -1029,7 +1029,7 @@
 void
 link_to_builtin_variable (symbol_record *sr)
 {
-  symbol_record *tmp_sym = global_sym_tab->lookup (sr->name (), 0, 0);
+  symbol_record *tmp_sym = global_sym_tab->lookup (sr->name ());
 
   if (tmp_sym && tmp_sym->is_builtin_variable ())
     sr->alias (tmp_sym);
@@ -1043,7 +1043,7 @@
 void
 link_to_builtin_or_function (symbol_record *sr)
 {
-  symbol_record *tmp_sym = global_sym_tab->lookup (sr->name (), 0, 0);
+  symbol_record *tmp_sym = global_sym_tab->lookup (sr->name ());
 
   if (tmp_sym
       && (tmp_sym->is_builtin_variable () || tmp_sym->is_function ())
@@ -1062,11 +1062,11 @@
 void
 force_link_to_function (const string& id_name)
 {
-  symbol_record *gsr = global_sym_tab->lookup (id_name, 1, 0);
+  symbol_record *gsr = global_sym_tab->lookup (id_name, true);
   if (gsr->is_function ())
     {
       curr_sym_tab->clear (id_name);
-      symbol_record *csr = curr_sym_tab->lookup (id_name, 1, 0);
+      symbol_record *csr = curr_sym_tab->lookup (id_name, true);
       csr->alias (gsr);
     }
 }
@@ -1176,7 +1176,7 @@
 
 static int
 maybe_list (const char *header, const string_vector& argv, int argc,
-	    ostream& os, int show_verbose, symbol_table
+	    ostream& os, bool show_verbose, symbol_table
 	    *sym_tab, unsigned type, unsigned scope)
 {
   int count;
@@ -1236,7 +1236,7 @@
 		error ("document: can't redefine help for built-in variables and functions");
 	      else
 		{
-		  symbol_record *sym_rec = curr_sym_tab->lookup (name, 0);
+		  symbol_record *sym_rec = curr_sym_tab->lookup (name);
 
 		  if (sym_rec)
 		    sym_rec->document (help);
@@ -1260,17 +1260,17 @@
 {
   octave_value_list retval;
 
-  int show_builtins = 0;
-  int show_functions = (curr_sym_tab == top_level_sym_tab);
-  int show_variables = 1;
-  int show_verbose = 0;
+  bool show_builtins = false;
+  bool show_functions = (curr_sym_tab == top_level_sym_tab);
+  bool show_variables = true;
+  bool show_verbose = false;
 
   string my_name = argv[0];
 
   if (argc > 1)
     {
-      show_functions = 0;
-      show_variables = 0;
+      show_functions = false;
+      show_variables = false;
     }
 
   int i;
@@ -1278,18 +1278,18 @@
     {
       if (argv[i] == "-all" || argv[i] == "-a")
 	{
-	  show_builtins++;
-	  show_functions++;
-	  show_variables++;
+	  show_builtins = true;
+	  show_functions = true;
+	  show_variables = true;
 	}
       else if (argv[i] == "-builtins" || argv[i] == "-b")
-	show_builtins++;
+	show_builtins = true;
       else if (argv[i] == "-functions" || argv[i] == "-f")
-	show_functions++;
+	show_functions = true;
       else if (argv[i] == "-long" || argv[i] == "-l")
-	show_verbose++;
+	show_verbose = true;
       else if (argv[i] == "-variables" || argv[i] == "-v")
-	show_variables++;
+	show_variables = true;
       else if (argv[i][0] == '-')
 	warning ("%s: unrecognized option `%s'", my_name.c_str (),
 		 argv[i].c_str ());
@@ -1405,7 +1405,7 @@
 void
 install_builtin_mapper (const builtin_mapper_function& mf)
 {
-  symbol_record *sym_rec = global_sym_tab->lookup (mf.name, 1);
+  symbol_record *sym_rec = global_sym_tab->lookup (mf.name, true);
   sym_rec->unprotect ();
 
   tree_builtin *def = new tree_builtin (mf, mf.name);
@@ -1420,7 +1420,7 @@
 void
 install_builtin_function (const builtin_function& f)
 {
-  symbol_record *sym_rec = global_sym_tab->lookup (f.name, 1);
+  symbol_record *sym_rec = global_sym_tab->lookup (f.name, true);
   sym_rec->unprotect ();
 
   tree_builtin *def = new tree_builtin (f.fcn, f.name);
@@ -1446,10 +1446,10 @@
 void
 install_builtin_variable_as_function (const string& name,
 				      const octave_value& val,
-				      int protect, int eternal,
+				      bool protect, bool eternal,
 				      const string& help)
 {
-  symbol_record *sym_rec = global_sym_tab->lookup (name, 1);
+  symbol_record *sym_rec = global_sym_tab->lookup (name, true);
   sym_rec->unprotect ();
 
   string tmp_help = help.empty () ? sym_rec->help () : help;
@@ -1468,12 +1468,12 @@
 void
 alias_builtin (const string& alias, const string& name)
 {
-  symbol_record *sr_name = global_sym_tab->lookup (name, 0, 0);
+  symbol_record *sr_name = global_sym_tab->lookup (name);
 
   if (! sr_name)
     panic ("can't alias to undefined name!");
 
-  symbol_record *sr_alias = global_sym_tab->lookup (alias, 1, 0);
+  symbol_record *sr_alias = global_sym_tab->lookup (alias, true);
 
   if (sr_alias)
     sr_alias->alias (sr_name);
@@ -1485,9 +1485,9 @@
 // Defining variables.
 
 void
-bind_ans (const octave_value& val, int print)
+bind_ans (const octave_value& val, bool print)
 {
-  static symbol_record *sr = global_sym_tab->lookup ("ans", 1, 0);
+  static symbol_record *sr = global_sym_tab->lookup ("ans", true);
 
   tree_identifier *ans_id = new tree_identifier (sr);
   tree_constant *tmp = new tree_constant (val);
@@ -1534,10 +1534,10 @@
 
 void
 bind_builtin_variable (const string& varname, const octave_value& val,
-		       int protect, int eternal, sv_Function sv_fcn,
+		       bool protect, bool eternal, sv_Function sv_fcn,
 		       const string& help)
 {
-  symbol_record *sr = global_sym_tab->lookup (varname, 1, 0);
+  symbol_record *sr = global_sym_tab->lookup (varname, true);
 
   // It is a programming error for a builtin symbol to be missing.
   // Besides, we just inserted it, so it must be there.
@@ -1740,7 +1740,7 @@
   // functions unless we are at the top level.  (Allowing that to
   // happen inside functions would result in pretty odd behavior...)
 
-  int clear_user_functions = (curr_sym_tab == top_level_sym_tab);
+  bool clear_user_functions = (curr_sym_tab == top_level_sym_tab);
 
   if (argc == 1)
     {
--- a/src/variables.h
+++ b/src/variables.h
@@ -43,16 +43,16 @@
 
 struct builtin_variable
 {
-  builtin_variable (const string& n, const octave_value& v, int iaf, int p,
-		    int e, sv_Function svf, const string& h)
+  builtin_variable (const string& n, const octave_value& v, bool iaf,
+		    bool p, bool e, sv_Function svf, const string& h)
     : name (n), value (v), install_as_function (iaf), protect (p),
       eternal (e), sv_function (svf), help_string (h) { }
 
   string name;
   octave_value value;
-  int install_as_function;
-  int protect;
-  int eternal;
+  bool install_as_function;
+  bool protect;
+  bool eternal;
   sv_Function sv_function;
   string help_string;
 };
@@ -91,21 +91,22 @@
 
 struct builtin_function
 {
-  builtin_function (const string& n, int itf, Octave_builtin_fcn f,
+  builtin_function (const string& n, bool itf, Octave_builtin_fcn f,
 		    const string& h)
     : name (n), is_text_fcn (itf), fcn (f), help_string (h) { }
 
   string name;
-  int is_text_fcn;
+  bool is_text_fcn;
   Octave_builtin_fcn fcn;
   string help_string;
 };
 
 extern void initialize_symbol_tables (void);
 
-extern bool lookup (symbol_record *s, int exec_script = 1);
+extern bool lookup (symbol_record *s, bool exec_script = true);
 
-extern symbol_record *lookup_by_name (const string& nm, int exec_script = 1);
+extern symbol_record *lookup_by_name (const string& nm,
+				      bool exec_script = true);
 
 extern octave_value get_global_value (const string& nm);
 
@@ -130,7 +131,7 @@
 extern bool is_globally_visible (const string&);
 
 extern tree_fvc *is_valid_function (const octave_value&, const string&,
-				    int warn = 0); 
+				    bool warn = false); 
 
 tree_fvc *extract_function (const octave_value& arg, const string& warn_for,
 			    const string& fname, const string& header,
@@ -147,19 +148,21 @@
 extern void
 install_builtin_variable_as_function (const string& name,
 				      const octave_value& val,
-				      int protect = 0, int eternal = 0,
+				      bool protect = false,
+				      bool eternal = false,
 				      const string& help = string ());
 
 extern void alias_builtin (const string& alias, const string& name);
 
-extern void bind_ans (const octave_value& val, int print);
+extern void bind_ans (const octave_value& val, bool print);
 
 extern void bind_global_error_variable (void);
 
 extern void clear_global_error_variable (void *);
 
 extern void bind_builtin_variable (const string&, const octave_value&,
-				   int protect = 0, int eternal = 0,
+				   bool protect = false,
+				   bool eternal = false,
 				   sv_Function f = (sv_Function) 0,
 				   const string& help = string ());