changeset 2470:1e673f0648b5

[project @ 1996-11-05 21:46:06 by jwe]
author jwe
date Tue, 05 Nov 1996 21:47:59 +0000
parents f201716926bb
children 7f99808d467d
files configure.in liboctave/cmd-hist.cc src/ChangeLog src/help.cc src/input.cc src/octave.cc src/sysdep.cc src/variables.cc
diffstat 8 files changed, 75 insertions(+), 59 deletions(-) [+]
line wrap: on
line diff
--- a/configure.in	Tue Nov 05 19:40:29 1996 +0000
+++ b/configure.in	Tue Nov 05 21:47:59 1996 +0000
@@ -20,7 +20,7 @@
 ### along with Octave; see the file COPYING.  If not, write to the Free
 ### Software Foundation, 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
-AC_REVISION($Revision: 1.223 $)
+AC_REVISION($Revision: 1.224 $)
 AC_PREREQ(2.9)
 AC_INIT(src/octave.cc)
 AC_CONFIG_HEADER(config.h)
@@ -426,11 +426,15 @@
 AC_SUBST(OCTAVE_LITE)
 
 ### special checks for odd OS specific things.
+###
+### I am told that on some SCO systems, the only place to find some
+### functions like gethostname and gettimeofday is in libsocket.
 
 AC_ISC_POSIX
 AC_MINIX
 AC_AIX
 AC_CHECK_LIB(sun, getpwnam)
+AC_CHECK_LIB(socket, gethostname)
 
 ### How big are ints and how are they oriented?  These could probably
 ### be eliminated in favor of run-time checks.
@@ -867,6 +871,8 @@
   AC_MSG_RESULT(yes)
   AC_DEFINE(HAVE_SYS_SIGLIST, 1),
   AC_MSG_RESULT(no))
+OCTAVE_SIGNAL_CHECK
+OCTAVE_REINSTALL_SIGHANDLERS
 
 ### Type stuff.
 
--- a/liboctave/cmd-hist.cc	Tue Nov 05 19:40:29 1996 +0000
+++ b/liboctave/cmd-hist.cc	Tue Nov 05 21:47:59 1996 +0000
@@ -39,10 +39,7 @@
 #include <unistd.h>
 #endif
 
-extern "C"
-{
 #include <readline/history.h>
-}
 
 #include "file-ops.h"
 #include "lo-error.h"
@@ -67,11 +64,11 @@
 	{
 	  xfile = f;
 
-	  read_history (f.c_str ());
+	  ::read_history (f.c_str ());
 
 	  lines_in_file = where ();
 
-	  using_history ();
+	  ::using_history ();
 	}
 
       if (n > 0)
@@ -122,7 +119,7 @@
 {
   if (! ignoring_entries ())
     {
-      add_history (s.c_str ());
+      ::add_history (s.c_str ());
       lines_this_session++;
     }
 }
@@ -130,27 +127,27 @@
 void
 command_history::remove (int n)
 {
-  HIST_ENTRY *discard = remove_history (n);
+  HIST_ENTRY *discard = ::remove_history (n);
 
   if (discard)
     {
       if (discard->line)
-	free (discard->line);
+	::free (discard->line);
 
-      free (discard);
+      ::free (discard);
     }
 }
 
 int
 command_history::where (void)
 {
-  return where_history ();
+  return ::where_history ();
 }
 
 int
 command_history::base (void)
 {
-  return history_base;
+  return ::history_base;
 }
 
 int
@@ -162,19 +159,19 @@
 void
 command_history::stifle (int n)
 {
-  stifle_history (n);
+  ::stifle_history (n);
 }
 
 int
 command_history::unstifle (void)
 {
-  return unstifle_history ();
+  return ::unstifle_history ();
 }
 
 int
 command_history::is_stifled (void)
 {
-  return history_is_stifled ();
+  return ::history_is_stifled ();
 }
 
 void
@@ -187,12 +184,12 @@
 
   if (! f.empty ())
     {
-      int status = read_history (f.c_str ());
+      int status = ::read_history (f.c_str ());
 
       if (status != 0)
 	error (status);
       else
-	using_history ();
+	::using_history ();
     }
   else
     error ("command_history::read: missing file name");
@@ -211,13 +208,13 @@
 
   if (! f.empty ())
     {
-      int status = read_history_range (f.c_str (), from, to);
+      int status = ::read_history_range (f.c_str (), from, to);
 
       if (status != 0)
 	error (status);
       else
 	{
-	  using_history ();
+	  ::using_history ();
 	  lines_in_file = where ();
 	}
     }
