home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
octa21fs.zip
/
octave
/
octave-2.1.23
/
PATCHES.OS2
< prev
next >
Wrap
Text File
|
2000-01-15
|
151KB
|
5,989 lines
diff -cwr n:/project/C/octave-2.1.23.orig/liboctave/cmd-edit.cc i:/project/C/octave-2.1.23/liboctave/cmd-edit.cc
*** n:/project/C/octave-2.1.23.orig/liboctave/cmd-edit.cc Wed Oct 13 08:05:22 1999
--- i:/project/C/octave-2.1.23/liboctave/cmd-edit.cc Fri Dec 24 18:44:34 1999
***************
*** 20,25 ****
--- 20,27 ----
*/
+ /* Modified by Klaus Gebhardt, 1999 */
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
***************
*** 52,57 ****
--- 54,69 ----
#include <readline/readline.h>
+ #ifdef __EMX__
+ extern "C"
+ {
+ extern void tputs ();
+ extern char *term_clrpag;
+ extern void _rl_output_character_function ();
+ extern void rl_resize_terminal ();
+ }
+ #endif
+
// It would be nice if readline.h declared these, I think.
extern int rl_blink_matching_paren;
***************
*** 246,252 ****
--- 258,276 ----
void
gnu_readline::do_clear_screen (void)
{
+ #ifdef __EMX__
+ rl_beg_of_line ();
+ rl_kill_line (1);
+
+ if (term_clrpag)
+ tputs (term_clrpag, 1, _rl_output_character_function);
+ else
+ crlf ();
+
+ fflush (rl_outstream);
+ #else
rl_clear_screen ();
+ #endif
}
void
***************
*** 628,633 ****
--- 652,664 ----
{
if (instance_ok ())
instance->command_number = n;
+ }
+
+ void
+ command_editor::add_current_command_number (int n)
+ {
+ if (instance_ok ())
+ instance->command_number += n;
}
void
diff -cwr n:/project/C/octave-2.1.23.orig/liboctave/cmd-edit.h i:/project/C/octave-2.1.23/liboctave/cmd-edit.h
*** n:/project/C/octave-2.1.23.orig/liboctave/cmd-edit.h Wed Oct 13 08:05:22 1999
--- i:/project/C/octave-2.1.23/liboctave/cmd-edit.h Fri Dec 24 13:35:56 1999
***************
*** 99,104 ****
--- 99,106 ----
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.23.orig/liboctave/cmd-hist.cc i:/project/C/octave-2.1.23/liboctave/cmd-hist.cc
*** n:/project/C/octave-2.1.23.orig/liboctave/cmd-hist.cc Mon May 5 04:24:04 1997
--- i:/project/C/octave-2.1.23/liboctave/cmd-hist.cc Fri Dec 24 13:35:56 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.23.orig/liboctave/file-ops.cc i:/project/C/octave-2.1.23/liboctave/file-ops.cc
*** n:/project/C/octave-2.1.23.orig/liboctave/file-ops.cc Thu Jul 24 20:33:34 1997
--- i:/project/C/octave-2.1.23/liboctave/file-ops.cc Sat Dec 25 14:04:24 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,551 ----
#endif
return status;
+ }
+
+ int
+ file_ops::close (int handle)
+ {
+ string msg;
+ return close (handle, msg);
+ }
+
+ int
+ file_ops::close (int handle, string& msg)
+ {
+ msg = string ();
+
+ int status = -1;
+
+ #if defined (HAVE_CLOSE)
+ status = ::close (handle);
+
+ if (status < 0)
+ msg = ::strerror (errno);
+ #else
+ msg = NOT_SUPPORTED ("close");
+ #endif
+
+ return status;
+ }
+
+ void *
+ file_ops::fdopen (int handle, const string& mode)
+ {
+ string msg;
+ return fdopen (handle, mode.c_str (), msg);
+ }
+
+ void *
+ file_ops::fdopen (int handle, const string& mode, string& msg)
+ {
+ msg = string ();
+
+ void *ptr = NULL;
+
+ #if defined (HAVE_FDOPEN)
+ ptr = static_cast<void *> (::fdopen (handle, mode.c_str ()));
+
+ if (ptr == NULL)
+ msg = ::strerror (errno);
+ #else
+ msg = NOT_SUPPORTED ("fdopen");
+ #endif
+
+ return ptr;
}
/*
diff -cwr n:/project/C/octave-2.1.23.orig/liboctave/file-ops.h i:/project/C/octave-2.1.23/liboctave/file-ops.h
*** n:/project/C/octave-2.1.23.orig/liboctave/file-ops.h Fri Jun 6 10:30:36 1997
--- i:/project/C/octave-2.1.23/liboctave/file-ops.h Sat Dec 25 12:42:28 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,79 ----
static int unlink (const string&);
static int unlink (const string&, string&);
+
+ static int close (int);
+ static int close (int, string&);
+
+ static void *fdopen (int, const string&);
+ static void *fdopen (int, const string&, string&);
};
#endif
diff -cwr n:/project/C/octave-2.1.23.orig/liboctave/file-stat.cc i:/project/C/octave-2.1.23/liboctave/file-stat.cc
*** n:/project/C/octave-2.1.23.orig/liboctave/file-stat.cc Mon Aug 2 22:56:42 1999
--- i:/project/C/octave-2.1.23/liboctave/file-stat.cc Fri Dec 24 13:35:56 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.23.orig/liboctave/lo-mappers.cc i:/project/C/octave-2.1.23/liboctave/lo-mappers.cc
*** n:/project/C/octave-2.1.23.orig/liboctave/lo-mappers.cc Fri Sep 10 06:17:00 1999
--- i:/project/C/octave-2.1.23/liboctave/lo-mappers.cc Fri Dec 24 13:35:56 1999
***************
*** 20,25 ****
--- 20,27 ----
*/
+ /* Modified by Klaus Gebhardt, 1997 - 1999 */
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
***************
*** 49,54 ****
--- 51,66 ----
#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
***************
*** 123,135 ****
}
double
xerf (double x)
{
#if defined (HAVE_ERF)
return erf (x);
#else
! (*current_liboctave_error_handler)
! ("erf (x) not available on this system");
#endif
}
--- 135,184 ----
}
double
+ xacosh (double x)
+ {
+ #if defined (HAVE_ACOSH)
+ return acosh (x);
+ #else
+ double y;
+ F77_YXFCN (dacosh, DACOSH, y, (&x));
+ return y;
+ #endif
+ }
+
+ double
+ xasinh (double x)
+ {
+ #if defined (HAVE_ASINH)
+ return asinh (x);
+ #else
+ double y;
+ F77_YXFCN (dasinh, DASINH, y, (&x));
+ return y;
+ #endif
+ }
+
+ double
+ xatanh (double x)
+ {
+ #if defined (HAVE_ATANH)
+ return atanh (x);
+ #else
+ double y;
+ F77_YXFCN (datanh, DATANH, y, (&x));
+ return y;
+ #endif
+ }
+
+ double
xerf (double x)
{
#if defined (HAVE_ERF)
return erf (x);
#else
! double y;
! F77_YXFCN (derf, DERF, y, (x));
! return y;
#endif
}
***************
*** 139,146 ****
#if defined (HAVE_ERFC)
return erfc (x);
#else
! (*current_liboctave_error_handler)
! ("erfc (x) not available on this system");
#endif
}
--- 188,196 ----
#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.23.orig/liboctave/lo-mappers.h i:/project/C/octave-2.1.23/liboctave/lo-mappers.h
*** n:/project/C/octave-2.1.23.orig/liboctave/lo-mappers.h Tue Jul 13 04:35:32 1999
--- i:/project/C/octave-2.1.23/liboctave/lo-mappers.h Fri Dec 24 14:45:02 1999
***************
*** 20,25 ****
--- 20,27 ----
*/
+ /* Modified by Klaus Gebhardt, 1999 */
+
#if !defined (octave_liboctave_mappers_h)
#define octave_liboctave_mappers_h 1
***************
*** 32,37 ****
--- 34,43 ----
extern double real (double x);
extern double round (double x);
extern double signum (double x);
+
+ extern double xacosh (double x);
+ extern double xasinh (double x);
+ extern double xatanh (double x);
extern double xerf (double x);
extern double xerfc (double x);
diff -cwr n:/project/C/octave-2.1.23.orig/liboctave/lo-specfun.cc i:/project/C/octave-2.1.23/liboctave/lo-specfun.cc
*** n:/project/C/octave-2.1.23.orig/liboctave/lo-specfun.cc Sat Dec 5 00:20:16 1998
--- i:/project/C/octave-2.1.23/liboctave/lo-specfun.cc Fri Dec 24 13:35:56 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.23.orig/liboctave/lo-sysdep.cc i:/project/C/octave-2.1.23/liboctave/lo-sysdep.cc
*** n:/project/C/octave-2.1.23.orig/liboctave/lo-sysdep.cc Thu Nov 27 03:02:26 1997
--- i:/project/C/octave-2.1.23/liboctave/lo-sysdep.cc Fri Dec 24 13:35:56 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.23.orig/liboctave/oct-shlib.cc i:/project/C/octave-2.1.23/liboctave/oct-shlib.cc
*** n:/project/C/octave-2.1.23.orig/liboctave/oct-shlib.cc Fri Oct 29 22:52:12 1999
--- i:/project/C/octave-2.1.23/liboctave/oct-shlib.cc Fri Dec 24 18:56:46 1999
***************
*** 20,25 ****
--- 20,27 ----
*/
+ /* Modified by Klaus Gebhardt, 1999 */
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
diff -cwr n:/project/C/octave-2.1.23.orig/liboctave/oct-syscalls.cc i:/project/C/octave-2.1.23/liboctave/oct-syscalls.cc
*** n:/project/C/octave-2.1.23.orig/liboctave/oct-syscalls.cc Fri Feb 6 22:27:10 1998
--- i:/project/C/octave-2.1.23/liboctave/oct-syscalls.cc Sat Dec 25 12:20:42 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"
***************
*** 48,53 ****
--- 52,83 ----
nm ## ": not supported on this system"
int
+ octave_syscalls::dup (int old_fd)
+ {
+ string msg;
+ return dup (old_fd);
+ }
+
+ int
+ octave_syscalls::dup (int old_fd, string& msg)
+ {
+ msg = string ();
+
+ int status = -1;
+
+ #if defined (HAVE_DUP)
+ status = ::dup (old_fd);
+
+ if (status < 0)
+ msg = ::strerror (errno);
+ #else
+ msg = NOT_SUPPORTED ("dup");
+ #endif
+
+ return status;
+ }
+
+ int
octave_syscalls::dup2 (int old_fd, int new_fd)
{
string msg;
***************
*** 99,104 ****
--- 129,180 ----
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.23.orig/liboctave/oct-syscalls.h i:/project/C/octave-2.1.23/liboctave/oct-syscalls.h
*** n:/project/C/octave-2.1.23.orig/liboctave/oct-syscalls.h Fri Feb 6 07:00:08 1998
--- i:/project/C/octave-2.1.23/liboctave/oct-syscalls.h Sat Dec 25 10:52:34 1999
***************
*** 20,25 ****
--- 20,27 ----
*/
+ /* Modified by Klaus Gebhardt, 1999 */
+
#if !defined (octave_syscalls_h)
#define octave_syscalls_h 1
***************
*** 34,44 ****
--- 36,54 ----
struct
octave_syscalls
{
+ static int dup (int);
+ static int dup (int, string&);
+
static int dup2 (int, int);
static int dup2 (int, int, string&);
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.23.orig/liboctave/pathsearch.cc i:/project/C/octave-2.1.23/liboctave/pathsearch.cc
*** n:/project/C/octave-2.1.23.orig/liboctave/pathsearch.cc Thu Oct 29 00:11:10 1998
--- i:/project/C/octave-2.1.23/liboctave/pathsearch.cc Fri Dec 24 13:35:56 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.23.orig/liboctave/str-vec.cc i:/project/C/octave-2.1.23/liboctave/str-vec.cc
*** n:/project/C/octave-2.1.23.orig/liboctave/str-vec.cc Fri Jun 6 10:29:28 1997
--- i:/project/C/octave-2.1.23/liboctave/str-vec.cc Sat Dec 25 12:27:38 1999
***************
*** 107,114 ****
void
string_vector::delete_c_str_vec (const char * const *v)
{
! while (*v)
! delete [] *v;
delete [] v;
}
--- 107,116 ----
void
string_vector::delete_c_str_vec (const char * const *v)
{
! int i = 0;
!
! while (v[i])
! delete [] v[i++];
delete [] v;
}
diff -cwr n:/project/C/octave-2.1.23.orig/libcruft/misc/dostop.c i:/project/C/octave-2.1.23/libcruft/misc/dostop.c
*** n:/project/C/octave-2.1.23.orig/libcruft/misc/dostop.c Thu Mar 27 17:18:28 1997
--- i:/project/C/octave-2.1.23/libcruft/misc/dostop.c Fri Dec 24 13:35:58 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.23.orig/libcruft/misc/f77-fcn.h i:/project/C/octave-2.1.23/libcruft/misc/f77-fcn.h
*** n:/project/C/octave-2.1.23.orig/libcruft/misc/f77-fcn.h Thu Mar 27 17:18:28 1997
--- i:/project/C/octave-2.1.23/libcruft/misc/f77-fcn.h Fri Dec 24 13:35:58 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.23.orig/src/cutils.c i:/project/C/octave-2.1.23/src/cutils.c
*** n:/project/C/octave-2.1.23.orig/src/cutils.c Fri Nov 12 17:18:16 1999
--- i:/project/C/octave-2.1.23/src/cutils.c Fri Dec 24 15:50:58 1999
***************
*** 48,53 ****
--- 48,60 ----
usleep (useconds);
+ #elif defined (HAVE__SLEEP2)
+
+ int delay = useconds / 1000;
+
+ if (delay > 0)
+ _sleep2 (delay);
+
#elif defined (HAVE_SELECT)
struct timeval delay;
diff -cwr n:/project/C/octave-2.1.23.orig/src/defaults.cc i:/project/C/octave-2.1.23/src/defaults.cc
*** n:/project/C/octave-2.1.23.orig/src/defaults.cc Tue Nov 23 21:54:24 1999
--- i:/project/C/octave-2.1.23/src/defaults.cc Fri Dec 24 13:35:58 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.23.orig/src/defun-int.h i:/project/C/octave-2.1.23/src/defun-int.h
*** n:/project/C/octave-2.1.23.orig/src/defun-int.h Sat Nov 20 04:05:44 1999
--- i:/project/C/octave-2.1.23/src/defun-int.h Fri Dec 24 16:08:58 1999
***************
*** 20,25 ****
--- 20,27 ----
*/
+ /* Modified by Klaus Gebhardt, 1999 */
+
#if !defined (octave_defun_int_h)
#define octave_defun_int_h 1
***************
*** 175,181 ****
install_builtin_mapper \
(new octave_mapper (ch_map, d_b_map, c_b_map, d_d_map, d_c_map, \
c_c_map, lo, hi, \
! can_ret_cmplx_for_real, #name))
#endif /* ! MAKE_BUILTINS */
--- 177,183 ----
install_builtin_mapper \
(new octave_mapper (ch_map, d_b_map, c_b_map, d_d_map, d_c_map, \
c_c_map, lo, hi, \
! can_ret_cmplx_for_real, #name, #doc))
#endif /* ! MAKE_BUILTINS */
diff -cwr n:/project/C/octave-2.1.23.orig/src/DLD-FUNCTIONS/qz.cc i:/project/C/octave-2.1.23/src/DLD-FUNCTIONS/qz.cc
*** n:/project/C/octave-2.1.23.orig/src/DLD-FUNCTIONS/qz.cc Tue Nov 23 20:07:18 1999
--- i:/project/C/octave-2.1.23/src/DLD-FUNCTIONS/qz.cc Fri Dec 24 13:35:58 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.23.orig/src/DLD-FUNCTIONS/rand.cc i:/project/C/octave-2.1.23/src/DLD-FUNCTIONS/rand.cc
*** n:/project/C/octave-2.1.23.orig/src/DLD-FUNCTIONS/rand.cc Sun Nov 21 17:26:06 1999
--- i:/project/C/octave-2.1.23/src/DLD-FUNCTIONS/rand.cc Fri Dec 24 13:35:58 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.23.orig/src/dynamic-ld.cc i:/project/C/octave-2.1.23/src/dynamic-ld.cc
*** n:/project/C/octave-2.1.23.orig/src/dynamic-ld.cc Tue Nov 23 21:54:24 1999
--- i:/project/C/octave-2.1.23/src/dynamic-ld.cc Fri Dec 24 18:47:56 1999
***************
*** 57,67 ****
static void *search (const string& fcn_name, octave_shlib& shl,
octave_shlib::name_mangler mangler = 0);
! private:
octave_shlib_list (void) { }
~octave_shlib_list (void) { }
void do_append (const octave_shlib& shl);
--- 57,69 ----
static void *search (const string& fcn_name, octave_shlib& shl,
octave_shlib::name_mangler mangler = 0);
! protected:
octave_shlib_list (void) { }
~octave_shlib_list (void) { }
+
+ private:
void do_append (const octave_shlib& shl);
diff -cwr n:/project/C/octave-2.1.23.orig/src/file-io.cc i:/project/C/octave-2.1.23/src/file-io.cc
*** n:/project/C/octave-2.1.23.orig/src/file-io.cc Wed Dec 15 21:48:44 1999
--- i:/project/C/octave-2.1.23/src/file-io.cc Fri Dec 24 13:35: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"
***************
*** 1479,1484 ****
--- 1482,1522 ----
}
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.23.orig/src/help.cc i:/project/C/octave-2.1.23/src/help.cc
*** n:/project/C/octave-2.1.23.orig/src/help.cc Tue Nov 23 21:54:24 1999
--- i:/project/C/octave-2.1.23/src/help.cc Sat Dec 25 19:24:36 1999
***************
*** 20,25 ****
--- 20,27 ----
*/
+ /* Modified by Klaus Gebhardt, 1996 */
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
***************
*** 69,74 ****
--- 71,94 ----
#include "variables.h"
#include "version.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;
***************
*** 499,504 ****
--- 519,526 ----
static int
try_info (const string& nm)
{
+ if (Vinfo_prog.length () > 0)
+ {
int status = 0;
static char *cmd_str = 0;
***************
*** 529,551 ****
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++)
--- 551,646 ----
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++)
***************
*** 597,604 ****
if (looks_like_texinfo (msg, pos))
{
- string tmp_file_name = file_ops::tempnam ("", "");
-
int cols = command_editor::terminal_cols ();
if (cols > 16)
--- 692,697 ----
***************
*** 611,616 ****
--- 704,745 ----
cols = 72;
ostrstream buf;
+
+ #ifdef __EMX__
+ string tmp_file_name_1 = file_ops::tempnam ("", "hlp-");
+ string tmp_file_name_2 = file_ops::tempnam ("", "hlp-");
+
+ ofstream tmp_file_1 (tmp_file_name_1.c_str ());
+ tmp_file_1 << msg.substr (pos+1);
+ tmp_file_1.close ();
+
+ buf << "sed -e \"s/^[#%]* *//g\" "
+ << tmp_file_name_1
+ << " | makeinfo"
+ << " -D \"VERSION " << OCTAVE_VERSION << "\""
+ << " -D \"OCTAVEHOME " << OCTAVE_PREFIX << "\""
+ << " -D \"TARGETHOSTTYPE " << CANONICAL_HOST_TYPE << "\""
+ << " --fill-column " << cols
+ << " --no-warn"
+ << " --no-validate"
+ << " --no-headers"
+ << " --output " << tmp_file_name_2
+ << " >NUL 2>&1"
+ << ends;
+
+ _IO_system (buf.str(), P_WAIT);
+
+ ifstream tmp_file_2 (tmp_file_name_2.c_str ());
+
+ int c;
+ while ((c = tmp_file_2.get ()) != EOF)
+ os << (char) c;
+
+ tmp_file_2.close ();
+
+ file_ops::unlink (tmp_file_name_2);
+ file_ops::unlink (tmp_file_name_1);
+ #else
buf << "sed 's/^[#%]+ *//' | makeinfo"
<< " -D \"VERSION " << OCTAVE_VERSION << "\""
<< " -D \"OCTAVEHOME " << OCTAVE_PREFIX << "\""
***************
*** 624,629 ****
--- 753,760 ----
<< " > /dev/null 2>&1"
<< ends;
+ string tmp_file_name = file_ops::tempnam ("", "");
+
char *cmd = buf.str ();
oprocstream filter (cmd);
***************
*** 648,653 ****
--- 779,785 ----
}
else
os << msg;
+ #endif
}
else
os << msg;
***************
*** 1018,1023 ****
--- 1150,1156 ----
string s = builtin_string_variable ("INFO_PROGRAM");
+ #ifndef __EMX__
if (s.empty ())
{
gripe_invalid_value_specified ("INFO_PROGRAM");
***************
*** 1025,1030 ****
--- 1158,1166 ----
}
else
Vinfo_prog = s;
+ #else
+ Vinfo_prog = s;
+ #endif
return status;
}
diff -cwr n:/project/C/octave-2.1.23.orig/src/input.cc i:/project/C/octave-2.1.23/src/input.cc
*** n:/project/C/octave-2.1.23.orig/src/input.cc Tue Nov 23 21:54:24 1999
--- i:/project/C/octave-2.1.23/src/input.cc Fri Dec 24 13:35:58 1999
***************
*** 20,25 ****
--- 20,27 ----
*/
+ /* Modified by Klaus Gebhardt, 1996-1999 */
+
// Get command input interactively or from files.
#ifdef HAVE_CONFIG_H
***************
*** 119,124 ****
--- 121,130 ----
// 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;
***************
*** 173,179 ****
}
else
{
! if (! s.empty () && (interactive || forced_interactive))
{
FILE *stream = command_editor::get_output_stream ();
--- 179,186 ----
}
else
{
! if (! s.empty () &&
! (interactive || forced_interactive || really_forced_interactive))
{
FILE *stream = command_editor::get_output_stream ();
***************
*** 199,205 ****
Vlast_prompt_time.stamp ();
! if ((interactive || forced_interactive)
&& (! (reading_fcn_file || reading_script_file)))
{
string ps = (promptflag > 0) ? Vps1 : Vps2;
--- 206,212 ----
Vlast_prompt_time.stamp ();
! if ((interactive || forced_interactive || really_forced_interactive)
&& (! (reading_fcn_file || reading_script_file)))
{
string ps = (promptflag > 0) ? Vps1 : Vps2;
***************
*** 344,350 ****
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 ());
--- 351,357 ----
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 ());
***************
*** 521,526 ****
--- 528,538 ----
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.23.orig/src/input.h i:/project/C/octave-2.1.23/src/input.h
*** n:/project/C/octave-2.1.23.orig/src/input.h Thu Jul 15 21:54:26 1999
--- i:/project/C/octave-2.1.23/src/input.h Fri Dec 24 13:35:58 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)
***************
*** 61,66 ****
--- 63,72 ----
// 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.23.orig/src/lex.l i:/project/C/octave-2.1.23/src/lex.l
*** n:/project/C/octave-2.1.23.orig/src/lex.l Thu Dec 16 05:51:46 1999
--- i:/project/C/octave-2.1.23/src/lex.l Fri Dec 24 16:33:16 1999
***************
*** 20,25 ****
--- 20,27 ----
*/
+ /* Modified by Klaus Gebhardt, 1996 - 1999 */
+
%s TEXT_FCN
%s MATRIX
***************
*** 194,200 ****
D [0-9]
S [ \t]
! NL ((\n)|(\r\n))
SNL ({S}|{NL})
EL (\.\.\.)
BS (\\)
--- 196,202 ----
D [0-9]
S [ \t]
! NL ((\n)|(\r)|(\r\n)|())
SNL ({S}|{NL})
EL (\.\.\.)
BS (\\)
***************
*** 247,253 ****
return handle_string (yytext[0], true);
}
! <TEXT_FCN>[^ \t\n\;\,\"\'][^ \t\n\;\,]*{S}* {
string tok = strip_trailing_whitespace (yytext);
TOK_PUSH_AND_RETURN (tok, TEXT);
}
--- 249,255 ----
return handle_string (yytext[0], true);
}
! <TEXT_FCN>[^ \t\r\n\;\,\"\'][^ \t\r\n\;\,]*{S}* {
string tok = strip_trailing_whitespace (yytext);
TOK_PUSH_AND_RETURN (tok, TEXT);
}
***************
*** 568,574 ****
else
{
int c;
! while ((c = yyinput ()) != EOF && c != '\n')
; // Eat comment.
}
--- 570,576 ----
else
{
int c;
! while ((c = yyinput ()) != EOF && c != '\n' && c != '\r' && c != '')
; // Eat comment.
}
***************
*** 757,763 ****
// 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);
--- 759,765 ----
// 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);
***************
*** 778,784 ****
char c;
while ((c = *s++) != '\0')
{
! if (c == '\n')
current_input_column = 1;
else
current_input_column++;
--- 780,786 ----
char c;
while ((c = *s++) != '\0')
{
! if (c == '\n' || c == '\r' || c == '')
current_input_column = 1;
else
current_input_column++;
***************
*** 1180,1186 ****
bool begin_comment = true;
bool in_comment = true;
! int c = 0;
while ((c = yyinput ()) != EOF)
{
--- 1182,1188 ----
bool begin_comment = true;
bool in_comment = true;
! int c = 0, d, ct;
while ((c = yyinput ()) != EOF)
{
***************
*** 1194,1205 ****
if (in_comment)
{
! help_buf += (char) c;
- if (c == '\n')
in_comment = false;
}
else
{
switch (c)
{
--- 1196,1225 ----
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)
{
***************
*** 1278,1284 ****
unput (c2);
}
else
! retval = match_any (c1, ",;\n]");
unput (c1);
--- 1298,1304 ----
unput (c2);
}
else
! retval = match_any (c1, ",;\n\r]");
unput (c1);
***************
*** 1468,1473 ****
--- 1488,1495 ----
retval |= ATE_SPACE_OR_TAB;
break;
+ case '':
+ case '\r':
case '\n':
retval |= ATE_NEWLINE;
in_comment = false;
***************
*** 1600,1605 ****
--- 1622,1628 ----
goto cleanup;
break;
+ case '':
case '\n':
current_input_column = 0;
promptflag--;
***************
*** 1720,1726 ****
if (! have_ellipsis_continuation (false))
buf << (char) c;
}
! else if (c == '\n')
{
error ("unterminated string constant");
break;
--- 1743,1749 ----
if (! have_ellipsis_continuation (false))
buf << (char) c;
}
! else if (c == '\n' || c == '\r' || c == '')
{
error ("unterminated string constant");
break;
***************
*** 2133,2138 ****
--- 2156,2163 ----
case ',':
break;
+ case '':
+ case '\r':
case '\n':
if (in_comment)
in_comment = false;
diff -cwr n:/project/C/octave-2.1.23.orig/src/mappers.cc i:/project/C/octave-2.1.23/src/mappers.cc
*** n:/project/C/octave-2.1.23.orig/src/mappers.cc Wed Dec 15 21:48:44 1999
--- i:/project/C/octave-2.1.23/src/mappers.cc Fri Dec 24 15:36:04 1999
***************
*** 20,25 ****
--- 20,27 ----
*/
+ /* Modified by Klaus Gebhardt, 1999 */
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
***************
*** 160,166 ****
acos (X): compute the inverse cosine of X for each element of X\n\
@end deftypefn");
! DEFUN_MAPPER (acosh, 0, 0, 0, acosh, 0, acosh, 1.0, DBL_MAX, 1,
"-*- texinfo -*-\n\
@deftypefn {Mapping Function} {} acosh (@var{X})\n\
acosh (X): compute the inverse hyperbolic cosine of X for each element of X.\n\
--- 162,168 ----
acos (X): compute the inverse cosine of X for each element of X\n\
@end deftypefn");
! DEFUN_MAPPER (acosh, 0, 0, 0, xacosh, 0, acosh, 1.0, DBL_MAX, 1,
"-*- texinfo -*-\n\
@deftypefn {Mapping Function} {} acosh (@var{X})\n\
acosh (X): compute the inverse hyperbolic cosine of X for each element of X.\n\
***************
*** 201,207 ****
asin (X): compute inverse sin (X) for each element of X\n\
@end deftypefn");
! DEFUN_MAPPER (asinh, 0, 0, 0, asinh, 0, asinh, 0.0, 0.0, 0,
"-*- texinfo -*-\n\
@deftypefn {Mapping Function} {} asinh (@var{X})\n\
asinh (X): compute the inverse hyperbolic sin (X) for each element of X\n\
--- 203,209 ----
asin (X): compute inverse sin (X) for each element of X\n\
@end deftypefn");
! DEFUN_MAPPER (asinh, 0, 0, 0, xasinh, 0, asinh, 0.0, 0.0, 0,
"-*- texinfo -*-\n\
@deftypefn {Mapping Function} {} asinh (@var{X})\n\
asinh (X): compute the inverse hyperbolic sin (X) for each element of X\n\
***************
*** 213,219 ****
atan (X): compute the inverse tangent of (X) for each element of X\n\
@end deftypefn");
! DEFUN_MAPPER (atanh, 0, 0, 0, atanh, 0, atanh, -1.0, 1.0, 1,
"-*- texinfo -*-\n\
@deftypefn {Mapping Function} {} atanh (@var{X})\n\
atanh (X): compute the inverse hyperbolic tanget of X for each element of X\n\
--- 215,221 ----
atan (X): compute the inverse tangent of (X) for each element of X\n\
@end deftypefn");
! DEFUN_MAPPER (atanh, 0, 0, 0, xatanh, 0, atanh, -1.0, 1.0, 1,
"-*- texinfo -*-\n\
@deftypefn {Mapping Function} {} atanh (@var{X})\n\
atanh (X): compute the inverse hyperbolic tanget of X for each element of X\n\
diff -cwr n:/project/C/octave-2.1.23.orig/src/mkbuiltins i:/project/C/octave-2.1.23/src/mkbuiltins
*** n:/project/C/octave-2.1.23.orig/src/mkbuiltins Sat Nov 20 04:05:44 1999
--- i:/project/C/octave-2.1.23/src/mkbuiltins Fri Dec 24 13:35:58 1999
***************
*** 56,62 ****
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 "}"
--- 56,62 ----
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 "}"
***************
*** 65,71 ****
for file in $VAR_FILES; do
f=`echo $file | sed 's,^\./,,; s/-/_/g'`
! echo "extern void symbols_of_${f} (void);"
done
cat << \EOF
--- 65,71 ----
for file in $VAR_FILES; do
f=`echo $file | sed 's,^\./,,; s/-/_/g'`
! echo "extern void symbols_of_${f##*/} (void);"
done
cat << \EOF
***************
*** 77,83 ****
for file in $VAR_FILES; do
f=`echo $file | sed 's,^\./,,; s/-/_/g'`
! echo " symbols_of_${f} ();"
done
cat << \EOF
--- 77,83 ----
for file in $VAR_FILES; do
f=`echo $file | sed 's,^\./,,; s/-/_/g'`
! echo " symbols_of_${f##*/} ();"
done
cat << \EOF
***************
*** 90,96 ****
for file in $DEF_FILES; do
fcn=`echo $file | sed 's,^\./,,; s/\.df//; s/-/_/g'`
! echo " install_${fcn}_fcns ();"
done
cat << \EOF
--- 90,96 ----
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.23.orig/src/mkops i:/project/C/octave-2.1.23/src/mkops
*** n:/project/C/octave-2.1.23.orig/src/mkops Sat Dec 5 00:20:22 1998
--- i:/project/C/octave-2.1.23/src/mkops Fri Dec 24 13:35:58 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.23.orig/src/oct-hist.cc i:/project/C/octave-2.1.23/src/oct-hist.cc
*** n:/project/C/octave-2.1.23.orig/src/oct-hist.cc Tue Nov 23 21:54:28 1999
--- i:/project/C/octave-2.1.23/src/oct-hist.cc Fri Dec 24 13:35:58 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.23.orig/src/oct-stream.cc i:/project/C/octave-2.1.23/src/oct-stream.cc
*** n:/project/C/octave-2.1.23.orig/src/oct-stream.cc Fri Nov 5 17:55:18 1999
--- i:/project/C/octave-2.1.23/src/oct-stream.cc Sat Dec 25 16:26:22 1999
***************
*** 20,25 ****
--- 20,27 ----
*/
+ /* Modified by Klaus Gebhardt, 1999 */
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
***************
*** 30,35 ****
--- 32,38 ----
#include <iomanip.h>
#include <strstream.h>
+ #include "file-ops.h"
#include "lo-ieee.h"
#include "lo-mappers.h"
#include "lo-utils.h"
***************
*** 762,767 ****
--- 765,781 ----
}
void
+ octave_base_stream::close (void)
+ {
+ int status = file_ops::close (file_number ());
+ if (status >= 0) open_state = false;
+ }
+
+
+
+
+
+ void
octave_base_stream::error (const string& msg)
{
fail = true;
***************
*** 1273,1279 ****
// XXX FIXME XXX -- is this the right thing to do?
! if (interactive && name () == "stdin")
{
is.clear ();
--- 1287,1293 ----
// XXX FIXME XXX -- is this the right thing to do?
! if ((interactive || really_forced_interactive) && name () == "stdin")
{
is.clear ();
***************
*** 1353,1359 ****
// XXX FIXME XXX -- is this the right thing to do?
! if (interactive && name () == "stdin")
{
is.clear ();
--- 1367,1373 ----
// XXX FIXME XXX -- is this the right thing to do?
! if ((interactive || really_forced_interactive) && name () == "stdin")
{
is.clear ();
***************
*** 1536,1542 ****
// XXX FIXME XXX -- is this the right thing to do?
! if (interactive && name () == "stdin")
{
is.clear ();
--- 1550,1556 ----
// XXX FIXME XXX -- is this the right thing to do?
! if ((interactive || really_forced_interactive) && name () == "stdin")
{
is.clear ();
***************
*** 1588,1594 ****
// XXX FIXME XXX -- is this the right thing to do?
! if (interactive && name () == "stdin")
{
is.clear ();
--- 1602,1608 ----
// XXX FIXME XXX -- is this the right thing to do?
! if ((interactive || really_forced_interactive) && name () == "stdin")
{
is.clear ();
***************
*** 1923,1928 ****
--- 1937,1943 ----
template void
do_printf_conv (ostream&, const char*, int, int, int, bool, const char*);
+
int
octave_base_stream::do_printf (printf_format_list& fmt_list,
const octave_value_list& args)
***************
*** 2870,2877 ****
ostrstream buf;
buf << "\n"
! << " number mode arch name\n"
! << " ------ ---- ---- ----\n";
for (int i = 0; i < curr_len; i++)
{
--- 2885,2892 ----
ostrstream buf;
buf << "\n"
! << " number file handle mode arch name\n"
! << " ------ ----------- ---- ---- ----\n";
for (int i = 0; i < curr_len; i++)
{
***************
*** 2889,2894 ****
--- 2904,2910 ----
buf << " "
<< setiosflags (ios::right)
<< setw (4) << i << " "
+ << setw (8) << os.file_number () << " "
<< setiosflags (ios::left)
<< setw (3) << mode.c_str () << " "
<< setw (9) << arch.c_str () << " "
diff -cwr n:/project/C/octave-2.1.23.orig/src/oct-stream.h i:/project/C/octave-2.1.23/src/oct-stream.h
*** n:/project/C/octave-2.1.23.orig/src/oct-stream.h Fri Nov 5 09:11:58 1999
--- i:/project/C/octave-2.1.23/src/oct-stream.h Sat Dec 25 13:53:04 1999
***************
*** 20,25 ****
--- 20,27 ----
*/
+ /* Modified by Klaus Gebhardt, 1999 */
+
#if !defined (octave_octave_stream_h)
#define octave_octave_stream_h 1
***************
*** 32,37 ****
--- 34,43 ----
class ostream;
class ostrstream;
+ #ifdef __EMX__
+ #include <iostream.h>
+ #endif
+
#include <string>
#include "Array.h"
***************
*** 262,268 ****
bool is_open (void) const { return open_state; }
! void close (void) { open_state = false; }
int file_number (void);
--- 268,274 ----
bool is_open (void) const { return open_state; }
! void close (void);
int file_number (void);
diff -cwr n:/project/C/octave-2.1.23.orig/src/octave.cc i:/project/C/octave-2.1.23/src/octave.cc
*** n:/project/C/octave-2.1.23.orig/src/octave.cc Fri Oct 29 22:39:24 1999
--- i:/project/C/octave-2.1.23/src/octave.cc Fri Dec 24 18:58:02 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"
***************
*** 104,110 ****
// 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\
--- 111,117 ----
// 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\
***************
*** 113,119 ****
// 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.
--- 120,126 ----
// 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\
***************
*** 418,423 ****
--- 427,436 ----
forced_interactive = true;
break;
+ case 'I':
+ really_forced_interactive = true;
+ break;
+
case 'p':
if (args.optarg ())
bind_builtin_variable ("LOADPATH", args.optarg ());
***************
*** 501,506 ****
--- 514,526 ----
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);
***************
*** 560,576 ****
// 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 ();
--- 580,598 ----
// 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.23.orig/src/OPERATORS/op-str-str.cc i:/project/C/octave-2.1.23/src/OPERATORS/op-str-str.cc
*** n:/project/C/octave-2.1.23.orig/src/OPERATORS/op-str-str.cc Fri Oct 30 21:26:30 1998
--- i:/project/C/octave-2.1.23/src/OPERATORS/op-str-str.cc Fri Dec 24 13:36:00 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.23.orig/src/pager.cc i:/project/C/octave-2.1.23/src/pager.cc
*** n:/project/C/octave-2.1.23.orig/src/pager.cc Tue Nov 23 21:54:28 1999
--- i:/project/C/octave-2.1.23/src/pager.cc Fri Dec 24 13:36:00 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.23.orig/src/parse.y i:/project/C/octave-2.1.23/src/parse.y
*** n:/project/C/octave-2.1.23.orig/src/parse.y Thu Dec 16 05:51:46 1999
--- i:/project/C/octave-2.1.23/src/parse.y Sat Dec 25 10:50:00 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;
***************
*** 283,289 ****
{ \
global_command = 0; \
yyerrok; \
! if (interactive || forced_interactive) \
YYACCEPT; \
else \
YYABORT; \
--- 291,297 ----
{ \
global_command = 0; \
yyerrok; \
! if (interactive || forced_interactive || really_forced_interactive) \
YYACCEPT; \
else \
YYABORT; \
***************
*** 405,411 ****
%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
--- 413,419 ----
%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
***************
*** 448,457 ****
--- 456,473 ----
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; }
;
***************
*** 1039,1050 ****
--- 1055,1068 ----
}
| 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 ();
***************
*** 1367,1378 ****
--- 1385,1400 ----
{ $$ = ';'; }
| '\n'
{ $$ = '\n'; }
+ | '\r'
+ { $$ = '\r'; }
| sep ','
{ $$ = $1; }
| sep ';'
{ $$ = $1; }
| sep '\n'
{ $$ = $1; }
+ | sep '\r'
+ { $$ = $1; }
;
opt_sep : // empty
***************
*** 2593,2598 ****
--- 2615,2621 ----
case 0:
case ',':
case '\n':
+ case '\r':
if (warn_missing_semi)
maybe_warn_missing_semi (list);
break;
***************
*** 2606,2611 ****
--- 2629,2639 ----
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 ();
***************
*** 2624,2629 ****
--- 2652,2661 ----
unwind_protect_ptr (curr_sym_tab);
+ if (setjmp(toplevel) == 0)
+ {
+ octave_set_interrupt_handler (old_interrupt_handler);
+
int retval;
do
{
***************
*** 2661,2668 ****
--- 2693,2706 ----
}
}
while (retval == 0);
+ }
+ else error ("script execution interrupted ...");
unwind_protect::run_frame ("parse_and_execute");
+
+ octave_ignore_interrupts ();
+ toplevel = old_toplevel;
+ octave_set_interrupt_handler (old_interrupt_handler);
}
static void
***************
*** 2675,2680 ****
--- 2713,2721 ----
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);
***************
*** 2711,2716 ****
--- 2752,2759 ----
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
***************
*** 2782,2791 ****
if (! have_help_text)
{
first_comments_seen = true;
! help_txt += (char) c;
}
! if (c == '\n')
{
if (update_pos)
{
--- 2825,2846 ----
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)
{
***************
*** 2800,2807 ****
{
if (update_pos)
current_input_column--;
ungetc (c, ffile);
! if (c == '\n')
break;
}
else
--- 2855,2866 ----
{
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
***************
*** 2819,2824 ****
--- 2878,2889 ----
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;
***************
*** 2838,2844 ****
--- 2903,2913 ----
default:
if (update_pos)
current_input_column--;
+ #if defined (EMX09C)
+ fseek (ffile, -1l, SEEK_CUR);
+ #else
ungetc (c, ffile);
+ #endif
goto done;
}
}
***************
*** 2865,2871 ****
if (! path.empty ())
{
! FILE *fptr = fopen (path.c_str (), "r");
if (fptr)
{
--- 2934,2940 ----
if (! path.empty ())
{
! FILE *fptr = fopen (path.c_str (), "rb");
if (fptr)
{
***************
*** 3256,3262 ****
octave_value_list tmp = eval_string (s, silent, parse_status, 1);
- if (! tmp.empty ())
retval = tmp(0);
return retval;
--- 3325,3330 ----
diff -cwr n:/project/C/octave-2.1.23.orig/src/pt-plot.cc i:/project/C/octave-2.1.23/src/pt-plot.cc
*** n:/project/C/octave-2.1.23.orig/src/pt-plot.cc Tue Nov 23 21:54:28 1999
--- i:/project/C/octave-2.1.23/src/pt-plot.cc Fri Dec 24 13:36:00 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)
***************
*** 1132,1137 ****
--- 1140,1146 ----
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.23.orig/src/sighandlers.cc i:/project/C/octave-2.1.23/src/sighandlers.cc
*** n:/project/C/octave-2.1.23.orig/src/sighandlers.cc Fri Nov 5 20:34:28 1999
--- i:/project/C/octave-2.1.23/src/sighandlers.cc Fri Dec 24 16:41:02 1999
***************
*** 20,25 ****
--- 20,27 ----
*/
+ /* Modified by Klaus Gebhardt, 1995 - 1996 */
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
***************
*** 40,45 ****
--- 42,52 ----
#include "cmd-edit.h"
+ #ifdef __EMX__
+ #include <float.h>
+ #include <sys/uflags.h>
+ #endif
+
#include "error.h"
#include "load-save.h"
#include "pager.h"
***************
*** 84,90 ****
#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) \
--- 91,97 ----
#if defined (__EMX__)
#define MAYBE_ACK_SIGNAL(sig) \
! signal (sig, SIG_ACK)
#define ACK_USES_SIG 1
#else
#define MAYBE_ACK_SIGNAL(sig) \
***************
*** 132,138 ****
{
been_there_done_that = true;
! cerr << "error: " << sig_name << " -- stopping myself...\n";
save_user_variables ();
--- 139,145 ----
{
been_there_done_that = true;
! cerr << "\n\nerror: " << sig_name << " -- stopping myself...\n";
save_user_variables ();
***************
*** 156,161 ****
--- 163,171 ----
if (can_interrupt)
{
+ #ifdef __EMX__
+ _uflags (_UF_SBRK_MODEL, _UF_SBRK_ARBITRARY);
+ #endif
jump_to_top_level ();
panic_impossible ();
}
***************
*** 174,179 ****
--- 184,193 ----
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
***************
*** 190,196 ****
// Handle SIGCHLD.
static RETSIGTYPE
! sigchld_handler (int /* sig */)
{
volatile octave_interrupt_handler saved_interrupt_handler
= octave_ignore_interrupts ();
--- 204,210 ----
// Handle SIGCHLD.
static RETSIGTYPE
! sigchld_handler (int sig)
{
volatile octave_interrupt_handler saved_interrupt_handler
= octave_ignore_interrupts ();
***************
*** 202,216 ****
#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 ();
! for (int i = 0; i < n; i++)
{
octave_child& elt = octave_child_list::elem (i);
--- 216,231 ----
#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);
***************
*** 226,244 ****
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
--- 241,265 ----
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
***************
*** 251,257 ****
#if defined (__alpha__)
static RETSIGTYPE
! sigfpe_handler (int /* sig */)
{
MAYBE_ACK_SIGNAL (SIGFPE);
--- 272,278 ----
#if defined (__alpha__)
static RETSIGTYPE
! sigfpe_handler (int sig)
{
MAYBE_ACK_SIGNAL (SIGFPE);
***************
*** 261,266 ****
--- 282,291 ----
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 ();
}
***************
*** 312,318 ****
}
static RETSIGTYPE
! sigpipe_handler (int /* sig */)
{
MAYBE_ACK_SIGNAL (SIGPIPE);
--- 337,343 ----
}
static RETSIGTYPE
! sigpipe_handler (int sig)
{
MAYBE_ACK_SIGNAL (SIGPIPE);
***************
*** 335,345 ****
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;
--- 360,374 ----
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;
***************
*** 362,377 ****
--- 391,429 ----
}
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;
***************
*** 465,472 ****
--- 517,528 ----
#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);
***************
*** 639,648 ****
}
void
! octave_child_list::insert (pid_t pid, octave_child::dead_child_handler f)
{
if (instance_ok ())
! instance->do_insert (pid, f);
}
void
--- 695,705 ----
}
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
***************
*** 667,673 ****
}
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.
--- 724,731 ----
}
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.
***************
*** 680,686 ****
if (tmp.pid < 0)
{
! list (i) = octave_child (pid, f);
enlarge = false;
break;
}
--- 738,744 ----
if (tmp.pid < 0)
{
! list (i) = octave_child (pid, f, name);
enlarge = false;
break;
}
***************
*** 698,704 ****
list.resize (total_len * 2);
}
! list (curr_len) = octave_child (pid, f);
curr_len++;
}
}
--- 756,762 ----
list.resize (total_len * 2);
}
! list (curr_len) = octave_child (pid, f, name);
curr_len++;
}
}
***************
*** 715,720 ****
--- 773,795 ----
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.23.orig/src/sighandlers.h i:/project/C/octave-2.1.23/src/sighandlers.h
*** n:/project/C/octave-2.1.23.orig/src/sighandlers.h Tue Jun 3 22:56:14 1997
--- i:/project/C/octave-2.1.23/src/sighandlers.h Fri Dec 24 13:36:00 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.23.orig/src/syscalls.cc i:/project/C/octave-2.1.23/src/syscalls.cc
*** n:/project/C/octave-2.1.23.orig/src/syscalls.cc Fri Nov 19 06:15:26 1999
--- i:/project/C/octave-2.1.23/src/syscalls.cc Sat Dec 25 12:58: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,95 ****
return m;
}
! DEFUN (dup2, args, ,
"-*- texinfo -*-\n\
@deftypefn {Built-in Function} {[@var{fid}, @var{msg}] =} dup2 (@var{old}, @var{new})\n\
Duplicate a file descriptor.\n\
--- 96,154 ----
return m;
}
! #if defined (__EMX__) && defined (OS2)
! 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)
! {
! string msg;
!
! int status = octave_syscalls::dup (i_old, msg);
!
! retval(0) = static_cast<double> (status);
!
! if (status < 0)
! retval(1) = msg;
! }
! 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, ,
"-*- texinfo -*-\n\
@deftypefn {Built-in Function} {[@var{fid}, @var{msg}] =} dup2 (@var{old}, @var{new})\n\
Duplicate a file descriptor.\n\
***************
*** 108,125 ****
if (nargin == 2)
{
! octave_stream old_stream
! = octave_stream_list::lookup (args(0), "dup2");
if (! error_state)
{
! octave_stream new_stream
! = octave_stream_list::lookup (args(1), "dup2");
!
! if (! error_state)
{
! int i_old = old_stream.file_number ();
! int i_new = new_stream.file_number ();
if (i_old >= 0 && i_new >= 0)
{
--- 167,182 ----
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)
{
***************
*** 128,142 ****
int status = octave_syscalls::dup2 (i_old, i_new, msg);
retval(0) = static_cast<double> (status);
retval(1) = msg;
}
}
}
else
! error ("dup2: invalid stream");
}
else
! print_usage ("dup2");
return retval;
}
--- 185,382 ----
int status = octave_syscalls::dup2 (i_old, i_new, msg);
retval(0) = static_cast<double> (status);
+
+ if (status < 0)
+ 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)
+ {
+ string msg;
+
+ FILE *f = static_cast<FILE *> (file_ops::fdopen (i_old, mode, msg));
retval(1) = msg;
+
+ if (f)
+ {
+ if (mode[0] == 'r')
+ {
+ octave_istdiostream *is
+ = new octave_istdiostream ("fdopen", f);
+ retval(0) = octave_stream_list::insert (is);
+ }
+ else if (mode[0] == 'w')
+ {
+ octave_ostdiostream *os
+ = new octave_ostdiostream ("fdopen", f);
+ retval(0) = octave_stream_list::insert (os);
+ }
+ else
+ error ("_fdopen: invalid mode");
+ }
+ else
+ error ("_fdopen: error opening file id");
+ }
+ else
+ error ("_fdopen: invalid file id");
+ }
+ else
+ error ("_fdopen: argument must be integer value");
+ }
+ else
+ error ("_fdopen: argument must be integer value");
+ }
+ else
+ error ("_fdopen: mode must be a string");
+ }
+ else
+ print_usage ("_fdopen");
+
+ return retval;
+ }
+ #endif
+
+ 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;
}
***************
*** 219,227 ****
return retval;
}
! DEFUN (fcntl, args, ,
"-*- texinfo -*-\n\
! @deftypefn {Built-in Function} {[@var{err}, @var{msg}] =} fcntl (@var{fid}, @var{request}, @var{arg})\n\
Change the properties of the open file @var{fid}. The following values\n\
may be passed as @var{request}:\n\
\n\
--- 459,468 ----
return retval;
}
! #if defined (__EMX__) && defined (OS2)
! DEFUN (_fcntl, args, ,
"-*- texinfo -*-\n\
! @deftypefn {Built-in Function} {[@var{err}, @var{msg}] =} _fcntl (@var{fid}, @var{request}, @var{arg})\n\
Change the properties of the open file @var{fid}. The following values\n\
may be passed as @var{request}:\n\
\n\
***************
*** 290,296 ****
{
// XXX FIXME XXX -- Need better checking here?
if (fid < 0)
! error ("fcntl: invalid file id");
else
{
string msg;
--- 531,537 ----
{
// XXX FIXME XXX -- Need better checking here?
if (fid < 0)
! error ("_fcntl: invalid file id");
else
{
string msg;
***************
*** 302,314 ****
}
}
else
! error ("fcntl: file id, request, and argument must be integers");
}
else
! print_usage ("fcntl");
return retval;
}
DEFUN (fork, args, ,
"-*- texinfo -*-\n\
--- 543,556 ----
}
}
else
! error ("_fcntl: file id, request, and argument must be integers");
}
else
! print_usage ("_fcntl");
return retval;
}
+ #endif
DEFUN (fork, args, ,
"-*- texinfo -*-\n\
***************
*** 572,577 ****
--- 814,870 ----
return retval;
}
+ #if defined (__EMX__) && defined (OS2)
+ 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];
+
+ string msg;
+
+ int status = octave_syscalls::pipe (fid, msg);
+
+ if (status < 0) retval(2) = msg;
+ 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;
+ }
+ #endif
+
DEFUN (pipe, args, ,
"-*- texinfo -*-\n\
@deftypefn {Built-in Function} {[@var{file_ids}, @var{err}, @var{msg}] =} pipe ()\n\
***************
*** 854,860 ****
--- 1147,1166 ----
{
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.23.orig/src/sysdep.cc i:/project/C/octave-2.1.23/src/sysdep.cc
*** n:/project/C/octave-2.1.23.orig/src/sysdep.cc Tue Nov 23 20:07:14 1999
--- i:/project/C/octave-2.1.23/src/sysdep.cc Fri Dec 24 13:37:50 1999
***************
*** 20,25 ****
--- 20,27 ----
*/
+ /* Modified by Klaus Gebhardt, 1996 */
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
***************
*** 56,61 ****
--- 58,68 ----
#include <sys/ioctl.h>
#endif
+ #ifdef __EMX__
+ #include <float.h>
+ #include <sys/uflags.h>
+ #endif
+
#if defined (HAVE_FLOATINGPOINT_H)
#include <floatingpoint.h>
#endif
***************
*** 68,73 ****
--- 75,92 ----
#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"
***************
*** 127,132 ****
--- 146,153 ----
{
_control87 ((EM_INVALID | EM_DENORMAL | EM_ZERODIVIDE | EM_OVERFLOW
| EM_UNDERFLOW | EM_INEXACT), MCW_EM);
+
+ _uflags (_UF_SBRK_MODEL, _UF_SBRK_ARBITRARY);
}
#endif
***************
*** 313,318 ****
--- 334,340 ----
kbhit (void)
{
int c;
+ flush_octave_stdout ();
raw_mode (1);
c = cin.get ();
raw_mode (0);
***************
*** 415,421 ****
// XXX FIXME XXX -- add timeout and default value args?
! if (interactive)
{
int c = kbhit ();
char *s = new char [2];
--- 437,443 ----
// XXX FIXME XXX -- add timeout and default value args?
! if (interactive || really_forced_interactive)
{
int c = kbhit ();
char *s = new char [2];
***************
*** 609,614 ****
--- 631,657 ----
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.23.orig/src/toplev.cc i:/project/C/octave-2.1.23/src/toplev.cc
*** n:/project/C/octave-2.1.23.orig/src/toplev.cc Wed Nov 3 20:54:52 1999
--- i:/project/C/octave-2.1.23/src/toplev.cc Sat Dec 25 19:15:42 1999
***************
*** 20,25 ****
--- 20,27 ----
*/
+ /* Modified by Klaus Gebhardt, 1996 - 1999 */
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
***************
*** 77,82 ****
--- 79,92 ----
#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;
***************
*** 98,103 ****
--- 108,117 ----
if (setjmp (toplevel) != 0)
{
+ #if defined (__EMX__) && defined (OS2)
+ unwind_protect::run_all ();
+ #endif
+
raw_mode (0);
cout << "\n";
***************
*** 114,119 ****
--- 128,138 ----
int retval;
do
{
+ #ifdef __EMX__
+ can_interrupt = 1;
+ octave_catch_interrupts ();
+ #endif
+
curr_sym_tab = top_level_sym_tab;
reset_parser ();
***************
*** 128,134 ****
global_command = 0;
! if (! (interactive || forced_interactive))
{
bool quit = (tree_return_command::returning
|| tree_break_command::breaking);
--- 147,154 ----
global_command = 0;
! if (! (interactive || forced_interactive
! || really_forced_interactive))
{
bool quit = (tree_return_command::returning
|| tree_break_command::breaking);
***************
*** 145,151 ****
if (error_state)
{
! if (! (interactive || forced_interactive))
break;
}
else
--- 165,172 ----
if (error_state)
{
! if (! (interactive || forced_interactive
! || really_forced_interactive))
break;
}
else
***************
*** 169,174 ****
--- 190,199 ----
{
do_octave_atexit ();
+ #if defined (__EMX__)
+ _sleep2 (500);
+ #endif
+
exit (retval == EOF ? 0 : retval);
}
***************
*** 296,307 ****
// Execute a shell command.
static void
cleanup_iprocstream (void *p)
{
iprocstream *cmd = static_cast<iprocstream *> (p);
! octave_child_list::remove (cmd->pid ());
delete cmd;
}
--- 321,341 ----
// Execute a shell command.
+ static int cmd_status = -1;
+ static int cmd_pid = -1;
+
+ static void
+ cmd_death_handler (pid_t, int status)
+ {
+ cmd_status = status;
+ }
+
static void
cleanup_iprocstream (void *p)
{
iprocstream *cmd = static_cast<iprocstream *> (p);
! octave_child_list::remove (cmd_pid);
delete cmd;
}
***************
*** 313,320 ****
--- 347,359 ----
iprocstream *cmd = new iprocstream (cmd_str.c_str ());
+ cmd_status = -1;
+
if (cmd)
{
+ cmd_pid = cmd->pid ();
+ octave_child_list::insert (cmd_pid, cmd_death_handler);
+
unwind_protect::add (cleanup_iprocstream, cmd);
if (*cmd)
***************
*** 344,350 ****
while (cmd->get (ch))
output_buf.put (ch);
! int cmd_status = cmd->close ();
if (WIFEXITED (cmd_status))
cmd_status = WEXITSTATUS (cmd_status);
--- 383,389 ----
while (cmd->get (ch))
output_buf.put (ch);
! cmd_status = cmd->close ();
if (WIFEXITED (cmd_status))
cmd_status = WEXITSTATUS (cmd_status);
***************
*** 421,427 ****
--- 460,470 ----
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;
***************
*** 437,444 ****
--- 480,495 ----
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");
***************
*** 449,456 ****
--- 500,512 ----
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)
***************
*** 466,478 ****
--- 522,555 ----
}
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
***************
*** 480,485 ****
--- 557,565 ----
if (WIFEXITED (status))
status = WEXITSTATUS (status);
+ else
+ status = 127;
+ #endif
retval = static_cast<double> (status);
}
***************
*** 493,501 ****
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)
--- 573,579 ----
DEFALIAS (shell_cmd, system);
! static SLStack<string> octave_atexit_functions;
void
do_octave_atexit (void)
***************
*** 530,536 ****
flush_octave_stdout ();
! if (!quitting_gracefully && (interactive || forced_interactive))
cout << "\n";
}
}
--- 608,615 ----
flush_octave_stdout ();
! if (!quitting_gracefully &&
! (interactive || forced_interactive || really_forced_interactive))
cout << "\n";
}
}
diff -cwr n:/project/C/octave-2.1.23.orig/src/utils.cc i:/project/C/octave-2.1.23/src/utils.cc
*** n:/project/C/octave-2.1.23.orig/src/utils.cc Tue Nov 23 21:54:30 1999
--- i:/project/C/octave-2.1.23/src/utils.cc Fri Dec 24 13:37:50 1999
***************
*** 20,25 ****
--- 20,27 ----
*/
+ /* Modified by Klaus Gebhardt, 1996 */
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
***************
*** 90,96 ****
--- 92,100 ----
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.23.orig/src/variables.cc i:/project/C/octave-2.1.23/src/variables.cc
*** n:/project/C/octave-2.1.23.orig/src/variables.cc Tue Dec 14 08:11:52 1999
--- i:/project/C/octave-2.1.23/src/variables.cc Fri Dec 24 16:46:12 1999
***************
*** 20,25 ****
--- 20,27 ----
*/
+ /* Modified by Klaus Gebhardt, 1996 - 1998 */
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
***************
*** 33,38 ****
--- 35,41 ----
#include "oct-env.h"
#include "glob-match.h"
#include "str-vec.h"
+ #include "lo-mappers.h"
#include <defaults.h>
#include "defun.h"
***************
*** 44,49 ****
--- 47,55 ----
#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"
***************
*** 1221,1226 ****
--- 1227,1267 ----
return retval;
}
+
+ #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 = NINT (val);
+ if (ival >= 0 && (double) ival == val)
+ {
+ Vkluge_procbuf_delay = ival;
+ return 0;
+ }
+ }
+ gripe_invalid_value_specified ("kluge_procbuf_delay");
+ return -1;
+ }
+
+ void
+ symbols_of_oct_procbuf (void)
+ {
+ DEFVAR (kluge_procbuf_delay, static_cast<double> (Vkluge_procbuf_delay),
+ kluge_procbuf_delay,
+ "number of microseconds to delay in the parent after forking\n\
+ (not used under OS/2)");
+ }
+ #endif
DEFUN (__dump_symtab_info__, args, ,
"__dump_symtab_info__ (): print raw symbol table statistices")
diff -cwr n:/project/C/octave-2.1.23.orig/src/version.h i:/project/C/octave-2.1.23/src/version.h
*** n:/project/C/octave-2.1.23.orig/src/version.h Sat Dec 18 03:06:04 1999
--- i:/project/C/octave-2.1.23/src/version.h Fri Dec 24 13:37:52 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.23"
+ #define OCTAVE_OS2_PATCHLEVEL "2.1.23-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.23"
#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.14)."
+ #endif
#endif
/*
diff -cwr n:/project/C/octave-2.1.23.orig/scripts/image/colormap.m i:/project/C/octave-2.1.23/scripts/image/colormap.m
*** n:/project/C/octave-2.1.23.orig/scripts/image/colormap.m Wed Dec 15 21:48:40 1999
--- i:/project/C/octave-2.1.23/scripts/image/colormap.m Fri Dec 24 20:47:06 1999
***************
*** 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.
##
***************
*** 33,39 ****
## With no arguments, @code{colormap} returns the current color map.
## @end deftypefn
! ## Author: Tony Richardson <arichard@stark.cc.oh.us>
## Created: July 1994
## Adapted-By: jwe
--- 33,39 ----
## With no arguments, @code{colormap} returns the current color map.
## @end deftypefn
! ## Author: Tony Richardson <amr@mpl.ucsd.edu>
## Created: July 1994
## Adapted-By: jwe
***************
*** 46,80 ****
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
--- 46,65 ----
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.23.orig/scripts/image/gray.m i:/project/C/octave-2.1.23/scripts/image/gray.m
*** n:/project/C/octave-2.1.23.orig/scripts/image/gray.m Wed Dec 15 21:48:40 1999
--- i:/project/C/octave-2.1.23/scripts/image/gray.m Fri Dec 24 20:47:06 1999
***************
*** 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.
##
***************
*** 24,30 ****
## omitted, 64 is assumed.
## @end deftypefn
! ## Author: Tony Richardson <arichard@stark.cc.oh.us>
## Created: July 1994
## Adapted-By: jwe
--- 24,30 ----
## omitted, 64 is assumed.
## @end deftypefn
! ## Author: Tony Richardson <amr@mpl.ucsd.edu>
## Created: July 1994
## Adapted-By: jwe
diff -cwr n:/project/C/octave-2.1.23.orig/scripts/image/gray2ind.m i:/project/C/octave-2.1.23/scripts/image/gray2ind.m
*** n:/project/C/octave-2.1.23.orig/scripts/image/gray2ind.m Wed Dec 15 21:48:40 1999
--- i:/project/C/octave-2.1.23/scripts/image/gray2ind.m Fri Dec 24 20:47:06 1999
***************
*** 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.
##
***************
*** 22,28 ****
## Convert a gray scale intensity image to an Octave indexed image.
## @end deftypefn
! ## Author: Tony Richardson <arichard@stark.cc.oh.us>
## Created: July 1994
## Adapted-By: jwe
--- 22,28 ----
## Convert a gray scale intensity image to an Octave indexed image.
## @end deftypefn
! ## Author: Tony Richardson <amr@mpl.ucsd.edu>
## Created: July 1994
## Adapted-By: jwe
diff -cwr n:/project/C/octave-2.1.23.orig/scripts/image/image.m i:/project/C/octave-2.1.23/scripts/image/image.m
*** n:/project/C/octave-2.1.23.orig/scripts/image/image.m Wed Dec 15 21:48:40 1999
--- i:/project/C/octave-2.1.23/scripts/image/image.m Fri Dec 24 21:01:04 1999
***************
*** 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.
##
***************
*** 21,27 ****
## @deftypefn {Function File} {} image (@var{x}, @var{zoom})
## Display a matrix as a color image. The elements of @var{x} are indices
## into the current colormap and should have values between 1 and the
! ## length of the colormap. If @var{zoom} is omitted, a value of 4 is
## assumed.
## @end deftypefn
--- 21,27 ----
## @deftypefn {Function File} {} image (@var{x}, @var{zoom})
## Display a matrix as a color image. The elements of @var{x} are indices
## into the current colormap and should have values between 1 and the
! ## length of the colormap. If @var{zoom} is omitted, a value of 1 is
## assumed.
## @end deftypefn
***************
*** 30,66 ****
## 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
--- 30,56 ----
## Author: Tony Richardson <arichard@stark.cc.oh.us>
## 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.23.orig/scripts/image/imagesc.m i:/project/C/octave-2.1.23/scripts/image/imagesc.m
*** n:/project/C/octave-2.1.23.orig/scripts/image/imagesc.m Wed Dec 15 21:48:40 1999
--- i:/project/C/octave-2.1.23/scripts/image/imagesc.m Fri Dec 24 20:47:06 1999
***************
*** 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.23.orig/scripts/image/imshow.m i:/project/C/octave-2.1.23/scripts/image/imshow.m
*** n:/project/C/octave-2.1.23.orig/scripts/image/imshow.m Wed Dec 15 21:48:40 1999
--- i:/project/C/octave-2.1.23/scripts/image/imshow.m Fri Dec 24 20:47:06 1999
***************
*** 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.
##
***************
*** 37,43 ****
## SEE ALSO: image, imagesc, colormap, gray2ind, rgb2ind.
! ## Author: Tony Richardson <arichard@stark.cc.oh.us>
## Created: July 1994
## Adapted-By: jwe
--- 37,43 ----
## 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.23.orig/scripts/image/ind2gray.m i:/project/C/octave-2.1.23/scripts/image/ind2gray.m
*** n:/project/C/octave-2.1.23.orig/scripts/image/ind2gray.m Wed Dec 15 21:48:40 1999
--- i:/project/C/octave-2.1.23/scripts/image/ind2gray.m Fri Dec 24 20:47:08 1999
***************
*** 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.
##
***************
*** 26,32 ****
## SEE ALSO: gray2ind, rgb2ntsc, image, colormap
! ## Author: Tony Richardson <arichard@stark.cc.oh.us>
## Created: July 1994
## Adapted-By: jwe
--- 26,32 ----
## 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.23.orig/scripts/image/ind2rgb.m i:/project/C/octave-2.1.23/scripts/image/ind2rgb.m
*** n:/project/C/octave-2.1.23.orig/scripts/image/ind2rgb.m Wed Dec 15 21:48:42 1999
--- i:/project/C/octave-2.1.23/scripts/image/ind2rgb.m Fri Dec 24 20:47:08 1999
***************
*** 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.23.orig/scripts/image/loadimage.m i:/project/C/octave-2.1.23/scripts/image/loadimage.m
*** n:/project/C/octave-2.1.23.orig/scripts/image/loadimage.m Wed Dec 15 21:48:42 1999
--- i:/project/C/octave-2.1.23/scripts/image/loadimage.m Fri Dec 24 20:53:40 1999
***************
*** 25,64 ****
## 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
--- 25,55 ----
## SEE ALSO: saveimage, load, save
! ## Author: Klaus Gebhardt <110114.1371@compuserve.com>
! ## 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.23.orig/scripts/image/ntsc2rgb.m i:/project/C/octave-2.1.23/scripts/image/ntsc2rgb.m
*** n:/project/C/octave-2.1.23.orig/scripts/image/ntsc2rgb.m Wed Dec 15 21:48:42 1999
--- i:/project/C/octave-2.1.23/scripts/image/ntsc2rgb.m Fri Dec 24 20:47:08 1999
***************
*** 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.
##
***************
*** 22,28 ****
## Image format conversion.
## @end deftypefn
! ## Author: Tony Richardson <arichard@stark.cc.oh.us>
## Created: July 1994
## Adapted-By: jwe
--- 22,28 ----
## Image format conversion.
## @end deftypefn
! ## Author: Tony Richardson <amr@mpl.ucsd.edu>
## Created: July 1994
## Adapted-By: jwe
diff -cwr n:/project/C/octave-2.1.23.orig/scripts/image/ocean.m i:/project/C/octave-2.1.23/scripts/image/ocean.m
*** n:/project/C/octave-2.1.23.orig/scripts/image/ocean.m Wed Dec 15 21:48:42 1999
--- i:/project/C/octave-2.1.23/scripts/image/ocean.m Fri Dec 24 20:47:08 1999
***************
*** 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,29 ****
## is omitted, 64 is assumed.
## @end deftypefn
! ## Author: Tony Richardson <arichard@stark.cc.oh.us>
## Created: July 1994
## Adapted-By: jwe
--- 23,29 ----
## is omitted, 64 is assumed.
## @end deftypefn
! ## Author: Tony Richardson <amr@mpl.ucsd.edu>
## Created: July 1994
## Adapted-By: jwe
diff -cwr n:/project/C/octave-2.1.23.orig/scripts/image/rgb2ind.m i:/project/C/octave-2.1.23/scripts/image/rgb2ind.m
*** n:/project/C/octave-2.1.23.orig/scripts/image/rgb2ind.m Wed Dec 15 21:48:42 1999
--- i:/project/C/octave-2.1.23/scripts/image/rgb2ind.m Fri Dec 24 20:47:08 1999
***************
*** 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.
##
***************
*** 26,32 ****
##
## Bugs: The color map may have duplicate entries.
! ## Author: Tony Richardson <arichard@stark.cc.oh.us>
## Created: July 1994
## Adapted-By: jwe
--- 26,32 ----
##
## 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.23.orig/scripts/image/rgb2ntsc.m i:/project/C/octave-2.1.23/scripts/image/rgb2ntsc.m
*** n:/project/C/octave-2.1.23.orig/scripts/image/rgb2ntsc.m Wed Dec 15 21:48:42 1999
--- i:/project/C/octave-2.1.23/scripts/image/rgb2ntsc.m Fri Dec 24 20:47:08 1999
***************
*** 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.
##
***************
*** 22,28 ****
## Image format conversion.
## @end deftypefn
! ## Author: Tony Richardson <arichard@stark.cc.oh.us>
## Created: July 1994
## Adapted-By: jwe
--- 22,28 ----
## Image format conversion.
## @end deftypefn
! ## Author: Tony Richardson <amr@mpl.ucsd.edu>
## Created: July 1994
## Adapted-By: jwe
diff -cwr n:/project/C/octave-2.1.23.orig/scripts/image/saveimage.m i:/project/C/octave-2.1.23/scripts/image/saveimage.m
*** n:/project/C/octave-2.1.23.orig/scripts/image/saveimage.m Tue Dec 14 21:40:06 1999
--- i:/project/C/octave-2.1.23/scripts/image/saveimage.m Fri Dec 24 20:58:58 1999
***************
*** 19,41 ****
## -*- texinfo -*-
## @deftypefn {Function File} {} saveimage (@var{file}, @var{x}, @var{fmt}, @var{map})
! ## Save the matrix @var{x} to @var{file} in image format @var{fmt}. Valid
! ## values for @var{fmt} are
! ##
! ## @table @code
! ## @item "img"
! ## Octave's image format. The current colormap is also saved in the file.
! ##
! ## @item "ppm"
! ## Portable pixmap format.
! ##
! ## @item "ps"
! ## PostScript format. Note that images saved in PostScript format can not
! ## be read back into Octave with loadimage.
! ## @end table
! ##
! ## If the fourth argument is supplied, the specified colormap will also be
! ## saved along with the image.
##
## 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
--- 19,25 ----
## -*- texinfo -*-
## @deftypefn {Function File} {} saveimage (@var{file}, @var{x}, @var{fmt}, @var{map})
! ## Save the matrix @var{x} to @var{file} in image format @var{fmt}.
##
## 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
***************
*** 44,104 ****
## otherwise the full color formats are used.
## @end deftypefn
! ## 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))
--- 28,50 ----
## otherwise the full color formats are used.
## @end deftypefn
! ## Author: Klaus Gebhardt <100114.1371@compuserve.com>
! ## 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))
***************
*** 109,307 ****
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;
! scale = 1;
!
! 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
--- 55,64 ----
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.23.orig/scripts/miscellaneous/bug_report.m i:/project/C/octave-2.1.23/scripts/miscellaneous/bug_report.m
*** n:/project/C/octave-2.1.23.orig/scripts/miscellaneous/bug_report.m Tue Feb 3 09:11:14 1998
--- i:/project/C/octave-2.1.23/scripts/miscellaneous/bug_report.m Fri Dec 24 20:47:08 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.23.orig/scripts/miscellaneous/popen2.m i:/project/C/octave-2.1.23/scripts/miscellaneous/popen2.m
*** n:/project/C/octave-2.1.23.orig/scripts/miscellaneous/popen2.m Wed Oct 20 05:49:38 1999
--- i:/project/C/octave-2.1.23/scripts/miscellaneous/popen2.m Sat Dec 25 12:59:36 1999
***************
*** 46,52 ****
## @end example
## @end deftypefn
! ## Author: jwe
function [in, out, pid] = popen2 (command, args)
--- 46,52 ----
## @end example
## @end deftypefn
! ## Author: Klaus Gebhardt, 1997
function [in, out, pid] = popen2 (command, args)
***************
*** 56,106 ****
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
--- 56,122 ----
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 (w_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.23.orig/scripts/startup/octaverc i:/project/C/octave-2.1.23/scripts/startup/octaverc
*** n:/project/C/octave-2.1.23.orig/scripts/startup/octaverc Wed Jul 24 19:05:42 1996
--- i:/project/C/octave-2.1.23/scripts/startup/octaverc Fri Dec 24 21:06:24 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.1.23 for OS/2
+ ## (c) 1996 - 1999, 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.23.orig/doc/conf.tex i:/project/C/octave-2.1.23/doc/conf.tex
*** n:/project/C/octave-2.1.23.orig/doc/conf.tex Fri Dec 24 11:01:34 1999
--- i:/project/C/octave-2.1.23/doc/conf.tex Fri Dec 24 13:37:54 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.23
! @set OCTAVEHOME
! @set TARGETHOSTTYPE i486-pc-os/2
diff -cwr n:/project/C/octave-2.1.23.orig/doc/faq/oct-faq.tex i:/project/C/octave-2.1.23/doc/faq/oct-faq.tex
*** n:/project/C/octave-2.1.23.orig/doc/faq/oct-faq.tex Fri Dec 24 11:01:34 1999
--- i:/project/C/octave-2.1.23/doc/faq/oct-faq.tex Fri Dec 24 13:37:54 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.23.orig/doc/interpreter/control.tex i:/project/C/octave-2.1.23/doc/interpreter/control.tex
*** n:/project/C/octave-2.1.23.orig/doc/interpreter/control.tex Fri Dec 24 11:01:34 1999
--- i:/project/C/octave-2.1.23/doc/interpreter/control.tex Fri Dec 24 13:37:54 1999
***************
*** 330,338 ****
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.
--- 330,338 ----
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.
diff -cwr n:/project/C/octave-2.1.23.orig/doc/interpreter/install.tex i:/project/C/octave-2.1.23/doc/interpreter/install.tex
*** n:/project/C/octave-2.1.23.orig/doc/interpreter/install.tex Fri Dec 24 11:01:36 1999
--- i:/project/C/octave-2.1.23/doc/interpreter/install.tex Fri Dec 24 13:37:54 1999
***************
*** 444,449 ****
--- 444,457 ----
@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::
***************
*** 563,568 ****
@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
--- 571,576 ----
@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.23.orig/doc/interpreter/octave.tex i:/project/C/octave-2.1.23/doc/interpreter/octave.tex
*** n:/project/C/octave-2.1.23.orig/doc/interpreter/octave.tex Fri Dec 24 11:01:38 1999
--- i:/project/C/octave-2.1.23/doc/interpreter/octave.tex Fri Dec 24 13:37:54 1999
***************
*** 3,8 ****
--- 3,9 ----
% 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.
***************
*** 13,18 ****
--- 14,27 ----
* 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:
***************
*** 38,44 ****
@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
--- 47,53 ----
@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.23.orig/doc/interpreter/poly.tex i:/project/C/octave-2.1.23/doc/interpreter/poly.tex
*** n:/project/C/octave-2.1.23.orig/doc/interpreter/poly.tex Fri Dec 24 11:01:38 1999
--- i:/project/C/octave-2.1.23/doc/interpreter/poly.tex Fri Dec 24 13:37:54 1999
***************
*** 10,24 ****
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
--- 10,26 ----
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.23.orig/doc/liboctave/gpl.tex i:/project/C/octave-2.1.23/doc/liboctave/gpl.tex
*** n:/project/C/octave-2.1.23.orig/doc/liboctave/gpl.tex Fri Dec 24 11:01:42 1999
--- i:/project/C/octave-2.1.23/doc/liboctave/gpl.tex Fri Dec 24 13:37:54 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.23.orig/doc/liboctave/liboct.tex i:/project/C/octave-2.1.23/doc/liboctave/liboct.tex
*** n:/project/C/octave-2.1.23.orig/doc/liboctave/liboct.tex Fri Dec 24 11:01:42 1999
--- i:/project/C/octave-2.1.23/doc/liboctave/liboct.tex Fri Dec 24 13:37:54 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.