diff src/symtab.h @ 1755:3a9462b655f1

[project @ 1996-01-22 04:47:22 by jwe]
author jwe
date Mon, 22 Jan 1996 04:47:22 +0000
parents bb9d00aa55fb
children e62277bf5fe0
line wrap: on
line diff
--- a/src/symtab.h	Mon Jan 22 04:47:00 1996 +0000
+++ b/src/symtab.h	Mon Jan 22 04:47:22 1996 +0000
@@ -28,8 +28,12 @@
 #pragma interface
 #endif
 
+#include <string>
+
 #include "SLStack.h"
 
+#include "str-vec.h"
+
 #include "variables.h"
 
 // Must be multiple of 2.
@@ -42,6 +46,8 @@
 class tree_constant;
 class tree_function;
 
+class string_vector;
+
 class symbol_def;
 class symbol_record;
 class symbol_record_info;
@@ -81,8 +87,8 @@
   void make_eternal (void);
 
   tree_fvc *def (void) const;
-  char *help (void) const;
-  void document (const char *h);
+  string help (void) const;
+  void document (const string& h);
 
   enum TYPE
     {
@@ -103,7 +109,7 @@
   unsigned eternal : 1;
   unsigned read_only : 1;
 
-  char *help_string;
+  string help_string;
   tree_fvc *definition;
   symbol_def *next_elem;
   int count;
@@ -123,15 +129,15 @@
 
 public:
   symbol_record (void);
-  symbol_record (const char *n, symbol_record *nxt = 0);
+  symbol_record (const string& n, symbol_record *nxt = 0);
 
- ~symbol_record (void);
+  ~symbol_record (void) { }
 
-  char *name (void) const;
-  char *help (void) const; 
+  string name (void) const;
+  string help (void) const; 
   tree_fvc *def (void) const;
 
-  void rename (const char *new_name);
+  void rename (const string& new_name);
 
   int is_function (void) const;
   int is_user_function (void) const;
@@ -160,7 +166,7 @@
   int define_as_fcn (tree_constant *t);
   int define_builtin_var (tree_constant *t);
 
-  void document (const char *h);
+  void document (const string& h);
 
   int clear (void);
 
@@ -184,7 +190,7 @@
   unsigned formal_param : 1;
   unsigned linked_to_global : 1;
 
-  char *nm;
+  string nm;
   sv_Function sv_fcn;
   symbol_def *definition;
   symbol_record *next_elem;
@@ -216,7 +222,7 @@
 
   symbol_record_info (const symbol_record_info& s);
 
-  ~symbol_record_info (void);
+  ~symbol_record_info (void) { }
 
   symbol_record_info& operator = (const symbol_record_info& s);
 
@@ -225,11 +231,11 @@
   int is_eternal (void) const;
   int hides_fcn (void) const;
   int hides_builtin (void) const;
-  char *type_as_string (void) const;
+  string type_as_string (void) const;
   int is_function (void) const;
   int rows (void) const;
   int columns (void) const;
-  char *name (void) const;
+  string name (void) const;
 
   enum HIDES
     {
@@ -260,7 +266,7 @@
   unsigned read_only : 1;
   int nr;
   int nc;
-  char *nm;
+  string nm;
   
   int initialized;
 };
@@ -289,25 +295,26 @@
 
   symbol_table (void);
 
-  symbol_record *lookup (const char *nm, int insert = 0, int warn = 0);
+  symbol_record *lookup (const string& nm, int insert = 0, int warn = 0);
 
-  void rename (const char *old_name, const char *new_name);
+  void rename (const string& old_name, const string& new_name);
 
   void clear (int clear_user_functions = 1);
-  int clear (const char *nm, int clear_user_functions = 1);
+  int clear (const string& nm, int clear_user_functions = 1);
 
   int size (void) const;
 
-  symbol_record_info *long_list (int& count, char **pats = 0,
-				 int npats = 0, int sort = 0,
-				 unsigned type = SYMTAB_ALL_TYPES,
-				 unsigned scope = SYMTAB_ALL_SCOPES) 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,
+	     unsigned scope = SYMTAB_ALL_SCOPES) const;
 
-  char **list (int& count, char **pats = 0, int npats = 0,
-	       int sort = 0, 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,
+	unsigned scope = SYMTAB_ALL_SCOPES) const;
 
-  symbol_record **glob (int& count, char *pat = "*",
+  symbol_record **glob (int& count, const string& pat = string ("*"),
 			unsigned type = SYMTAB_ALL_TYPES,
 			unsigned scope = SYMTAB_ALL_SCOPES) const;
 
@@ -316,7 +323,7 @@
 
 private:
 
-  unsigned int hash (const char *s);
+  unsigned int hash (const string& s);
 
   symbol_record table[HASH_TABLE_SIZE];
 };