@@ -235,7 +232,7 @@
 
   if (! f.empty ())
     {
-      int status = write_history (f.c_str ());
+      int status = ::write_history (f.c_str ());
 
       if (status != 0)
 	error (status);
@@ -270,7 +267,7 @@
 		  close (tem);
 		}
 
-	      int status = append_history (lines_this_session, f.c_str ());
+	      int status = ::append_history (lines_this_session, f.c_str ());
 
 	      if (status != 0)
 		error (status);
@@ -294,7 +291,7 @@
     f = xfile;
 
   if (! f.empty ())
-    history_truncate_file (f.c_str (), n);
+    ::history_truncate_file (f.c_str (), n);
   else
     error ("command_history::truncate_file: missing file name");
 }
@@ -306,7 +303,7 @@
 
   if (limit)
     {
-      HIST_ENTRY **hlist = history_list ();
+      HIST_ENTRY **hlist = ::history_list ();
 
       if (hlist)
 	{
@@ -324,7 +321,7 @@
 	      ostrstream output_buf;
 
 	      if (number_lines)
-		output_buf.form ("%5d%c", i + history_base,
+		output_buf.form ("%5d%c", i + ::history_base,
 				 hlist[i]->data ? '*' : ' '); 
 
 	      output_buf << hlist[i]->line << ends;
@@ -346,7 +343,7 @@
 {
   string retval;
 
-  HIST_ENTRY *entry = history_get (history_base + n);
+  HIST_ENTRY *entry = ::history_get (::history_base + n);
 
   if (entry && entry->line)
     retval = entry->line;
@@ -357,14 +354,14 @@
 void
 command_history::replace_entry (int which, const string& line)
 {
-  HIST_ENTRY *discard = replace_history_entry (which, line.c_str (), 0);
+  HIST_ENTRY *discard = ::replace_history_entry (which, line.c_str (), 0);
 
   if (discard)
     {
       if (discard->line)
-	free (discard->line);
+	::free (discard->line);
 
-      free (discard);
+      ::free (discard);
     }
 }
 
@@ -383,16 +380,16 @@
 
       stifle (n);
 
-      write_history (f.c_str ());
+      ::write_history (f.c_str ());
     }
   else
     error ("command_history::clean_up_and_save: missing file name");
 }
 
 void
-command_history::error (int errno)
+command_history::error (int err_num)
 {
-  (*current_liboctave_error_handler) ("%s", strerror (errno));
+  (*current_liboctave_error_handler) ("%s", strerror (err_num));
 }
 
 void
--- a/src/ChangeLog	Tue Nov 05 19:40:29 1996 +0000
+++ b/src/ChangeLog	Tue Nov 05 21:47:59 1996 +0000
@@ -1,5 +1,11 @@
 Tue Nov  5 13:00:35 1996  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
+	* input.cc, sysdep.cc, variables.cc: Only include readline.h and
+	history.h if USE_READLINE is defined.
+
+	* help.cc: Make it compile without warnings even if USE_GNU_INFO
+	is not defined.
+
 	* sighandlers.h (octave_child_list): Don't define
 	HAVE_POSIX_SIGNALS HERE.
 
--- a/src/help.cc	Tue Nov 05 19:40:29 1996 +0000
+++ b/src/help.cc	Tue Nov 05 21:47:59 1996 +0000
@@ -325,21 +325,23 @@
   return keywords;
 }
 
-#define VERBOSE_HELP_MESSAGE \
-  "\n\
+#if defined (USE_GNU_INFO)
+static void
+additional_help_message (ostream& os)
+{
+  if (! Vsuppress_verbose_help_message)
+    os << "\n\
 Additional help for builtin functions, operators, and variables\n\
 is available in the on-line version of the manual.\n\
 \n\
-Use the command `help -i <topic>' to search the manual index.\n"
-
+Use the command `help -i <topic>' to search the manual index.\n";
+}
+#else
 static void
-additional_help_message (ostream& os)
+additional_help_message (ostream&)
 {
-#ifdef USE_GNU_INFO
-  if (! Vsuppress_verbose_help_message)
-    os << VERBOSE_HELP_MESSAGE;
+}
 #endif
-}
 
 void
 print_usage (const string& nm, int just_usage)
@@ -518,7 +520,7 @@
   additional_help_message (octave_stdout);
 }
 
-#ifdef USE_GNU_INFO
+#if defined (USE_GNU_INFO)
 static int
 try_info (const string& nm)
 {
@@ -563,12 +565,10 @@
 
   return status;
 }
-#endif
 
 static void
 help_from_info (const string_vector& argv, int idx, int argc)
 {
-#ifdef USE_GNU_INFO
   if (idx == argc)
     try_info (string ());
   else
@@ -594,10 +594,14 @@
 	    }
 	}
     }
+}
 #else
+static void
+help_from_info (const string_vector&, int, int)
+{
   message (0, "sorry, help -i is not available in this version of Octave");
+}
 #endif
-}
 
 int
 help_from_list (ostream& os, const help_list *list,
@@ -671,7 +675,7 @@
   additional_help_message (octave_stdout);
 }
 
-#ifdef USE_GNU_INFO
+#if defined (USE_GNU_INFO)
 DEFUN_TEXT (help, args, ,
   "help [-i] [topic ...]\n\
 \n\
@@ -962,11 +966,9 @@
   DEFVAR (INFO_PROGRAM, Vinfo_prog, 0, info_prog,
     "name of the Octave info reader");
 
-#ifdef USE_GNU_INFO
   DEFVAR (suppress_verbose_help_message, 0.0, 0, suppress_verbose_help_message,
     "suppress printing of message pointing to additional help in the\n\
 help and usage functions");
-#endif
 }
 
 /*
--- a/src/input.cc	Tue Nov 05 19:40:29 1996 +0000
+++ b/src/input.cc	Tue Nov 05 21:47:59 1996 +0000
@@ -54,11 +54,10 @@
 #include <unistd.h>
 #endif
 
-// This must come before anything that includes iostream.h...
-// (This is apparently no longer true...)
-
-#include "readline/readline.h"
-#include "readline/history.h"
+#if defined (USE_READLINE)
+#include <readline/readline.h>
+#include <readline/history.h>
+#endif
 
 #include "str-vec.h"
 
--- a/src/octave.cc	Tue Nov 05 19:40:29 1996 +0000
+++ b/src/octave.cc	Tue Nov 05 21:47:59 1996 +0000
@@ -84,16 +84,18 @@
 #endif
 
 // Don't redefine the variables if glibc already has.
-#ifndef HAVE_PROGRAM_INVOCATION_NAME
+#if defined (HAVE_PROGRAM_INVOCATION_NAME)
+extern char *program_invocation_name;
+extern char *program_invocation_short_name;
+#else
 char *program_invocation_name;
 char *program_invocation_short_name;
-#else
-extern char *program_invocation_name;
-extern char *program_invocation_short_name;
 #endif
 
+#if defined (USE_READLINE)
 // This is from readline's paren.c:
 extern int rl_blink_matching_paren;
+#endif
 
 // The command-line options.
 static string_vector octave_argv;
@@ -196,7 +198,7 @@
 {
   // Kpathsea needs this.
 
-#ifndef HAVE_PROGRAM_INVOCATION_NAME
+#if ! defined (HAVE_PROGRAM_INVOCATION_NAME)
   program_invocation_name = strsave (name.c_str ());
   program_invocation_short_name = strrchr (program_invocation_name, '/');
   if (! program_invocation_short_name)
@@ -328,9 +330,9 @@
   --info-file FILE        Use top-level info file FILE.\n\
   --info-program PROGRAM  Use PROGRAM for reading info files.\n\
   -i, --interactive       Force interactive behavior.\n\
-  --no-init-file          Don't read the ~/.octaverc or .octaverc files\n\
+  --no-init-file          Don't read the ~/.octaverc or .octaverc files.\n\
   --no-line-editing       Don't use readline for command-line editing.\n\
-  --no-site-file          Don't read the site-wide octaverc file\n\
+  --no-site-file          Don't read the site-wide octaverc file.\n\
   -p PATH, --path PATH    Set initial LOADPATH to PATH.\n\
   -q, --silent            Don't print message at startup.\n\
   --traditional           Set compatibility variables.\n\
--- a/src/sysdep.cc	Tue Nov 05 19:40:29 1996 +0000
+++ b/src/sysdep.cc	Tue Nov 05 21:47:59 1996 +0000
@@ -67,8 +67,10 @@
 #include <sys/utsname.h>
 #endif
 
+#if defined (USE_READLINE)
 #include <readline/readline.h>
 #include <readline/tilde.h>
+#endif
 
 extern char *term_clrpag;
 extern "C" void _rl_output_character_function ();
--- a/src/variables.cc	Tue Nov 05 19:40:29 1996 +0000
+++ b/src/variables.cc	Tue Nov 05 21:47:59 1996 +0000
@@ -41,7 +41,9 @@
 #include <unistd.h>
 #endif
 
+#if defined (USE_READLINE)
 #include <readline/readline.h>
+#endif
 
 #include "file-ops.h"
 #include "oct-glob.h"