changeset 801:cbc37d8d0fdf

[project @ 1994-10-13 17:03:23 by jwe]
author jwe
date Thu, 13 Oct 1994 17:03:45 +0000
parents 73fdde1f8473
children b7d68dfee8d8
files octave-bug.in src/tc-rep.cc src/utils.cc src/utils.h
diffstat 4 files changed, 139 insertions(+), 75 deletions(-) [+]
line wrap: on
line diff
--- a/octave-bug.in
+++ b/octave-bug.in
@@ -44,27 +44,29 @@
   HAVE_FMT=true
 fi
 
-# BUGADDR="bug-octave@che.utexas.edu"
-BUGADDR="jwe@che.utexas.edu"
+ss_p=`echo $VERSION | grep "^ss-"`
+if test -n "$ss_p"
+then
+  BUGADDR="octave-maintainers@che.utexas.edu"
+else
+  BUGADDR="bug-octave@che.utexas.edu"
+fi
 
 SUBJECT="[50 character or so descriptive subject here (for reference)]"
 if test $# -gt 0
 then
   case "$1" in
     -s)
-      shift;
+      shift
       if test $# -gt 0
       then
         SUBJECT="$1"
+        shift
       else
         echo "usage: octave-bug [-s subject]"
         exit 1
       fi
     ;;
-    *)
-      echo "usage: octave-bug [-s subject]"
-      exit 1
-    ;;
   esac
 fi
 
@@ -72,31 +74,8 @@
 To: $BUGADDR
 Subject: $SUBJECT
 
-Configuration (please do not edit this section):
------------------------------------------------
-
 Bug report for Octave $VERSION configured for $MACHINE
 
-uname output:     $UN
-Fortran compiler: $F77
-FFLAGS:           $FFLAGS
-C compiler:       $CC
-CFLAGS:           $CFLAGS
-C++ compiler:     $CXX
-CXXFLAGS:         $CXXFLAGS
-DEFS:
-
-EOF
-
-if $HAVE_FMT
-then
-  echo $DEFS | fmt | sed 's/^/  /' >> $TEMP
-else
-  echo $DEFS >> $TEMP
-fi
-
-cat >> $TEMP << EOF
-
 Description:
 -----------
 
@@ -116,8 +95,43 @@
     fix the problem (if you don't have a fix for the problem, don't
     include this section, but please do submit your report anyway).
 
+
+
+Configuration (please do not edit this section):
+-----------------------------------------------
+
+uname output:     $UN
+Fortran compiler: $F77
+FFLAGS:           $FFLAGS
+C compiler:       $CC
+CFLAGS:           $CFLAGS
+C++ compiler:     $CXX
+CXXFLAGS:         $CXXFLAGS
+DEFS:
+
 EOF
 
+if $HAVE_FMT
+then
+  echo $DEFS | fmt | sed 's/^/  /' >> $TEMP
+else
+  echo $DEFS >> $TEMP
+fi
+
+if test $# -gt 0
+then
+  if test -f "$1"
+  then
+    cat >> $TEMP << EOF
+
+User-preferences (please do not edit this section):
+--------------------------------------------------
+
+EOF
+    cat $1 >> $TEMP
+  fi
+fi
+
 chmod u+w $TEMP
 cp $TEMP $TEMP.x
 
--- a/src/tc-rep.cc
+++ b/src/tc-rep.cc
@@ -1721,50 +1721,6 @@
     }
 }
 
-static char *
-undo_string_escapes (char c)
-{
-  static char retval[2];
-  retval[1] = '\0';
-
-  if (! c)
-    return 0;
-
-  switch (c)
-    {
-    case '\a':
-      return "\\a";
-
-    case '\b': // backspace
-      return "\\b";
-
-    case '\f': // formfeed
-      return "\\f";
-
-    case '\n': // newline
-      return "\\n";
-
-    case '\r': // carriage return
-      return "\\r";
-
-    case '\t': // horizontal tab
-      return "\\t";
-
-    case '\v': // vertical tab
-      return "\\v";
-
-    case '\\': // backslash
-      return "\\\\";
-
-    case '"': // double quote
-      return "\\\"";
-
-    default:
-      retval[0] = c;
-      return retval;
-    }
-}
-
 void
 TC_REP::print_code (ostream& os)
 {
@@ -1805,7 +1761,7 @@
       {
 	os << "\"";
 	char *s, *t = string;
-	while (s = undo_string_escapes (*t++))
+	while (s = undo_string_escape (*t++))
 	  os << s;
 	os << "\"";
       }
--- a/src/utils.cc
+++ b/src/utils.cc
@@ -205,6 +205,20 @@
   return retval;
 }
 
+DEFUN ("octave_tmp_file_name", Foctave_tmp_file_name,
+       Soctave_tmp_file_name, 0, 1,
+ "octave_tmp_file_name ()")
+{
+  tree_constant retval;
+
+  if (args.length () == 0)
+    retval = octave_tmp_file_name ();
+  else
+    print_usage ("octave_tmp_file_name");
+
+  return retval;
+}
+
 char **
 pathstring_to_vector (char *pathstring)
 {
@@ -702,6 +716,83 @@
   return file_in_path (name, ".oct");
 }
 
+char *
+undo_string_escape (char c)
+{
+  static char retval[2];
+  retval[1] = '\0';
+
+  if (! c)
+    return 0;
+
+  switch (c)
+    {
+    case '\a':
+      return "\\a";
+
+    case '\b': // backspace
+      return "\\b";
+
+    case '\f': // formfeed
+      return "\\f";
+
+    case '\n': // newline
+      return "\\n";
+
+    case '\r': // carriage return
+      return "\\r";
+
+    case '\t': // horizontal tab
+      return "\\t";
+
+    case '\v': // vertical tab
+      return "\\v";
+
+    case '\\': // backslash
+      return "\\\\";
+
+    case '"': // double quote
+      return "\\\"";
+
+    default:
+      retval[0] = c;
+      return retval;
+    }
+}
+
+char *
+undo_string_escapes (char *s)
+{
+  ostrstream buf;
+
+  char *t;
+  while (t = undo_string_escape (*s++))
+    buf << t;
+  buf << ends;
+
+  return buf.str ();
+}
+
+DEFUN ("undo_string_escapes", Fundo_string_escapes,
+       Sundo_string_escapes, 1, 1,
+  "undo_string_escapes (STRING)")
+{
+  tree_constant retval;
+
+  int nargin = args.length ();
+
+  if (nargin == 1 && args(0).is_string ())
+    {
+      char *str = undo_string_escapes (args(0).string_value ());
+      retval = str;
+      delete [] str;
+    }
+  else
+    print_usage ("undo_string_escapaes");
+
+  return retval;
+}
+
 /*
 ;;; Local Variables: ***
 ;;; mode: C++ ***
--- a/src/utils.h
+++ b/src/utils.h
@@ -75,6 +75,9 @@
 
 extern ostrstream& list_in_columns (ostrstream& os, char **list);
 
+extern char *undo_string_escape (char c);
+extern char *undo_string_escapes (char *s);
+
 #endif
 
 /*