home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
octa21eb.zip
/
octave
/
PATOS2.ZIP
/
PATCHES.OS2
< prev
next >
Wrap
Text File
|
1999-05-13
|
179KB
|
6,941 lines
diff -cwr n:/project/C/octave-2.1.14.orig/liboctave/cmd-edit.cc i:/project/C/octave-2.1.14/liboctave/cmd-edit.cc
*** n:/project/C/octave-2.1.14.orig/liboctave/cmd-edit.cc Mon Nov 23 16:56:38 1998
--- i:/project/C/octave-2.1.14/liboctave/cmd-edit.cc Thu Apr 15 13:59:16 1999
***************
*** 616,621 ****
--- 616,628 ----
}
void
+ command_editor::add_current_command_number (int n)
+ {
+ if (instance_ok ())
+ instance->command_number += n;
+ }
+
+ void
command_editor::increment_current_command_number (void)
{
if (instance_ok ())
diff -cwr n:/project/C/octave-2.1.14.orig/liboctave/cmd-edit.h i:/project/C/octave-2.1.14/liboctave/cmd-edit.h
*** n:/project/C/octave-2.1.14.orig/liboctave/cmd-edit.h Thu Nov 12 19:26:38 1998
--- i:/project/C/octave-2.1.14/liboctave/cmd-edit.h Thu Apr 15 13:58:50 1999
***************
*** 97,102 ****
--- 97,104 ----
static void reset_current_command_number (int n);
+ static void add_current_command_number (int n);
+
static void increment_current_command_number (void);
private:
diff -cwr n:/project/C/octave-2.1.14.orig/liboctave/cmd-hist.cc i:/project/C/octave-2.1.14/liboctave/cmd-hist.cc
*** n:/project/C/octave-2.1.14.orig/liboctave/cmd-hist.cc Tue Nov 10 15:11:14 1998
--- i:/project/C/octave-2.1.14/liboctave/cmd-hist.cc Wed Apr 14 21:35:00 1999
***************
*** 20,25 ****
--- 20,27 ----
*/
+ /* Modified by Klaus Gebhardt, 1999 */
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
***************
*** 119,128 ****
if (! do_ignoring_entries ())
{
if (s.empty ()
! || (s.length () == 1 && (s[0] == '\r' || s[0] == '\n')))
return;
! ::add_history (s.c_str ());
lines_this_session++;
}
--- 121,143 ----
if (! do_ignoring_entries ())
{
if (s.empty ()
! || (s.length () == 1 && (s[0] == '\r' || s[0] == '\n' || s[0] == ''))
! || (s.length () == 2 && (s[0] == '\r' && s[1] == '\n')))
return;
! string t = s;
! int l = t.length ();
! char c = t[l-2];
!
! if (c == '\n' || c == '\r' || c == '')
! {
! t.resize (l - 1);
! t[l-2] = '\n';
!
! if (l == 2) return;
! }
!
! ::add_history (t.c_str ());
lines_this_session++;
}
diff -cwr n:/project/C/octave-2.1.14.orig/liboctave/file-ops.cc i:/project/C/octave-2.1.14/liboctave/file-ops.cc
*** n:/project/C/octave-2.1.14.orig/liboctave/file-ops.cc Tue Nov 10 15:11:14 1998
--- i:/project/C/octave-2.1.14/liboctave/file-ops.cc Thu Apr 15 14:26:42 1999
***************
*** 20,25 ****
--- 20,27 ----
*/
+ /* Modified by Klaus Gebhardt, 1996 */
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
***************
*** 39,44 ****
--- 41,50 ----
#include <unistd.h>
#endif
+ #ifdef OS2
+ #include <mkfifo.h>
+ #endif
+
#include "file-ops.h"
#include "oct-env.h"
#include "oct-passwd.h"
***************
*** 488,493 ****
--- 494,511 ----
#endif
return status;
+ }
+
+ int
+ file_ops::close (int handle)
+ {
+ return ::close (handle);
+ }
+
+ void *
+ file_ops::fdopen (int handle, const string& mode)
+ {
+ return static_cast<void *> (::fdopen (handle, mode.c_str ()));
}
/*
diff -cwr n:/project/C/octave-2.1.14.orig/liboctave/file-ops.h i:/project/C/octave-2.1.14/liboctave/file-ops.h
*** n:/project/C/octave-2.1.14.orig/liboctave/file-ops.h Tue Nov 10 15:11:14 1998
--- i:/project/C/octave-2.1.14/liboctave/file-ops.h Thu Apr 15 14:22:08 1999
***************
*** 20,25 ****
--- 20,27 ----
*/
+ /* Modified by Klaus Gebhardt, 1999 */
+
#if !defined (octave_file_ops_h)
#define octave_file_ops_h 1
***************
*** 66,71 ****
--- 68,76 ----
static int unlink (const string&);
static int unlink (const string&, string&);
+
+ static int close (int);
+ static void *fdopen (int, const string&);
};
#endif
diff -cwr n:/project/C/octave-2.1.14.orig/liboctave/file-stat.cc i:/project/C/octave-2.1.14/liboctave/file-stat.cc
*** n:/project/C/octave-2.1.14.orig/liboctave/file-stat.cc Tue Nov 10 15:11:14 1998
--- i:/project/C/octave-2.1.14/liboctave/file-stat.cc Wed Apr 14 21:41:10 1999
***************
*** 20,25 ****
--- 20,27 ----
*/
+ /* Modified by Klaus Gebhardt, 1999 */
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
***************
*** 37,42 ****
--- 39,70 ----
#include "file-stat.h"
#include "statdefs.h"
+ #ifdef __EMX__
+ // Normal stat and lstat does not work with EMX!
+ // Using old approach.
+ // Modified, by Klaus Gebhardt, 1998
+ static __inline int _stat (const char *name, struct stat *buf)
+ {
+ int ret;
+
+ do
+ ret = stat (name, buf);
+ while (ret < 0 && errno == EINTR);
+
+ return ret;
+ }
+
+ static __inline int _lstat (const char *name, struct stat *buf)
+ {
+ int ret;
+
+ do
+ ret = lstat (name, buf);
+ while (ret < 0 && errno == EINTR);
+
+ return ret;
+ }
+ #else
#if !defined (HAVE_LSTAT)
static inline int
lstat (const char *name, struct stat *buf)
***************
*** 44,49 ****
--- 72,78 ----
return stat (name, buf);
}
#endif
+ #endif
// XXX FIXME XXX -- the is_* and mode_as_string functions are only valid
// for initialized objects. If called for an object that is not
***************
*** 158,164 ****
--- 187,197 ----
struct stat buf;
+ #ifdef __EMX__
+ int status = follow_links ? _stat (cname, &buf) : _lstat (cname, &buf);
+ #else
int status = follow_links ? stat (cname, &buf) : lstat (cname, &buf);
+ #endif
if (status < 0)
{
diff -cwr n:/project/C/octave-2.1.14.orig/liboctave/lo-mappers.cc i:/project/C/octave-2.1.14/liboctave/lo-mappers.cc
*** n:/project/C/octave-2.1.14.orig/liboctave/lo-mappers.cc Tue Nov 10 15:11:14 1998
--- i:/project/C/octave-2.1.14/liboctave/lo-mappers.cc Wed Apr 14 21:21:42 1999
***************
*** 20,25 ****
--- 20,27 ----
*/
+ /* Modified by Klaus Gebhardt, 1997 */
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
***************
*** 41,46 ****
--- 43,58 ----
#define finite(x) ((x) < DBL_MAX && (x) > -DBL_MAX)
#endif
+ extern "C"
+ {
+ double F77_FCN (dacosh, DACOSH) (const double*);
+ double F77_FCN (dasinh, DASINH) (const double*);
+ double F77_FCN (datanh, DATANH) (const double*);
+
+ double F77_FCN (derf, DERF) (const double&);
+ double F77_FCN (derfc, DERFC) (const double&);
+ }
+
#ifndef M_LOG10E
#define M_LOG10E 0.43429448190325182765
#endif
***************
*** 115,127 ****
}
double
xerf (double x)
{
#if defined (HAVE_ERF)
return erf (x);
#else
! (*current_liboctave_error_handler)
! ("erf (x) not available on this system");
#endif
}
--- 127,170 ----
}
double
+ xacosh (double x)
+ {
+ #if defined (HAVE_ACOSH)
+ return acosh (x);
+ #else
+ return F77_FCN (dacosh, DACOSH) (&x);
+ #endif
+ }
+
+ double
+ xasinh (double x)
+ {
+ #if defined (HAVE_ASINH)
+ return asinh (x);
+ #else
+ return F77_FCN (dasinh, DASINH) (&x);
+ #endif
+ }
+
+ double
+ xatanh (double x)
+ {
+ #if defined (HAVE_ATANH)
+ return atanh (x);
+ #else
+ return F77_FCN (datanh, DATANH) (&x);
+ #endif
+ }
+
+ double
xerf (double x)
{
#if defined (HAVE_ERF)
return erf (x);
#else
! double y;
! F77_YXFCN (derf, DERF, y, (x));
! return y;
#endif
}
***************
*** 131,138 ****
#if defined (HAVE_ERFC)
return erfc (x);
#else
! (*current_liboctave_error_handler)
! ("erfc (x) not available on this system");
#endif
}
--- 174,182 ----
#if defined (HAVE_ERFC)
return erfc (x);
#else
! double y;
! F77_YXFCN (derfc, DERFC, y, (x));
! return y;
#endif
}
diff -cwr n:/project/C/octave-2.1.14.orig/liboctave/lo-mappers.h i:/project/C/octave-2.1.14/liboctave/lo-mappers.h
*** n:/project/C/octave-2.1.14.orig/liboctave/lo-mappers.h Tue Nov 10 15:11:14 1998
--- i:/project/C/octave-2.1.14/liboctave/lo-mappers.h Thu Apr 15 13:37:22 1999
***************
*** 20,25 ****
--- 20,27 ----
*/
+ /* Modified by Klaus Gebhardt, 1999 */
+
#if !defined (octave_liboctave_mappers_h)
#define octave_liboctave_mappers_h 1
***************
*** 37,42 ****
--- 39,48 ----
extern double xisnan (double x);
extern double xfinite (double x);
extern double xisinf (double x);
+
+ extern double xacosh (double x);
+ extern double xasinh (double x);
+ extern double xatanh (double x);
extern double xisnan (const Complex& x);
extern double xfinite (const Complex& x);
diff -cwr n:/project/C/octave-2.1.14.orig/liboctave/lo-specfun.cc i:/project/C/octave-2.1.14/liboctave/lo-specfun.cc
*** n:/project/C/octave-2.1.14.orig/liboctave/lo-specfun.cc Wed Nov 25 00:26:04 1998
--- i:/project/C/octave-2.1.14/liboctave/lo-specfun.cc Wed Apr 14 21:50:02 1999
***************
*** 20,29 ****
--- 20,35 ----
*/
+ /* Modified by Klaus Gebhardt, 1997-1999 */
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
+ #ifdef __EMX__
+ #include <float.h>
+ #endif
+
#include "Range.h"
#include "CColVector.h"
#include "CMatrix.h"
***************
*** 91,97 ****
acosh (double x)
{
double retval;
! F77_XFCN (dacosh, DACOSH, (x, retval));
return retval;
}
#endif
--- 97,103 ----
acosh (double x)
{
double retval;
! F77_XFCN (xdacosh, DACOSH, (x, retval));
return retval;
}
#endif
***************
*** 101,107 ****
asinh (double x)
{
double retval;
! F77_XFCN (dasinh, DASINH, (x, retval));
return retval;
}
#endif
--- 107,113 ----
asinh (double x)
{
double retval;
! F77_XFCN (xdasinh, DASINH, (x, retval));
return retval;
}
#endif
***************
*** 111,117 ****
atanh (double x)
{
double retval;
! F77_XFCN (datanh, DATANH, (x, retval));
return retval;
}
#endif
--- 117,123 ----
atanh (double x)
{
double retval;
! F77_XFCN (xdatanh, DATANH, (x, retval));
return retval;
}
#endif
***************
*** 121,127 ****
erf (double x)
{
double retval;
! F77_XFCN (derf, DERF, (x, retval));
return retval;
}
#endif
--- 127,133 ----
erf (double x)
{
double retval;
! F77_XFCN (xderf, DERF, (x, retval));
return retval;
}
#endif
***************
*** 131,137 ****
erfc (double x)
{
double retval;
! F77_XFCN (derfc, DERFC, (x, retval));
return retval;
}
#endif
--- 137,143 ----
erfc (double x)
{
double retval;
! F77_XFCN (xderfc, DERFC, (x, retval));
return retval;
}
#endif
diff -cwr n:/project/C/octave-2.1.14.orig/liboctave/lo-sysdep.cc i:/project/C/octave-2.1.14/liboctave/lo-sysdep.cc
*** n:/project/C/octave-2.1.14.orig/liboctave/lo-sysdep.cc Tue Nov 10 15:11:14 1998
--- i:/project/C/octave-2.1.14/liboctave/lo-sysdep.cc Wed Apr 14 21:56:18 1999
***************
*** 28,33 ****
--- 28,35 ----
*/
+ /* Modified by Klaus Gebhardt, 1999 */
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
***************
*** 43,52 ****
--- 45,59 ----
#include <unistd.h>
#endif
+ #ifdef __EMX__
+ #include <stdlib.h>
+ #endif
+
#if ! defined (HAVE_GETHOSTNAME) && defined (HAVE_SYS_UTSNAME_H)
#include <sys/utsname.h>
#endif
+ #include "lo-utils.h"
#include "lo-error.h"
#include "pathlen.h"
***************
*** 75,81 ****
return retval;
}
! int
octave_chdir (const string& path)
{
#if defined (__EMX__)
--- 82,88 ----
return retval;
}
! bool
octave_chdir (const string& path)
{
#if defined (__EMX__)
diff -cwr n:/project/C/octave-2.1.14.orig/liboctave/oct-syscalls.cc i:/project/C/octave-2.1.14/liboctave/oct-syscalls.cc
*** n:/project/C/octave-2.1.14.orig/liboctave/oct-syscalls.cc Tue Nov 10 15:11:14 1998
--- i:/project/C/octave-2.1.14/liboctave/oct-syscalls.cc Thu Apr 15 12:30:48 1999
***************
*** 20,25 ****
--- 20,27 ----
*/
+ /* Modified by Klaus Gebhardt, 1999 */
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
***************
*** 40,45 ****
--- 42,49 ----
#include <fcntl.h>
#endif
+ #include <process.h>
+
#include "oct-syscalls.h"
#include "str-vec.h"
#include "syswait.h"
***************
*** 99,104 ****
--- 103,154 ----
msg = ::strerror (errno);
#else
msg = NOT_SUPPORTED ("execvp");
+ #endif
+
+ return status;
+ }
+
+ int
+ octave_syscalls::spawnvp (const string& mode, const string& file,
+ const string_vector& argv)
+ {
+ string msg;
+ return spawnvp (mode, file, argv, msg);
+ }
+
+ int
+ octave_syscalls::spawnvp (const string& mode, const string& file,
+ const string_vector& args,
+ string& msg)
+ {
+ msg = string ();
+
+ int status = -1;
+
+ #if defined (HAVE_SPAWNVP)
+ int m = P_WAIT;
+
+ if (mode == "wait") m = P_WAIT;
+ else if (mode == "nowait") m = P_NOWAIT;
+ else if (mode == "detach") m = P_DETACH;
+ else if (mode == "session") m = P_SESSION;
+ else if (mode == "pm") m = P_PM;
+ else
+ {
+ msg = "spawnvp: invalid mode specified.";
+ return status;
+ }
+
+ char **argv = args.c_str_vec ();
+
+ status = ::spawnvp (m, file.c_str (), argv);
+
+ string_vector::delete_c_str_vec (argv);
+
+ if (status < 0)
+ msg = ::strerror (errno);
+ #else
+ msg = NOT_SUPPORTED ("spawnvp");
#endif
return status;
diff -cwr n:/project/C/octave-2.1.14.orig/liboctave/oct-syscalls.h i:/project/C/octave-2.1.14/liboctave/oct-syscalls.h
*** n:/project/C/octave-2.1.14.orig/liboctave/oct-syscalls.h Tue Nov 10 15:11:14 1998
--- i:/project/C/octave-2.1.14/liboctave/oct-syscalls.h Thu Apr 15 12:24:26 1999
***************
*** 20,25 ****
--- 20,27 ----
*/
+ /* Modified by Klaus Gebhardt, 1999 */
+
#if !defined (octave_syscalls_h)
#define octave_syscalls_h 1
***************
*** 39,44 ****
--- 41,51 ----
static int execvp (const string&, const string_vector&);
static int execvp (const string&, const string_vector&, string&);
+
+ static int spawnvp (const string&, const string&,
+ const string_vector&);
+ static int spawnvp (const string&, const string&,
+ const string_vector&, string&);
static int fcntl (int, int, long);
static int fcntl (int, int, long, string&);
diff -cwr n:/project/C/octave-2.1.14.orig/liboctave/pathsearch.cc i:/project/C/octave-2.1.14/liboctave/pathsearch.cc
*** n:/project/C/octave-2.1.14.orig/liboctave/pathsearch.cc Tue Nov 10 15:11:14 1998
--- i:/project/C/octave-2.1.14/liboctave/pathsearch.cc Sat Apr 17 12:45:16 1999
***************
*** 20,25 ****
--- 20,27 ----
*/
+ /* Modified by Klaus Gebhardt, 1998 */
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
***************
*** 145,151 ****
--- 147,157 ----
void
dir_path::set_program_name (const string& nm)
{
+ #ifndef __EMX__
+ kpse_set_program_name (nm.c_str (), "octave");
+ #else
kpse_set_progname (nm.c_str ());
+ #endif
}
void
diff -cwr n:/project/C/octave-2.1.14.orig/libcruft/misc/dostop.c i:/project/C/octave-2.1.14/libcruft/misc/dostop.c
*** n:/project/C/octave-2.1.14.orig/libcruft/misc/dostop.c Tue Nov 10 15:11:12 1998
--- i:/project/C/octave-2.1.14/libcruft/misc/dostop.c Wed Apr 14 20:55:56 1999
***************
*** 21,26 ****
--- 21,28 ----
*/
+ /* Modified by Klaus Gebhardt, 1996 */
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
***************
*** 30,35 ****
--- 32,42 ----
#include "f77-fcn.h"
#include "lo-error.h"
+
+ #ifdef __EMX__
+ int f77_exception_encountered;
+ jmp_buf f77_context;
+ #endif
/* All the STOP statements in the Fortran routines have been replaced
with a call to XSTOPX, defined in the file libcruft/misc/xstopx.f.
diff -cwr n:/project/C/octave-2.1.14.orig/libcruft/misc/f77-fcn.h i:/project/C/octave-2.1.14/libcruft/misc/f77-fcn.h
*** n:/project/C/octave-2.1.14.orig/libcruft/misc/f77-fcn.h Tue Nov 10 15:11:12 1998
--- i:/project/C/octave-2.1.14/libcruft/misc/f77-fcn.h Wed Apr 14 20:55:56 1999
***************
*** 20,25 ****
--- 20,27 ----
*/
+ /* Modified by Klaus Gebhardt, 1997 */
+
#if !defined (octave_f77_fcn_h)
#define octave_f77_fcn_h 1
***************
*** 77,82 ****
--- 79,103 ----
} \
else \
F77_FCN (f, F) args; \
+ copy_f77_context ((char *) saved_f77_context, (char *) f77_context, \
+ sizeof (jmp_buf)); \
+ } \
+ while (0)
+
+ #define F77_YXFCN(f, F, rc, args) \
+ do \
+ { \
+ jmp_buf saved_f77_context; \
+ f77_exception_encountered = 0; \
+ copy_f77_context ((char *) f77_context, (char *) saved_f77_context, \
+ sizeof (jmp_buf)); \
+ if (setjmp (f77_context)) \
+ { \
+ f77_exception_encountered = 1; \
+ F77_XFCN_ERROR (f, F); \
+ } \
+ else \
+ rc = F77_FCN (f, F) args; \
copy_f77_context ((char *) saved_f77_context, (char *) f77_context, \
sizeof (jmp_buf)); \
} \
diff -cwr n:/project/C/octave-2.1.14.orig/src/defaults.cc i:/project/C/octave-2.1.14/src/defaults.cc
*** n:/project/C/octave-2.1.14.orig/src/defaults.cc Fri Mar 26 07:52:42 1999
--- i:/project/C/octave-2.1.14/src/defaults.cc Thu May 13 15:01:30 1999
***************
*** 20,25 ****
--- 20,27 ----
*/
+ /* Modified by Klaus Gebhardt, 1996 - 1997 */
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
***************
*** 168,174 ****
if (! shell_path.empty ())
{
! Vexec_path = string (":");
Vexec_path.append (shell_path);
}
}
--- 170,176 ----
if (! shell_path.empty ())
{
! Vexec_path = string (SEPCHAR_STR);
Vexec_path.append (shell_path);
}
}
***************
*** 183,189 ****
string oct_path = octave_env::getenv ("OCTAVE_PATH");
! Vload_path = oct_path.empty () ? string (":") : oct_path;
Vload_path_dir_path = dir_path (Vload_path, Vdefault_load_path);
}
--- 185,191 ----
string oct_path = octave_env::getenv ("OCTAVE_PATH");
! Vload_path = oct_path.empty () ? string (SEPCHAR_STR) : oct_path;
Vload_path_dir_path = dir_path (Vload_path, Vdefault_load_path);
}
***************
*** 204,210 ****
string oct_info_prog = octave_env::getenv ("OCTAVE_INFO_PROGRAM");
if (oct_info_prog.empty ())
! Vinfo_prog = "info";
else
Vinfo_prog = string (oct_info_prog);
}
--- 206,219 ----
string oct_info_prog = octave_env::getenv ("OCTAVE_INFO_PROGRAM");
if (oct_info_prog.empty ())
! {
! #if !defined (__EMX__)
! Vinfo_prog = Varch_lib_dir;
! Vinfo_prog.append ("/info");
! #else
! Vinfo_prog = "";
! #endif
! }
else
Vinfo_prog = string (oct_info_prog);
}
***************
*** 212,218 ****
--- 221,231 ----
static void
set_default_editor (void)
{
+ #if defined (__EMX__) && defined (OS2)
+ Veditor = "e";
+ #else
Veditor = "emacs";
+ #endif
string env_editor = octave_env::getenv ("EDITOR");
***************
*** 345,352 ****
if (eplen > 0)
{
! bool prepend = (Vexec_path[0] == ':');
! bool append = (eplen > 1 && Vexec_path[eplen-1] == ':');
if (prepend)
{
--- 358,365 ----
if (eplen > 0)
{
! bool prepend = (Vexec_path[0] == SEPCHAR);
! bool append = (eplen > 1 && Vexec_path[eplen-1] == SEPCHAR);
if (prepend)
{
diff -cwr n:/project/C/octave-2.1.14.orig/src/DLD-FUNCTIONS/qz.cc i:/project/C/octave-2.1.14/src/DLD-FUNCTIONS/qz.cc
*** n:/project/C/octave-2.1.14.orig/src/DLD-FUNCTIONS/qz.cc Fri Oct 9 04:24:02 1998
--- i:/project/C/octave-2.1.14/src/DLD-FUNCTIONS/qz.cc Thu Apr 15 13:25:26 1999
***************
*** 20,25 ****
--- 20,27 ----
*/
+ /* Modified by Klaus Gebhardt, 1999 */
+
// Generalized eigenvalue balancing via LAPACK
// Written by A. S. Hodel <scotte@eng.auburn.edu>
***************
*** 27,33 ****
--- 29,37 ----
#undef DEBUG_SORT
#undef DEBUG_EIG
+ #ifdef HAVE_CONFIG_H
#include "config.h"
+ #endif
#include <cfloat>
#include <iostream.h>
diff -cwr n:/project/C/octave-2.1.14.orig/src/DLD-FUNCTIONS/rand.cc i:/project/C/octave-2.1.14/src/DLD-FUNCTIONS/rand.cc
*** n:/project/C/octave-2.1.14.orig/src/DLD-FUNCTIONS/rand.cc Thu Oct 15 06:57:38 1998
--- i:/project/C/octave-2.1.14/src/DLD-FUNCTIONS/rand.cc Wed Apr 14 20:57:56 1999
***************
*** 20,25 ****
--- 20,27 ----
*/
+ /* Modified by Klaus Gebhardt, 1997 */
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
diff -cwr n:/project/C/octave-2.1.14.orig/src/file-io.cc i:/project/C/octave-2.1.14/src/file-io.cc
*** n:/project/C/octave-2.1.14.orig/src/file-io.cc Thu Mar 4 09:15:50 1999
--- i:/project/C/octave-2.1.14/src/file-io.cc Wed Apr 14 20:55:58 1999
***************
*** 34,39 ****
--- 34,41 ----
// Completely rewritten by John W. Eaton <jwe@bevo.che.wisc.edu>,
// April 1996.
+ /* Modified by Klaus Gebhardt, 1997 */
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
***************
*** 62,67 ****
--- 64,70 ----
#include "oct-stream.h"
#include "oct-strstrm.h"
#include "pager.h"
+ #include "sighandlers.h"
#include "sysdep.h"
#include "utils.h"
#include "variables.h"
***************
*** 1288,1293 ****
--- 1291,1331 ----
}
DEFALIAS (octave_tmp_file_name, tmpnam);
+
+ DEFUN (child_purge_temp, args, ,
+ "child_purge_temp (pid, name)\n\
+ Remove the file NAME, when child PID dies.")
+ {
+ octave_value retval = -1.0;
+
+ if (args.length () == 2)
+ {
+ if (args(1).is_string ())
+ {
+ double d_pid = args(0).double_value ();
+ string name = args(1).string_value ();
+
+ if (!error_state)
+ {
+ if (D_NINT (d_pid) == d_pid)
+ {
+ int i_pid = NINT (d_pid);
+
+ octave_child_list::insert (i_pid, 0, name);
+ retval = 0.0;
+ }
+ else
+ error ("child_purge_temp: pid must be an integer");
+ }
+ }
+ else
+ error ("child_purge_temp: second argument must be a string");
+ }
+ else
+ print_usage ("child_purge_temp");
+
+ return retval;
+ }
static int
convert (int x, int ibase, int obase)
diff -cwr n:/project/C/octave-2.1.14.orig/src/help.cc i:/project/C/octave-2.1.14/src/help.cc
*** n:/project/C/octave-2.1.14.orig/src/help.cc Tue Nov 10 15:06:38 1998
--- i:/project/C/octave-2.1.14/src/help.cc Tue Apr 27 23:31:20 1999
***************
*** 20,25 ****
--- 20,27 ----
*/
+ /* Modified by Klaus Gebhardt, 1996 */
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
***************
*** 66,71 ****
--- 68,91 ----
#include "utils.h"
#include "variables.h"
+ #if defined (__EMX__)
+ extern "C"
+ {
+ #include "info/info.h"
+ #include "info/dribble.h"
+ #include "info/terminal.h"
+
+ extern int external_info_search ();
+ extern int index_entry_exists ();
+ extern int do_info_index_search ();
+ extern void finish_info_session ();
+ extern char *replace_in_documentation ();
+
+ #include <process.h>
+ int _IO_system (const char *, int);
+ }
+ #endif
+
// Name of the info file specified on command line.
// (--info-file file)
string Vinfo_file;
***************
*** 575,580 ****
--- 595,602 ----
static int
try_info (const string& nm)
{
+ if (Vinfo_prog.length () > 0)
+ {
int status = 0;
static char *cmd_str = 0;
***************
*** 605,627 ****
volatile octave_interrupt_handler old_interrupt_handler
= octave_ignore_interrupts ();
status = system (cmd_str);
octave_set_interrupt_handler (old_interrupt_handler);
if (WIFEXITED (status))
status = WEXITSTATUS (status);
else
status = 127;
return status;
}
static void
help_from_info (const string_vector& argv, int idx, int argc)
{
if (idx == argc)
! try_info (string ());
else
{
for (int i = idx; i < argc; i++)
--- 627,722 ----
volatile octave_interrupt_handler old_interrupt_handler
= octave_ignore_interrupts ();
+ #ifdef __EMX__
+ status = _IO_system (cmd_str, P_WAIT);
+ #else
status = system (cmd_str);
+ #endif
octave_set_interrupt_handler (old_interrupt_handler);
+ #ifndef __EMX__
if (WIFEXITED (status))
status = WEXITSTATUS (status);
else
status = 127;
+ #else
+ if (status > 127) status -= 256;
+ #endif
return status;
}
+ else
+ {
+ volatile octave_interrupt_handler old_interrupt_handler
+ = octave_ignore_interrupts ();
+
+ int status = 0;
+
+ char *directory_name = strdup (Vinfo_file.c_str ());
+ char *temp = filename_non_directory (directory_name);
+
+ if (temp != directory_name)
+ {
+ *temp = 0;
+ info_add_path (directory_name, INFOPATH_PREPEND);
+ }
+
+ delete [] directory_name;
+
+ NODE *initial_node = info_get_node (Vinfo_file.c_str (), 0);
+
+ if (! initial_node) status = 127;
+ else
+ {
+ status = external_info_search(initial_node, 0,
+ Vinfo_file.c_str (), nm.c_str ());
+ if (status == 1)
+ {
+ char *format = replace_in_documentation
+ ("Type \"\\[quit]\" to quit, \"\\[get-help-window]\" for help.");
+ window_message_in_echo_area (format);
+
+ info_read_and_dispatch ();
+
+ #ifdef __EMX__
+ terminal_goto_xy (0, screenheight - 2);
+ #else
+ terminal_goto_xy (0, screenheight - 1);
+ #endif
+ terminal_clear_to_eol ();
+ terminal_unprep_terminal ();
+ }
+
+ status = status * status - 1;
+
+ _finish_info_session (initial_node, 0);
+ }
+
+ octave_set_interrupt_handler (old_interrupt_handler);
+
+ return status;
+ }
+ }
static void
help_from_info (const string_vector& argv, int idx, int argc)
{
if (idx == argc)
! {
! int status = try_info (string ());
!
! if (status)
! {
! if (status < 0)
! {
! message ("help", "sorry, `%s' is not indexed in the manual",
! string ().c_str ());
! sleep (2);
! }
! else error ("help: unable to find info!");
! }
! }
else
{
for (int i = idx; i < argc; i++)
***************
*** 1042,1047 ****
--- 1137,1143 ----
string s = builtin_string_variable ("INFO_PROGRAM");
+ #ifndef __EMX__
if (s.empty ())
{
gripe_invalid_value_specified ("INFO_PROGRAM");
***************
*** 1049,1054 ****
--- 1145,1153 ----
}
else
Vinfo_prog = s;
+ #else
+ Vinfo_prog = s;
+ #endif
return status;
}
diff -cwr n:/project/C/octave-2.1.14.orig/src/input.cc i:/project/C/octave-2.1.14/src/input.cc
*** n:/project/C/octave-2.1.14.orig/src/input.cc Thu Nov 12 19:28:40 1998
--- i:/project/C/octave-2.1.14/src/input.cc Thu May 13 16:59:16 1999
***************
*** 20,25 ****
--- 20,27 ----
*/
+ /* Modified by Klaus Gebhardt, 1996-1999 */
+
// Get command input interactively or from files.
#ifdef HAVE_CONFIG_H
***************
*** 120,125 ****
--- 122,131 ----
// TRUE means the user forced this shell to be interactive (-i).
bool forced_interactive = false;
+ // Nonzero means the user forced this shell to be really interactive (-i),
+ // but without using the pager.
+ int really_forced_interactive = 0;
+
// Should we issue a prompt?
int promptflag = 1;
***************
*** 174,180 ****
}
else
{
! if (! s.empty () && (interactive || forced_interactive))
{
FILE *stream = command_editor::get_output_stream ();
--- 180,187 ----
}
else
{
! if (! s.empty () &&
! (interactive || forced_interactive || really_forced_interactive))
{
FILE *stream = command_editor::get_output_stream ();
***************
*** 200,206 ****
Vlast_prompt_time = time (0);
! if ((interactive || forced_interactive)
&& (! (reading_fcn_file || reading_script_file)))
{
string ps = (promptflag > 0) ? Vps1 : Vps2;
--- 207,213 ----
Vlast_prompt_time = time (0);
! if ((interactive || forced_interactive || really_forced_interactive)
&& (! (reading_fcn_file || reading_script_file)))
{
string ps = (promptflag > 0) ? Vps1 : Vps2;
***************
*** 345,351 ****
FILE *instream = 0;
if (name.length () > 0)
! instream = fopen (name.c_str (), "r");
if (! instream && warn)
warning ("%s: no such file or directory", name.c_str ());
--- 352,358 ----
FILE *instream = 0;
if (name.length () > 0)
! instream = fopen (name.c_str (), "rb");
if (! instream && warn)
warning ("%s: no such file or directory", name.c_str ());
***************
*** 522,527 ****
--- 529,539 ----
flush_octave_stdout ();
string input_buf = gnu_readline (prompt.c_str (), true);
+
+ #ifdef __EMX__
+ if (reading_fcn_file || reading_script_file)
+ octave_diary << prompt.c_str () << input_buf << "\n";
+ #endif
if (! input_buf.empty ())
{
diff -cwr n:/project/C/octave-2.1.14.orig/src/input.h i:/project/C/octave-2.1.14/src/input.h
*** n:/project/C/octave-2.1.14.orig/src/input.h Tue Nov 10 15:06:38 1998
--- i:/project/C/octave-2.1.14/src/input.h Thu Apr 15 12:34:10 1999
***************
*** 20,25 ****
--- 20,27 ----
*/
+ /* Modified by Klaus Gebhardt, 1996 */
+
// Use the GNU readline library for command line editing and hisory.
#if !defined (octave_input_h)
***************
*** 60,65 ****
--- 62,71 ----
// TRUE means the user forced this shell to be interactive (-i).
extern bool forced_interactive;
+
+ // Nonzero means the user forced this shell to be really interactive (-i),
+ // but without using the pager.
+ extern int really_forced_interactive;
// Should we issue a prompt?
extern int promptflag;
diff -cwr n:/project/C/octave-2.1.14.orig/src/lex.l i:/project/C/octave-2.1.14/src/lex.l
*** n:/project/C/octave-2.1.14.orig/src/lex.l Wed Mar 3 18:56:04 1999
--- i:/project/C/octave-2.1.14/src/lex.l Thu Apr 15 12:35:42 1999
***************
*** 20,25 ****
--- 20,27 ----
*/
+ /* Modified by Klaus Gebhardt, 1996 */
+
%s TEXT_FCN
%s MATRIX
***************
*** 186,192 ****
D [0-9]
S [ \t]
! NL ((\n)|(\r\n))
SNL ({S}|{NL})
EL (\.\.\.)
BS (\\)
--- 188,194 ----
D [0-9]
S [ \t]
! NL ((\n)|(\r)|(\r\n)|())
SNL ({S}|{NL})
EL (\.\.\.)
BS (\\)
***************
*** 239,245 ****
return handle_string (yytext[0], 1);
}
! <TEXT_FCN>[^ \t\n\;\,\"\'][^ \t\n\;\,]*{S}* {
string tok = strip_trailing_whitespace (yytext);
TOK_PUSH_AND_RETURN (tok, TEXT);
}
--- 241,247 ----
return handle_string (yytext[0], 1);
}
! <TEXT_FCN>[^ \t\r\n\;\,\"\'][^ \t\r\n\;\,]*{S}* {
string tok = strip_trailing_whitespace (yytext);
TOK_PUSH_AND_RETURN (tok, TEXT);
}
***************
*** 536,542 ****
else
{
int c;
! while ((c = yyinput ()) != EOF && c != '\n')
; // Eat comment.
}
--- 538,544 ----
else
{
int c;
! while ((c = yyinput ()) != EOF && c != '\n' && c != '\r' && c != '')
; // Eat comment.
}
***************
*** 707,713 ****
// Only ask for input from stdin if we are expecting interactive
// input.
! if ((interactive || forced_interactive)
&& ! (reading_fcn_file || get_input_from_eval_string
|| input_from_startup_file))
yyrestart (stdin);
--- 709,715 ----
// Only ask for input from stdin if we are expecting interactive
// input.
! if ((interactive || forced_interactive || really_forced_interactive)
&& ! (reading_fcn_file || get_input_from_eval_string
|| input_from_startup_file))
yyrestart (stdin);
***************
*** 728,734 ****
char c;
while ((c = *s++) != '\0')
{
! if (c == '\n')
current_input_column = 1;
else
current_input_column++;
--- 730,736 ----
char c;
while ((c = *s++) != '\0')
{
! if (c == '\n' || c == '\r' || c == '')
current_input_column = 1;
else
current_input_column++;
***************
*** 1130,1136 ****
bool begin_comment = true;
bool in_comment = true;
! int c = 0;
while ((c = yyinput ()) != EOF)
{
--- 1132,1138 ----
bool begin_comment = true;
bool in_comment = true;
! int c = 0, d, ct;
while ((c = yyinput ()) != EOF)
{
***************
*** 1144,1155 ****
if (in_comment)
{
! help_buf += (char) c;
- if (c == '\n')
in_comment = false;
}
else
{
switch (c)
{
--- 1146,1175 ----
if (in_comment)
{
! if (c == '\n' || c == '\r' || c == '')
! {
! ct = 0;
! d = c;
!
! do
! {
! if (d == '\n' || d == '')
! {
! if (++ct > 1) break;
! help_buf += (char) '\n';
! }
! }
! while (((d = yyinput ()) != EOF) &&
! (d == '\n' || d == '\r' || d == ''));
!
! if (d != EOF) yyunput (d, yytext);
in_comment = false;
}
else
+ help_buf += (char) c;
+ }
+ else
{
switch (c)
{
***************
*** 1336,1341 ****
--- 1356,1363 ----
retval |= ATE_SPACE_OR_TAB;
break;
+ case '':
+ case '\r':
case '\n':
retval |= ATE_NEWLINE;
in_comment = false;
***************
*** 1468,1473 ****
--- 1490,1497 ----
goto cleanup;
break;
+ case '':
+ case '\r':
case '\n':
current_input_column = 0;
promptflag--;
***************
*** 1577,1583 ****
if (! have_ellipsis_continuation (false))
buf << (char) c;
}
! else if (c == '\n')
{
error ("unterminated string constant");
break;
--- 1601,1607 ----
if (! have_ellipsis_continuation (false))
buf << (char) c;
}
! else if (c == '\n' || c == '\r' || c == '')
{
error ("unterminated string constant");
break;
***************
*** 1740,1746 ****
int postfix_un_op = next_token_is_postfix_unary_op
(spc_gobbled, yytext);
! int other_op = match_any (c1, ",;\n]");
if (! (postfix_un_op || bin_op || other_op)
&& nesting_level.is_brace ()
--- 1764,1770 ----
int postfix_un_op = next_token_is_postfix_unary_op
(spc_gobbled, yytext);
! int other_op = match_any (c1, ",;\n\r]");
if (! (postfix_un_op || bin_op || other_op)
&& nesting_level.is_brace ()
***************
*** 1775,1781 ****
unput (c2);
unput (c1);
! int sep_op = match_any (c1, ",;\n]");
int dot_op = (c1 == '.'
&& (isalpha (c2) || isspace (c2) || c2 == '_'));
--- 1799,1805 ----
unput (c2);
unput (c1);
! int sep_op = match_any (c1, ",;\n\r]");
int dot_op = (c1 == '.'
&& (isalpha (c2) || isspace (c2) || c2 == '_'));
***************
*** 1965,1970 ****
--- 1989,1996 ----
case ',':
break;
+ case '':
+ case '\r':
case '\n':
if (in_comment)
in_comment = false;
diff -cwr n:/project/C/octave-2.1.14.orig/src/mappers.cc i:/project/C/octave-2.1.14/src/mappers.cc
*** n:/project/C/octave-2.1.14.orig/src/mappers.cc Wed Nov 18 08:19:12 1998
--- i:/project/C/octave-2.1.14/src/mappers.cc Wed Apr 14 20:56:00 1999
***************
*** 137,143 ****
DEFUN_MAPPER (acos, 0, acos, 0, acos, -1.0, 1.0, 1,
"acos (X): compute acos (X) for each element of X");
! DEFUN_MAPPER (acosh, 0, acosh, 0, acosh, 1.0, DBL_MAX, 1,
"acosh (X): compute acosh (X) for each element of X");
DEFUN_MAPPER (angle, 0, arg, arg, 0, 0.0, 0.0, 0,
--- 137,143 ----
DEFUN_MAPPER (acos, 0, acos, 0, acos, -1.0, 1.0, 1,
"acos (X): compute acos (X) for each element of X");
! DEFUN_MAPPER (acosh, 0, xacosh, 0, acosh, 1.0, DBL_MAX, 1,
"acosh (X): compute acosh (X) for each element of X");
DEFUN_MAPPER (angle, 0, arg, arg, 0, 0.0, 0.0, 0,
***************
*** 149,161 ****
DEFUN_MAPPER (asin, 0, asin, 0, asin, -1.0, 1.0, 1,
"asin (X): compute asin (X) for each element of X");
! DEFUN_MAPPER (asinh, 0, asinh, 0, asinh, 0.0, 0.0, 0,
"asinh (X): compute asinh (X) for each element of X");
DEFUN_MAPPER (atan, 0, atan, 0, atan, 0.0, 0.0, 0,
"atan (X): compute atan (X) for each element of X");
! DEFUN_MAPPER (atanh, 0, atanh, 0, atanh, -1.0, 1.0, 1,
"atanh (X): compute atanh (X) for each element of X");
DEFUN_MAPPER (ceil, 0, ceil, 0, ceil, 0.0, 0.0, 0,
--- 149,161 ----
DEFUN_MAPPER (asin, 0, asin, 0, asin, -1.0, 1.0, 1,
"asin (X): compute asin (X) for each element of X");
! DEFUN_MAPPER (asinh, 0, xasinh, 0, asinh, 0.0, 0.0, 0,
"asinh (X): compute asinh (X) for each element of X");
DEFUN_MAPPER (atan, 0, atan, 0, atan, 0.0, 0.0, 0,
"atan (X): compute atan (X) for each element of X");
! DEFUN_MAPPER (atanh, 0, xatanh, 0, atanh, -1.0, 1.0, 1,
"atanh (X): compute atanh (X) for each element of X");
DEFUN_MAPPER (ceil, 0, ceil, 0, ceil, 0.0, 0.0, 0,
diff -cwr n:/project/C/octave-2.1.14.orig/src/mkbuiltins i:/project/C/octave-2.1.14/src/mkbuiltins
*** n:/project/C/octave-2.1.14.orig/src/mkbuiltins Wed Nov 25 06:49:18 1998
--- i:/project/C/octave-2.1.14/src/mkbuiltins Wed Apr 14 11:17:28 1999
***************
*** 34,40 ****
for file in $DEF_FILES; do
fcn=`echo $file | sed 's,^\./,,; s/\.df//; s/-/_/g'`
echo "static void"
! echo "install_${fcn}_fcns (void)"
echo "{"
cat $file
echo "}"
--- 34,40 ----
for file in $DEF_FILES; do
fcn=`echo $file | sed 's,^\./,,; s/\.df//; s/-/_/g'`
echo "static void"
! echo "install_${fcn##*/}_fcns (void)"
echo "{"
cat $file
echo "}"
***************
*** 43,49 ****
for file in $VAR_FILES; do
f=`echo $file | sed 's,^\./,,; s/-/_/g'`
! echo "extern void symbols_of_${f} (void);"
done
cat << \EOF
--- 43,49 ----
for file in $VAR_FILES; do
f=`echo $file | sed 's,^\./,,; s/-/_/g'`
! echo "extern void symbols_of_${f##*/} (void);"
done
cat << \EOF
***************
*** 55,61 ****
for file in $VAR_FILES; do
f=`echo $file | sed 's,^\./,,; s/-/_/g'`
! echo " symbols_of_${f} ();"
done
cat << \EOF
--- 55,61 ----
for file in $VAR_FILES; do
f=`echo $file | sed 's,^\./,,; s/-/_/g'`
! echo " symbols_of_${f##*/} ();"
done
cat << \EOF
***************
*** 68,74 ****
for file in $DEF_FILES; do
fcn=`echo $file | sed 's,^\./,,; s/\.df//; s/-/_/g'`
! echo " install_${fcn}_fcns ();"
done
cat << \EOF
--- 68,74 ----
for file in $DEF_FILES; do
fcn=`echo $file | sed 's,^\./,,; s/\.df//; s/-/_/g'`
! echo " install_${fcn##*/}_fcns ();"
done
cat << \EOF
diff -cwr n:/project/C/octave-2.1.14.orig/src/mkops i:/project/C/octave-2.1.14/src/mkops
*** n:/project/C/octave-2.1.14.orig/src/mkops Wed Nov 25 06:48:50 1998
--- i:/project/C/octave-2.1.14/src/mkops Wed Apr 14 11:34:10 1999
***************
*** 13,19 ****
for file in "$@"; do
f=`echo $file | sed 's,^\./,,; s%^OPERATORS/op-%%; s%\.cc%%; s%-%_%g'`
! echo "extern void install_${f}_ops (void);"
done
cat << \EOF
--- 13,19 ----
for file in "$@"; do
f=`echo $file | sed 's,^\./,,; s%^OPERATORS/op-%%; s%\.cc%%; s%-%_%g'`
! echo "extern void install_${f#op_}_ops (void);"
done
cat << \EOF
***************
*** 27,33 ****
for file in "$@"; do
f=`echo $file | sed 's,^\./,,; s%^OPERATORS/op-%%; s%\.cc%%; s%-%_%g'`
! echo " install_${f}_ops ();"
done
cat << \EOF
--- 27,33 ----
for file in "$@"; do
f=`echo $file | sed 's,^\./,,; s%^OPERATORS/op-%%; s%\.cc%%; s%-%_%g'`
! echo " install_${f#op_}_ops ();"
done
cat << \EOF
diff -cwr n:/project/C/octave-2.1.14.orig/src/oct-hist.cc i:/project/C/octave-2.1.14/src/oct-hist.cc
*** n:/project/C/octave-2.1.14.orig/src/oct-hist.cc Tue Nov 17 18:04:10 1998
--- i:/project/C/octave-2.1.14/src/oct-hist.cc Thu Apr 15 11:13:30 1999
***************
*** 31,36 ****
--- 31,38 ----
*/
+ /* Modified by Klaus Gebhardt, 1996 */
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
***************
*** 72,77 ****
--- 74,87 ----
#include "utils.h"
#include "variables.h"
+ #ifdef __EMX__
+ extern "C"
+ {
+ #include <process.h>
+ int _IO_system (const char *, int);
+ }
+ #endif
+
// TRUE means input is coming from temporary history file.
bool input_from_tmp_history_file = false;
***************
*** 303,309 ****
int cmd_len = cmd.length ();
! if (cmd[cmd_len - 1] == '\n')
cmd.resize (cmd_len - 1);
if (! cmd.empty ())
--- 313,320 ----
int cmd_len = cmd.length ();
! if (cmd[cmd_len - 1] == '\n' || cmd[cmd_len - 1] == '\r'
! || cmd[cmd_len - 1] == '')
cmd.resize (cmd_len - 1);
if (! cmd.empty ())
***************
*** 322,328 ****
int len = tmp.length ();
! if (len > 0 && tmp[len-1] == '\n')
tmp.resize (len - 1);
if (! tmp.empty ())
--- 333,340 ----
int len = tmp.length ();
! if (len > 0 &&
! (tmp[len-1] == '\n' || tmp[len-1] == '\r' || tmp[len-1] == ''))
tmp.resize (len - 1);
if (! tmp.empty ())
***************
*** 450,456 ****
--- 462,472 ----
volatile octave_interrupt_handler old_interrupt_handler
= octave_ignore_interrupts ();
+ #ifdef __EMX__
+ _IO_system (cmd.c_str (), P_WAIT);
+ #else
system (cmd.c_str ());
+ #endif
octave_set_interrupt_handler (old_interrupt_handler);
diff -cwr n:/project/C/octave-2.1.14.orig/src/octave.cc i:/project/C/octave-2.1.14/src/octave.cc
*** n:/project/C/octave-2.1.14.orig/src/octave.cc Tue Mar 2 08:10:20 1999
--- i:/project/C/octave-2.1.14/src/octave.cc Wed Apr 21 15:16:50 1999
***************
*** 22,27 ****
--- 22,29 ----
// Born February 20, 1992.
+ /* Modified by Klaus Gebhardt, 1996 */
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
***************
*** 43,48 ****
--- 45,55 ----
#include <unistd.h>
#endif
+ #ifdef __EMX__
+ #include <float.h>
+ #include <sys/uflags.h>
+ #endif
+
#include "cmd-edit.h"
#include "file-stat.h"
#include "lo-error.h"
***************
*** 105,111 ****
// Usage message
static const char *usage_string =
! "octave [-?HVdfhiqvx] [--debug] [--echo-commands] [--exec-path path]\n\
[--help] [--info-file file] [--info-program prog] [--interactive]\n\
[--no-history] [--no-init-file] [--no-line-editing] [--no-site-file]\n\
[-p path] [--path path] [--silent] [--traditional] [--verbose]\n\
--- 112,118 ----
// Usage message
static const char *usage_string =
! "octave [-?HVdfhiIqvx] [--debug] [--echo-commands] [--exec-path path]\n\
[--help] [--info-file file] [--info-program prog] [--interactive]\n\
[--no-history] [--no-init-file] [--no-line-editing] [--no-site-file]\n\
[-p path] [--path path] [--silent] [--traditional] [--verbose]\n\
***************
*** 114,120 ****
// This is here so that it's more likely that the usage message and
// the real set of options will agree. Note: the `+' must come first
// to prevent getopt from permuting arguments!
! static const char *short_opts = "+?HVdfhip:qvx";
// Long options. See the comments in getopt.h for the meanings of the
// fields in this structure.
--- 121,127 ----
// This is here so that it's more likely that the usage message and
// the real set of options will agree. Note: the `+' must come first
// to prevent getopt from permuting arguments!
! static const char *short_opts = "+?HVdfhiIp:qvx";
// Long options. See the comments in getopt.h for the meanings of the
// fields in this structure.
***************
*** 184,190 ****
odb = octave_env::getenv ("OCTAVE_DB_DIR");
if (odb.empty ())
! odb = Vdata_dir + string ("/octave:") + Vlibexec_dir + string ("/octave");
octave_env::putenv ("TEXMFDBS", odb);
}
--- 191,198 ----
odb = octave_env::getenv ("OCTAVE_DB_DIR");
if (odb.empty ())
! odb = Vdata_dir + string ("/octave") + string (SEPCHAR_STR)
! + Vlibexec_dir + string ("/octave");
octave_env::putenv ("TEXMFDBS", odb);
}
***************
*** 277,282 ****
--- 285,291 ----
--info-file FILE Use top-level info file FILE.\n\
--info-program PROGRAM Use PROGRAM for reading info files.\n\
--interactive, -i Force interactive behavior.\n\
+ -I Force really interactive behavior, but no pager.\n\
--no-history, -H Don't save commands to the history list\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\
***************
*** 417,422 ****
--- 426,435 ----
forced_interactive = true;
break;
+ case 'I':
+ really_forced_interactive = true;
+ break;
+
case 'p':
if (args.optarg ())
bind_builtin_variable ("LOADPATH", args.optarg ());
***************
*** 500,505 ****
--- 513,525 ----
if (! inhibit_startup_message && reading_startup_message_printed)
cout << endl;
+ #if defined (__EMX__)
+ _control87 (EM_INVALID | EM_DENORMAL | EM_ZERODIVIDE | EM_OVERFLOW |
+ EM_UNDERFLOW | EM_INEXACT, MCW_EM);
+
+ _uflags (_UF_SBRK_MODEL, _UF_SBRK_ARBITRARY);
+ #endif
+
// Avoid counting commands executed from startup files.
command_editor::reset_current_command_number (1);
***************
*** 559,575 ****
// Force input to be echoed if not really interactive, but the user
// has forced interactive behavior.
! if (! interactive && forced_interactive)
{
command_editor::blink_matching_paren (false);
// XXX FIXME XXX -- is this the right thing to do?
bind_builtin_variable ("echo_executing_commands",
static_cast<double> (ECHO_CMD_LINE));
}
! if (! interactive)
line_editing = false;
int retval = main_loop ();
--- 579,597 ----
// Force input to be echoed if not really interactive, but the user
// has forced interactive behavior.
! if (! interactive && (forced_interactive || really_forced_interactive))
{
command_editor::blink_matching_paren (false);
// XXX FIXME XXX -- is this the right thing to do?
+ #if ! defined (__EMX__)
bind_builtin_variable ("echo_executing_commands",
static_cast<double> (ECHO_CMD_LINE));
+ #endif
}
! if (! (interactive || really_forced_interactive))
line_editing = false;
int retval = main_loop ();
diff -cwr n:/project/C/octave-2.1.14.orig/src/OPERATORS/op-str-str.cc i:/project/C/octave-2.1.14/src/OPERATORS/op-str-str.cc
*** n:/project/C/octave-2.1.14.orig/src/OPERATORS/op-str-str.cc Tue Nov 10 15:06:42 1998
--- i:/project/C/octave-2.1.14/src/OPERATORS/op-str-str.cc Wed Apr 14 20:57:34 1999
***************
*** 20,25 ****
--- 20,27 ----
*/
+ /* Modified by Klaus Gebhardt, 1997 */
+
#if defined (__GNUG__)
#pragma implementation
#endif
***************
*** 58,77 ****
if (cm2.rows () == 1 && cm2.columns () == 1)
return octave_value (cm1 (0, 0) == cm2 (0, 0));
else
! SC_MX_BOOL_OP (char, c, cm1 (0, 0), charMatrix, m, cm2,
c == m (i, j), 0.0);
}
else
{
! int cm2_nr = cm2.rows ();
! int cm2_nc = cm2.cols ();
!
! if (cm2_nr == 1 && cm2_nc == 1)
! MX_SC_BOOL_OP (charMatrix, m, cm1, char, c, cm2 (0, 0),
c == m (i, j), 0.0);
else
! MX_MX_BOOL_OP (charMatrix, m1, cm1, charMatrix, m2, cm2,
! m1 (i, j) == m2 (i, j), "==", 0.0, 1.0);
}
}
--- 60,80 ----
if (cm2.rows () == 1 && cm2.columns () == 1)
return octave_value (cm1 (0, 0) == cm2 (0, 0));
else
! SC_MX_BOOL_OP (char, c, cm1 (0, 0), \
! charMatrix, m, cm2, \
c == m (i, j), 0.0);
}
else
{
! if (cm2.rows () == 1 && cm2.columns () == 1)
! MX_SC_BOOL_OP (charMatrix, m, cm1, \
! char, c, cm2 (0, 0), \
c == m (i, j), 0.0);
else
! MX_MX_BOOL_OP (charMatrix, m1, cm1, \
! charMatrix, m2, cm2, \
! m1 (i, j) == m2 (i, j), \
! "==", 0.0, 1.0);
}
}
diff -cwr n:/project/C/octave-2.1.14.orig/src/ov.cc i:/project/C/octave-2.1.14/src/ov.cc
*** n:/project/C/octave-2.1.14.orig/src/ov.cc Fri Nov 20 23:35:26 1998
--- i:/project/C/octave-2.1.14/src/ov.cc Thu Apr 29 13:42:46 1999
***************
*** 325,440 ****
octave_value::octave_value (void)
: rep (new octave_base_value ())
{
! rep->count = 1;
}
octave_value::octave_value (double d)
: rep (new octave_scalar (d))
{
! rep->count = 1;
}
octave_value::octave_value (const Matrix& m)
: rep (new octave_matrix (m))
{
! rep->count = 1;
maybe_mutate ();
}
octave_value::octave_value (const DiagMatrix& d)
: rep (new octave_matrix (d))
{
! rep->count = 1;
maybe_mutate ();
}
octave_value::octave_value (const RowVector& v, int pcv)
: rep (new octave_matrix (v, pcv))
{
! rep->count = 1;
maybe_mutate ();
}
octave_value::octave_value (const ColumnVector& v, int pcv)
: rep (new octave_matrix (v, pcv))
{
! rep->count = 1;
maybe_mutate ();
}
octave_value::octave_value (const Complex& C)
: rep (new octave_complex (C))
{
! rep->count = 1;
maybe_mutate ();
}
octave_value::octave_value (const ComplexMatrix& m)
: rep (new octave_complex_matrix (m))
{
! rep->count = 1;
maybe_mutate ();
}
octave_value::octave_value (const ComplexDiagMatrix& d)
: rep (new octave_complex_matrix (d))
{
! rep->count = 1;
maybe_mutate ();
}
octave_value::octave_value (const ComplexRowVector& v, int pcv)
: rep (new octave_complex_matrix (v, pcv))
{
! rep->count = 1;
maybe_mutate ();
}
octave_value::octave_value (const ComplexColumnVector& v, int pcv)
: rep (new octave_complex_matrix (v, pcv))
{
! rep->count = 1;
maybe_mutate ();
}
octave_value::octave_value (bool b)
: rep (new octave_bool (b))
{
! rep->count = 1;
}
octave_value::octave_value (const boolMatrix& bm)
: rep (new octave_bool_matrix (bm))
{
! rep->count = 1;
maybe_mutate ();
}
octave_value::octave_value (char c)
: rep (new octave_char_matrix_str (c))
{
! rep->count = 1;
maybe_mutate ();
}
octave_value::octave_value (const char *s)
: rep (new octave_char_matrix_str (s))
{
! rep->count = 1;
maybe_mutate ();
}
octave_value::octave_value (const string& s)
: rep (new octave_char_matrix_str (s))
{
! rep->count = 1;
maybe_mutate ();
}
octave_value::octave_value (const string_vector& s)
: rep (new octave_char_matrix_str (s))
{
! rep->count = 1;
maybe_mutate ();
}
--- 325,440 ----
octave_value::octave_value (void)
: rep (new octave_base_value ())
{
! rep->ref_count = 1;
}
octave_value::octave_value (double d)
: rep (new octave_scalar (d))
{
! rep->ref_count = 1;
}
octave_value::octave_value (const Matrix& m)
: rep (new octave_matrix (m))
{
! rep->ref_count = 1;
maybe_mutate ();
}
octave_value::octave_value (const DiagMatrix& d)
: rep (new octave_matrix (d))
{
! rep->ref_count = 1;
maybe_mutate ();
}
octave_value::octave_value (const RowVector& v, int pcv)
: rep (new octave_matrix (v, pcv))
{
! rep->ref_count = 1;
maybe_mutate ();
}
octave_value::octave_value (const ColumnVector& v, int pcv)
: rep (new octave_matrix (v, pcv))
{
! rep->ref_count = 1;
maybe_mutate ();
}
octave_value::octave_value (const Complex& C)
: rep (new octave_complex (C))
{
! rep->ref_count = 1;
maybe_mutate ();
}
octave_value::octave_value (const ComplexMatrix& m)
: rep (new octave_complex_matrix (m))
{
! rep->ref_count = 1;
maybe_mutate ();
}
octave_value::octave_value (const ComplexDiagMatrix& d)
: rep (new octave_complex_matrix (d))
{
! rep->ref_count = 1;
maybe_mutate ();
}
octave_value::octave_value (const ComplexRowVector& v, int pcv)
: rep (new octave_complex_matrix (v, pcv))
{
! rep->ref_count = 1;
maybe_mutate ();
}
octave_value::octave_value (const ComplexColumnVector& v, int pcv)
: rep (new octave_complex_matrix (v, pcv))
{
! rep->ref_count = 1;
maybe_mutate ();
}
octave_value::octave_value (bool b)
: rep (new octave_bool (b))
{
! rep->ref_count = 1;
}
octave_value::octave_value (const boolMatrix& bm)
: rep (new octave_bool_matrix (bm))
{
! rep->ref_count = 1;
maybe_mutate ();
}
octave_value::octave_value (char c)
: rep (new octave_char_matrix_str (c))
{
! rep->ref_count = 1;
maybe_mutate ();
}
octave_value::octave_value (const char *s)
: rep (new octave_char_matrix_str (s))
{
! rep->ref_count = 1;
maybe_mutate ();
}
octave_value::octave_value (const string& s)
: rep (new octave_char_matrix_str (s))
{
! rep->ref_count = 1;
maybe_mutate ();
}
octave_value::octave_value (const string_vector& s)
: rep (new octave_char_matrix_str (s))
{
! rep->ref_count = 1;
maybe_mutate ();
}
***************
*** 446,519 ****
else
rep = new octave_char_matrix (chm);
! rep->count = 1;
maybe_mutate ();
}
octave_value::octave_value (double base, double limit, double inc)
: rep (new octave_range (base, limit, inc))
{
! rep->count = 1;
maybe_mutate ();
}
octave_value::octave_value (const Range& r)
: rep (new octave_range (r))
{
! rep->count = 1;
maybe_mutate ();
}
octave_value::octave_value (const Octave_map& m)
: rep (new octave_struct (m))
{
! rep->count = 1;
}
octave_value::octave_value (octave_stream *s, int n)
: rep (new octave_file (s, n))
{
! rep->count = 1;
}
octave_value::octave_value (octave_function *f)
: rep (f)
{
! rep->count = 1;
}
octave_value::octave_value (const octave_value_list& l)
: rep (new octave_list (l))
{
! rep->count = 1;
}
octave_value::octave_value (octave_value::magic_colon)
: rep (new octave_magic_colon ())
{
! rep->count = 1;
}
octave_value::octave_value (octave_value::all_va_args)
: rep (new octave_all_va_args ())
{
! rep->count = 1;
}
octave_value::octave_value (octave_value *new_rep)
: rep (new_rep)
{
! rep->count = 1;
}
octave_value::~octave_value (void)
{
#if defined (MDEBUG)
cerr << "~octave_value: rep: " << rep
! << " rep->count: " << rep->count << "\n";
#endif
! if (rep && --rep->count == 0)
{
delete rep;
rep = 0;
--- 446,519 ----
else
rep = new octave_char_matrix (chm);
! rep->ref_count = 1;
maybe_mutate ();
}
octave_value::octave_value (double base, double limit, double inc)
: rep (new octave_range (base, limit, inc))
{
! rep->ref_count = 1;
maybe_mutate ();
}
octave_value::octave_value (const Range& r)
: rep (new octave_range (r))
{
! rep->ref_count = 1;
maybe_mutate ();
}
octave_value::octave_value (const Octave_map& m)
: rep (new octave_struct (m))
{
! rep->ref_count = 1;
}
octave_value::octave_value (octave_stream *s, int n)
: rep (new octave_file (s, n))
{
! rep->ref_count = 1;
}
octave_value::octave_value (octave_function *f)
: rep (f)
{
! rep->ref_count = 1;
}
octave_value::octave_value (const octave_value_list& l)
: rep (new octave_list (l))
{
! rep->ref_count = 1;
}
octave_value::octave_value (octave_value::magic_colon)
: rep (new octave_magic_colon ())
{
! rep->ref_count = 1;
}
octave_value::octave_value (octave_value::all_va_args)
: rep (new octave_all_va_args ())
{
! rep->ref_count = 1;
}
octave_value::octave_value (octave_value *new_rep)
: rep (new_rep)
{
! rep->ref_count = 1;
}
octave_value::~octave_value (void)
{
#if defined (MDEBUG)
cerr << "~octave_value: rep: " << rep
! << " rep->ref_count: " << rep->ref_count << "\n";
#endif
! if (rep && --rep->ref_count == 0)
{
delete rep;
rep = 0;
***************
*** 533,543 ****
if (tmp && tmp != rep)
{
! if (--rep->count == 0)
delete rep;
rep = tmp;
! rep->count = 1;
}
}
--- 533,543 ----
if (tmp && tmp != rep)
{
! if (--rep->ref_count == 0)
delete rep;
rep = tmp;
! rep->ref_count = 1;
}
}
***************
*** 879,898 ****
{
octave_value *old_rep = rep;
rep = tmp;
! rep->count = 1;
assignment_ok = try_assignment (op, idx, rhs);
if (! assignment_ok && old_rep)
{
! if (--rep->count == 0)
delete rep;
rep = old_rep;
old_rep = 0;
}
! if (old_rep && --old_rep->count == 0)
delete old_rep;
}
else
--- 879,898 ----
{
octave_value *old_rep = rep;
rep = tmp;
! rep->ref_count = 1;
assignment_ok = try_assignment (op, idx, rhs);
if (! assignment_ok && old_rep)
{
! if (--rep->ref_count == 0)
delete rep;
rep = old_rep;
old_rep = 0;
}
! if (old_rep && --old_rep->ref_count == 0)
delete old_rep;
}
else
***************
*** 944,950 ****
if (tmp)
{
rep = tmp;
! rep->count = 1;
}
else
{
--- 944,950 ----
if (tmp)
{
rep = tmp;
! rep->ref_count = 1;
}
else
{
***************
*** 963,976 ****
if (! assignment_ok && old_rep)
{
! if (--rep->count == 0)
delete rep;
rep = old_rep;
old_rep = 0;
}
! if (old_rep && --old_rep->count == 0)
delete old_rep;
}
--- 963,976 ----
if (! assignment_ok && old_rep)
{
! if (--rep->ref_count == 0)
delete rep;
rep = old_rep;
old_rep = 0;
}
! if (old_rep && --old_rep->ref_count == 0)
delete old_rep;
}
***************
*** 1192,1198 ****
{
octave_value *old_rep = rep;
rep = tmp;
! rep->count = 1;
t = type_id ();
--- 1192,1198 ----
{
octave_value *old_rep = rep;
rep = tmp;
! rep->ref_count = 1;
t = type_id ();
***************
*** 1202,1215 ****
{
f (*rep);
! if (old_rep && --old_rep->count == 0)
delete old_rep;
}
else
{
if (old_rep)
{
! if (--rep->count == 0)
delete rep;
rep = old_rep;
--- 1202,1215 ----
{
f (*rep);
! if (old_rep && --old_rep->ref_count == 0)
delete old_rep;
}
else
{
if (old_rep)
{
! if (--rep->ref_count == 0)
delete rep;
rep = old_rep;
diff -cwr n:/project/C/octave-2.1.14.orig/src/ov.h i:/project/C/octave-2.1.14/src/ov.h
*** n:/project/C/octave-2.1.14.orig/src/ov.h Sat Mar 27 00:13:02 1999
--- i:/project/C/octave-2.1.14/src/ov.h Thu Apr 29 13:42:46 1999
***************
*** 184,193 ****
octave_value (const octave_value& a)
{
rep = a.rep;
! rep->count++;
}
! // Delete the representation of this constant if the count drops to
// zero.
virtual ~octave_value (void);
--- 184,193 ----
octave_value (const octave_value& a)
{
rep = a.rep;
! rep->ref_count++;
}
! // Delete the representation of this constant if the ref_count drops to
// zero.
virtual ~octave_value (void);
***************
*** 198,208 ****
void make_unique (void)
{
! if (rep->count > 1)
{
! --rep->count;
rep = rep->clone ();
! rep->count = 1;
}
}
--- 198,208 ----
void make_unique (void)
{
! if (rep->ref_count > 1)
{
! --rep->ref_count;
rep = rep->clone ();
! rep->ref_count = 1;
}
}
***************
*** 212,228 ****
{
if (rep != a.rep)
{
! if (--rep->count == 0)
delete rep;
rep = a.rep;
! rep->count++;
}
return *this;
}
! int count (void) { return rep->count; }
virtual type_conv_fcn numeric_conversion_function (void) const
{ return rep->numeric_conversion_function (); }
--- 212,228 ----
{
if (rep != a.rep)
{
! if (--rep->ref_count == 0)
delete rep;
rep = a.rep;
! rep->ref_count++;
}
return *this;
}
! int count (void) { return rep->ref_count; }
virtual type_conv_fcn numeric_conversion_function (void) const
{ return rep->numeric_conversion_function (); }
***************
*** 504,510 ****
union
{
octave_value *rep; // The real representation.
! int count; // A reference count.
};
bool convert_and_assign (assign_op, const octave_value_list& idx,
--- 504,510 ----
union
{
octave_value *rep; // The real representation.
! int ref_count; // A reference count.
};
bool convert_and_assign (assign_op, const octave_value_list& idx,
diff -cwr n:/project/C/octave-2.1.14.orig/src/pager.cc i:/project/C/octave-2.1.14/src/pager.cc
*** n:/project/C/octave-2.1.14.orig/src/pager.cc Fri Jan 22 11:58:06 1999
--- i:/project/C/octave-2.1.14/src/pager.cc Wed Apr 14 20:57:34 1999
***************
*** 20,25 ****
--- 20,27 ----
*/
+ /* Modified by Klaus Gebhardt, 1996 */
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
***************
*** 221,227 ****
int
octave_pager_buf::sync (void)
{
! if (! interactive
|| really_flush_to_pager
|| (Vpage_screen_output && Vpage_output_immediately)
|| ! Vpage_screen_output)
--- 223,229 ----
int
octave_pager_buf::sync (void)
{
! if ((! interactive || really_forced_interactive)
|| really_flush_to_pager
|| (Vpage_screen_output && Vpage_output_immediately)
|| ! Vpage_screen_output)
***************
*** 230,236 ****
int len = pptr () - buf;
! bool bypass_pager = (! interactive
|| ! Vpage_screen_output
|| (really_flush_to_pager
&& Vpage_screen_output
--- 232,238 ----
int len = pptr () - buf;
! bool bypass_pager = ((! interactive || really_forced_interactive)
|| ! Vpage_screen_output
|| (really_flush_to_pager
&& Vpage_screen_output
diff -cwr n:/project/C/octave-2.1.14.orig/src/parse.y i:/project/C/octave-2.1.14/src/parse.y
*** n:/project/C/octave-2.1.14.orig/src/parse.y Sat Jan 16 00:12:20 1999
--- i:/project/C/octave-2.1.14/src/parse.y Thu Apr 15 13:47:42 1999
***************
*** 20,25 ****
--- 20,27 ----
*/
+ /* Modified by Klaus Gebhardt, 1996 */
+
// Parser for Octave.
// C decarations.
***************
*** 40,45 ****
--- 42,49 ----
#include <strstream.h>
+ #include <setjmp.h>
+
#include "Matrix.h"
#include "cmd-edit.h"
#include "cmd-hist.h"
***************
*** 57,68 ****
--- 61,76 ----
#include "pager.h"
#include "parse.h"
#include "pt-all.h"
+ #include "sighandlers.h"
#include "symtab.h"
#include "token.h"
#include "unwind-prot.h"
#include "utils.h"
#include "variables.h"
+ // Top level context (?)
+ extern jmp_buf toplevel;
+
// TRUE means we print
static bool Vdefault_eval_print_flag = true;
***************
*** 279,285 ****
{ \
global_command = 0; \
yyerrok; \
! if (interactive || forced_interactive) \
YYACCEPT; \
else \
YYABORT; \
--- 287,293 ----
{ \
global_command = 0; \
yyerrok; \
! if (interactive || forced_interactive || really_forced_interactive) \
YYACCEPT; \
else \
YYABORT; \
***************
*** 398,404 ****
%type <subplot_axes_type> axes
// Precedence and associativity.
! %left ';' ',' '\n'
%right '=' ADD_EQ SUB_EQ MUL_EQ DIV_EQ LEFTDIV_EQ EMUL_EQ EDIV_EQ ELEFTDIV_EQ OR_EQ AND_EQ LSHIFT_EQ RSHIFT_EQ
%left EXPR_AND_AND EXPR_OR_OR
%left EXPR_AND EXPR_OR
--- 406,412 ----
%type <subplot_axes_type> axes
// Precedence and associativity.
! %left ';' ',' '\n' '\r' ''
%right '=' ADD_EQ SUB_EQ MUL_EQ DIV_EQ LEFTDIV_EQ EMUL_EQ EDIV_EQ ELEFTDIV_EQ OR_EQ AND_EQ LSHIFT_EQ RSHIFT_EQ
%left EXPR_AND_AND EXPR_OR_OR
%left EXPR_AND EXPR_OR
***************
*** 441,450 ****
--- 449,466 ----
input1 : '\n'
{ $$ = 0; }
+ | '\r'
+ { $$ = 0; }
+ | ''
+ { $$ = 0; }
| simple_list
{ $$ = $1; }
| simple_list '\n'
{ $$ = $1; }
+ | simple_list '\r'
+ { $$ = $1; }
+ | simple_list ''
+ { $$ = $1; }
| simple_list END_OF_INPUT
{ $$ = $1; }
;
***************
*** 1004,1015 ****
--- 1020,1033 ----
}
| param_list1 param_list_end
{
+ lexer_flags.looking_at_parameter_list = false;
lexer_flags.quote_is_transpose = false;
$1->mark_as_formal_parameters ();
$$ = $1;
}
| param_list1 ',' ELLIPSIS param_list_end
{
+ lexer_flags.looking_at_parameter_list = false;
lexer_flags.quote_is_transpose = false;
$1->mark_as_formal_parameters ();
$1->mark_varargs ();
***************
*** 1332,1343 ****
--- 1350,1365 ----
{ $$ = ';'; }
| '\n'
{ $$ = '\n'; }
+ | '\r'
+ { $$ = '\r'; }
| sep ','
{ $$ = $1; }
| sep ';'
{ $$ = $1; }
| sep '\n'
{ $$ = $1; }
+ | sep '\r'
+ { $$ = $1; }
;
opt_sep : // empty
***************
*** 2497,2502 ****
--- 2519,2525 ----
case 0:
case ',':
case '\n':
+ case '\r':
if (warn_missing_semi)
maybe_warn_missing_semi (list);
break;
***************
*** 2510,2515 ****
--- 2533,2543 ----
void
parse_and_execute (FILE *f)
{
+ volatile octave_interrupt_handler old_interrupt_handler
+ = octave_ignore_interrupts ();
+
+ volatile jmp_buf old_toplevel = toplevel;
+
unwind_protect::begin_frame ("parse_and_execute");
YY_BUFFER_STATE old_buf = current_buffer ();
***************
*** 2528,2533 ****
--- 2556,2565 ----
unwind_protect_ptr (curr_sym_tab);
+ if (setjmp(toplevel) == 0)
+ {
+ octave_set_interrupt_handler (old_interrupt_handler);
+
int retval;
do
{
***************
*** 2565,2572 ****
--- 2597,2610 ----
}
}
while (retval == 0);
+ }
+ else error ("script executing interrupted ...");
unwind_protect::run_frame ("parse_and_execute");
+
+ octave_ignore_interrupts ();
+ toplevel = old_toplevel;
+ octave_set_interrupt_handler (old_interrupt_handler);
}
static void
***************
*** 2579,2584 ****
--- 2617,2625 ----
void
parse_and_execute (const string& s, bool verbose, const char *warn_for)
{
+ volatile octave_interrupt_handler old_interrupt_handler
+ = octave_ignore_interrupts ();
+
unwind_protect::begin_frame ("parse_and_execute_2");
unwind_protect_bool (reading_script_file);
***************
*** 2615,2620 ****
--- 2656,2663 ----
error ("%s: unable to open file `%s'", warn_for, s.c_str ());
unwind_protect::run_frame ("parse_and_execute_2");
+
+ octave_set_interrupt_handler (old_interrupt_handler);
}
static bool
***************
*** 2686,2695 ****
if (! have_help_text)
{
first_comments_seen = true;
! help_txt += (char) c;
}
! if (c == '\n')
{
if (update_pos)
{
--- 2729,2750 ----
if (! have_help_text)
{
first_comments_seen = true;
! if (c == '\r')
! {
! int d = getc (ffile);
! if (c != '\n' && c != '\r' && c != '')
! help_txt += (char) '\n';
! #if defined (EMX09C)
! fseek (ffile, -1l, SEEK_CUR);
! #else
! ungetc (d, ffile);
! #endif
! }
! else if (c == '') help_txt += (char) '\n';
! else help_txt += (char) c;
}
! if ((c == '\n') || (c == ''))
{
if (update_pos)
{
***************
*** 2704,2711 ****
{
if (update_pos)
current_input_column--;
ungetc (c, ffile);
! if (c == '\n')
break;
}
else
--- 2759,2770 ----
{
if (update_pos)
current_input_column--;
+ #if defined (EMX09C)
+ fseek (ffile, -1l, SEEK_CUR);
+ #else
ungetc (c, ffile);
! #endif
! if ((c == '\n') || (c == '\r') || (c == ''))
break;
}
else
***************
*** 2723,2728 ****
--- 2782,2793 ----
have_help_text = true;
break;
+ case '\r':
+ if (first_comments_seen) have_help_text = true;
+ if (update_pos) current_input_column = 0;
+ continue;
+
+ case '':
case '\n':
if (first_comments_seen)
have_help_text = true;
***************
*** 2742,2748 ****
--- 2807,2817 ----
default:
if (update_pos)
current_input_column--;
+ #if defined (EMX09C)
+ fseek (ffile, -1l, SEEK_CUR);
+ #else
ungetc (c, ffile);
+ #endif
goto done;
}
}
***************
*** 2769,2775 ****
if (! path.empty ())
{
! FILE *fptr = fopen (path.c_str (), "r");
if (fptr)
{
--- 2838,2844 ----
if (! path.empty ())
{
! FILE *fptr = fopen (path.c_str (), "rb");
if (fptr)
{
***************
*** 3130,3136 ****
octave_value_list tmp = eval_string (s, silent, parse_status, 1);
- if (! tmp.empty ())
retval = tmp(0);
return retval;
--- 3199,3204 ----
diff -cwr n:/project/C/octave-2.1.14.orig/src/pt-plot.cc i:/project/C/octave-2.1.14/src/pt-plot.cc
*** n:/project/C/octave-2.1.14.orig/src/pt-plot.cc Fri Jan 29 11:34:00 1999
--- i:/project/C/octave-2.1.14/src/pt-plot.cc Wed Apr 14 20:57:36 1999
***************
*** 20,25 ****
--- 20,27 ----
*/
+ /* Modified by Klaus Gebhardt, 1996 */
+
#if defined (__GNUG__)
#pragma implementation
#endif
***************
*** 150,162 ****
sigemptyset (&set);
sigaddset (&set, SIGINT);
sigprocmask (SIG_BLOCK, &set, &oset);
#else
volatile octave_interrupt_handler old_interrupt_handler
= octave_ignore_interrupts ();
#endif
-
plot_stream = new oprocstream (plot_prog.c_str ());
!
if (plot_stream)
{
if (! *plot_stream)
--- 152,168 ----
sigemptyset (&set);
sigaddset (&set, SIGINT);
sigprocmask (SIG_BLOCK, &set, &oset);
+ #endif
+
+ #if defined (__EMX__) && defined (OS2)
+ plot_stream = new oprocstream (plot_prog.c_str (), ios::out);
#else
+ #if !defined (HAVE_POSIX_SIGNALS)
volatile octave_interrupt_handler old_interrupt_handler
= octave_ignore_interrupts ();
#endif
plot_stream = new oprocstream (plot_prog.c_str ());
! #endif
if (plot_stream)
{
if (! *plot_stream)
***************
*** 179,186 ****
--- 185,194 ----
#if defined (HAVE_POSIX_SIGNALS)
sigprocmask (SIG_SETMASK, &oset, 0);
#else
+ #if ! defined (__EMX__) || ! defined (OS2)
octave_set_interrupt_handler (old_interrupt_handler);
#endif
+ #endif
}
if (! error_state && plot_stream && *plot_stream && ! initialized)
***************
*** 1092,1097 ****
--- 1100,1106 ----
char *plot_command = plot_buf.str ();
send_to_plot_stream (plot_command);
+ sleep (2);
delete [] plot_command;
diff -cwr n:/project/C/octave-2.1.14.orig/src/sighandlers.cc i:/project/C/octave-2.1.14/src/sighandlers.cc
*** n:/project/C/octave-2.1.14.orig/src/sighandlers.cc Tue Nov 10 15:06:40 1998
--- i:/project/C/octave-2.1.14/src/sighandlers.cc Thu Apr 15 11:18:18 1999
***************
*** 20,25 ****
--- 20,27 ----
*/
+ /* Modified by Klaus Gebhardt, 1995 - 1996 */
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
***************
*** 38,43 ****
--- 40,50 ----
#include <unistd.h>
#endif
+ #ifdef __EMX__
+ #include <float.h>
+ #include <sys/uflags.h>
+ #endif
+
#include "error.h"
#include "load-save.h"
#include "pager.h"
***************
*** 82,88 ****
#if defined (__EMX__)
#define MAYBE_ACK_SIGNAL(sig) \
! octave_set_signal_handler (sig, SIG_ACK)
#define ACK_USES_SIG 1
#else
#define MAYBE_ACK_SIGNAL(sig) \
--- 89,95 ----
#if defined (__EMX__)
#define MAYBE_ACK_SIGNAL(sig) \
! signal (sig, SIG_ACK)
#define ACK_USES_SIG 1
#else
#define MAYBE_ACK_SIGNAL(sig) \
***************
*** 130,136 ****
{
been_there_done_that = true;
! cerr << "error: " << sig_name << " -- stopping myself...\n";
save_user_variables ();
--- 137,143 ----
{
been_there_done_that = true;
! cerr << "\n\nerror: " << sig_name << " -- stopping myself...\n";
save_user_variables ();
***************
*** 154,159 ****
--- 161,169 ----
if (can_interrupt)
{
+ #ifdef __EMX__
+ _uflags (_UF_SBRK_MODEL, _UF_SBRK_ARBITRARY);
+ #endif
jump_to_top_level ();
panic_impossible ();
}
***************
*** 172,177 ****
--- 182,191 ----
sigemptyset (&oact.sa_mask);
sigaction (sig, &act, &oact);
return oact.sa_handler;
+ #elif defined (__EMX__)
+ sig_handler *signal_handler = signal (sig, handler);
+ MAYBE_ACK_SIGNAL(sig);
+ return signal_handler;
#else
return signal (sig, handler);
#endif
***************
*** 188,194 ****
// Handle SIGCHLD.
static RETSIGTYPE
! sigchld_handler (int /* sig */)
{
volatile octave_interrupt_handler saved_interrupt_handler
= octave_ignore_interrupts ();
--- 202,208 ----
// Handle SIGCHLD.
static RETSIGTYPE
! sigchld_handler (int sig)
{
volatile octave_interrupt_handler saved_interrupt_handler
= octave_ignore_interrupts ();
***************
*** 200,220 ****
#if defined (__EMX__)
volatile sig_handler *saved_sigchld_handler
= octave_set_signal_handler (SIGCHLD, SIG_IGN);
! #endif
!
sigset_t set, oset;
BLOCK_CHILD (set, oset);
int n = octave_child_list::length ();
! if (n == 0)
! {
! waitpid (-1, 0, WNOHANG);
! }
! else
! {
! for (int i = 0; i < n; i++)
{
octave_child& elt = octave_child_list::elem (i);
--- 214,229 ----
#if defined (__EMX__)
volatile sig_handler *saved_sigchld_handler
= octave_set_signal_handler (SIGCHLD, SIG_IGN);
! #else
sigset_t set, oset;
BLOCK_CHILD (set, oset);
+ #endif
+ int i = 0;
int n = octave_child_list::length ();
! for (i = 0; i < n; i++)
{
octave_child& elt = octave_child_list::elem (i);
***************
*** 230,249 ****
octave_child::dead_child_handler f = elt.handler;
! if (f)
! f (pid, status);
break;
}
}
}
! }
octave_set_interrupt_handler (saved_interrupt_handler);
UNBLOCK_CHILD (oset);
!
! #ifdef __EMX__
octave_set_signal_handler (SIGCHLD, saved_sigchld_handler);
#endif
--- 239,263 ----
octave_child::dead_child_handler f = elt.handler;
! if (f) f (pid, status);
! else
! {
! string file = elt.filename;
! unlink (file.c_str ());
! }
break;
}
}
}
!
! if (i == n) waitpid (-1, NULL, WNOHANG);
octave_set_interrupt_handler (saved_interrupt_handler);
+ #ifndef __EMX__
UNBLOCK_CHILD (oset);
! #else
octave_set_signal_handler (SIGCHLD, saved_sigchld_handler);
#endif
***************
*** 256,262 ****
#if defined (__alpha__)
static RETSIGTYPE
! sigfpe_handler (int /* sig */)
{
MAYBE_ACK_SIGNAL (SIGFPE);
--- 270,276 ----
#if defined (__alpha__)
static RETSIGTYPE
! sigfpe_handler (int sig)
{
MAYBE_ACK_SIGNAL (SIGFPE);
***************
*** 266,271 ****
--- 280,289 ----
if (can_interrupt)
{
+ #if defined (__EMX__)
+ _control87 (EM_INVALID | EM_DENORMAL | EM_ZERODIVIDE | EM_OVERFLOW |
+ EM_UNDERFLOW | EM_INEXACT, MCW_EM);
+ #endif
jump_to_top_level ();
panic_impossible ();
}
***************
*** 301,307 ****
}
static RETSIGTYPE
! sigpipe_handler (int /* sig */)
{
MAYBE_ACK_SIGNAL (SIGPIPE);
--- 319,325 ----
}
static RETSIGTYPE
! sigpipe_handler (int sig)
{
MAYBE_ACK_SIGNAL (SIGPIPE);
***************
*** 324,334 ****
octave_interrupt_handler retval;
#ifdef SIGINT
! retval.int_handler = octave_set_signal_handler (SIGINT, sigint_handler);
#endif
#ifdef SIGBREAK
! retval.brk_handler = octave_set_signal_handler (SIGBREAK, sigint_handler);
#endif
return retval;
--- 342,356 ----
octave_interrupt_handler retval;
#ifdef SIGINT
! octave_set_signal_handler (SIGINT, sigint_handler);
! retval.int_handler = sigint_handler;
! MAYBE_ACK_SIGNAL (SIGINT);
#endif
#ifdef SIGBREAK
! octave_set_signal_handler (SIGBREAK, sigint_handler);
! retval.brk_handler = sigint_handler;
! MAYBE_ACK_SIGNAL (SIGBREAK);
#endif
return retval;
***************
*** 351,366 ****
--- 373,411 ----
}
octave_interrupt_handler
+ octave_set_interrupt_handler (RETSIGTYPE (*f)(int))
+ {
+ octave_interrupt_handler retval;
+
+ if (f)
+ {
+ #ifdef SIGINT
+ retval.int_handler = octave_set_signal_handler (SIGINT, f);
+ MAYBE_ACK_SIGNAL (SIGINT);
+ #endif
+
+ #ifdef SIGBREAK
+ retval.brk_handler = octave_set_signal_handler (SIGBREAK, f);
+ MAYBE_ACK_SIGNAL (SIGBREAK);
+ #endif
+ }
+
+ return retval;
+ }
+
+ octave_interrupt_handler
octave_set_interrupt_handler (const volatile octave_interrupt_handler& h)
{
octave_interrupt_handler retval;
#ifdef SIGINT
retval.int_handler = octave_set_signal_handler (SIGINT, h.int_handler);
+ MAYBE_ACK_SIGNAL (SIGINT);
#endif
#ifdef SIGBREAK
retval.brk_handler = octave_set_signal_handler (SIGBREAK, h.brk_handler);
+ MAYBE_ACK_SIGNAL (SIGBREAK);
#endif
return retval;
***************
*** 454,461 ****
--- 499,510 ----
#endif
#ifdef SIGTERM
+ #ifdef __EMX__
+ signal (SIGTERM, SIG_DFL);
+ #else
octave_set_signal_handler (SIGTERM, generic_sig_handler);
#endif
+ #endif
#ifdef SIGTRAP
octave_set_signal_handler (SIGTRAP, generic_sig_handler);
***************
*** 624,633 ****
}
void
! octave_child_list::insert (pid_t pid, octave_child::dead_child_handler f)
{
if (instance_ok ())
! instance->do_insert (pid, f);
}
void
--- 673,683 ----
}
void
! octave_child_list::insert (pid_t pid, octave_child::dead_child_handler f,
! string name)
{
if (instance_ok ())
! instance->do_insert (pid, f, name);
}
void
***************
*** 652,658 ****
}
void
! octave_child_list::do_insert (pid_t pid, octave_child::dead_child_handler f)
{
// Insert item in first open slot, increasing size of list if
// necessary.
--- 702,709 ----
}
void
! octave_child_list::do_insert (pid_t pid, octave_child::dead_child_handler f,
! string name)
{
// Insert item in first open slot, increasing size of list if
// necessary.
***************
*** 665,671 ****
if (tmp.pid < 0)
{
! list (i) = octave_child (pid, f);
enlarge = false;
break;
}
--- 716,722 ----
if (tmp.pid < 0)
{
! list (i) = octave_child (pid, f, name);
enlarge = false;
break;
}
***************
*** 683,689 ****
list.resize (total_len * 2);
}
! list (curr_len) = octave_child (pid, f);
curr_len++;
}
}
--- 734,740 ----
list.resize (total_len * 2);
}
! list (curr_len) = octave_child (pid, f, name);
curr_len++;
}
}
***************
*** 700,705 ****
--- 751,773 ----
if (tmp.pid == pid)
{
tmp.pid = -1;
+
+ octave_child::dead_child_handler f = tmp.handler;
+
+ if (f)
+ {
+ int status;
+
+ if (waitpid (pid, &status, WNOHANG) <= 0) status = 127;
+
+ f (pid, status);
+ }
+ else
+ {
+ string file = tmp.filename;
+ unlink (file.c_str ());
+ }
+
break;
}
}
diff -cwr n:/project/C/octave-2.1.14.orig/src/sighandlers.h i:/project/C/octave-2.1.14/src/sighandlers.h
*** n:/project/C/octave-2.1.14.orig/src/sighandlers.h Tue Nov 10 15:06:40 1998
--- i:/project/C/octave-2.1.14/src/sighandlers.h Wed Apr 14 20:57:58 1999
***************
*** 30,38 ****
--- 30,42 ----
// This file should always be included after config.h!
+ /* Modified by Klaus Gebhardt, 1996 */
+
#if !defined (octave_sighandlers_h)
#define octave_sighandlers_h 1
+ #include <string>
+
#include <Array.h>
#include "syswait.h"
***************
*** 65,72 ****
typedef RETSIGTYPE sig_handler (int);
- // XXX FIXME XXX -- the data should probably be private...
-
struct
octave_interrupt_handler
{
--- 69,74 ----
***************
*** 118,128 ****
typedef void (*dead_child_handler) (pid_t, int);
! octave_child (pid_t id = -1, dead_child_handler f = 0)
! : pid (id), handler (f) { }
octave_child (const octave_child& oc)
! : pid (oc.pid), handler (oc.handler) { }
octave_child& operator = (const octave_child& oc)
{
--- 120,130 ----
typedef void (*dead_child_handler) (pid_t, int);
! octave_child (pid_t id = -1, dead_child_handler f = 0, string name = "")
! : pid (id), handler (f), filename (name) { }
octave_child (const octave_child& oc)
! : pid (oc.pid), handler (oc.handler), filename (oc.filename) { }
octave_child& operator = (const octave_child& oc)
{
***************
*** 130,135 ****
--- 132,138 ----
{
pid = oc.pid;
handler = oc.handler;
+ filename = oc.filename;
}
return *this;
}
***************
*** 141,146 ****
--- 144,152 ----
// The function we call if this child dies.
dead_child_handler handler;
+
+ // The file to remove if this child dies.
+ string filename;
};
class
***************
*** 156,162 ****
static bool instance_ok (void);
! static void insert (pid_t pid, octave_child::dead_child_handler f);
static void remove (pid_t pid);
--- 162,169 ----
static bool instance_ok (void);
! static void insert (pid_t pid, octave_child::dead_child_handler f,
! string name = "");
static void remove (pid_t pid);
***************
*** 172,178 ****
static octave_child_list *instance;
! void do_insert (pid_t pid, octave_child::dead_child_handler f);
void do_remove (pid_t pid);
--- 179,186 ----
static octave_child_list *instance;
! void do_insert (pid_t pid, octave_child::dead_child_handler f,
! string name = "");
void do_remove (pid_t pid);
diff -cwr n:/project/C/octave-2.1.14.orig/src/strftime.c i:/project/C/octave-2.1.14/src/strftime.c
*** n:/project/C/octave-2.1.14.orig/src/strftime.c Wed Nov 25 06:34:08 1998
--- i:/project/C/octave-2.1.14/src/strftime.c Wed Apr 14 20:57:58 1999
***************
*** 49,55 ****
# endif
#endif
! #if HAVE_TZNAME
extern char *tzname[];
#endif
--- 49,55 ----
# endif
#endif
! #ifdef HAVE_TZNAME
extern char *tzname[];
#endif
***************
*** 61,68 ****
with other C libraries that use unsafe encodings. */
#define DO_MULTIBYTE (HAVE_MBLEN && ! MULTIBYTE_IS_FORMAT_SAFE)
! #if DO_MULTIBYTE
! # if HAVE_MBRLEN
# include <wchar.h>
# else
/* Simulate mbrlen with mblen as best we can. */
--- 61,68 ----
with other C libraries that use unsafe encodings. */
#define DO_MULTIBYTE (HAVE_MBLEN && ! MULTIBYTE_IS_FORMAT_SAFE)
! #ifdef DO_MULTIBYTE
! #ifdef HAVE_MBRLEN
# include <wchar.h>
# else
/* Simulate mbrlen with mblen as best we can. */
***************
*** 73,83 ****
static const mbstate_t mbstate_zero;
#endif
! #if HAVE_LIMITS_H
# include <limits.h>
#endif
! #if STDC_HEADERS
# include <stddef.h>
# include <stdlib.h>
# include <string.h>
--- 73,83 ----
static const mbstate_t mbstate_zero;
#endif
! #ifdef HAVE_LIMITS_H
# include <limits.h>
#endif
! #ifdef STDC_HEADERS
# include <stddef.h>
# include <stdlib.h>
# include <string.h>
***************
*** 180,186 ****
} while (0)
#define cpy(n, s) add ((n), memcpy((PTR) p, (PTR) (s), (n)))
! #if ! HAVE_TM_GMTOFF
/* Yield the difference between *A and *B,
measured in seconds, ignoring leap seconds. */
static int tm_diff __P ((const struct tm *, const struct tm *));
--- 180,186 ----
} while (0)
#define cpy(n, s) add ((n), memcpy((PTR) p, (PTR) (s), (n)))
! #ifndef HAVE_TM_GMTOFF
/* Yield the difference between *A and *B,
measured in seconds, ignoring leap seconds. */
static int tm_diff __P ((const struct tm *, const struct tm *));
***************
*** 290,299 ****
register const char *f;
zone = 0;
! #if HAVE_TM_ZONE
zone = (const char *) tp->tm_zone;
#endif
! #if HAVE_TZNAME
if (!(zone && *zone) && tp->tm_isdst >= 0)
zone = tzname[tp->tm_isdst];
#endif
--- 290,299 ----
register const char *f;
zone = 0;
! #ifdef HAVE_TM_ZONE
zone = (const char *) tp->tm_zone;
#endif
! #ifdef HAVE_TZNAME
if (!(zone && *zone) && tp->tm_isdst >= 0)
zone = tzname[tp->tm_isdst];
#endif
***************
*** 320,326 ****
? INT_STRLEN_BOUND (time_t)
: INT_STRLEN_BOUND (int))];
! #if DO_MULTIBYTE
switch (*f)
{
--- 320,326 ----
? INT_STRLEN_BOUND (time_t)
: INT_STRLEN_BOUND (int))];
! #ifdef DO_MULTIBYTE
switch (*f)
{
***************
*** 482,488 ****
case 'C': /* POSIX.2 extension. */
if (modifier == 'O')
goto bad_format;
! #if HAVE_STRUCT_ERA_ENTRY
if (modifier == 'E')
{
struct era_entry *era = _nl_get_era_entry (tp);
--- 482,488 ----
case 'C': /* POSIX.2 extension. */
if (modifier == 'O')
goto bad_format;
! #ifdef HAVE_STRUCT_ERA_ENTRY
if (modifier == 'E')
{
struct era_entry *era = _nl_get_era_entry (tp);
***************
*** 783,789 ****
DO_NUMBER (1, tp->tm_wday);
case 'Y':
! #if HAVE_STRUCT_ERA_ENTRY
if (modifier == 'E')
{
struct era_entry *era = _nl_get_era_entry (tp);
--- 783,789 ----
DO_NUMBER (1, tp->tm_wday);
case 'Y':
! #ifdef HAVE_STRUCT_ERA_ENTRY
if (modifier == 'E')
{
struct era_entry *era = _nl_get_era_entry (tp);
***************
*** 800,806 ****
DO_NUMBER (1, tp->tm_year + TM_YEAR_BASE);
case 'y':
! #if HAVE_STRUCT_ERA_ENTRY
if (modifier == 'E')
{
struct era_entry *era = _nl_get_era_entry (tp);
--- 800,806 ----
DO_NUMBER (1, tp->tm_year + TM_YEAR_BASE);
case 'y':
! #ifdef HAVE_STRUCT_ERA_ENTRY
if (modifier == 'E')
{
struct era_entry *era = _nl_get_era_entry (tp);
***************
*** 824,830 ****
{
int diff;
! #if HAVE_TM_GMTOFF
diff = tp->tm_gmtoff;
#else
struct tm gtm;
--- 824,830 ----
{
int diff;
! #ifdef HAVE_TM_GMTOFF
diff = tp->tm_gmtoff;
#else
struct tm gtm;
diff -cwr n:/project/C/octave-2.1.14.orig/src/syscalls.cc i:/project/C/octave-2.1.14/src/syscalls.cc
*** n:/project/C/octave-2.1.14.orig/src/syscalls.cc Tue Nov 10 15:06:40 1998
--- i:/project/C/octave-2.1.14/src/syscalls.cc Thu Apr 15 13:52:02 1999
***************
*** 25,30 ****
--- 25,32 ----
//
// mkfifo unlink waitpid
+ /* Modified by Klaus Gebhardt, 1996 */
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
***************
*** 32,37 ****
--- 34,40 ----
#include <cerrno>
#include <cstdio>
#include <cstring>
+ #include <csignal>
#ifdef HAVE_UNISTD_H
#ifdef HAVE_SYS_TYPES_H
***************
*** 48,53 ****
--- 51,58 ----
#include "file-stat.h"
#include "oct-syscalls.h"
+ #include <process.h>
+
#include "defun.h"
#include "error.h"
#include "gripes.h"
***************
*** 56,61 ****
--- 61,68 ----
#include "oct-obj.h"
#include "oct-stdstrm.h"
#include "oct-stream.h"
+ #include "oct-fstrm.h"
+ #include "sighandlers.h"
#include "sysdep.h"
#include "syswait.h"
#include "utils.h"
***************
*** 89,96 ****
return m;
}
! DEFUN (dup2, args, ,
! "[FID, MSG] = dup2 (OLD, NEW)\n\
\n\
Duplicate a file descriptor.\n\
\n\
--- 96,152 ----
return m;
}
! DEFUN (_dup, args, ,
! "[FID, MSG] = _dup (old): duplicate a file descriptor")
! {
! octave_value_list retval;
!
! retval(1) = string ();
! retval(0) = -1.0;
!
! int nargin = args.length ();
!
! if (nargin == 1)
! {
! #if defined (HAVE_DUP)
! double d_old = args(0).double_value ();
!
! if (! error_state)
! {
! if (static_cast<int> (d_old) == d_old)
! {
! int i_old = static_cast<int> (d_old);
!
! // XXX FIXME XXX -- are these checks sufficient?
! if (i_old >= 0)
! {
! int status = dup (i_old);
!
! retval(0) = (double) status;
!
! if (status < 0)
! retval(1) = strerror (errno);
! }
! else
! error ("_dup: invalid file id");
! }
! else
! error ("_dup: argument must be integer value");
! }
! else
! error ("_dup: argument must be integer value");
! #else
! gripe_not_supported ("_dup");
! #endif
! }
! else
! print_usage ("_dup");
!
! return retval;
! }
!
! DEFUN (_dup2, args, ,
! "[FID, MSG] = _dup2 (OLD, NEW)\n\
\n\
Duplicate a file descriptor.\n\
\n\
***************
*** 106,118 ****
if (nargin == 2)
{
! octave_stream *old_stream = octave_stream_list::lookup (args(0));
! octave_stream *new_stream = octave_stream_list::lookup (args(1));
if (! error_state)
{
! int i_old = old_stream->file_number ();
! int i_new = new_stream->file_number ();
if (i_old >= 0 && i_new >= 0)
{
--- 162,177 ----
if (nargin == 2)
{
! double d_old = args(0).double_value ();
! double d_new = args(1).double_value ();
if (! error_state)
{
! if ((static_cast<int> (d_old) == d_old) &&
! (static_cast<int> (d_new) == d_new))
! {
! int i_old = static_cast<int> (d_old);
! int i_new = static_cast<int> (d_new);
if (i_old >= 0 && i_new >= 0)
{
***************
*** 124,136 ****
retval(1) = msg;
}
else
! error ("dup2: invalid file id");
}
else
! error ("dup2: invalid stream");
}
else
! print_usage ("dup2");
return retval;
}
--- 183,367 ----
retval(1) = msg;
}
else
! error ("_dup2: invalid file id");
}
else
! error ("_dup2: arguments must be integer values");
}
else
! error ("_dup2: invalid stream");
! }
! else
! print_usage ("_dup2");
!
! return retval;
! }
!
! DEFUN (_close, args, ,
! "[RETVAL, MSG] = _close (fid): close a file handle")
! {
! octave_value_list retval;
!
! retval(1) = string ();
! retval(0) = -1.0;
!
! int nargin = args.length ();
!
! if (nargin == 1)
! {
! double d_old = args(0).double_value ();
!
! if (! error_state)
! {
! if (static_cast<int> (d_old) == d_old)
! {
! int i_old = static_cast<int> (d_old);
!
! // XXX FIXME XXX -- are these checks sufficient?
! if (i_old >= 0)
! {
! int status = file_ops::close (i_old);
!
! retval(0) = (double) status;
!
! if (status < 0)
! retval(1) = strerror (errno);
! }
! else
! error ("_close: invalid file id");
! }
! else
! error ("_close: argument must be integer value");
! }
! }
! else
! print_usage ("_close");
!
! return retval;
! }
!
! DEFUN (_fdopen, args, ,
! "[FID, MSG] = _fdopen (fid, mode): create a stream for file handle")
! {
! octave_value_list retval;
!
! retval(1) = string ();
! retval(0) = -1.0;
!
! int nargin = args.length ();
!
! if (nargin == 2)
! {
! if (args(1).is_string ())
! {
! string mode = args(1).string_value ();
!
! double d_old = args(0).double_value ();
!
! if (! error_state)
! {
! if (static_cast<int> (d_old) == d_old)
! {
! int i_old = static_cast<int> (d_old);
!
! // XXX FIXME XXX -- are these checks sufficient?
! if (i_old >= 0)
! {
! FILE *f = static_cast<FILE *> (file_ops::fdopen (i_old, mode));
! if (f)
! {
! if (mode[0] == 'r')
! {
! octave_istdiostream *is
! = new octave_istdiostream ("fdopen", f);
! retval(0) = octave_stream_list::insert (is);
! }
! else if (mode[1] == 'w')
! {
! octave_ostdiostream *os
! = new octave_ostdiostream ("fdopen", f);
! retval(0) = octave_stream_list::insert (os);
! }
! else
! error ("_fdopen: invalid mode");
! }
! error ("_fdopen: error opening file id");
! }
! else
! error ("_fdopen: invalid file id");
! }
! else
! error ("_fdopen: argument must be integer value");
! }
! }
! else
! error ("_fdopen: mode must be a string");
! }
! else
! print_usage ("_fdopen");
!
! return retval;
! }
!
! DEFUN (spawn, args, ,
! "[STATUS, MSG] = spawn (mode, file, args): run a program")
! {
! octave_value_list retval;
!
! retval(1) = string ();
! retval(0) = -1.0;
!
! int nargin = args.length ();
!
! if (nargin == 2 || nargin == 3)
! {
! string mode_strg = args(0).string_value ();
! string exec_file = args(1).string_value ();
!
! if (! error_state)
! {
! string_vector exec_args;
!
! if (nargin == 3)
! {
! string_vector tmp = args(2).all_strings ();
!
! if (! error_state)
! {
! int len = tmp.length ();
!
! exec_args.resize (len + 1);
!
! exec_args[0] = exec_file;
!
! for (int i = 0; i < len; i++)
! exec_args[i+1] = tmp[i];
! }
! else
! error ("exec: arguments must be strings");
! }
! else
! {
! exec_args.resize (1);
!
! exec_args[0] = exec_file;
! }
!
! if (! error_state)
! {
! string msg;
!
! int status = octave_syscalls::spawnvp (mode_strg, exec_file, exec_args, msg);
!
! retval(0) = static_cast<double> (status);
! retval(1) = msg;
! }
! }
! else
! error ("spawn: first two arguments must be strings");
! }
! else
! print_usage ("spawn");
return retval;
}
***************
*** 202,209 ****
return retval;
}
! DEFUN (fcntl, args, ,
! "[STATUS, MSG] = fcntl (FID, REQUEST, ARGUMENT)\n\
\n\
Control open file descriptors.\n\
\n\
--- 433,440 ----
return retval;
}
! DEFUN (_fcntl, args, ,
! "[STATUS, MSG] = _fcntl (FID, REQUEST, ARGUMENT)\n\
\n\
Control open file descriptors.\n\
\n\
***************
*** 474,479 ****
--- 705,757 ----
return retval;
}
+ DEFUN (_pipe, args, ,
+ "[FIDS, STATUS, MSG] = _pipe (): create an interprocess channel.\n\
+ \n\
+ Return the FIDS corresponding to the reading and writing ends of\n\
+ the pipe, as a vector.\n\
+ \n\
+ You must open the FIDS using _fdopen!\n\
+ \n\
+ If successful, STATUS is 0 and MSG is an empty string. Otherwise,\n\
+ STATUS is nonzero and MSG contains a system-dependent error message.")
+ {
+ octave_value_list retval;
+
+ retval(2) = string ();
+ retval(1) = -1.0;
+ retval(0) = Matrix ();
+
+ int nargin = args.length ();
+
+ if (nargin == 0)
+ {
+ #if defined (HAVE_PIPE)
+ int fid[2];
+
+ int status = pipe (fid);
+
+ if (status < 0) retval(2) = strerror (errno);
+ else
+ {
+ Matrix file_ids (1, 2);
+
+ file_ids (0, 0) = (double) fid[0];
+ file_ids (0, 1) = (double) fid[1];
+
+ retval(0) = file_ids;
+ retval(1) = (double) status;
+ }
+ #else
+ gripe_not_supported ("_pipe");
+ #endif
+ }
+ else
+ print_usage ("_pipe");
+
+ return retval;
+ }
+
DEFUN (pipe, args, ,
"[FILE_LIST, STATUS, MSG] = pipe (): create an interprocess channel.\n\
\n\
***************
*** 679,685 ****
--- 957,976 ----
{
string msg;
+ #ifdef __EMX__
+ volatile octave_interrupt_handler saved_interrupt_handler
+ = octave_ignore_interrupts ();
+
+ volatile sig_handler *saved_sigchld_handler
+ = octave_set_signal_handler (SIGCHLD, SIG_IGN);
+ #endif
+
pid_t status = octave_syscalls::waitpid (pid, options, msg);
+
+ #ifdef __EMX__
+ octave_set_interrupt_handler (saved_interrupt_handler);
+ octave_set_signal_handler (SIGCHLD, saved_sigchld_handler);
+ #endif
retval(0) = static_cast<double> (status);
retval(1) = msg;
diff -cwr n:/project/C/octave-2.1.14.orig/src/sysdep.cc i:/project/C/octave-2.1.14/src/sysdep.cc
*** n:/project/C/octave-2.1.14.orig/src/sysdep.cc Fri Jan 29 04:30:02 1999
--- i:/project/C/octave-2.1.14/src/sysdep.cc Thu Apr 15 14:01:04 1999
***************
*** 20,25 ****
--- 20,27 ----
*/
+ /* Modified by Klaus Gebhardt, 1996 */
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
***************
*** 52,57 ****
--- 54,64 ----
LOSE! LOSE!
#endif
+ #ifdef __EMX__
+ #include <float.h>
+ #include <sys/uflags.h>
+ #endif
+
#if defined (HAVE_FLOATINGPOINT_H)
#include <floatingpoint.h>
#endif
***************
*** 64,69 ****
--- 71,88 ----
#include <sys/utsname.h>
#endif
+ #ifdef __EMX__
+ #include <readline/readline.h>
+ #include <readline/tilde.h>
+ #include <sys/ioctl.h>
+ extern "C"
+ {
+ extern void tputs ();
+ extern char *term_clrpag;
+ extern void _rl_output_character_function ();
+ }
+ #endif
+
#include "cmd-edit.h"
#include "file-ops.h"
#include "lo-mappers.h"
***************
*** 123,128 ****
--- 142,149 ----
{
_control87 ((EM_INVALID | EM_DENORMAL | EM_ZERODIVIDE | EM_OVERFLOW
| EM_UNDERFLOW | EM_INEXACT), MCW_EM);
+
+ _uflags (_UF_SBRK_MODEL, _UF_SBRK_ARBITRARY);
}
#endif
***************
*** 309,314 ****
--- 330,336 ----
kbhit (void)
{
int c;
+ flush_octave_stdout ();
raw_mode (1);
c = cin.get ();
raw_mode (0);
***************
*** 381,387 ****
// XXX FIXME XXX -- add timeout and default value args?
! if (interactive)
{
int c = kbhit ();
char *s = new char [2];
--- 403,409 ----
// XXX FIXME XXX -- add timeout and default value args?
! if (interactive || really_forced_interactive)
{
int c = kbhit ();
char *s = new char [2];
***************
*** 483,488 ****
--- 505,515 ----
if (delay > 0)
usleep (delay);
+ #elif defined (HAVE__SLEEP2)
+ int delay = NINT (dval / 1e3);
+
+ if (delay > 0)
+ _sleep2 (delay);
#else
int delay = NINT (dval / 1e6);
***************
*** 536,541 ****
--- 563,589 ----
DEFALIAS (EXTPROC, extproc);
+ DEFUN (add_to_command_number, args, ,
+ "add_to_command_number: add argument to the current command number")
+ {
+ octave_value_list retval;
+ int nargin;
+
+ if ((nargin = args.length ()) != 1)
+ {
+ print_usage ("add_to_command_number");
+ return retval;
+ }
+
+ double tmp_d = args(0).double_value ();
+
+ if (error_state || (static_cast<int> (tmp_d) != tmp_d))
+ error ("add_to_command_number: expecting integer as argument");
+ else
+ command_editor::add_current_command_number (static_cast<int> (tmp_d));
+
+ return retval;
+ }
#endif
/*
diff -cwr n:/project/C/octave-2.1.14.orig/src/toplev.cc i:/project/C/octave-2.1.14/src/toplev.cc
*** n:/project/C/octave-2.1.14.orig/src/toplev.cc Fri Jan 29 04:50:02 1999
--- i:/project/C/octave-2.1.14/src/toplev.cc Thu Apr 15 13:13:50 1999
***************
*** 20,25 ****
--- 20,27 ----
*/
+ /* Modified by Klaus Gebhardt, 1996 - 1999 */
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
***************
*** 79,84 ****
--- 81,94 ----
#include "variables.h"
#include <version.h>
+ #ifdef __EMX__
+ extern "C"
+ {
+ #include <process.h>
+ int _IO_system (const char *, int);
+ }
+ #endif
+
// TRUE means we are exiting via the builtin exit or quit functions.
static bool quitting_gracefully = false;
***************
*** 100,105 ****
--- 110,119 ----
if (setjmp (toplevel) != 0)
{
+ #if defined (__EMX__) && defined (OS2)
+ unwind_protect::run_all ();
+ #endif
+
raw_mode (0);
cout << "\n";
***************
*** 116,121 ****
--- 130,140 ----
int retval;
do
{
+ #ifdef __EMX__
+ can_interrupt = 1;
+ octave_catch_interrupts ();
+ #endif
+
curr_sym_tab = top_level_sym_tab;
reset_parser ();
***************
*** 130,136 ****
global_command = 0;
! if (! (interactive || forced_interactive))
{
bool quit = (tree_return_command::returning
|| tree_break_command::breaking);
--- 149,156 ----
global_command = 0;
! if (! (interactive || forced_interactive
! || really_forced_interactive))
{
bool quit = (tree_return_command::returning
|| tree_break_command::breaking);
***************
*** 147,153 ****
if (error_state)
{
! if (! (interactive || forced_interactive))
break;
}
else
--- 167,174 ----
if (error_state)
{
! if (! (interactive || forced_interactive
! || really_forced_interactive))
break;
}
else
***************
*** 171,176 ****
--- 192,201 ----
{
do_octave_atexit ();
+ #if defined (__EMX__)
+ _sleep2 (500);
+ #endif
+
exit (retval == EOF ? 0 : retval);
}
***************
*** 280,286 ****
// Execute a shell command.
! static int cmd_status = 0;
static void
cmd_death_handler (pid_t, int status)
--- 305,312 ----
// Execute a shell command.
! static int cmd_status = -1;
! static int cmd_pid = -1;
static void
cmd_death_handler (pid_t, int status)
***************
*** 293,299 ****
{
iprocstream *cmd = static_cast<iprocstream *> (p);
! octave_child_list::remove (cmd->pid ());
delete cmd;
}
--- 319,325 ----
{
iprocstream *cmd = static_cast<iprocstream *> (p);
! octave_child_list::remove (cmd_pid);
delete cmd;
}
***************
*** 306,315 ****
iprocstream *cmd = new iprocstream (cmd_str.c_str ());
cmd_status = -1;
if (cmd)
{
! octave_child_list::insert (cmd->pid (), cmd_death_handler);
unwind_protect::add (cleanup_iprocstream, cmd);
--- 332,342 ----
iprocstream *cmd = new iprocstream (cmd_str.c_str ());
cmd_status = -1;
+ cmd_pid = cmd->pid ();
if (cmd)
{
! octave_child_list::insert (cmd_pid, cmd_death_handler);
unwind_protect::add (cleanup_iprocstream, cmd);
***************
*** 344,350 ****
while (cmd->get (ch))
output_buf.put (ch);
! cmd->close ();
// One way or another, cmd_death_handler should be called
// when the process exits, and it will save the exit status
--- 371,377 ----
while (cmd->get (ch))
output_buf.put (ch);
! cmd_status = cmd->close ();
// One way or another, cmd_death_handler should be called
// when the process exits, and it will save the exit status
***************
*** 411,417 ****
--- 438,448 ----
string cmd_str = args(0).string_value ();
+ #if defined (__EMX__) && defined (OS2)
+ enum exec_type { sync, async, pm };
+ #else
enum exec_type { sync, async };
+ #endif
exec_type type = sync;
***************
*** 427,434 ****
--- 458,473 ----
type = sync;
else if (type_str == "async")
type = async;
+ #if defined (__EMX__) && defined (OS2)
+ else if (type_str == "pm")
+ type = pm;
+ else
+ error ("system: third arg must be \"sync\" , \"async\""
+ "or \"pm\"");
+ #else
else
error ("system: third arg must be \"sync\" or \"async\"");
+ #endif
}
else
error ("system: third argument must be a string");
***************
*** 439,446 ****
--- 478,490 ----
if (! error_state)
{
+ #if defined (__EMX__) && defined (OS2)
+ if (type == async || type == pm)
+ #else
if (type == async)
+ #endif
{
+ #ifndef __EMX__
pid_t pid = fork ();
if (pid < 0)
***************
*** 453,465 ****
--- 497,530 ----
}
else
retval(0) = static_cast<double> (pid);
+ #else
+ pid_t pid;
+ int p_mode;
+ #ifdef OS2
+ if (type == pm) p_mode = P_PM;
+ else p_mode = P_NOWAIT;
+ #else
+ p_mode = P_NOWAIT;
+ #endif
+ pid = _IO_system (cmd_str.c_str (), p_mode);
+
+ if (pid < 0)
+ error ("system: spawn failed -- can't create child process");
+ else
+ retval(0) = (double) pid;
+ #endif
}
else if (return_output)
retval = run_command_and_return_output (cmd_str);
else
{
+ #ifdef __EMX__
+ int status = _IO_system (cmd_str.c_str (), P_WAIT);
+ #else
int status = system (cmd_str.c_str ());
+ #endif
+ #ifndef __EMX__
// The value in status is as returned by waitpid. If
// the process exited normally, extract the actual exit
// status of the command. Otherwise, return 127 as a
***************
*** 467,472 ****
--- 532,540 ----
if (WIFEXITED (status))
status = WEXITSTATUS (status);
+ else
+ status = 127;
+ #endif
retval = static_cast<double> (status);
}
***************
*** 480,488 ****
DEFALIAS (shell_cmd, system);
! // XXX FIXME XXX -- this should really be static, but that causes
! // problems on some systems.
! SLStack<string> octave_atexit_functions;
void
do_octave_atexit (void)
--- 548,554 ----
DEFALIAS (shell_cmd, system);
! static SLStack<string> octave_atexit_functions;
void
do_octave_atexit (void)
***************
*** 517,523 ****
flush_octave_stdout ();
! if (!quitting_gracefully && (interactive || forced_interactive))
cout << "\n";
}
}
--- 583,590 ----
flush_octave_stdout ();
! if (!quitting_gracefully &&
! (interactive || forced_interactive || really_forced_interactive))
cout << "\n";
}
}
diff -cwr n:/project/C/octave-2.1.14.orig/src/utils.cc i:/project/C/octave-2.1.14/src/utils.cc
*** n:/project/C/octave-2.1.14.orig/src/utils.cc Thu Dec 3 05:39:16 1998
--- i:/project/C/octave-2.1.14/src/utils.cc Thu Apr 15 12:52:26 1999
***************
*** 20,25 ****
--- 20,27 ----
*/
+ /* Modified by Klaus Gebhardt, 1996 */
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
***************
*** 88,94 ****
--- 90,98 ----
extern "C" void
jump_to_top_level (void)
{
+ #if ! defined (__EMX__) || ! defined (OS2)
unwind_protect::run_all ();
+ #endif
longjmp (toplevel, 1);
}
diff -cwr n:/project/C/octave-2.1.14.orig/src/variables.cc i:/project/C/octave-2.1.14/src/variables.cc
*** n:/project/C/octave-2.1.14.orig/src/variables.cc Fri Mar 26 23:55:32 1999
--- i:/project/C/octave-2.1.14/src/variables.cc Thu Apr 15 14:04:56 1999
***************
*** 20,25 ****
--- 20,27 ----
*/
+ /* Modified by Klaus Gebhardt, 1996 - 1998 */
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
***************
*** 34,39 ****
--- 36,42 ----
#include "oct-env.h"
#include "glob-match.h"
#include "str-vec.h"
+ #include "lo-mappers.h"
#include <defaults.h>
#include "defun.h"
***************
*** 45,50 ****
--- 48,56 ----
#include "lex.h"
#include "oct-map.h"
#include "oct-obj.h"
+ #ifndef __EMX__
+ #include "oct-procbuf.h"
+ #endif
#include "ov.h"
#include "pager.h"
#include "parse.h"
***************
*** 1214,1219 ****
--- 1220,1262 ----
"don't check to see if function files have changed since they were\n\
last compiled. Possible values are \"system\" and \"all\"");
}
+
+ #ifdef __EMX__
+ // We are using a general procbuf!
+ // So this has to be defined here.
+ // Klaus Gebhardt, 1998
+
+ static int Vkluge_procbuf_delay = 0;
+
+ static int
+ kluge_procbuf_delay (void)
+ {
+ double val;
+
+ if (builtin_real_scalar_variable ("kluge_procbuf_delay", val)
+ && ! xisnan (val))
+ {
+ int ival = static_cast<int> (val);
+ if (ival >= 0 && (double) ival == val)
+ {
+ Vkluge_procbuf_delay = ival;
+ return 0;
+ }
+ }
+
+ gripe_invalid_value_specified ("kluge_procbuf_delay");
+ return -1;
+ }
+
+ static void
+ symbols_of_oct_procbuf (void)
+ {
+ DEFVAR (kluge_procbuf_delay, static_cast<double> (Vkluge_procbuf_delay),
+ 0, kluge_procbuf_delay,
+ "number of microseconds to delay in the parent after forking\n\
+ (not used under OS/2)");
+ }
+ #endif
/*
;;; Local Variables: ***
diff -cwr n:/project/C/octave-2.1.14.orig/src/version.h i:/project/C/octave-2.1.14/src/version.h
*** n:/project/C/octave-2.1.14.orig/src/version.h Tue Mar 30 08:03:18 1999
--- i:/project/C/octave-2.1.14/src/version.h Thu Apr 15 12:39:42 1999
***************
*** 23,28 ****
--- 23,59 ----
#if !defined (octave_version_h)
#define octave_version_h 1
+ /* Modified by Klaus Gebhardt, 1996 - 1998 */
+
+ #if defined (__EMX__) && defined (OS2)
+ #define OCTAVE_VERSION "2.1.14"
+ #define OCTAVE_OS2_PATCHLEVEL "2.1.14-b01"
+
+ #define OCTAVE_COPYRIGHT \
+ "Copyright (C) 1996, 1997, 1998 John W. Eaton.\n\
+ OS/2-Port by Klaus Gebhardt, 1996 - 1999."
+
+ #define OCTAVE_NAME_AND_VERSION \
+ "Octave " OCTAVE_VERSION " for OS/2 2.x, Warp 3 and Warp 4.\n(Patchlevel " \
+ OCTAVE_OS2_PATCHLEVEL ")"
+
+ #define OCTAVE_NAME_VERSION_AND_COPYRIGHT \
+ OCTAVE_NAME_AND_VERSION ".\n" OCTAVE_COPYRIGHT "\n\
+ This is free software with ABSOLUTELY NO WARRANTY."
+
+ #define OCTAVE_STARTUP_MESSAGE \
+ OCTAVE_NAME_VERSION_AND_COPYRIGHT "\n\
+ For details, type `warranty'.\n\
+ \n\
+ *** This is a development version of Octave. Development releases\n\
+ *** are provided for people who want to help test, debug, and improve\n\
+ *** Octave.\n\
+ ***\n\
+ *** If you want a stable, well-tested version of Octave, you should be\n\
+ *** using one of the stable releases (when this development release\n\
+ *** was made, the latest stable version was 2.0.13)."
+
+ #else
#define OCTAVE_VERSION "2.1.14"
#define OCTAVE_COPYRIGHT \
***************
*** 47,52 ****
--- 78,84 ----
*** using one of the stable releases (when this development release\n\
*** was made, the latest stable version was 2.0.13)."
+ #endif
#endif
/*
diff -cwr n:/project/C/octave-2.1.14.orig/scripts/image/colormap.m i:/project/C/octave-2.1.14/scripts/image/colormap.m
*** n:/project/C/octave-2.1.14.orig/scripts/image/colormap.m Thu Mar 11 19:35:56 1999
--- i:/project/C/octave-2.1.14/scripts/image/colormap.m Wed Nov 19 07:27:52 1997
***************
*** 1,4 ****
! ## Copyright (C) 1996, 1997 John W. Eaton
##
## This file is part of Octave.
##
--- 1,4 ----
! ## Copyright (C) 1996 John W. Eaton
##
## This file is part of Octave.
##
***************
*** 29,35 ****
##
## colormap with no arguments returns the current colormap.
! ## Author: Tony Richardson <arichard@stark.cc.oh.us>
## Created: July 1994
## Adapted-By: jwe
--- 29,35 ----
##
## colormap with no arguments returns the current colormap.
! ## Author: Tony Richardson <amr@mpl.ucsd.edu>
## Created: July 1994
## Adapted-By: jwe
***************
*** 42,76 ****
endif
if (nargin == 1)
-
if (isstr (map))
if (strcmp (map, "default"))
! map = gray ();
else
! unwind_protect
! save_default_eval_print_flag = default_eval_print_flag;
! default_eval_print_flag = 0;
! map = eval (map);
! unwind_protect_cleanup
! default_eval_print_flag = save_default_eval_print_flag;
! end_unwind_protect
! endif
! endif
!
! if (! isempty (map))
! if (columns (map) != 3)
! error( "colormap: map must have 3 columns: [R,G,B]." );
! endif
! if (min (min (map)) < 0 || max (max (map)) > 1)
! error( "colormap: map must have values in [0,1]." );
endif
## Set the new color map
__current_color_map__ = map;
endif
-
endif
## Return current color map.
cmap = __current_color_map__;
endfunction
--- 42,61 ----
endif
if (nargin == 1)
if (isstr (map))
if (strcmp (map, "default"))
! __current_color_map__ = gray ();
else
! error ("invalid argument");
endif
+ else
## Set the new color map
__current_color_map__ = map;
endif
endif
## Return current color map.
+
cmap = __current_color_map__;
endfunction
diff -cwr n:/project/C/octave-2.1.14.orig/scripts/image/gray.m i:/project/C/octave-2.1.14/scripts/image/gray.m
*** n:/project/C/octave-2.1.14.orig/scripts/image/gray.m Tue Nov 10 15:11:20 1998
--- i:/project/C/octave-2.1.14/scripts/image/gray.m Thu Jul 11 22:25:22 1996
***************
*** 1,4 ****
! ## Copyright (C) 1996, 1997 John W. Eaton
##
## This file is part of Octave.
##
--- 1,4 ----
! ## Copyright (C) 1996 John W. Eaton
##
## This file is part of Octave.
##
***************
*** 19,25 ****
## Colormap.
! ## Author: Tony Richardson <arichard@stark.cc.oh.us>
## Created: July 1994
## Adapted-By: jwe
--- 19,25 ----
## Colormap.
! ## Author: Tony Richardson <amr@mpl.ucsd.edu>
## Created: July 1994
## Adapted-By: jwe
diff -cwr n:/project/C/octave-2.1.14.orig/scripts/image/gray2ind.m i:/project/C/octave-2.1.14/scripts/image/gray2ind.m
*** n:/project/C/octave-2.1.14.orig/scripts/image/gray2ind.m Tue Nov 10 15:11:20 1998
--- i:/project/C/octave-2.1.14/scripts/image/gray2ind.m Thu Jul 11 22:25:22 1996
***************
*** 1,4 ****
! ## Copyright (C) 1996, 1997 John W. Eaton
##
## This file is part of Octave.
##
--- 1,4 ----
! ## Copyright (C) 1996 John W. Eaton
##
## This file is part of Octave.
##
***************
*** 19,25 ****
## Image format conversion
! ## Author: Tony Richardson <arichard@stark.cc.oh.us>
## Created: July 1994
## Adapted-By: jwe
--- 19,25 ----
## Image format conversion
! ## Author: Tony Richardson <amr@mpl.ucsd.edu>
## Created: July 1994
## Adapted-By: jwe
diff -cwr n:/project/C/octave-2.1.14.orig/scripts/image/image.m i:/project/C/octave-2.1.14/scripts/image/image.m
*** n:/project/C/octave-2.1.14.orig/scripts/image/image.m Tue Nov 10 15:11:20 1998
--- i:/project/C/octave-2.1.14/scripts/image/image.m Wed Jul 1 22:00:10 1998
***************
*** 1,4 ****
! ## Copyright (C) 1996, 1997 John W. Eaton
##
## This file is part of Octave.
##
--- 1,4 ----
! ## Copyright (C) 1996 John W. Eaton
##
## This file is part of Octave.
##
***************
*** 23,66 ****
## indices into the current colormap and should have values between 1
## and the length of the colormap.
##
! ## image (x, zoom) changes the zoom factor. The default value is 4.
##
! ## SEE ALSO: imshow, imagesc, colormap.
! ## Author: Tony Richardson <arichard@stark.cc.oh.us>
## Created: July 1994
## Adapted-By: jwe
function image (x, zoom)
if (nargin == 0)
## Load Bobbie Jo Richardson (Born 3/16/94)
! x = loadimage ("default.img");
! zoom = 2;
elseif (nargin == 1)
! zoom = 4;
elseif (nargin > 2)
usage ("image (matrix, [zoom])");
endif
! ppm_name = tmpnam ();
! saveimage (ppm_name, x, "ppm");
! ## Start the viewer. Try xv, then xloadimage.
! xv = sprintf ("xv -expand %f %s", zoom, ppm_name);
!
! xloadimage = sprintf ("xloadimage -zoom %f %s", zoom*100, ppm_name);
!
! rm = sprintf ("rm -f %s", ppm_name);
!
! ## Need to let the shell clean up the tmp file because we are putting
! ## the viewer in the background.
!
! command = sprintf ("( %s || %s && %s ) > /dev/null 2>&1 &",
! xv, xloadimage, rm);
!
! system (command);
endfunction
--- 23,56 ----
## indices into the current colormap and should have values between 1
## and the length of the colormap.
##
! ## image (x, zoom) changes the zoom factor. The default value is 1.
##
! ## SEE ALSO: imshow, imagesc, colormap.## SEE ALSO: imshow, imagesc, colormap.
! ## Author: Tony Richardson <amr@mpl.ucsd.edu>
## Created: July 1994
## Adapted-By: jwe
+ ## Modified by Klaus Gebhardt, 1996 - 1997
function image (x, zoom)
if (nargin == 0)
## Load Bobbie Jo Richardson (Born 3/16/94)
! [x, map] = loadimage ("default.img");
elseif (nargin == 1)
! zoom = 1;
elseif (nargin > 2)
usage ("image (matrix, [zoom])");
endif
! pnm_name = tmpnam ();
! saveimage (pnm_name, x, "pnm");
! ## Start the viewer.
! i = findstr (pnm_name, "/");
! pnm_name (i) = "\\";
! system (sprintf ("oct-view %s %f", pnm_name, zoom));
endfunction
diff -cwr n:/project/C/octave-2.1.14.orig/scripts/image/imagesc.m i:/project/C/octave-2.1.14/scripts/image/imagesc.m
*** n:/project/C/octave-2.1.14.orig/scripts/image/imagesc.m Wed Nov 25 04:45:06 1998
--- i:/project/C/octave-2.1.14/scripts/image/imagesc.m Thu Jul 11 22:25:22 1996
***************
*** 1,4 ****
! ## Copyright (C) 1996, 1997 John W. Eaton
##
## This file is part of Octave.
##
--- 1,4 ----
! ## Copyright (C) 1996 John W. Eaton
##
## This file is part of Octave.
##
***************
*** 27,40 ****
##
## SEE ALSO: image, imshow
! ## Author: Tony Richardson <arichard@stark.cc.oh.us>
## Created: July 1994
## Adapted-By: jwe
! function y = imagesc (x, zoom)
if (nargin < 1 || nargin > 2)
! usage ("imagesc (matrix, [zoom])");
elseif (nargin == 1)
zoom = 4;
endif
--- 27,40 ----
##
## SEE ALSO: image, imshow
! ## Author: Tony Richardson <amr@mpl.ucsd.edu>
## Created: July 1994
## Adapted-By: jwe
! function x = imagesc (x, zoom)
if (nargin < 1 || nargin > 2)
! usage ("image (matrix, [zoom])");
elseif (nargin == 1)
zoom = 4;
endif
***************
*** 48,59 ****
## length (colormap) inclusive.
if (maxval == minval)
! y = ones (high, wide);
else
## Rescale values to between 1 and length (colormap) inclusive.
! y = round ((x - minval) / (maxval - minval) * (rows (colormap) - 1)) + 1;
endif
! image (y, zoom);
endfunction
--- 48,59 ----
## length (colormap) inclusive.
if (maxval == minval)
! x = ones (high, wide);
else
## Rescale values to between 1 and length (colormap) inclusive.
! x = fix ((x - minval) / (maxval - minval) * (length (colormap) - 1)) + 1;
endif
! image (x, zoom);
endfunction
diff -cwr n:/project/C/octave-2.1.14.orig/scripts/image/imshow.m i:/project/C/octave-2.1.14/scripts/image/imshow.m
*** n:/project/C/octave-2.1.14.orig/scripts/image/imshow.m Tue Nov 10 15:11:20 1998
--- i:/project/C/octave-2.1.14/scripts/image/imshow.m Thu Jul 11 22:25:22 1996
***************
*** 1,4 ****
! ## Copyright (C) 1996, 1997 John W. Eaton
##
## This file is part of Octave.
##
--- 1,4 ----
! ## Copyright (C) 1996 John W. Eaton
##
## This file is part of Octave.
##
***************
*** 29,35 ****
##
## SEE ALSO: image, imagesc, colormap, gray2ind, rgb2ind.
! ## Author: Tony Richardson <arichard@stark.cc.oh.us>
## Created: July 1994
## Adapted-By: jwe
--- 29,35 ----
##
## SEE ALSO: image, imagesc, colormap, gray2ind, rgb2ind.
! ## Author: Tony Richardson <amr@mpl.ucsd.edu>
## Created: July 1994
## Adapted-By: jwe
diff -cwr n:/project/C/octave-2.1.14.orig/scripts/image/ind2gray.m i:/project/C/octave-2.1.14/scripts/image/ind2gray.m
*** n:/project/C/octave-2.1.14.orig/scripts/image/ind2gray.m Tue Nov 10 15:11:20 1998
--- i:/project/C/octave-2.1.14/scripts/image/ind2gray.m Thu Oct 10 23:38:00 1996
***************
*** 1,4 ****
! ## Copyright (C) 1996, 1997 John W. Eaton
##
## This file is part of Octave.
##
--- 1,4 ----
! ## Copyright (C) 1996 John W. Eaton
##
## This file is part of Octave.
##
***************
*** 28,34 ****
##
## SEE ALSO: gray2ind, rgb2ntsc, image, colormap
! ## Author: Tony Richardson <arichard@stark.cc.oh.us>
## Created: July 1994
## Adapted-By: jwe
--- 28,34 ----
##
## SEE ALSO: gray2ind, rgb2ntsc, image, colormap
! ## Author: Tony Richardson <amr@mpl.ucsd.edu>
## Created: July 1994
## Adapted-By: jwe
diff -cwr n:/project/C/octave-2.1.14.orig/scripts/image/ind2rgb.m i:/project/C/octave-2.1.14/scripts/image/ind2rgb.m
*** n:/project/C/octave-2.1.14.orig/scripts/image/ind2rgb.m Tue Nov 10 15:11:20 1998
--- i:/project/C/octave-2.1.14/scripts/image/ind2rgb.m Thu Oct 10 23:38:00 1996
***************
*** 1,4 ****
! ## Copyright (C) 1996, 1997 John W. Eaton
##
## This file is part of Octave.
##
--- 1,4 ----
! ## Copyright (C) 1996 John W. Eaton
##
## This file is part of Octave.
##
***************
*** 25,31 ****
##
## SEE ALSO: rgb2ind, image, imshow, ind2gray, gray2ind.
! ## Author: Tony Richardson <arichard@stark.cc.oh.us>
## Created: July 1994
## Adapted-By: jwe
--- 25,31 ----
##
## SEE ALSO: rgb2ind, image, imshow, ind2gray, gray2ind.
! ## Author: Tony Richardson <amr@mpl.ucsd.edu>
## Created: July 1994
## Adapted-By: jwe
diff -cwr n:/project/C/octave-2.1.14.orig/scripts/image/loadimage.m i:/project/C/octave-2.1.14/scripts/image/loadimage.m
*** n:/project/C/octave-2.1.14.orig/scripts/image/loadimage.m Tue Nov 10 15:11:20 1998
--- i:/project/C/octave-2.1.14/scripts/image/loadimage.m Wed Feb 11 00:32:52 1998
***************
*** 1,64 ****
! ## Copyright (C) 1996, 1997 John W. Eaton
##
- ## This file is part of Octave.
- ##
- ## Octave is free software; you can redistribute it and/or modify it
- ## under the terms of the GNU General Public License as published by
- ## the Free Software Foundation; either version 2, or (at your option)
- ## any later version.
- ##
- ## Octave is distributed in the hope that it will be useful, but
- ## WITHOUT ANY WARRANTY; without even the implied warranty of
- ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- ## General Public License for more details.
- ##
- ## You should have received a copy of the GNU General Public License
- ## 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.
-
## Load an image file.
##
! ## [img, map] = loadimage (img_file) loads an image and it's associated
! ## color map from file img_file. The image must be in stored in
! ## octave's image format.
##
## SEE ALSO: saveimage, load, save
! ## Author: Tony Richardson <arichard@stark.cc.oh.us>
! ## Created: July 1994
! ## Adapted-By: jwe
! function [img_retval, map_retval] = loadimage (filename)
! if (nargin != 1)
! usage ("[img, map] = loadimage (filename)");
elseif (! isstr (filename))
error ("loadimage: expecting filename as a string");
endif
! file = file_in_path (IMAGEPATH, filename);
!
! if (isempty (file))
! error ("loadimage: unable to find image file");
endif
! ## The file is assumed to have variables img and map, or X and map.
! eval (['load ', file]);
! if (exist ("img"))
! img_retval = img;
! elseif (exist ("X"))
! img_retval = X;
! else
! error ("loadimage: invalid image file found");
endif
! if (exist ("map"))
! map_retval = map;
! else
! error ("loadimage: invalid image file found");
! endif
endfunction
--- 1,37 ----
! ## Copyright (C) 1996 Klaus Gebhardt
##
## Load an image file.
##
! ## [X, map] = loadimage (img_file, fmt) loads an image and its associated
! ## color map from file img_file.
##
## SEE ALSO: saveimage, load, save
! ## Author: Klaus Gebhardt <gebhardt@crunch.ikp.physik.th-darmstadt.de>
! ## Created: November 1996
! function [X, map] = loadimage (filename, fmt)
! if (nargin != 1 && nargin != 2)
! usage ("loadimage (filename[, fmt])");
elseif (! isstr (filename))
error ("loadimage: expecting filename as a string");
endif
! if (nargin == 1)
! fmt = "img";
endif
! if (! isstr (fmt))
! error ("loadimage: expecting fmt as a string");
! endif
! file = file_in_path (IMAGEPATH, filename);
! if (isempty (file))
! error ("loadimage: unable to find image file");
endif
! eval (sprintf ("[X, map] = %s_dec (file);", fmt));
endfunction
diff -cwr n:/project/C/octave-2.1.14.orig/scripts/image/ntsc2rgb.m i:/project/C/octave-2.1.14/scripts/image/ntsc2rgb.m
*** n:/project/C/octave-2.1.14.orig/scripts/image/ntsc2rgb.m Tue Nov 10 15:11:20 1998
--- i:/project/C/octave-2.1.14/scripts/image/ntsc2rgb.m Thu Jul 11 22:25:22 1996
***************
*** 1,4 ****
! ## Copyright (C) 1996, 1997 John W. Eaton
##
## This file is part of Octave.
##
--- 1,4 ----
! ## Copyright (C) 1996 John W. Eaton
##
## This file is part of Octave.
##
***************
*** 19,25 ****
## Image format conversion.
! ## Author: Tony Richardson <arichard@stark.cc.oh.us>
## Created: July 1994
## Adapted-By: jwe
--- 19,25 ----
## Image format conversion.
! ## Author: Tony Richardson <amr@mpl.ucsd.edu>
## Created: July 1994
## Adapted-By: jwe
diff -cwr n:/project/C/octave-2.1.14.orig/scripts/image/ocean.m i:/project/C/octave-2.1.14/scripts/image/ocean.m
*** n:/project/C/octave-2.1.14.orig/scripts/image/ocean.m Tue Nov 10 15:11:20 1998
--- i:/project/C/octave-2.1.14/scripts/image/ocean.m Mon Jul 15 23:20:20 1996
***************
*** 1,4 ****
! ## Copyright (C) 1996, 1997 John W. Eaton
##
## This file is part of Octave.
##
--- 1,4 ----
! ## Copyright (C) 1996 John W. Eaton
##
## This file is part of Octave.
##
***************
*** 19,25 ****
## Colormap.
! ## Author: Tony Richardson <arichard@stark.cc.oh.us>
## Created: July 1994
## Adapted-By: jwe
--- 19,25 ----
## Colormap.
! ## Author: Tony Richardson <amr@mpl.ucsd.edu>
## Created: July 1994
## Adapted-By: jwe
diff -cwr n:/project/C/octave-2.1.14.orig/scripts/image/rgb2ind.m i:/project/C/octave-2.1.14/scripts/image/rgb2ind.m
*** n:/project/C/octave-2.1.14.orig/scripts/image/rgb2ind.m Tue Nov 10 15:11:20 1998
--- i:/project/C/octave-2.1.14/scripts/image/rgb2ind.m Thu Oct 10 23:38:02 1996
***************
*** 1,4 ****
! ## Copyright (C) 1996, 1997 John W. Eaton
##
## This file is part of Octave.
##
--- 1,4 ----
! ## Copyright (C) 1996 John W. Eaton
##
## This file is part of Octave.
##
***************
*** 25,31 ****
##
## Bugs: The color map may have duplicate entries.
! ## Author: Tony Richardson <arichard@stark.cc.oh.us>
## Created: July 1994
## Adapted-By: jwe
--- 25,31 ----
##
## Bugs: The color map may have duplicate entries.
! ## Author: Tony Richardson <amr@mpl.ucsd.edu>
## Created: July 1994
## Adapted-By: jwe
diff -cwr n:/project/C/octave-2.1.14.orig/scripts/image/rgb2ntsc.m i:/project/C/octave-2.1.14/scripts/image/rgb2ntsc.m
*** n:/project/C/octave-2.1.14.orig/scripts/image/rgb2ntsc.m Tue Nov 10 15:11:20 1998
--- i:/project/C/octave-2.1.14/scripts/image/rgb2ntsc.m Thu Jul 11 22:25:22 1996
***************
*** 1,4 ****
! ## Copyright (C) 1996, 1997 John W. Eaton
##
## This file is part of Octave.
##
--- 1,4 ----
! ## Copyright (C) 1996 John W. Eaton
##
## This file is part of Octave.
##
***************
*** 19,25 ****
## Image format conversion.
! ## Author: Tony Richardson <arichard@stark.cc.oh.us>
## Created: July 1994
## Adapted-By: jwe
--- 19,25 ----
## Image format conversion.
! ## Author: Tony Richardson <amr@mpl.ucsd.edu>
## Created: July 1994
## Adapted-By: jwe
diff -cwr n:/project/C/octave-2.1.14.orig/scripts/image/saveimage.m i:/project/C/octave-2.1.14/scripts/image/saveimage.m
*** n:/project/C/octave-2.1.14.orig/scripts/image/saveimage.m Wed Nov 25 05:01:32 1998
--- i:/project/C/octave-2.1.14/scripts/image/saveimage.m Wed Feb 11 00:32:52 1998
***************
*** 1,101 ****
! ## Copyright (C) 1996, 1997 John W. Eaton
##
- ## This file is part of Octave.
- ##
- ## Octave is free software; you can redistribute it and/or modify it
- ## under the terms of the GNU General Public License as published by
- ## the Free Software Foundation; either version 2, or (at your option)
- ## any later version.
- ##
- ## Octave is distributed in the hope that it will be useful, but
- ## WITHOUT ANY WARRANTY; without even the implied warranty of
- ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- ## General Public License for more details.
- ##
- ## You should have received a copy of the GNU General Public License
- ## 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.
-
## Save a matrix to disk in image format.
##
! ## saveimage (filename, x) saves matrix x to file filename in octave's
## image format. The current colormap is saved in the file also.
##
- ## saveimage (filename, x, "img") saves the image in the default format
- ## and is the same as saveimage (filename, x).
- ##
- ## saveimage (filename, x, "ppm") saves the image in ppm format instead
- ## of the default octave image format.
- ##
- ## saveimage (filename, x, "ps") saves the image in PostScript format
- ## instead of the default octave image format. (Note: images saved in
- ## PostScript format can not be read back into octave with loadimage.)
- ##
## saveimage (filename, x, format, map) saves the image along with the
## specified colormap in the specified format.
##
- ## Note: If the colormap contains only two entries and these entries
- ## are black and white, the bitmap ppm and PostScript formats are used.
- ## If the image is a gray scale image (the entries within each row of
- ## the colormap are equal) the gray scale ppm and PostScript image
- ## formats are used, otherwise the full color formats are used.
- ##
- ## The conversion to PostScript is based on pbmtolps.c, which was
- ## written by
- ##
- ## George Phillips <phillips@cs.ubc.ca>
- ## Department of Computer Science
- ## University of British Columbia
- ##
- ## and is part of the portable bitmap utilities,
- ##
- ## SEE ALSO: loadimage, save, load, colormap
-
- ## Author: Tony Richardson <arichard@stark.cc.oh.us>
- ## Created: July 1994
- ## Adapted-By: jwe
! ## Rewritten by jwe to avoid using octoppm and pbm routines so that
! ## people who don't have the the pbm stuff installed can still use this
! ## function.
! ##
! ## The conversion to PostScript is based on pnmtops.c, which is part of
! ## the portable bitmap utilties and bears this copyright notice:
! ##
! ## Copyright (C) 1989 by Jef Poskanzer.
! ##
! ## Permission to use, copy, modify, and distribute this software and its
! ## documentation for any purpose and without fee is hereby granted, provided
! ## that the above copyright notice appear in all copies and that both that
! ## copyright notice and this permission notice appear in supporting
! ## documentation. This software is provided "as is" without express or
! ## implied warranty.
! function saveimage (filename, img, img_form, map)
! if (nargin < 2 || nargin > 4)
! usage ("saveimage (filename, matrix, [format, [colormap]])");
endif
if (nargin < 4)
map = colormap ();
endif
- [map_nr, map_nc] = size (map);
-
- if (map_nc != 3)
- error ("colormap should be an N x 3 matrix");
- endif
-
if (nargin < 3)
img_form = "img";
elseif (! isstr (img_form))
error ("image format specification must be a string");
- elseif (! (strcmp (img_form, "img")
- || strcmp (img_form, "ppm")
- || strcmp (img_form, "ps")))
- error ("unsupported image format specification");
endif
if (! is_matrix (img))
--- 1,31 ----
! ## Copyright (C) 1996 Klaus Gebhardt
##
## Save a matrix to disk in image format.
##
! ## saveimage (filename, x) saves matrix x to file filename in octaves
## image format. The current colormap is saved in the file also.
##
## saveimage (filename, x, format, map) saves the image along with the
## specified colormap in the specified format.
##
! ## Author: Klaus Gebhardt <gebhardt@crunch.ikp.physik.th-darmstadt.de>
! ## Created: November 1996
! function saveimage (filename, img, img_form, map, opt)
! if (nargin < 2 || nargin > 5)
! usage ("saveimage (filename, matrix, [format, [colormap, [opt]]])");
endif
if (nargin < 4)
map = colormap ();
endif
if (nargin < 3)
img_form = "img";
elseif (! isstr (img_form))
error ("image format specification must be a string");
endif
if (! is_matrix (img))
***************
*** 106,303 ****
error ("file name must be a string");
endif
! ## If we just want Octave image format, save and return.
!
! if (strcmp (img_form, "img"))
! eval (strcat ("save -ascii ", filename, " map img"));
! return;
! endif
!
! ## Convert to another format if requested.
!
! grey = all (map(:,1) == map(:,2) && map(:,1) == map (:,3));
!
! pbm = pgm = ppm = 0;
!
! map_sz = map_nr * map_nc;
!
! map = reshape (map, map_sz, 1);
!
! idx = find (map > 1);
! map (idx) = ones (size (idx));
!
! idx = find (map < 0);
! map (idx) = zeros (size (idx));
!
! map = round (255 * map);
!
! bw = (map_nr == 2
! && ((map(1,1) == 0 && map(2,1) == 255)
! || (map(1,1) == 255 && map(2,1) == 0)));
!
! img = round (img');
! [img_nr, img_nc] = size (img);
!
! img_sz = img_nr * img_nc;
! img = reshape (img, img_sz, 1);
!
! idx = find (img > map_nr);
! img (idx) = ones (size (idx)) * map_nr;
!
! idx = find (img <= 0);
! img (idx) = ones (size (idx));
!
! if (strcmp (img_form, "ppm"))
! if (grey && map_nr == 2 && bw)
!
! if (map(1) != 0)
! map = [1; 0];
! else
! map = [0; 1];
! endif
!
! n_long = rem (img_nc, 8);
! tmp = zeros (ceil (img_nc/8), img_nr);
!
! for i = 1:img_nr
! idx = (i-1)*img_nc+1:i*img_nc;
! if (n_long > 0)
! img_row = [map(img(idx)); zeros (8-n_long, 1)];
! else
! img_row = map(img(idx));
! endif
! img_row
! tmp
! if (img_nc < 8)
! for j = 1:8
! tmp(:,i) = tmp(:,i) + img_row (j) * 2^(8-j);
! endfor
! else
! for j = 1:8
! tmp(:,i) = tmp(:,i) + img_row (j:8:img_nc) * 2^(8-j);
! endfor
! endif
! endfor
!
! fid = fopen (filename, "w");
! fprintf (fid, "P4\n%d %d\n", img_nr, img_nc);
! fwrite (fid, tmp, "char");
! fprintf (fid, "\n");
! fclose (fid);
!
! elseif (grey)
!
! fid = fopen (filename, "w");
! fprintf (fid, "P5\n%d %d\n255\n", img_nr, img_nc);
! fwrite (fid, map(img), "uchar");
! fprintf (fid, "\n");
! fclose (fid);
!
! else
!
! img_idx = ((1:3:3*img_sz)+2)';
! map_idx = ((2*map_nr+1):map_sz)';
!
! tmap = map(map_idx);
! tmp(img_idx--) = tmap(img);
!
! map_idx = map_idx - map_nr;
! tmap = map(map_idx);
! tmp(img_idx--) = tmap(img);
!
! map_idx = map_idx - map_nr;
! tmap = map(map_idx);
! tmp(img_idx--) = tmap(img);
!
! fid = fopen (filename, "w");
! fprintf (fid, "P6\n%d %d\n255\n", img_nr, img_nc);
! fwrite (fid, tmp, "uchar");
! fprintf (fid, "\n");
! fclose (fid);
!
! endif
!
! elseif (strcmp (img_form, "ps") == 1)
!
! if (! grey)
! error ("must have a greyscale color map for conversion to PostScript");
! endif
!
! bps = 8;
! dpi = 300;
! pagewid = 612;
! pagehgt = 762;
! MARGIN = 0.95;
! devpix = dpi / 72.0 + 0.5;
! pixfac = 72.0 / dpi * devpix;
!
! ## Compute padding to round cols * bps up to the nearest multiple of 8
! ## (nr and nc are switched because we transposed the image above).
!
! padright = (((img_nr * bps + 7) / 8) * 8 - img_nr * bps) / bps;
!
! scols = img_nr * pixfac;
! srows = img_nc * pixfac;
!
! if (scols > pagewid * MARGIN || srows > pagehgt * MARGIN)
! if (scols > pagewid * MARGIN)
! scale = scale * (pagewid / scols * MARGIN);
! scols = scale * img_nr * pixfac;
! srows = scale * img_nc * pixfac;
! endif
! if (srows > pagehgt * MARGIN)
! scale = scale * (pagehgt / srows * MARGIN);
! scols = scale * img_nr * pixfac;
! srows = scale * img_nc * pixfac;
! endif
! warning ("image too large for page, rescaling to %g", scale);
! endif
!
! llx = (pagewid - scols) / 2;
! lly = (pagehgt - srows) / 2;
! urx = llx + fix (scols + 0.5);
! ury = lly + fix (srows + 0.5);
!
! fid = fopen (filename, "w");
!
! fprintf (fid, "%%!PS-Adobe-2.0 EPSF-2.0\n");
! fprintf (fid, "%%%%Creator: Octave %s (saveimage.m)\n", OCTAVE_VERSION);
! fprintf (fid, "%%%%Title: %s\n", filename);
! fprintf (fid, "%%%%Pages: 1\n");
! fprintf (fid, "%%%%BoundingBox: %d %d %d %d\n",
! fix (llx), fix (lly), fix (urx), fix (ury));
! fprintf (fid, "%%%%EndComments\n" );
! fprintf (fid, "/readstring {\n");
! fprintf (fid, " currentfile exch readhexstring pop\n");
! fprintf (fid, "} bind def\n");
! fprintf (fid, "/picstr %d string def\n",
! fix ((img_nr + padright) * bps / 8));
! fprintf (fid, "%%%%EndProlog\n");
! fprintf (fid, "%%%%Page: 1 1\n");
! fprintf (fid, "gsave\n");
! fprintf (fid, "%g %g translate\n", llx, lly);
! fprintf (fid, "%g %g scale\n", scols, srows);
! fprintf (fid, "%d %d %d\n", img_nr, img_nc, bps);
! fprintf (fid, "[ %d 0 0 -%d 0 %d ]\n", img_nr, img_nc, img_nc);
! fprintf (fid, "{ picstr readstring }\n" );
! fprintf (fid, "image\n" );
!
! img = map(img);
!
! fmt = "%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x\n";
! fprintf (fid, fmt, img);
!
! if (rem (img_sz, 30) != 0)
! fprintf (fid, "\n" );
! endif
!
! fprintf (fid, "grestore\n" );
! fprintf (fid, "showpage\n" );
! fprintf (fid, "%%%%Trailer\n" );
! fclose (fid);
!
else
! error ("saveimage: what happened to the image type?");
endif
endfunction
--- 36,45 ----
error ("file name must be a string");
endif
! if (nargin < 5)
! eval (sprintf ("%s_enc (filename, map, img);", img_form));
else
! eval (sprintf ("%s_enc (filename, map, img, opt);", img_form));
endif
endfunction
diff -cwr n:/project/C/octave-2.1.14.orig/scripts/miscellaneous/bug_report.m i:/project/C/octave-2.1.14/scripts/miscellaneous/bug_report.m
*** n:/project/C/octave-2.1.14.orig/scripts/miscellaneous/bug_report.m Tue Nov 10 15:11:22 1998
--- i:/project/C/octave-2.1.14/scripts/miscellaneous/bug_report.m Wed Apr 14 20:58:14 1999
***************
*** 24,29 ****
--- 24,30 ----
## you are finished editing.
## Author: jwe
+ ## Modified by Klaus Gebhardt, 1997
function bug_report ()
***************
*** 49,55 ****
endif
endif
! cmd = "octave-bug";
if (length (subject) > 0)
cmd = sprintf ("%s -s \"%s\"", cmd, subject);
--- 50,56 ----
endif
endif
! cmd = "/octave-bug";
if (length (subject) > 0)
cmd = sprintf ("%s -s \"%s\"", cmd, subject);
diff -cwr n:/project/C/octave-2.1.14.orig/scripts/miscellaneous/popen2.m i:/project/C/octave-2.1.14/scripts/miscellaneous/popen2.m
*** n:/project/C/octave-2.1.14.orig/scripts/miscellaneous/popen2.m Tue Nov 10 15:11:24 1998
--- i:/project/C/octave-2.1.14/scripts/miscellaneous/popen2.m Wed Apr 14 20:58:14 1999
***************
*** 21,28 ****
##
## Start a subprocess with two-way communication. COMMAND specifies
## the name of the command to start. ARGS is an array of strings
! ## containing options for COMMAND. IN and out are the file ids of the
! ## input and streams for the subprocess, and PID is the process id of
## the subprocess, or -1 if COMMAND could not be executed.
##
## Example:
--- 21,28 ----
##
## Start a subprocess with two-way communication. COMMAND specifies
## the name of the command to start. ARGS is an array of strings
! ## containing options for COMMAND. IN and OUT are the file ids of the
! ## input and output streams for the subprocess, and PID is the process id of
## the subprocess, or -1 if COMMAND could not be executed.
##
## Example:
***************
*** 38,44 ****
## endwhile
## fclose (out);
! ## Author: jwe
function [in, out, pid] = popen2 (command, args)
--- 38,44 ----
## endwhile
## fclose (out);
! ## Author: Klaus Gebhardt, 1997
function [in, out, pid] = popen2 (command, args)
***************
*** 48,98 ****
if (nargin == 1 || nargin == 2)
- if (nargin == 1)
- args = "";
- endif
-
if (isstr (command))
! [stdin_pipe, stdin_status] = pipe ();
! [stdout_pipe, stdout_status] = pipe ();
! if (stdin_status == 0 && stdout_status == 0)
! pid = fork ();
! if (pid == 0)
! fclose (stdin_pipe (2));
! fclose (stdout_pipe (1));
! dup2 (stdin_pipe (1), stdin);
! fclose (stdin_pipe (1));
! dup2 (stdout_pipe (2), stdout);
! fclose (stdout_pipe (2));
! if (exec (command, args) < 0)
! error ("popen2: unable to start process `%s'", command);
! exit (0);
endif
! elseif (pid)
! fclose (stdin_pipe (1));
! fclose (stdout_pipe (2));
- if (fcntl (stdout_pipe (1), __F_SETFL__, __O_NONBLOCK__) < 0)
- error ("popen2: error setting file mode");
else
! in = stdin_pipe (2);
! out = stdout_pipe (1);
endif
! elseif (pid < 0)
! error ("popen2: fork failed -- unable to create child process");
endif
! else
error ("popen2: pipe creation failed");
endif
else
--- 48,114 ----
if (nargin == 1 || nargin == 2)
if (isstr (command))
! [r_pipe, r_status] = _pipe ();
! [w_pipe, w_status] = _pipe ();
! if ((r_status != -1) && (w_status != -1))
! r_parent_end = r_pipe(1);
! r_child_end = r_pipe(2);
! _fcntl (r_parent_end, F_SETFD, 1);
! r_org = _dup (1);
! w_parent_end = w_pipe(2);
! w_child_end = w_pipe(1);
! _fcntl (w_parent_end, F_SETFD, 1);
! w_org = _dup (0);
! if ((r_org != -1) && (w_org != -1))
! _dup2 (r_child_end, 1); _close (r_child_end); r_child_end = -1;
! _dup2 (w_child_end, 0); _close (w_child_end); w_child_end = -1;
! if (nargin == 1)
! pid = spawn ("nowait", command);
! else
! pid = spawn ("nowait", command, args);
! endif
! _dup2 (r_org, 1); _close (r_org);
! _dup2 (w_org, 0); _close (w_org);
! endif
!
! if (r_child_end != -1)
! _close (r_child_end);
endif
! if (w_child_end != -1)
! _close (w_child_end);
! endif
! if (pid < 0)
! _close (r_parent_end);
! _close (w_parent_end);
! error ("popen2: unable to start process `%s'", command);
! else
! out = _fdopen (r_parent_end, "r");
! in = _fdopen (w_parent_end, "w");
! endif
else
!
! if (r_status != -1)
! _close (r_pipe(1));
! _close (r_pipe(2));
endif
! if (wr_status != -1)
! _close (w_pipe(1));
! _close (w_pipe(2));
endif
!
error ("popen2: pipe creation failed");
endif
else
diff -cwr n:/project/C/octave-2.1.14.orig/scripts/startup/octaverc i:/project/C/octave-2.1.14/scripts/startup/octaverc
*** n:/project/C/octave-2.1.14.orig/scripts/startup/octaverc Tue Nov 10 15:11:26 1998
--- i:/project/C/octave-2.1.14/scripts/startup/octaverc Thu Apr 15 14:39:22 1999
***************
*** 2,4 ****
--- 2,37 ----
##
## This file should contain any commands that should be executed each
## time Octave starts for every user at this site.
+
+ ## System-wide startup file
+ ## Octave 2.0.10 for OS/2
+ ## (c) 1996, Klaus Gebhardt
+
+ PS1 = "octave:\\#>";
+
+ EDITOR = "e";
+
+ oct_home = "h:/apps/science/octave";
+ if length(getenv("OCTAVE_HOME"))
+ oct_home = getenv("OCTAVE_HOME");
+ endif
+
+ LOADPATH = sprintf ("%s/scripts//;%s/dlfcn/examples", oct_home, oct_home);
+ INFO_FILE = sprintf ("%s/doc/octave", oct_home);
+
+ if length(file_in_path(getenv("PATH"),"less.exe"))
+ PAGER = sprintf("%s -ce",file_in_path(getenv("PATH"),"less.exe"));
+ else
+ PAGER = "more";
+ endif
+
+ if length(getenv("GNUPLOT"))
+ gnuplot_binary = sprintf ("%s/gnuplot.exe", getenv("GNUPLOT"));
+ else
+ gnuplot_binary = "gnuplot";
+ endif
+
+ implicit_str_to_num_ok = 1;
+ ok_to_lose_imaginary_part = 1;
+ ignore_function_time_stamp = 1;
+ auto_unload_dot_oct_files = 1;
diff -cwr n:/project/C/octave-2.1.14.orig/scripts/strings/deblank.m i:/project/C/octave-2.1.14/scripts/strings/deblank.m
*** n:/project/C/octave-2.1.14.orig/scripts/strings/deblank.m Thu Nov 5 20:30:44 1998
--- i:/project/C/octave-2.1.14/scripts/strings/deblank.m Wed Apr 14 20:58:14 1999
***************
*** 23,28 ****
--- 23,29 ----
## Author: Kurt Hornik <Kurt.Hornik@ci.tuwien.ac.at>
## Adapted-By: jwe
+ ## Modified by Klaus Gebhardt, 1998
function t = deblank (s)
diff -cwr n:/project/C/octave-2.1.14.orig/doc/conf.tex i:/project/C/octave-2.1.14/doc/conf.tex
*** n:/project/C/octave-2.1.14.orig/doc/conf.tex Tue Apr 13 13:11:30 1999
--- i:/project/C/octave-2.1.14/doc/conf.tex Thu Apr 15 10:42:20 1999
***************
*** 2,7 ****
@c This is part of the Octave manual.
@c For copying conditions, see the file gpl.tex.
! @set VERSION 2.0.5
! @set OCTAVEHOME /usr/local
! @set TARGETHOSTTYPE i586-pc-linux-gnu
--- 2,7 ----
@c This is part of the Octave manual.
@c For copying conditions, see the file gpl.tex.
! @set VERSION 2.1.14
! @set OCTAVEHOME
! @set TARGETHOSTTYPE i486-pc-os/2
diff -cwr n:/project/C/octave-2.1.14.orig/doc/faq/oct-faq.tex i:/project/C/octave-2.1.14/doc/faq/oct-faq.tex
*** n:/project/C/octave-2.1.14.orig/doc/faq/oct-faq.tex Tue Apr 13 13:11:30 1999
--- i:/project/C/octave-2.1.14/doc/faq/oct-faq.tex Wed Apr 14 20:58:14 1999
***************
*** 1,3 ****
--- 1,4 ----
+ % Modified by Klaus Gebhardt, 1997
\input texinfo.tex @c -*-texinfo-*-
@setfilename oct-faq.
***************
*** 19,24 ****
--- 20,33 ----
@top
@unnumbered Preface
@cindex FAQ for Octave, latest version
+
+ @macro email{text}
+ (\text\)
+ @end macro
+
+ @macro url{text}
+ (\text\)
+ @end macro
@end ifinfo
This is a list of frequently asked questions (FAQ) for Octave users.
diff -cwr n:/project/C/octave-2.1.14.orig/doc/interpreter/control.tex i:/project/C/octave-2.1.14/doc/interpreter/control.tex
*** n:/project/C/octave-2.1.14.orig/doc/interpreter/control.tex Tue Apr 13 13:11:32 1999
--- i:/project/C/octave-2.1.14/doc/interpreter/control.tex Thu Apr 15 11:01:56 1999
***************
*** 224,230 ****
@strong{Inputs:}
@table @var
@item num
! vector of coefficients @math{[c_0 c_1 ... c_n]}
of the SISO FIR transfer function
@ifinfo
--- 224,230 ----
@strong{Inputs:}
@table @var
@item num
! vector of coefficients @code{[c_0 c_1 ... c_n]}
of the SISO FIR transfer function
@ifinfo
***************
*** 291,297 ****
default: @var{d} = zero matrix
@item tsam
! sampling rate. Default: @math{tsam = 0} (continuous system)
@item n, nz
number of continuous, discrete states in the system
--- 291,297 ----
default: @var{d} = zero matrix
@item tsam
! sampling rate. Default: @code{tsam = 0} (continuous system)
@item n, nz
number of continuous, discrete states in the system
***************
*** 299,308 ****
default:
@table @var
@item tsam = 0
! @math{n = @code{rows}(@var{a})}, @math{nz = 0}
@item tsam > 0
! @math{ n = 0}, @math{nz = @code{rows}(@var{a})}
see below for system partitioning
--- 299,308 ----
default:
@table @var
@item tsam = 0
! @code{n = @code{rows}(@var{a})}, @code{nz = 0}
@item tsam > 0
! @code{ n = 0}, @code{nz = @code{rows}(@var{a})}
see below for system partitioning
***************
*** 331,339 ****
default:
@table @var
@item tsam = 0
! @math{outlist = []}
@item tsam > 0
! @math{outlist = 1:@code{rows}(@var{c})}
@end table
Unlike states, discrete/continous outputs may appear in any order.
--- 331,339 ----
default:
@table @var
@item tsam = 0
! @code{outlist = []}
@item tsam > 0
! @code{outlist = 1:@code{rows}(@var{c})}
@end table
Unlike states, discrete/continous outputs may appear in any order.
***************
*** 365,377 ****
@end example
with dynamic equations:
@ifinfo
! @math{ d/dt xc(t) = acc*xc(t) + acd*xd(k*tsam) + bc*u(t)}
! @math{ xd((k+1)*tsam) = adc*xc(k*tsam) + add*xd(k*tsam) + bd*u(k*tsam)}
! @math{ yc(t) = ccc*xc(t) + ccd*xd(k*tsam) + dc*u(t)}
! @math{ yd(k*tsam) = cdc*xc(k*tsam) + cdd*xd(k*tsam) + dd*u(k*tsam)}
@end ifinfo
@iftex
@tex
--- 365,377 ----
@end example
with dynamic equations:
@ifinfo
! @code{ d/dt xc(t) = acc*xc(t) + acd*xd(k*tsam) + bc*u(t)}
! @code{ xd((k+1)*tsam) = adc*xc(k*tsam) + add*xd(k*tsam) + bd*u(k*tsam)}
! @code{ yc(t) = ccc*xc(t) + ccd*xd(k*tsam) + dc*u(t)}
! @code{ yd(k*tsam) = cdc*xc(k*tsam) + cdd*xd(k*tsam) + dd*u(k*tsam)}
@end ifinfo
@iftex
@tex
***************
*** 399,405 ****
----------------------------------------------------
@end group
@end example
! where @math{cout} is the list of in 1:@code{rows}(@var{p})
that are not contained in outlist. (Discrete/continuous outputs
may be entered in any order desired by the user.)
--- 399,405 ----
----------------------------------------------------
@end group
@end example
! where @code{cout} is the list of in 1:@code{rows}(@var{p})
that are not contained in outlist. (Discrete/continuous outputs
may be entered in any order desired by the user.)
***************
*** 669,675 ****
@item yd
binary vector; @var{yd}(@var{ii}) is nonzero if output @var{ii} is
discrete.
! @math{yd(ii) = 0} if output @var{ii} is continous
@end table
@end deftypefn
--- 669,675 ----
@item yd
binary vector; @var{yd}(@var{ii}) is nonzero if output @var{ii} is
discrete.
! @code{yd(ii) = 0} if output @var{ii} is continous
@end table
@end deftypefn
***************
*** 986,992 ****
@end deftypefn
@deftypefn {Function File } { } tfout (@var{num}, @var{denom}@{, @var{x}@})
! print formatted transfer function @math{n(s)/d(s) } to the screen
@var{x} defaults to the string @code{"s"}
@end deftypefn
--- 986,992 ----
@end deftypefn
@deftypefn {Function File } { } tfout (@var{num}, @var{denom}@{, @var{x}@})
! print formatted transfer function @code{n(s)/d(s) } to the screen
@var{x} defaults to the string @code{"s"}
@end deftypefn
***************
*** 1008,1014 ****
@item yd
indices of strings to append with the string "(discrete)"
(used by @var{sysout}; minimal checking of this argument)
! @math{yd = [] } indicates all outputs are continuous
@item ilist
index numbers to print with names.
--- 1008,1014 ----
@item yd
indices of strings to append with the string "(discrete)"
(used by @var{sysout}; minimal checking of this argument)
! @code{yd = [] } indicates all outputs are continuous
@item ilist
index numbers to print with names.
***************
*** 1188,1194 ****
@end table
@strong{Outputs}
@var{outsys}
! system data structure has representation with @math{w = 2 * pi * nfreq}:
@example
/ \
| / -2w*damp -w \ / w \ |
--- 1188,1194 ----
@end table
@strong{Outputs}
@var{outsys}
! system data structure has representation with @code{w = 2 * pi * nfreq}:
@example
/ \
| / -2w*damp -w \ / w \ |
***************
*** 1263,1270 ****
list of names for new inputs
@item yd
! binary vector; @math{yd(ii)=0} indicates a continuous output;
! @math{yd(ii)=1} indicates a discrete output.
@end table
@strong{Outputs} @var{sys}
--- 1263,1270 ----
list of names for new inputs
@item yd
! binary vector; @code{yd(ii)=0} indicates a continuous output;
! @code{yd(ii)=1} indicates a discrete output.
@end table
@strong{Outputs} @var{sys}
***************
*** 1305,1312 ****
@item sys
system data structure
@item out_idx, in_idx
! list of connections indices; @math{y(out_idx(ii))}
! is connected to @math{u(in_idx(ii))}.
@item order
logical flag (default = 0)
@table @code
--- 1305,1312 ----
@item sys
system data structure
@item out_idx, in_idx
! list of connections indices; @code{y(out_idx(ii))}
! is connected to @code{u(in_idx(ii))}.
@item order
logical flag (default = 0)
@table @code
***************
*** 1448,1454 ****
@var{Asys}, @var{Bsys}: system data structures
@strong{Outputs}
! @math{sys = @r{block diag}(Asys,Bsys)}
@example
@group
__________________
--- 1448,1454 ----
@var{Asys}, @var{Bsys}: system data structures
@strong{Outputs}
! @code{sys = @r{block diag}(Asys,Bsys)}
@example
@group
__________________
***************
*** 1477,1483 ****
@node sysmult, sysprune, sysgroupn, blockdiag
@deftypefn {Function File } { @var{sys} =} sysmult( @var{Asys}, @var{Bsys})
! Compute @math{sys = Asys*Bsys} (series connection):
@example
@group
u ---------- ----------
--- 1477,1483 ----
@node sysmult, sysprune, sysgroupn, blockdiag
@deftypefn {Function File } { @var{sys} =} sysmult( @var{Asys}, @var{Bsys})
! Compute @code{sys = Asys*Bsys} (series connection):
@example
@group
u ---------- ----------
***************
*** 1560,1566 ****
@node syssub, , sysscale, blockdiag
@deftypefn {Function File } { @var{sys} =} syssub (@var{Gsys}, @var{Hsys})
! returns @math{sys = Gsys - Hsys}
Method: @var{Gsys} and @var{Hsys} are connected in parallel
The input vector is connected to both systems; the outputs are
--- 1560,1566 ----
@node syssub, , sysscale, blockdiag
@deftypefn {Function File } { @var{sys} =} syssub (@var{Gsys}, @var{Hsys})
! returns @code{sys = Gsys - Hsys}
Method: @var{Gsys} and @var{Hsys} are connected in parallel
The input vector is connected to both systems; the outputs are
***************
*** 1628,1637 ****
@var{n}x@var{n} matrix.
@item b
@var{n}x@var{n} matrix or @var{n}x@var{m} matrix; in the latter case
! @var{b} is replaced by @math{b:=b*b'}.
@item c
@var{n}x@var{n} matrix or @var{p}x@var{m} matrix; in the latter case
! @var{c} is replaced by @math{c:=c'*c}.
@item opt
(optional argument; default = @code{"B"}):
String option passed to @code{balance} prior to ordered Schur decomposition.
--- 1628,1637 ----
@var{n}x@var{n} matrix.
@item b
@var{n}x@var{n} matrix or @var{n}x@var{m} matrix; in the latter case
! @var{b} is replaced by @code{b:=b*b'}.
@item c
@var{n}x@var{n} matrix or @var{p}x@var{m} matrix; in the latter case
! @var{c} is replaced by @code{c:=c'*c}.
@item opt
(optional argument; default = @code{"B"}):
String option passed to @code{balance} prior to ordered Schur decomposition.
***************
*** 1675,1681 ****
@item c
@var{n} by @var{n}, symmetric positive semidefinite, or @var{p} by @var{n}.
! In the latter case @math{c:=c'*c} is used.
@item r
@var{m} by @var{m}, symmetric positive definite (invertible).
--- 1675,1681 ----
@item c
@var{n} by @var{n}, symmetric positive semidefinite, or @var{p} by @var{n}.
! In the latter case @code{c:=c'*c} is used.
@item r
@var{m} by @var{m}, symmetric positive definite (invertible).
***************
*** 1765,1773 ****
@deftypefn {Function File } { @var{m} =} gram (@var{a}, @var{b})
Return controllability grammian @var{m} of the continuous time system
! @math{ dx/dt = a x + b u}.
! @var{m} satisfies @math{ a m + m a' + b b' = 0 }.
@end deftypefn
--- 1765,1773 ----
@deftypefn {Function File } { @var{m} =} gram (@var{a}, @var{b})
Return controllability grammian @var{m} of the continuous time system
! @code{ dx/dt = a x + b u}.
! @var{m} satisfies @code{ a m + m a' + b b' = 0 }.
@end deftypefn
***************
*** 1885,1891 ****
@item zgscal
Generalized conjugate gradient iteration to
solve zero-computation generalized eigenvalue problem balancing equation
! @math{fx=z};
called by @code{zgepbal}
@item zgsgiv
--- 1885,1891 ----
@item zgscal
Generalized conjugate gradient iteration to
solve zero-computation generalized eigenvalue problem balancing equation
! @code{fx=z};
called by @code{zgepbal}
@item zgsgiv
***************
*** 2166,2178 ****
@item Bu
(@var{n} x @var{nu}) @var{Ru}-transformed controlled input matrix;
! @strong{Note} @math{B = [Bw Bu] }
@item Cz
(@var{nz} x @var{n}) Qz-transformed error output matrix
@item Cy
(@var{ny} x @var{n}) @var{Ry}-transformed measured output matrix
! @strong{Note} @math{C = [Cz; Cy] }
@item Dzu, Dyw
off-diagonal blocks of transformed @var{D} matrix that enter
@var{z}, @var{y} from @var{u}, @var{w} respectively
--- 2166,2178 ----
@item Bu
(@var{n} x @var{nu}) @var{Ru}-transformed controlled input matrix;
! @strong{Note} @code{B = [Bw Bu] }
@item Cz
(@var{nz} x @var{n}) Qz-transformed error output matrix
@item Cy
(@var{ny} x @var{n}) @var{Ry}-transformed measured output matrix
! @strong{Note} @code{C = [Cz; Cy] }
@item Dzu, Dyw
off-diagonal blocks of transformed @var{D} matrix that enter
@var{z}, @var{y} from @var{u}, @var{w} respectively
***************
*** 2340,2346 ****
@code{1e-8}.
@item "bi"
Conversion is performed via bilinear transform
! @math{z = (1 + s T / 2)/(1 - s T / 2)} where @var{T} is the
system sampling time (see @code{sysgettsam}).
FIXME: bilinear option exits with an error if @var{sys} is not purely discrete
--- 2340,2346 ----
@code{1e-8}.
@item "bi"
Conversion is performed via bilinear transform
! @code{z = (1 + s T / 2)/(1 - s T / 2)} where @var{T} is the
system sampling time (see @code{sysgettsam}).
FIXME: bilinear option exits with an error if @var{sys} is not purely discrete
***************
*** 2373,2379 ****
"constant u flag" if @var{cuflg} is nonzero then the system inputs are
assumed to be constant over the revised sampling interval @var{Ts2}.
Otherwise, since the inputs can change during the interval
! @var{t} in @math{[k Ts2, (k+1) Ts2]}, an additional set of inputs is
included in the revised B matrix so that these intersample inputs
may be included in the single-rate system.
default
--- 2373,2379 ----
"constant u flag" if @var{cuflg} is nonzero then the system inputs are
assumed to be constant over the revised sampling interval @var{Ts2}.
Otherwise, since the inputs can change during the interval
! @var{t} in @code{[k Ts2, (k+1) Ts2]}, an additional set of inputs is
included in the revised B matrix so that these intersample inputs
may be included in the single-rate system.
default
***************
*** 2476,2498 ****
@item w
frequency values for evaluation.
! if @var{sys} is continuous, then bode evaluates @math{G(jw)} where
! @math{G(s)} is the system transfer function.
if @var{sys} is discrete, then bode evaluates G(@code{exp}(jwT)), where
@itemize @bullet
@item @var{T}=@code{sysgettsam(@var{sys})} (the system sampling time) and
! @item @math{G(z)} is the system transfer function.
@end itemize
@strong{ Default} the default frequency range is selected as follows: (These
steps are NOT performed if @var{w} is specified)
@enumerate
@item via routine bodquist, isolate all poles and zeros away from
! @var{w}=0 (@var{jw}=0 or @math{@code{exp}(jwT)}=1) and select the frequency
range based on the breakpoint locations of the frequencies.
@item if @var{sys} is discrete time, the frequency range is limited
! to @math{jwT} in
@ifinfo
[0,2 pi /T]
@end ifinfo
--- 2476,2498 ----
@item w
frequency values for evaluation.
! if @var{sys} is continuous, then bode evaluates @code{G(jw)} where
! @code{G(s)} is the system transfer function.
if @var{sys} is discrete, then bode evaluates G(@code{exp}(jwT)), where
@itemize @bullet
@item @var{T}=@code{sysgettsam(@var{sys})} (the system sampling time) and
! @item @code{G(z)} is the system transfer function.
@end itemize
@strong{ Default} the default frequency range is selected as follows: (These
steps are NOT performed if @var{w} is specified)
@enumerate
@item via routine bodquist, isolate all poles and zeros away from
! @var{w}=0 (@var{jw}=0 or @code{@code{exp}(jwT)}=1) and select the frequency
range based on the breakpoint locations of the frequencies.
@item if @var{sys} is discrete time, the frequency range is limited
! to @code{jwT} in
@ifinfo
[0,2 pi /T]
@end ifinfo
***************
*** 2514,2520 ****
@table @var
@item mag, phase
the magnitude and phase of the frequency response
! @math{G(jw)} or @math{G(@code{exp}(jwT))} at the selected frequency values.
@item w
the vector of frequency values used
@end table
--- 2514,2520 ----
@table @var
@item mag, phase
the magnitude and phase of the frequency response
! @code{G(jw)} or @code{G(@code{exp}(jwT))} at the selected frequency values.
@item w
the vector of frequency values used
@end table
***************
*** 2532,2538 ****
being printed to the screen (@code{ans = []}).
@item If the requested plot is for an MIMO system, mag is set to
! @math{||G(jw)||} or @math{||G(@code{exp}(jwT))||}
and phase information is not computed.
@end enumerate
@end deftypefn
--- 2532,2538 ----
being printed to the screen (@code{ans = []}).
@item If the requested plot is for an MIMO system, mag is set to
! @code{||G(jw)||} or @code{||G(@code{exp}(jwT))||}
and phase information is not computed.
@end enumerate
@end deftypefn
***************
*** 2566,2572 ****
@item w
list of frequencies
@item f
! frequency response of sys; @math{f(ii) = f(omega(ii))}
@end table
@strong{Note} bodquist could easily be incorporated into a Nichols
plot function; this is in a "to do" list.
--- 2566,2572 ----
@item w
list of frequencies
@item f
! frequency response of sys; @code{f(ii) = f(omega(ii))}
@end table
@strong{Note} bodquist could easily be incorporated into a Nichols
plot function; this is in a "to do" list.
***************
*** 2593,2599 ****
@strong{Outputs}
@table @var
@item @var{out}
! vector of finite @math{G(j*w)} entries (or @math{||G(j*w)||} for MIMO)
@item w
vector of corresponding frequencies
@end table
--- 2593,2599 ----
@strong{Outputs}
@table @var
@item @var{out}
! vector of finite @code{G(j*w)} entries (or @code{||G(j*w)||} for MIMO)
@item w
vector of corresponding frequencies
@end table
***************
*** 2605,2611 ****
@strong{Inputs}
@table @var
@item A, B
! coefficient matrices of @math{dx/dt = A x + B u}
@item sys
system data structure
@item w
--- 2605,2611 ----
@strong{Inputs}
@table @var
@item A, B
! coefficient matrices of @code{dx/dt = A x + B u}
@item sys
system data structure
@item w
***************
*** 2617,2623 ****
-1
G(s) = (jw I-A) B
@end example
! for complex frequencies @math{s = jw}.
@end deftypefn
@deftypefn {Function File } {[@var{realp}, @var{imagp}, @var{w}] =} nyquist (@var{sys}@{, @var{w}, @var{out_idx}, @var{in_idx}, @var{atol}@})
--- 2617,2623 ----
-1
G(s) = (jw I-A) B
@end example
! for complex frequencies @code{s = jw}.
@end deftypefn
@deftypefn {Function File } {[@var{realp}, @var{imagp}, @var{w}] =} nyquist (@var{sys}@{, @var{w}, @var{out_idx}, @var{in_idx}, @var{atol}@})
***************
*** 2639,2645 ****
@table @var
@item realp, imagp
the real and imaginary parts of the frequency response
! @math{G(jw)} or @math{G(exp(jwT))} at the selected frequency values.
@item w
the vector of frequency values used
@end table
--- 2639,2645 ----
@table @var
@item realp, imagp
the real and imaginary parts of the frequency response
! @code{G(jw)} or @code{G(exp(jwT))} at the selected frequency values.
@item w
the vector of frequency values used
@end table
diff -cwr n:/project/C/octave-2.1.14.orig/doc/interpreter/install.tex i:/project/C/octave-2.1.14/doc/interpreter/install.tex
*** n:/project/C/octave-2.1.14.orig/doc/interpreter/install.tex Tue Apr 13 13:11:34 1999
--- i:/project/C/octave-2.1.14/doc/interpreter/install.tex Wed Apr 14 20:58:22 1999
***************
*** 442,447 ****
--- 442,455 ----
@email{bug-octave@@bevo.che.wisc.edu} if you are interested in helping
make a binary distribution available for your system.)
+ Also, binary distributions are limited to static binaries that do not
+ support dynamic linking. For earlier versions of Octave, I tried
+ distributing dynamically linked binaries but that proved to be too much
+ trouble to support. If you want to have a copy of Octave that includes
+ all the features described in this manual, you will have to build it
+ from the sources yourself, or find someone else who is willing to do it
+ for you.
+
@menu
* Installing Octave from a Binary Distribution::
* Creating a Binary Distribution::
***************
*** 561,566 ****
@end example
This will create a compressed tar file ready for distribution.
! It will have a name like
@file{octave-@value{VERSION}-@value{TARGETHOSTTYPE}.tar.gz}
@end itemize
--- 569,574 ----
@end example
This will create a compressed tar file ready for distribution.
! It will contain statically linked binaries and have a name like
@file{octave-@value{VERSION}-@value{TARGETHOSTTYPE}.tar.gz}
@end itemize
diff -cwr n:/project/C/octave-2.1.14.orig/doc/interpreter/linalg.tex i:/project/C/octave-2.1.14/doc/interpreter/linalg.tex
*** n:/project/C/octave-2.1.14.orig/doc/interpreter/linalg.tex Tue Apr 13 13:11:34 1999
--- i:/project/C/octave-2.1.14/doc/interpreter/linalg.tex Thu Apr 15 11:02:12 1999
***************
*** 382,398 ****
@deftypefn {Function File} {@var{lambda} =} qz (@var{a}, @var{b})
! Generalized eigenvalue problem @math{A x = s B x},
@var{QZ} decomposition. Three ways to call:
@enumerate
@item @code{lambda = qz(A,B)}
! Computes the generalized eigenvalues @var{lambda} of @math{(A - sB)}.
@item @code{[AA, BB, Q, Z @{, V, W, lambda@}] = qz (A, B)}
Computes qz decomposition, generalized eigenvectors, and
! generalized eigenvalues of @math{(A - sB)}
@example
@group
A V = B V diag(lambda)
--- 382,398 ----
@deftypefn {Function File} {@var{lambda} =} qz (@var{a}, @var{b})
! Generalized eigenvalue problem @code{A x = s B x},
@var{QZ} decomposition. Three ways to call:
@enumerate
@item @code{lambda = qz(A,B)}
! Computes the generalized eigenvalues @var{lambda} of @code{(A - sB)}.
@item @code{[AA, BB, Q, Z @{, V, W, lambda@}] = qz (A, B)}
Computes qz decomposition, generalized eigenvectors, and
! generalized eigenvalues of @code{(A - sB)}
@example
@group
A V = B V diag(lambda)
diff -cwr n:/project/C/octave-2.1.14.orig/doc/interpreter/octave.tex i:/project/C/octave-2.1.14/doc/interpreter/octave.tex
*** n:/project/C/octave-2.1.14.orig/doc/interpreter/octave.tex Tue Apr 13 13:11:34 1999
--- i:/project/C/octave-2.1.14/doc/interpreter/octave.tex Wed Apr 14 20:58:24 1999
***************
*** 1,6 ****
--- 1,7 ----
% Copyright (C) 1996, 1997 John W. Eaton
% This is part of the Octave manual.
% For copying conditions, see the file gpl.tex.
+ % Modified by Klaus Gebhardt, 1997
\input texinfo
@setfilename octave.
***************
*** 11,16 ****
--- 12,25 ----
* Octave: (octave). Interactive language for numerical computations.
END-INFO-DIR-ENTRY
@end format
+
+ @macro email{text}
+ (\text\)
+ @end macro
+
+ @macro url{text}
+ (\text\)
+ @end macro
@end ifinfo
@c Settings for printing on 8-1/2 by 11 inch paper:
***************
*** 36,42 ****
@c This file doesn't include a chapter, so it must not be included
@c if you want to run the Emacs function texinfo-multiple-files-update.
! @include conf.tex
@settitle GNU Octave
--- 45,51 ----
@c This file doesn't include a chapter, so it must not be included
@c if you want to run the Emacs function texinfo-multiple-files-update.
! @include ../conf.tex
@settitle GNU Octave
diff -cwr n:/project/C/octave-2.1.14.orig/doc/interpreter/poly.tex i:/project/C/octave-2.1.14/doc/interpreter/poly.tex
*** n:/project/C/octave-2.1.14.orig/doc/interpreter/poly.tex Tue Apr 13 13:11:34 1999
--- i:/project/C/octave-2.1.14/doc/interpreter/poly.tex Wed Apr 14 20:58:24 1999
***************
*** 8,22 ****
In Octave, a polynomial is represented by its coefficients (arranged
in descending order). For example, a vector
@iftex
@end iftex
@ifinfo
! $c$
@end ifinfo
of length
@iftex
@tex
$N+1$
@end tex
@ifinfo
@var{N+1}
@end ifinfo
--- 8,24 ----
In Octave, a polynomial is represented by its coefficients (arranged
in descending order). For example, a vector
@iftex
+ $c$
@end iftex
@ifinfo
! @var{c}
@end ifinfo
of length
@iftex
@tex
$N+1$
@end tex
+ @end iftex
@ifinfo
@var{N+1}
@end ifinfo
diff -cwr n:/project/C/octave-2.1.14.orig/doc/liboctave/gpl.tex i:/project/C/octave-2.1.14/doc/liboctave/gpl.tex
*** n:/project/C/octave-2.1.14.orig/doc/liboctave/gpl.tex Tue Apr 13 13:11:38 1999
--- i:/project/C/octave-2.1.14/doc/liboctave/gpl.tex Wed Apr 14 20:58:28 1999
***************
*** 1,4 ****
! @c Copyright (C) 1996, 1997 John W. Eaton
@c This is part of the Octave manual.
@c For copying conditions, see the file gpl.tex.
--- 1,4 ----
! @c Copyright (C) 1996 John W. Eaton
@c This is part of the Octave manual.
@c For copying conditions, see the file gpl.tex.
diff -cwr n:/project/C/octave-2.1.14.orig/doc/liboctave/liboct.tex i:/project/C/octave-2.1.14/doc/liboctave/liboct.tex
*** n:/project/C/octave-2.1.14.orig/doc/liboctave/liboct.tex Tue Apr 13 13:11:38 1999
--- i:/project/C/octave-2.1.14/doc/liboctave/liboct.tex Thu Apr 15 10:47:16 1999
***************
*** 1,6 ****
--- 1,7 ----
% Copyright (C) 1996, 1997 John W. Eaton
% This is part of the Octave manual.
% For copying conditions, see the file gpl.tex.
+ % Modified by Klaus Gebhardt, 1997
\input texinfo @c -*-texinfo-*-
@setfilename liboct.
***************
*** 28,38 ****
@c This file doesn't include a chapter, so it must not be included
@c if you want to run the Emacs function texinfo-multiple-files-update.
! @c @include conf.tex
@settitle Octave C++ Classes
@ifinfo
Copyright (C) 1996, 1997 John W. Eaton.
--- 29,47 ----
@c This file doesn't include a chapter, so it must not be included
@c if you want to run the Emacs function texinfo-multiple-files-update.
! @include ../conf.tex
@settitle Octave C++ Classes
@ifinfo
+
+ @macro email{text}
+ (\text\)
+ @end macro
+
+ @macro url{text}
+ (\text\)
+ @end macro
Copyright (C) 1996, 1997 John W. Eaton.