home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / octa21fb.zip / octave / PATOS2.ZIP / PATCHES.OS2 < prev    next >
Text File  |  2000-01-15  |  151KB  |  5,989 lines

  1. 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
  2. *** n:/project/C/octave-2.1.23.orig/liboctave/cmd-edit.cc    Wed Oct 13 08:05:22 1999
  3. --- i:/project/C/octave-2.1.23/liboctave/cmd-edit.cc    Fri Dec 24 18:44:34 1999
  4. ***************
  5. *** 20,25 ****
  6. --- 20,27 ----
  7.   
  8.   */
  9.   
  10. + /* Modified by Klaus Gebhardt, 1999 */
  11.   #ifdef HAVE_CONFIG_H
  12.   #include <config.h>
  13.   #endif
  14. ***************
  15. *** 52,57 ****
  16. --- 54,69 ----
  17.   
  18.   #include <readline/readline.h>
  19.   
  20. + #ifdef __EMX__
  21. + extern "C"
  22. + {
  23. +   extern void tputs ();
  24. +   extern char *term_clrpag;
  25. +   extern void _rl_output_character_function ();
  26. +   extern void rl_resize_terminal ();
  27. + }
  28. + #endif
  29.   // It would be nice if readline.h declared these, I think.
  30.   
  31.   extern int rl_blink_matching_paren;
  32. ***************
  33. *** 246,252 ****
  34. --- 258,276 ----
  35.   void
  36.   gnu_readline::do_clear_screen (void)
  37.   {
  38. + #ifdef __EMX__
  39. +   rl_beg_of_line ();
  40. +   rl_kill_line (1);
  41. +   if (term_clrpag)
  42. +     tputs (term_clrpag, 1, _rl_output_character_function);
  43. +   else
  44. +     crlf ();
  45. +   fflush (rl_outstream);
  46. + #else
  47.     rl_clear_screen ();
  48. + #endif
  49.   }
  50.   
  51.   void
  52. ***************
  53. *** 628,633 ****
  54. --- 652,664 ----
  55.   {
  56.     if (instance_ok ())
  57.       instance->command_number = n;
  58. + }
  59. + void
  60. + command_editor::add_current_command_number (int n)
  61. + {
  62. +   if (instance_ok ())
  63. +     instance->command_number += n;
  64.   }
  65.   
  66.   void
  67. 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
  68. *** n:/project/C/octave-2.1.23.orig/liboctave/cmd-edit.h    Wed Oct 13 08:05:22 1999
  69. --- i:/project/C/octave-2.1.23/liboctave/cmd-edit.h    Fri Dec 24 13:35:56 1999
  70. ***************
  71. *** 99,104 ****
  72. --- 99,106 ----
  73.   
  74.     static void reset_current_command_number (int n);
  75.   
  76. +   static void add_current_command_number (int n);
  77.     static void increment_current_command_number (void);
  78.   
  79.   private:
  80. 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
  81. *** n:/project/C/octave-2.1.23.orig/liboctave/cmd-hist.cc    Mon May  5 04:24:04 1997
  82. --- i:/project/C/octave-2.1.23/liboctave/cmd-hist.cc    Fri Dec 24 13:35:56 1999
  83. ***************
  84. *** 20,25 ****
  85. --- 20,27 ----
  86.   
  87.   */
  88.   
  89. + /* Modified by Klaus Gebhardt, 1999 */
  90.   #ifdef HAVE_CONFIG_H
  91.   #include <config.h>
  92.   #endif
  93. ***************
  94. *** 119,128 ****
  95.     if (! do_ignoring_entries ())
  96.       {
  97.         if (s.empty ()
  98. !       || (s.length () == 1 && (s[0] == '\r' || s[0] == '\n')))
  99.       return;
  100.   
  101. !       ::add_history (s.c_str ());
  102.   
  103.         lines_this_session++;
  104.       }
  105. --- 121,143 ----
  106.     if (! do_ignoring_entries ())
  107.       {
  108.         if (s.empty ()
  109. !       || (s.length () == 1 && (s[0] == '\r' || s[0] == '\n' || s[0] == ''))
  110. !       || (s.length () == 2 && (s[0] == '\r' && s[1] == '\n')))
  111.       return;
  112.   
  113. !       string t = s;
  114. !       int l    = t.length ();
  115. !       char c   = t[l-2];
  116. !       if (c == '\n' || c == '\r' || c == '')
  117. !     {
  118. !       t.resize (l - 1);
  119. !       t[l-2] = '\n';
  120. !       if (l == 2)  return;
  121. !     }
  122. !       ::add_history (t.c_str ());
  123.   
  124.         lines_this_session++;
  125.       }
  126. 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
  127. *** n:/project/C/octave-2.1.23.orig/liboctave/file-ops.cc    Thu Jul 24 20:33:34 1997
  128. --- i:/project/C/octave-2.1.23/liboctave/file-ops.cc    Sat Dec 25 14:04:24 1999
  129. ***************
  130. *** 20,25 ****
  131. --- 20,27 ----
  132.   
  133.   */
  134.   
  135. + /* Modified by Klaus Gebhardt, 1996 */
  136.   #ifdef HAVE_CONFIG_H
  137.   #include <config.h>
  138.   #endif
  139. ***************
  140. *** 39,44 ****
  141. --- 41,50 ----
  142.   #include <unistd.h>
  143.   #endif
  144.   
  145. + #ifdef OS2
  146. + #include <mkfifo.h>
  147. + #endif
  148.   #include "file-ops.h"
  149.   #include "oct-env.h"
  150.   #include "oct-passwd.h"
  151. ***************
  152. *** 488,493 ****
  153. --- 494,551 ----
  154.   #endif
  155.   
  156.     return status;
  157. + }
  158. + int
  159. + file_ops::close (int handle)
  160. + {
  161. +   string msg;
  162. +   return close (handle, msg);
  163. + }
  164. + int
  165. + file_ops::close (int handle, string& msg)
  166. + {
  167. +   msg = string ();
  168. +   int status = -1;
  169. + #if defined (HAVE_CLOSE)
  170. +   status = ::close (handle);
  171. +   if (status < 0)
  172. +     msg = ::strerror (errno);
  173. + #else
  174. +   msg = NOT_SUPPORTED ("close");
  175. + #endif
  176. +   return status;
  177. + }
  178. + void *
  179. + file_ops::fdopen (int handle, const string& mode)
  180. + {
  181. +   string msg;
  182. +   return fdopen (handle, mode.c_str (), msg);
  183. + }
  184. + void *
  185. + file_ops::fdopen (int handle, const string& mode, string& msg)
  186. + {
  187. +   msg = string ();
  188. +   void *ptr = NULL;
  189. + #if defined (HAVE_FDOPEN)
  190. +   ptr = static_cast<void *> (::fdopen (handle, mode.c_str ()));
  191. +   if (ptr == NULL)
  192. +     msg = ::strerror (errno);
  193. + #else
  194. +   msg = NOT_SUPPORTED ("fdopen");
  195. + #endif
  196. +   return ptr;
  197.   }
  198.   
  199.   /*
  200. 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
  201. *** n:/project/C/octave-2.1.23.orig/liboctave/file-ops.h    Fri Jun  6 10:30:36 1997
  202. --- i:/project/C/octave-2.1.23/liboctave/file-ops.h    Sat Dec 25 12:42:28 1999
  203. ***************
  204. *** 20,25 ****
  205. --- 20,27 ----
  206.   
  207.   */
  208.   
  209. + /* Modified by Klaus Gebhardt, 1999 */
  210.   #if !defined (octave_file_ops_h)
  211.   #define octave_file_ops_h 1
  212.   
  213. ***************
  214. *** 66,71 ****
  215. --- 68,79 ----
  216.   
  217.     static int unlink (const string&);
  218.     static int unlink (const string&, string&);
  219. +   static int close (int);
  220. +   static int close (int, string&);
  221. +   static void *fdopen (int, const string&);
  222. +   static void *fdopen (int, const string&, string&);
  223.   };
  224.   
  225.   #endif
  226. 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
  227. *** n:/project/C/octave-2.1.23.orig/liboctave/file-stat.cc    Mon Aug  2 22:56:42 1999
  228. --- i:/project/C/octave-2.1.23/liboctave/file-stat.cc    Fri Dec 24 13:35:56 1999
  229. ***************
  230. *** 20,25 ****
  231. --- 20,27 ----
  232.   
  233.   */
  234.   
  235. + /* Modified by Klaus Gebhardt, 1999 */
  236.   #ifdef HAVE_CONFIG_H
  237.   #include <config.h>
  238.   #endif
  239. ***************
  240. *** 37,42 ****
  241. --- 39,70 ----
  242.   #include "file-stat.h"
  243.   #include "statdefs.h"
  244.   
  245. + #ifdef __EMX__
  246. + // Normal stat and lstat does not work with EMX!
  247. + // Using old approach.
  248. + // Modified, by Klaus Gebhardt, 1998
  249. + static __inline int _stat (const char *name, struct stat *buf)
  250. + {
  251. +   int ret;
  252. +   do
  253. +     ret = stat (name, buf);
  254. +   while (ret < 0 && errno == EINTR);
  255. +   return ret;
  256. + }
  257. + static __inline int _lstat (const char *name, struct stat *buf)
  258. + {
  259. +   int ret;
  260. +   do
  261. +     ret = lstat (name, buf);
  262. +   while (ret < 0 && errno == EINTR);
  263. +   return ret;
  264. + }
  265. + #else
  266.   #if !defined (HAVE_LSTAT)
  267.   static inline int
  268.   lstat (const char *name, struct stat *buf)
  269. ***************
  270. *** 44,49 ****
  271. --- 72,78 ----
  272.     return stat (name, buf);
  273.   }
  274.   #endif
  275. + #endif
  276.   
  277.   // XXX FIXME XXX -- the is_* and mode_as_string functions are only valid
  278.   // for initialized objects.  If called for an object that is not
  279. ***************
  280. *** 158,164 ****
  281. --- 187,197 ----
  282.   
  283.         struct stat buf;
  284.   
  285. + #ifdef __EMX__
  286. +       int status = follow_links ? _stat (cname, &buf) : _lstat (cname, &buf);
  287. + #else
  288.         int status = follow_links ? stat (cname, &buf) : lstat (cname, &buf);
  289. + #endif
  290.   
  291.         if (status < 0)
  292.       {
  293. 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
  294. *** n:/project/C/octave-2.1.23.orig/liboctave/lo-mappers.cc    Fri Sep 10 06:17:00 1999
  295. --- i:/project/C/octave-2.1.23/liboctave/lo-mappers.cc    Fri Dec 24 13:35:56 1999
  296. ***************
  297. *** 20,25 ****
  298. --- 20,27 ----
  299.   
  300.   */
  301.   
  302. + /* Modified by Klaus Gebhardt, 1997 - 1999 */
  303.   #ifdef HAVE_CONFIG_H
  304.   #include <config.h>
  305.   #endif
  306. ***************
  307. *** 49,54 ****
  308. --- 51,66 ----
  309.   #define finite(x) ((x) < DBL_MAX && (x) > -DBL_MAX)
  310.   #endif
  311.   
  312. + extern "C"
  313. + {
  314. +   double F77_FCN (dacosh, DACOSH) (const double*);
  315. +   double F77_FCN (dasinh, DASINH) (const double*);
  316. +   double F77_FCN (datanh, DATANH) (const double*);
  317. +   double F77_FCN (derf, DERF) (const double&);
  318. +   double F77_FCN (derfc, DERFC) (const double&);
  319. + }
  320.   #ifndef M_LOG10E
  321.   #define M_LOG10E 0.43429448190325182765
  322.   #endif
  323. ***************
  324. *** 123,135 ****
  325.   }
  326.   
  327.   double
  328.   xerf (double x)
  329.   {
  330.   #if defined (HAVE_ERF)
  331.     return erf (x);
  332.   #else
  333. !   (*current_liboctave_error_handler)
  334. !     ("erf (x) not available on this system");
  335.   #endif
  336.   }
  337.   
  338. --- 135,184 ----
  339.   }
  340.   
  341.   double
  342. + xacosh (double x)
  343. + {
  344. + #if defined (HAVE_ACOSH)
  345. +   return acosh (x);
  346. + #else
  347. +   double y;
  348. +   F77_YXFCN (dacosh, DACOSH, y, (&x));
  349. +   return y;
  350. + #endif
  351. + }
  352. + double
  353. + xasinh (double x)
  354. + {
  355. + #if defined (HAVE_ASINH)
  356. +   return asinh (x);
  357. + #else
  358. +   double y;
  359. +   F77_YXFCN (dasinh, DASINH, y, (&x));
  360. +   return y;
  361. + #endif
  362. + }
  363. + double
  364. + xatanh (double x)
  365. + {
  366. + #if defined (HAVE_ATANH)
  367. +   return atanh (x);
  368. + #else
  369. +   double y;
  370. +   F77_YXFCN (datanh, DATANH, y, (&x));
  371. +   return y;
  372. + #endif
  373. + }
  374. + double
  375.   xerf (double x)
  376.   {
  377.   #if defined (HAVE_ERF)
  378.     return erf (x);
  379.   #else
  380. !   double y;
  381. !   F77_YXFCN (derf, DERF, y, (x));
  382. !   return y;
  383.   #endif
  384.   }
  385.   
  386. ***************
  387. *** 139,146 ****
  388.   #if defined (HAVE_ERFC)
  389.     return erfc (x);
  390.   #else
  391. !   (*current_liboctave_error_handler)
  392. !     ("erfc (x) not available on this system");
  393.   #endif
  394.   }
  395.   
  396. --- 188,196 ----
  397.   #if defined (HAVE_ERFC)
  398.     return erfc (x);
  399.   #else
  400. !   double y;
  401. !   F77_YXFCN (derfc, DERFC, y, (x));
  402. !   return y;
  403.   #endif
  404.   }
  405.   
  406. 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
  407. *** n:/project/C/octave-2.1.23.orig/liboctave/lo-mappers.h    Tue Jul 13 04:35:32 1999
  408. --- i:/project/C/octave-2.1.23/liboctave/lo-mappers.h    Fri Dec 24 14:45:02 1999
  409. ***************
  410. *** 20,25 ****
  411. --- 20,27 ----
  412.   
  413.   */
  414.   
  415. + /* Modified by Klaus Gebhardt, 1999 */
  416.   #if !defined (octave_liboctave_mappers_h)
  417.   #define octave_liboctave_mappers_h 1
  418.   
  419. ***************
  420. *** 32,37 ****
  421. --- 34,43 ----
  422.   extern double real (double x);
  423.   extern double round (double x);
  424.   extern double signum (double x);
  425. + extern double xacosh (double x);
  426. + extern double xasinh (double x);
  427. + extern double xatanh (double x);
  428.   extern double xerf (double x);
  429.   extern double xerfc (double x);
  430.   
  431. 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
  432. *** n:/project/C/octave-2.1.23.orig/liboctave/lo-specfun.cc    Sat Dec  5 00:20:16 1998
  433. --- i:/project/C/octave-2.1.23/liboctave/lo-specfun.cc    Fri Dec 24 13:35:56 1999
  434. ***************
  435. *** 20,29 ****
  436. --- 20,35 ----
  437.   
  438.   */
  439.   
  440. + /* Modified by Klaus Gebhardt, 1997-1999 */
  441.   #ifdef HAVE_CONFIG_H
  442.   #include <config.h>
  443.   #endif
  444.   
  445. + #ifdef __EMX__
  446. + #include <float.h>
  447. + #endif
  448.   #include "Range.h"
  449.   #include "CColVector.h"
  450.   #include "CMatrix.h"
  451. ***************
  452. *** 91,97 ****
  453.   acosh (double x)
  454.   {
  455.     double retval;
  456. !   F77_XFCN (dacosh, DACOSH, (x, retval));
  457.     return retval;
  458.   }
  459.   #endif
  460. --- 97,103 ----
  461.   acosh (double x)
  462.   {
  463.     double retval;
  464. !   F77_XFCN (xdacosh, DACOSH, (x, retval));
  465.     return retval;
  466.   }
  467.   #endif
  468. ***************
  469. *** 101,107 ****
  470.   asinh (double x)
  471.   {
  472.     double retval;
  473. !   F77_XFCN (dasinh, DASINH, (x, retval));
  474.     return retval;
  475.   }
  476.   #endif
  477. --- 107,113 ----
  478.   asinh (double x)
  479.   {
  480.     double retval;
  481. !   F77_XFCN (xdasinh, DASINH, (x, retval));
  482.     return retval;
  483.   }
  484.   #endif
  485. ***************
  486. *** 111,117 ****
  487.   atanh (double x)
  488.   {
  489.     double retval;
  490. !   F77_XFCN (datanh, DATANH, (x, retval));
  491.     return retval;
  492.   }
  493.   #endif
  494. --- 117,123 ----
  495.   atanh (double x)
  496.   {
  497.     double retval;
  498. !   F77_XFCN (xdatanh, DATANH, (x, retval));
  499.     return retval;
  500.   }
  501.   #endif
  502. ***************
  503. *** 121,127 ****
  504.   erf (double x)
  505.   {
  506.     double retval;
  507. !   F77_XFCN (derf, DERF, (x, retval));
  508.     return retval;
  509.   }
  510.   #endif
  511. --- 127,133 ----
  512.   erf (double x)
  513.   {
  514.     double retval;
  515. !   F77_XFCN (xderf, DERF, (x, retval));
  516.     return retval;
  517.   }
  518.   #endif
  519. ***************
  520. *** 131,137 ****
  521.   erfc (double x)
  522.   {
  523.     double retval;
  524. !   F77_XFCN (derfc, DERFC, (x, retval));
  525.     return retval;
  526.   }
  527.   #endif
  528. --- 137,143 ----
  529.   erfc (double x)
  530.   {
  531.     double retval;
  532. !   F77_XFCN (xderfc, DERFC, (x, retval));
  533.     return retval;
  534.   }
  535.   #endif
  536. 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
  537. *** n:/project/C/octave-2.1.23.orig/liboctave/lo-sysdep.cc    Thu Nov 27 03:02:26 1997
  538. --- i:/project/C/octave-2.1.23/liboctave/lo-sysdep.cc    Fri Dec 24 13:35:56 1999
  539. ***************
  540. *** 28,33 ****
  541. --- 28,35 ----
  542.   
  543.   */
  544.   
  545. + /* Modified by Klaus Gebhardt, 1999 */
  546.   #ifdef HAVE_CONFIG_H
  547.   #include <config.h>
  548.   #endif
  549. ***************
  550. *** 43,52 ****
  551. --- 45,59 ----
  552.   #include <unistd.h>
  553.   #endif
  554.   
  555. + #ifdef __EMX__
  556. + #include <stdlib.h>
  557. + #endif
  558.   #if ! defined (HAVE_GETHOSTNAME) && defined (HAVE_SYS_UTSNAME_H)
  559.   #include <sys/utsname.h>
  560.   #endif
  561.   
  562. + #include "lo-utils.h"
  563.   #include "lo-error.h"
  564.   #include "pathlen.h"
  565.   
  566. ***************
  567. *** 75,81 ****
  568.     return retval;
  569.   }
  570.   
  571. ! int
  572.   octave_chdir (const string& path)
  573.   {
  574.   #if defined (__EMX__)
  575. --- 82,88 ----
  576.     return retval;
  577.   }
  578.   
  579. ! bool
  580.   octave_chdir (const string& path)
  581.   {
  582.   #if defined (__EMX__)
  583. 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
  584. *** n:/project/C/octave-2.1.23.orig/liboctave/oct-shlib.cc    Fri Oct 29 22:52:12 1999
  585. --- i:/project/C/octave-2.1.23/liboctave/oct-shlib.cc    Fri Dec 24 18:56:46 1999
  586. ***************
  587. *** 20,25 ****
  588. --- 20,27 ----
  589.   
  590.   */
  591.   
  592. + /* Modified by Klaus Gebhardt, 1999 */
  593.   #ifdef HAVE_CONFIG_H
  594.   #include <config.h>
  595.   #endif
  596. 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
  597. *** n:/project/C/octave-2.1.23.orig/liboctave/oct-syscalls.cc    Fri Feb  6 22:27:10 1998
  598. --- i:/project/C/octave-2.1.23/liboctave/oct-syscalls.cc    Sat Dec 25 12:20:42 1999
  599. ***************
  600. *** 20,25 ****
  601. --- 20,27 ----
  602.   
  603.   */
  604.   
  605. + /* Modified by Klaus Gebhardt, 1999 */
  606.   #ifdef HAVE_CONFIG_H
  607.   #include <config.h>
  608.   #endif
  609. ***************
  610. *** 40,45 ****
  611. --- 42,49 ----
  612.   #include <fcntl.h>
  613.   #endif
  614.   
  615. + #include <process.h>
  616.   #include "oct-syscalls.h"
  617.   #include "str-vec.h"
  618.   #include "syswait.h"
  619. ***************
  620. *** 48,53 ****
  621. --- 52,83 ----
  622.     nm ## ": not supported on this system"
  623.   
  624.   int
  625. + octave_syscalls::dup (int old_fd)
  626. + {
  627. +   string msg;
  628. +   return dup (old_fd);
  629. + }
  630. + int
  631. + octave_syscalls::dup (int old_fd, string& msg)
  632. + {
  633. +   msg = string ();
  634. +   int status = -1;
  635. + #if defined (HAVE_DUP)
  636. +   status = ::dup (old_fd);
  637. +   if (status < 0)
  638. +     msg = ::strerror (errno);
  639. + #else
  640. +   msg = NOT_SUPPORTED ("dup");
  641. + #endif
  642. +   return status;
  643. + }
  644. + int
  645.   octave_syscalls::dup2 (int old_fd, int new_fd)
  646.   {
  647.     string msg;
  648. ***************
  649. *** 99,104 ****
  650. --- 129,180 ----
  651.       msg = ::strerror (errno);
  652.   #else
  653.     msg = NOT_SUPPORTED ("execvp");
  654. + #endif
  655. +   return status;
  656. + }
  657. + int
  658. + octave_syscalls::spawnvp (const string& mode, const string& file,
  659. +               const string_vector& argv)
  660. + {
  661. +   string msg;
  662. +   return spawnvp (mode, file, argv, msg);
  663. + }
  664. + int
  665. + octave_syscalls::spawnvp (const string& mode, const string& file,
  666. +               const string_vector& args,
  667. +               string& msg)
  668. + {
  669. +   msg = string ();
  670. +   int status = -1;
  671. + #if defined (HAVE_SPAWNVP)
  672. +   int m = P_WAIT;
  673. +   if (mode == "wait")         m = P_WAIT;
  674. +   else if (mode == "nowait")  m = P_NOWAIT;
  675. +   else if (mode == "detach")  m = P_DETACH;
  676. +   else if (mode == "session") m = P_SESSION;
  677. +   else if (mode == "pm")      m = P_PM;
  678. +   else
  679. +     {
  680. +       msg = "spawnvp: invalid mode specified.";
  681. +       return status;
  682. +     }
  683. +   char **argv = args.c_str_vec ();
  684. +   status = ::spawnvp (m, file.c_str (), argv);
  685. +   string_vector::delete_c_str_vec (argv);
  686. +   if (status < 0)
  687. +     msg = ::strerror (errno);
  688. + #else
  689. +   msg = NOT_SUPPORTED ("spawnvp");
  690.   #endif
  691.   
  692.     return status;
  693. 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
  694. *** n:/project/C/octave-2.1.23.orig/liboctave/oct-syscalls.h    Fri Feb  6 07:00:08 1998
  695. --- i:/project/C/octave-2.1.23/liboctave/oct-syscalls.h    Sat Dec 25 10:52:34 1999
  696. ***************
  697. *** 20,25 ****
  698. --- 20,27 ----
  699.   
  700.   */
  701.   
  702. + /* Modified by Klaus Gebhardt, 1999 */
  703.   #if !defined (octave_syscalls_h)
  704.   #define octave_syscalls_h 1
  705.   
  706. ***************
  707. *** 34,44 ****
  708. --- 36,54 ----
  709.   struct
  710.   octave_syscalls
  711.   {
  712. +   static int dup (int);
  713. +   static int dup (int, string&);
  714.     static int dup2 (int, int);
  715.     static int dup2 (int, int, string&);
  716.   
  717.     static int execvp (const string&, const string_vector&);
  718.     static int execvp (const string&, const string_vector&, string&);
  719. +   static int spawnvp (const string&, const string&,
  720. +               const string_vector&);
  721. +   static int spawnvp (const string&, const string&,
  722. +               const string_vector&, string&);
  723.   
  724.     static int fcntl (int, int, long);
  725.     static int fcntl (int, int, long, string&);
  726. diff -cwr n:/project/C/octave-2.1.23.orig/liboctave/pathsearch.cc i:/project/C/octave-2.1.23/liboctave/pathsearch.cc
  727. *** n:/project/C/octave-2.1.23.orig/liboctave/pathsearch.cc    Thu Oct 29 00:11:10 1998
  728. --- i:/project/C/octave-2.1.23/liboctave/pathsearch.cc    Fri Dec 24 13:35:56 1999
  729. ***************
  730. *** 20,25 ****
  731. --- 20,27 ----
  732.   
  733.   */
  734.   
  735. + /* Modified by Klaus Gebhardt, 1998 */
  736.   #ifdef HAVE_CONFIG_H
  737.   #include <config.h>
  738.   #endif
  739. ***************
  740. *** 145,151 ****
  741. --- 147,157 ----
  742.   void
  743.   dir_path::set_program_name (const string& nm)
  744.   {
  745. + #ifndef __EMX__
  746. +   kpse_set_program_name (nm.c_str (), "octave");
  747. + #else
  748.     kpse_set_progname (nm.c_str ());
  749. + #endif
  750.   }
  751.   
  752.   void
  753. 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
  754. *** n:/project/C/octave-2.1.23.orig/liboctave/str-vec.cc    Fri Jun  6 10:29:28 1997
  755. --- i:/project/C/octave-2.1.23/liboctave/str-vec.cc    Sat Dec 25 12:27:38 1999
  756. ***************
  757. *** 107,114 ****
  758.   void
  759.   string_vector::delete_c_str_vec (const char * const *v)
  760.   {
  761. !   while (*v)
  762. !     delete [] *v;
  763.   
  764.     delete [] v;
  765.   }
  766. --- 107,116 ----
  767.   void
  768.   string_vector::delete_c_str_vec (const char * const *v)
  769.   {
  770. !   int i = 0;
  771. !   while (v[i])
  772. !     delete [] v[i++];
  773.   
  774.     delete [] v;
  775.   }
  776. 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
  777. *** n:/project/C/octave-2.1.23.orig/libcruft/misc/dostop.c    Thu Mar 27 17:18:28 1997
  778. --- i:/project/C/octave-2.1.23/libcruft/misc/dostop.c    Fri Dec 24 13:35:58 1999
  779. ***************
  780. *** 21,26 ****
  781. --- 21,28 ----
  782.   
  783.   */
  784.   
  785. + /* Modified by Klaus Gebhardt, 1996 */
  786.   #ifdef HAVE_CONFIG_H
  787.   #include <config.h>
  788.   #endif
  789. ***************
  790. *** 30,35 ****
  791. --- 32,42 ----
  792.   
  793.   #include "f77-fcn.h"
  794.   #include "lo-error.h"
  795. + #ifdef __EMX__
  796. + int f77_exception_encountered;
  797. + jmp_buf f77_context;
  798. + #endif
  799.   
  800.   /* All the STOP statements in the Fortran routines have been replaced
  801.      with a call to XSTOPX, defined in the file libcruft/misc/xstopx.f.
  802. 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
  803. *** n:/project/C/octave-2.1.23.orig/libcruft/misc/f77-fcn.h    Thu Mar 27 17:18:28 1997
  804. --- i:/project/C/octave-2.1.23/libcruft/misc/f77-fcn.h    Fri Dec 24 13:35:58 1999
  805. ***************
  806. *** 20,25 ****
  807. --- 20,27 ----
  808.   
  809.   */
  810.   
  811. + /* Modified by Klaus Gebhardt, 1997 */
  812.   #if !defined (octave_f77_fcn_h)
  813.   #define octave_f77_fcn_h 1
  814.   
  815. ***************
  816. *** 77,82 ****
  817. --- 79,103 ----
  818.       } \
  819.         else \
  820.       F77_FCN (f, F) args; \
  821. +       copy_f77_context ((char *) saved_f77_context, (char *) f77_context, \
  822. +             sizeof (jmp_buf)); \
  823. +     } \
  824. +   while (0)
  825. + #define F77_YXFCN(f, F, rc, args) \
  826. +   do \
  827. +     { \
  828. +       jmp_buf saved_f77_context; \
  829. +       f77_exception_encountered = 0; \
  830. +       copy_f77_context ((char *) f77_context, (char *) saved_f77_context, \
  831. +             sizeof (jmp_buf)); \
  832. +       if (setjmp (f77_context)) \
  833. +     { \
  834. +       f77_exception_encountered = 1; \
  835. +       F77_XFCN_ERROR (f, F); \
  836. +     } \
  837. +       else \
  838. +     rc = F77_FCN (f, F) args; \
  839.         copy_f77_context ((char *) saved_f77_context, (char *) f77_context, \
  840.               sizeof (jmp_buf)); \
  841.       } \
  842. diff -cwr n:/project/C/octave-2.1.23.orig/src/cutils.c i:/project/C/octave-2.1.23/src/cutils.c
  843. *** n:/project/C/octave-2.1.23.orig/src/cutils.c    Fri Nov 12 17:18:16 1999
  844. --- i:/project/C/octave-2.1.23/src/cutils.c    Fri Dec 24 15:50:58 1999
  845. ***************
  846. *** 48,53 ****
  847. --- 48,60 ----
  848.   
  849.     usleep (useconds);
  850.   
  851. + #elif defined (HAVE__SLEEP2)
  852. +   int delay = useconds / 1000;
  853. +   if (delay > 0)
  854. +     _sleep2 (delay);
  855.   #elif defined (HAVE_SELECT)
  856.   
  857.     struct timeval delay;
  858. diff -cwr n:/project/C/octave-2.1.23.orig/src/defaults.cc i:/project/C/octave-2.1.23/src/defaults.cc
  859. *** n:/project/C/octave-2.1.23.orig/src/defaults.cc    Tue Nov 23 21:54:24 1999
  860. --- i:/project/C/octave-2.1.23/src/defaults.cc    Fri Dec 24 13:35:58 1999
  861. ***************
  862. *** 20,25 ****
  863. --- 20,27 ----
  864.   
  865.   */
  866.   
  867. + /* Modified by Klaus Gebhardt, 1996 - 1997 */
  868.   #ifdef HAVE_CONFIG_H
  869.   #include <config.h>
  870.   #endif
  871. ***************
  872. *** 168,174 ****
  873.   
  874.         if (! shell_path.empty ())
  875.       {
  876. !       Vexec_path = string (":");
  877.         Vexec_path.append (shell_path);
  878.       }
  879.       }
  880. --- 170,176 ----
  881.   
  882.         if (! shell_path.empty ())
  883.       {
  884. !       Vexec_path = string (SEPCHAR_STR);
  885.         Vexec_path.append (shell_path);
  886.       }
  887.       }
  888. ***************
  889. *** 183,189 ****
  890.   
  891.     string oct_path = octave_env::getenv ("OCTAVE_PATH");
  892.   
  893. !   Vload_path = oct_path.empty () ? string (":") : oct_path;
  894.   
  895.     Vload_path_dir_path = dir_path (Vload_path, Vdefault_load_path);
  896.   }
  897. --- 185,191 ----
  898.   
  899.     string oct_path = octave_env::getenv ("OCTAVE_PATH");
  900.   
  901. !   Vload_path = oct_path.empty () ? string (SEPCHAR_STR) : oct_path;
  902.   
  903.     Vload_path_dir_path = dir_path (Vload_path, Vdefault_load_path);
  904.   }
  905. ***************
  906. *** 204,210 ****
  907.     string oct_info_prog = octave_env::getenv ("OCTAVE_INFO_PROGRAM");
  908.   
  909.     if (oct_info_prog.empty ())
  910. !     Vinfo_prog = "info";
  911.     else
  912.       Vinfo_prog = string (oct_info_prog);
  913.   }
  914. --- 206,219 ----
  915.     string oct_info_prog = octave_env::getenv ("OCTAVE_INFO_PROGRAM");
  916.   
  917.     if (oct_info_prog.empty ())
  918. !     {
  919. ! #if !defined (__EMX__)
  920. !       Vinfo_prog = Varch_lib_dir;
  921. !       Vinfo_prog.append ("/info");
  922. ! #else
  923. !       Vinfo_prog = "";
  924. ! #endif
  925. !     }
  926.     else
  927.       Vinfo_prog = string (oct_info_prog);
  928.   }
  929. ***************
  930. *** 212,218 ****
  931. --- 221,231 ----
  932.   static void
  933.   set_default_editor (void)
  934.   {
  935. + #if defined (__EMX__) && defined (OS2)
  936. +   Veditor = "e";
  937. + #else
  938.     Veditor = "emacs";
  939. + #endif
  940.   
  941.     string env_editor = octave_env::getenv ("EDITOR");
  942.   
  943. ***************
  944. *** 345,352 ****
  945.   
  946.         if (eplen > 0)
  947.       {
  948. !       bool prepend = (Vexec_path[0] == ':');
  949. !       bool append = (eplen > 1 && Vexec_path[eplen-1] == ':');
  950.   
  951.         if (prepend)
  952.           {
  953. --- 358,365 ----
  954.   
  955.         if (eplen > 0)
  956.       {
  957. !       bool prepend = (Vexec_path[0] == SEPCHAR);
  958. !       bool append = (eplen > 1 && Vexec_path[eplen-1] == SEPCHAR);
  959.   
  960.         if (prepend)
  961.           {
  962. 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
  963. *** n:/project/C/octave-2.1.23.orig/src/defun-int.h    Sat Nov 20 04:05:44 1999
  964. --- i:/project/C/octave-2.1.23/src/defun-int.h    Fri Dec 24 16:08:58 1999
  965. ***************
  966. *** 20,25 ****
  967. --- 20,27 ----
  968.   
  969.   */
  970.   
  971. + /* Modified by Klaus Gebhardt, 1999 */
  972.   #if !defined (octave_defun_int_h)
  973.   #define octave_defun_int_h 1
  974.   
  975. ***************
  976. *** 175,181 ****
  977.     install_builtin_mapper \
  978.       (new octave_mapper (ch_map, d_b_map, c_b_map, d_d_map, d_c_map, \
  979.               c_c_map, lo, hi, \
  980. !             can_ret_cmplx_for_real, #name))
  981.   
  982.   #endif /* ! MAKE_BUILTINS */
  983.   
  984. --- 177,183 ----
  985.     install_builtin_mapper \
  986.       (new octave_mapper (ch_map, d_b_map, c_b_map, d_d_map, d_c_map, \
  987.               c_c_map, lo, hi, \
  988. !             can_ret_cmplx_for_real, #name, #doc))
  989.   
  990.   #endif /* ! MAKE_BUILTINS */
  991.   
  992. 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
  993. *** n:/project/C/octave-2.1.23.orig/src/DLD-FUNCTIONS/qz.cc    Tue Nov 23 20:07:18 1999
  994. --- i:/project/C/octave-2.1.23/src/DLD-FUNCTIONS/qz.cc    Fri Dec 24 13:35:58 1999
  995. ***************
  996. *** 20,25 ****
  997. --- 20,27 ----
  998.   
  999.   */
  1000.   
  1001. + /* Modified by Klaus Gebhardt, 1999 */
  1002.   // Generalized eigenvalue balancing via LAPACK
  1003.   // Written by A. S. Hodel <scotte@eng.auburn.edu>
  1004.   
  1005. ***************
  1006. *** 27,33 ****
  1007. --- 29,37 ----
  1008.   #undef DEBUG_SORT
  1009.   #undef DEBUG_EIG
  1010.   
  1011. + #ifdef HAVE_CONFIG_H
  1012.   #include "config.h"
  1013. + #endif
  1014.   
  1015.   #include <cfloat>
  1016.   #include <iostream.h>
  1017. 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
  1018. *** n:/project/C/octave-2.1.23.orig/src/DLD-FUNCTIONS/rand.cc    Sun Nov 21 17:26:06 1999
  1019. --- i:/project/C/octave-2.1.23/src/DLD-FUNCTIONS/rand.cc    Fri Dec 24 13:35:58 1999
  1020. ***************
  1021. *** 20,25 ****
  1022. --- 20,27 ----
  1023.   
  1024.   */
  1025.   
  1026. + /* Modified by Klaus Gebhardt, 1997 */
  1027.   #ifdef HAVE_CONFIG_H
  1028.   #include <config.h>
  1029.   #endif
  1030. 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
  1031. *** n:/project/C/octave-2.1.23.orig/src/dynamic-ld.cc    Tue Nov 23 21:54:24 1999
  1032. --- i:/project/C/octave-2.1.23/src/dynamic-ld.cc    Fri Dec 24 18:47:56 1999
  1033. ***************
  1034. *** 57,67 ****
  1035.     static void *search (const string& fcn_name, octave_shlib& shl,
  1036.                  octave_shlib::name_mangler mangler = 0);
  1037.   
  1038. ! private:
  1039.   
  1040.     octave_shlib_list (void) { }
  1041.   
  1042.     ~octave_shlib_list (void) { }
  1043.   
  1044.     void do_append (const octave_shlib& shl);
  1045.   
  1046. --- 57,69 ----
  1047.     static void *search (const string& fcn_name, octave_shlib& shl,
  1048.                  octave_shlib::name_mangler mangler = 0);
  1049.   
  1050. ! protected:
  1051.   
  1052.     octave_shlib_list (void) { }
  1053.   
  1054.     ~octave_shlib_list (void) { }
  1055. + private:
  1056.   
  1057.     void do_append (const octave_shlib& shl);
  1058.   
  1059. 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
  1060. *** n:/project/C/octave-2.1.23.orig/src/file-io.cc    Wed Dec 15 21:48:44 1999
  1061. --- i:/project/C/octave-2.1.23/src/file-io.cc    Fri Dec 24 13:35:58 1999
  1062. ***************
  1063. *** 34,39 ****
  1064. --- 34,41 ----
  1065.   // Completely rewritten by John W. Eaton <jwe@bevo.che.wisc.edu>,
  1066.   // April 1996.
  1067.   
  1068. + /* Modified by Klaus Gebhardt, 1997 */
  1069.   #ifdef HAVE_CONFIG_H
  1070.   #include <config.h>
  1071.   #endif
  1072. ***************
  1073. *** 62,67 ****
  1074. --- 64,70 ----
  1075.   #include "oct-stream.h"
  1076.   #include "oct-strstrm.h"
  1077.   #include "pager.h"
  1078. + #include "sighandlers.h"
  1079.   #include "sysdep.h"
  1080.   #include "utils.h"
  1081.   #include "variables.h"
  1082. ***************
  1083. *** 1479,1484 ****
  1084. --- 1482,1522 ----
  1085.   }
  1086.   
  1087.   DEFALIAS (octave_tmp_file_name, tmpnam);
  1088. + DEFUN (child_purge_temp, args, ,
  1089. +  "child_purge_temp (pid, name)\n\
  1090. + Remove the file NAME, when child PID dies.")
  1091. + {
  1092. +   octave_value retval = -1.0;
  1093. +   if (args.length () == 2)
  1094. +     {
  1095. +       if (args(1).is_string ())
  1096. +     {
  1097. +       double d_pid = args(0).double_value ();
  1098. +       string name  = args(1).string_value ();
  1099. +       if (!error_state)
  1100. +         {
  1101. +           if (D_NINT (d_pid) == d_pid)
  1102. +         {
  1103. +           int i_pid = NINT (d_pid);
  1104. +           octave_child_list::insert (i_pid, 0, name);
  1105. +           retval = 0.0;
  1106. +         }
  1107. +           else
  1108. +         error ("child_purge_temp: pid must be an integer");
  1109. +         }
  1110. +     }
  1111. +       else
  1112. +     error ("child_purge_temp: second argument must be a string");
  1113. +     }
  1114. +   else
  1115. +     print_usage ("child_purge_temp");
  1116. +   return retval;
  1117. + }
  1118.   
  1119.   static int
  1120.   convert (int x, int ibase, int obase)
  1121. diff -cwr n:/project/C/octave-2.1.23.orig/src/help.cc i:/project/C/octave-2.1.23/src/help.cc
  1122. *** n:/project/C/octave-2.1.23.orig/src/help.cc    Tue Nov 23 21:54:24 1999
  1123. --- i:/project/C/octave-2.1.23/src/help.cc    Sat Dec 25 19:24:36 1999
  1124. ***************
  1125. *** 20,25 ****
  1126. --- 20,27 ----
  1127.   
  1128.   */
  1129.   
  1130. + /* Modified by Klaus Gebhardt, 1996 */
  1131.   #ifdef HAVE_CONFIG_H
  1132.   #include <config.h>
  1133.   #endif
  1134. ***************
  1135. *** 69,74 ****
  1136. --- 71,94 ----
  1137.   #include "variables.h"
  1138.   #include "version.h"
  1139.   
  1140. + #if defined (__EMX__)
  1141. + extern "C"
  1142. + {
  1143. + #include "info/info.h"
  1144. + #include "info/dribble.h"
  1145. + #include "info/terminal.h"
  1146. +   extern int external_info_search ();
  1147. +   extern int index_entry_exists ();
  1148. +   extern int do_info_index_search ();
  1149. +   extern void finish_info_session ();
  1150. +   extern char *replace_in_documentation ();
  1151. + #include <process.h>
  1152. +   int _IO_system (const char *, int);
  1153. + }
  1154. + #endif
  1155.   // Name of the info file specified on command line.
  1156.   // (--info-file file)
  1157.   string Vinfo_file;
  1158. ***************
  1159. *** 499,504 ****
  1160. --- 519,526 ----
  1161.   static int
  1162.   try_info (const string& nm)
  1163.   {
  1164. +   if (Vinfo_prog.length () > 0)
  1165. +     {
  1166.         int status = 0;
  1167.   
  1168.         static char *cmd_str = 0;
  1169. ***************
  1170. *** 529,551 ****
  1171.     volatile octave_interrupt_handler old_interrupt_handler
  1172.       = octave_ignore_interrupts ();
  1173.   
  1174.     status = system (cmd_str);
  1175.   
  1176.     octave_set_interrupt_handler (old_interrupt_handler);
  1177.   
  1178.     if (WIFEXITED (status))
  1179.       status = WEXITSTATUS (status);
  1180.     else
  1181.       status = 127;
  1182.   
  1183.     return status;
  1184.   }
  1185.   
  1186.   static void
  1187.   help_from_info (const string_vector& argv, int idx, int argc)
  1188.   {
  1189.     if (idx == argc)
  1190. !     try_info (string ());
  1191.     else
  1192.       {
  1193.         for (int i = idx; i < argc; i++)
  1194. --- 551,646 ----
  1195.         volatile octave_interrupt_handler old_interrupt_handler
  1196.       = octave_ignore_interrupts ();
  1197.   
  1198. + #ifdef __EMX__
  1199. +       status = _IO_system (cmd_str, P_WAIT);
  1200. + #else
  1201.         status = system (cmd_str);
  1202. + #endif
  1203.   
  1204.         octave_set_interrupt_handler (old_interrupt_handler);
  1205.   
  1206. + #ifndef __EMX__
  1207.         if (WIFEXITED (status))
  1208.       status = WEXITSTATUS (status);
  1209.         else
  1210.       status = 127;
  1211. + #else
  1212. +       if (status > 127) status -= 256;
  1213. + #endif
  1214. +       return status;
  1215. +     }
  1216. +   else
  1217. +     {
  1218. +       volatile octave_interrupt_handler old_interrupt_handler
  1219. +     = octave_ignore_interrupts ();
  1220. +       int status = 0;
  1221. +       char *directory_name = strdup (Vinfo_file.c_str ());
  1222. +       char *temp = filename_non_directory (directory_name);
  1223. +       if (temp != directory_name)
  1224. +     {
  1225. +       *temp = 0;
  1226. +       info_add_path (directory_name, INFOPATH_PREPEND);
  1227. +     }
  1228. +       delete [] directory_name;
  1229. +       NODE *initial_node = info_get_node (Vinfo_file.c_str (), 0);
  1230. +       if (! initial_node)  status = 127;
  1231. +       else
  1232. +     {
  1233. +       status = external_info_search(initial_node, 0,
  1234. +                     Vinfo_file.c_str (), nm.c_str ());
  1235. +       if (status == 1)
  1236. +         {
  1237. +           char *format = replace_in_documentation
  1238. +         ("Type \"\\[quit]\" to quit, \"\\[get-help-window]\" for help.");
  1239. +           window_message_in_echo_area (format);
  1240. +           info_read_and_dispatch ();
  1241. + #ifdef __EMX__
  1242. +           terminal_goto_xy (0, screenheight - 2);
  1243. + #else
  1244. +           terminal_goto_xy (0, screenheight - 1);
  1245. + #endif
  1246. +           terminal_clear_to_eol ();
  1247. +           terminal_unprep_terminal ();
  1248. +         }
  1249. +       status = status * status - 1;
  1250. +       _finish_info_session (initial_node, 0);
  1251. +     }
  1252. +       octave_set_interrupt_handler (old_interrupt_handler);
  1253.   
  1254.         return status;
  1255.       }
  1256. + }
  1257.   
  1258.   static void
  1259.   help_from_info (const string_vector& argv, int idx, int argc)
  1260.   {
  1261.     if (idx == argc)
  1262. !     {
  1263. !       int status = try_info (string ());
  1264. !       if (status)
  1265. !     {
  1266. !       if (status < 0)
  1267. !         {
  1268. !           message ("help", "sorry, `%s' is not indexed in the manual",
  1269. !                string ().c_str ());
  1270. !           sleep (2);
  1271. !         }
  1272. !       else  error ("help: unable to find info!");
  1273. !     }
  1274. !     }
  1275.     else
  1276.       {
  1277.         for (int i = idx; i < argc; i++)
  1278. ***************
  1279. *** 597,604 ****
  1280.   
  1281.     if (looks_like_texinfo (msg, pos))
  1282.       {
  1283. -       string tmp_file_name = file_ops::tempnam ("", "");
  1284.         int cols = command_editor::terminal_cols ();
  1285.   
  1286.         if (cols > 16)
  1287. --- 692,697 ----
  1288. ***************
  1289. *** 611,616 ****
  1290. --- 704,745 ----
  1291.       cols = 72;
  1292.   
  1293.         ostrstream buf;
  1294. + #ifdef __EMX__
  1295. +       string tmp_file_name_1 = file_ops::tempnam ("", "hlp-");
  1296. +       string tmp_file_name_2 = file_ops::tempnam ("", "hlp-");
  1297. +       ofstream tmp_file_1 (tmp_file_name_1.c_str ());
  1298. +       tmp_file_1 << msg.substr (pos+1);
  1299. +       tmp_file_1.close ();
  1300. +       buf << "sed -e \"s/^[#%]* *//g\" "
  1301. +       << tmp_file_name_1
  1302. +       << " | makeinfo"
  1303. +       << " -D \"VERSION " << OCTAVE_VERSION << "\""
  1304. +       << " -D \"OCTAVEHOME " << OCTAVE_PREFIX << "\""
  1305. +       << " -D \"TARGETHOSTTYPE " << CANONICAL_HOST_TYPE << "\""
  1306. +       << " --fill-column " << cols
  1307. +       << " --no-warn"
  1308. +       << " --no-validate"
  1309. +       << " --no-headers"
  1310. +       << " --output " << tmp_file_name_2
  1311. +       << " >NUL 2>&1"
  1312. +       << ends;
  1313. +       _IO_system (buf.str(), P_WAIT);
  1314. +       ifstream tmp_file_2 (tmp_file_name_2.c_str ());
  1315. +       int c;
  1316. +       while ((c = tmp_file_2.get ()) != EOF)
  1317. +     os << (char) c;
  1318. +       tmp_file_2.close ();
  1319. +       file_ops::unlink (tmp_file_name_2);
  1320. +       file_ops::unlink (tmp_file_name_1);
  1321. + #else
  1322.         buf << "sed 's/^[#%]+ *//' | makeinfo"
  1323.         << " -D \"VERSION " << OCTAVE_VERSION << "\""
  1324.         << " -D \"OCTAVEHOME " << OCTAVE_PREFIX << "\""
  1325. ***************
  1326. *** 624,629 ****
  1327. --- 753,760 ----
  1328.         << " > /dev/null 2>&1"
  1329.         << ends;
  1330.   
  1331. +       string tmp_file_name = file_ops::tempnam ("", "");
  1332.         char *cmd = buf.str ();
  1333.   
  1334.         oprocstream filter (cmd);
  1335. ***************
  1336. *** 648,653 ****
  1337. --- 779,785 ----
  1338.       }
  1339.         else
  1340.       os << msg;
  1341. + #endif
  1342.       }
  1343.     else
  1344.       os << msg;
  1345. ***************
  1346. *** 1018,1023 ****
  1347. --- 1150,1156 ----
  1348.   
  1349.     string s = builtin_string_variable ("INFO_PROGRAM");
  1350.   
  1351. + #ifndef __EMX__
  1352.     if (s.empty ())
  1353.       {
  1354.         gripe_invalid_value_specified ("INFO_PROGRAM");
  1355. ***************
  1356. *** 1025,1030 ****
  1357. --- 1158,1166 ----
  1358.       }
  1359.     else
  1360.       Vinfo_prog = s;
  1361. + #else
  1362. +   Vinfo_prog = s;
  1363. + #endif
  1364.   
  1365.     return status;
  1366.   }
  1367. diff -cwr n:/project/C/octave-2.1.23.orig/src/input.cc i:/project/C/octave-2.1.23/src/input.cc
  1368. *** n:/project/C/octave-2.1.23.orig/src/input.cc    Tue Nov 23 21:54:24 1999
  1369. --- i:/project/C/octave-2.1.23/src/input.cc    Fri Dec 24 13:35:58 1999
  1370. ***************
  1371. *** 20,25 ****
  1372. --- 20,27 ----
  1373.   
  1374.   */
  1375.   
  1376. + /* Modified by Klaus Gebhardt, 1996-1999 */
  1377.   // Get command input interactively or from files.
  1378.   
  1379.   #ifdef HAVE_CONFIG_H
  1380. ***************
  1381. *** 119,124 ****
  1382. --- 121,130 ----
  1383.   // TRUE means the user forced this shell to be interactive (-i).
  1384.   bool forced_interactive = false;
  1385.   
  1386. + // Nonzero means the user forced this shell to be really interactive (-i),
  1387. + // but without using the pager.
  1388. + int really_forced_interactive = 0;
  1389.   // Should we issue a prompt?
  1390.   int promptflag = 1;
  1391.   
  1392. ***************
  1393. *** 173,179 ****
  1394.       }
  1395.     else
  1396.       {
  1397. !       if (! s.empty () && (interactive || forced_interactive))
  1398.       {
  1399.         FILE *stream = command_editor::get_output_stream ();
  1400.   
  1401. --- 179,186 ----
  1402.       }
  1403.     else
  1404.       {
  1405. !       if (! s.empty () &&
  1406. !       (interactive || forced_interactive || really_forced_interactive))
  1407.       {
  1408.         FILE *stream = command_editor::get_output_stream ();
  1409.   
  1410. ***************
  1411. *** 199,205 ****
  1412.   
  1413.     Vlast_prompt_time.stamp ();
  1414.   
  1415. !   if ((interactive || forced_interactive)
  1416.         && (! (reading_fcn_file || reading_script_file)))
  1417.       {
  1418.         string ps = (promptflag > 0) ? Vps1 : Vps2;
  1419. --- 206,212 ----
  1420.   
  1421.     Vlast_prompt_time.stamp ();
  1422.   
  1423. !   if ((interactive || forced_interactive || really_forced_interactive)
  1424.         && (! (reading_fcn_file || reading_script_file)))
  1425.       {
  1426.         string ps = (promptflag > 0) ? Vps1 : Vps2;
  1427. ***************
  1428. *** 344,350 ****
  1429.     FILE *instream = 0;
  1430.   
  1431.     if (name.length () > 0)
  1432. !     instream = fopen (name.c_str (), "r");
  1433.   
  1434.     if (! instream && warn)
  1435.       warning ("%s: no such file or directory", name.c_str ());
  1436. --- 351,357 ----
  1437.     FILE *instream = 0;
  1438.   
  1439.     if (name.length () > 0)
  1440. !     instream = fopen (name.c_str (), "rb");
  1441.   
  1442.     if (! instream && warn)
  1443.       warning ("%s: no such file or directory", name.c_str ());
  1444. ***************
  1445. *** 521,526 ****
  1446. --- 528,538 ----
  1447.     flush_octave_stdout ();
  1448.   
  1449.     string input_buf = gnu_readline (prompt.c_str (), true);
  1450. + #ifdef __EMX__
  1451. +   if (reading_fcn_file || reading_script_file)
  1452. +     octave_diary << prompt.c_str () << input_buf << "\n";
  1453. + #endif
  1454.   
  1455.     if (! input_buf.empty ())
  1456.       {
  1457. diff -cwr n:/project/C/octave-2.1.23.orig/src/input.h i:/project/C/octave-2.1.23/src/input.h
  1458. *** n:/project/C/octave-2.1.23.orig/src/input.h    Thu Jul 15 21:54:26 1999
  1459. --- i:/project/C/octave-2.1.23/src/input.h    Fri Dec 24 13:35:58 1999
  1460. ***************
  1461. *** 20,25 ****
  1462. --- 20,27 ----
  1463.   
  1464.   */
  1465.   
  1466. + /* Modified by Klaus Gebhardt, 1996 */
  1467.   // Use the GNU readline library for command line editing and hisory.
  1468.   
  1469.   #if !defined (octave_input_h)
  1470. ***************
  1471. *** 61,66 ****
  1472. --- 63,72 ----
  1473.   
  1474.   // TRUE means the user forced this shell to be interactive (-i).
  1475.   extern bool forced_interactive;
  1476. + // Nonzero means the user forced this shell to be really interactive (-i),
  1477. + // but without using the pager.
  1478. + extern int really_forced_interactive;
  1479.   
  1480.   // Should we issue a prompt?
  1481.   extern int promptflag;
  1482. diff -cwr n:/project/C/octave-2.1.23.orig/src/lex.l i:/project/C/octave-2.1.23/src/lex.l
  1483. *** n:/project/C/octave-2.1.23.orig/src/lex.l    Thu Dec 16 05:51:46 1999
  1484. --- i:/project/C/octave-2.1.23/src/lex.l    Fri Dec 24 16:33:16 1999
  1485. ***************
  1486. *** 20,25 ****
  1487. --- 20,27 ----
  1488.   
  1489.   */
  1490.   
  1491. + /* Modified by Klaus Gebhardt, 1996 - 1999 */
  1492.   %s TEXT_FCN
  1493.   %s MATRIX
  1494.   
  1495. ***************
  1496. *** 194,200 ****
  1497.   
  1498.   D    [0-9]
  1499.   S    [ \t]
  1500. ! NL    ((\n)|(\r\n))
  1501.   SNL    ({S}|{NL})
  1502.   EL    (\.\.\.)
  1503.   BS    (\\)
  1504. --- 196,202 ----
  1505.   
  1506.   D    [0-9]
  1507.   S    [ \t]
  1508. ! NL    ((\n)|(\r)|(\r\n)|())
  1509.   SNL    ({S}|{NL})
  1510.   EL    (\.\.\.)
  1511.   BS    (\\)
  1512. ***************
  1513. *** 247,253 ****
  1514.       return handle_string (yytext[0], true);
  1515.     }
  1516.   
  1517. ! <TEXT_FCN>[^ \t\n\;\,\"\'][^ \t\n\;\,]*{S}* {
  1518.       string tok = strip_trailing_whitespace (yytext);
  1519.       TOK_PUSH_AND_RETURN (tok, TEXT);
  1520.     }
  1521. --- 249,255 ----
  1522.       return handle_string (yytext[0], true);
  1523.     }
  1524.   
  1525. ! <TEXT_FCN>[^ \t\r\n\;\,\"\'][^ \t\r\n\;\,]*{S}* {
  1526.       string tok = strip_trailing_whitespace (yytext);
  1527.       TOK_PUSH_AND_RETURN (tok, TEXT);
  1528.     }
  1529. ***************
  1530. *** 568,574 ****
  1531.       else
  1532.         {
  1533.       int c;
  1534. !     while ((c = yyinput ()) != EOF && c != '\n')
  1535.         ; // Eat comment.
  1536.         }
  1537.   
  1538. --- 570,576 ----
  1539.       else
  1540.         {
  1541.       int c;
  1542. !     while ((c = yyinput ()) != EOF && c != '\n' && c != '\r' && c != '')
  1543.         ; // Eat comment.
  1544.         }
  1545.   
  1546. ***************
  1547. *** 757,763 ****
  1548.   
  1549.     // Only ask for input from stdin if we are expecting interactive
  1550.     // input.
  1551. !   if ((interactive || forced_interactive)
  1552.         && ! (reading_fcn_file || get_input_from_eval_string
  1553.           || input_from_startup_file))
  1554.       yyrestart (stdin);
  1555. --- 759,765 ----
  1556.   
  1557.     // Only ask for input from stdin if we are expecting interactive
  1558.     // input.
  1559. !   if ((interactive || forced_interactive || really_forced_interactive)
  1560.         && ! (reading_fcn_file || get_input_from_eval_string
  1561.           || input_from_startup_file))
  1562.       yyrestart (stdin);
  1563. ***************
  1564. *** 778,784 ****
  1565.     char c;
  1566.     while ((c = *s++) != '\0')
  1567.       {
  1568. !       if (c == '\n')
  1569.         current_input_column = 1;
  1570.         else
  1571.       current_input_column++;
  1572. --- 780,786 ----
  1573.     char c;
  1574.     while ((c = *s++) != '\0')
  1575.       {
  1576. !       if (c == '\n' || c == '\r' || c == '')
  1577.         current_input_column = 1;
  1578.         else
  1579.       current_input_column++;
  1580. ***************
  1581. *** 1180,1186 ****
  1582.   
  1583.     bool begin_comment = true;
  1584.     bool in_comment = true;
  1585. !   int c = 0;
  1586.   
  1587.     while ((c = yyinput ()) != EOF)
  1588.       {
  1589. --- 1182,1188 ----
  1590.   
  1591.     bool begin_comment = true;
  1592.     bool in_comment = true;
  1593. !   int c = 0, d, ct;
  1594.   
  1595.     while ((c = yyinput ()) != EOF)
  1596.       {
  1597. ***************
  1598. *** 1194,1205 ****
  1599.   
  1600.         if (in_comment)
  1601.       {
  1602. !       help_buf += (char) c;
  1603.   
  1604. -       if (c == '\n')
  1605.           in_comment = false;
  1606.       }
  1607.         else
  1608.       {
  1609.         switch (c)
  1610.           {
  1611. --- 1196,1225 ----
  1612.   
  1613.         if (in_comment)
  1614.       {
  1615. !       if (c == '\n' || c == '\r' || c == '')
  1616. !         {
  1617. !           ct = 0;
  1618. !           d  = c;
  1619. !           do
  1620. !         {
  1621. !           if (d == '\n' || d == '')
  1622. !             {
  1623. !               if (++ct > 1)  break;
  1624. !               help_buf += (char) '\n';
  1625. !             }
  1626. !         }
  1627. !           while (((d = yyinput ()) != EOF) &&
  1628. !              (d == '\n' || d == '\r' || d == ''));
  1629. !           if (d != EOF)  yyunput (d, yytext);
  1630.   
  1631.           in_comment = false;
  1632.       }
  1633.         else
  1634. +         help_buf += (char) c;
  1635. +     }
  1636. +       else
  1637.       {
  1638.         switch (c)
  1639.           {
  1640. ***************
  1641. *** 1278,1284 ****
  1642.       unput (c2);
  1643.       }
  1644.     else
  1645. !     retval = match_any (c1, ",;\n]");
  1646.   
  1647.     unput (c1);
  1648.   
  1649. --- 1298,1304 ----
  1650.       unput (c2);
  1651.       }
  1652.     else
  1653. !     retval = match_any (c1, ",;\n\r]");
  1654.   
  1655.     unput (c1);
  1656.   
  1657. ***************
  1658. *** 1468,1473 ****
  1659. --- 1488,1495 ----
  1660.         retval |= ATE_SPACE_OR_TAB;
  1661.         break;
  1662.   
  1663. +     case '':
  1664. +     case '\r':
  1665.       case '\n':
  1666.         retval |= ATE_NEWLINE;
  1667.         in_comment = false;
  1668. ***************
  1669. *** 1600,1605 ****
  1670. --- 1622,1628 ----
  1671.           goto cleanup;
  1672.         break;
  1673.   
  1674. +     case '':
  1675.       case '\n':
  1676.         current_input_column = 0;
  1677.         promptflag--;
  1678. ***************
  1679. *** 1720,1726 ****
  1680.         if (! have_ellipsis_continuation (false))
  1681.           buf << (char) c;
  1682.       }
  1683. !       else if (c == '\n')
  1684.       {
  1685.         error ("unterminated string constant");
  1686.         break;
  1687. --- 1743,1749 ----
  1688.         if (! have_ellipsis_continuation (false))
  1689.           buf << (char) c;
  1690.       }
  1691. !       else if (c == '\n' || c == '\r' || c == '')
  1692.       {
  1693.         error ("unterminated string constant");
  1694.         break;
  1695. ***************
  1696. *** 2133,2138 ****
  1697. --- 2156,2163 ----
  1698.       case ',':
  1699.         break;
  1700.   
  1701. +     case '':
  1702. +     case '\r':
  1703.       case '\n':
  1704.         if (in_comment)
  1705.           in_comment = false;
  1706. diff -cwr n:/project/C/octave-2.1.23.orig/src/mappers.cc i:/project/C/octave-2.1.23/src/mappers.cc
  1707. *** n:/project/C/octave-2.1.23.orig/src/mappers.cc    Wed Dec 15 21:48:44 1999
  1708. --- i:/project/C/octave-2.1.23/src/mappers.cc    Fri Dec 24 15:36:04 1999
  1709. ***************
  1710. *** 20,25 ****
  1711. --- 20,27 ----
  1712.   
  1713.   */
  1714.   
  1715. + /* Modified by Klaus Gebhardt, 1999 */
  1716.   #ifdef HAVE_CONFIG_H
  1717.   #include <config.h>
  1718.   #endif
  1719. ***************
  1720. *** 160,166 ****
  1721.   acos (X): compute the inverse cosine of X for each element of X\n\
  1722.   @end deftypefn");
  1723.   
  1724. !   DEFUN_MAPPER (acosh, 0, 0, 0, acosh, 0, acosh, 1.0, DBL_MAX, 1,
  1725.       "-*- texinfo -*-\n\
  1726.   @deftypefn {Mapping Function} {} acosh (@var{X})\n\
  1727.   acosh (X): compute the inverse hyperbolic cosine of X for each element of X.\n\
  1728. --- 162,168 ----
  1729.   acos (X): compute the inverse cosine of X for each element of X\n\
  1730.   @end deftypefn");
  1731.   
  1732. !   DEFUN_MAPPER (acosh, 0, 0, 0, xacosh, 0, acosh, 1.0, DBL_MAX, 1,
  1733.       "-*- texinfo -*-\n\
  1734.   @deftypefn {Mapping Function} {} acosh (@var{X})\n\
  1735.   acosh (X): compute the inverse hyperbolic cosine of X for each element of X.\n\
  1736. ***************
  1737. *** 201,207 ****
  1738.   asin (X): compute inverse sin (X) for each element of X\n\
  1739.   @end deftypefn");
  1740.   
  1741. !   DEFUN_MAPPER (asinh, 0, 0, 0, asinh, 0, asinh, 0.0, 0.0, 0,
  1742.       "-*- texinfo -*-\n\
  1743.   @deftypefn {Mapping Function} {} asinh (@var{X})\n\
  1744.   asinh (X): compute the inverse hyperbolic sin (X) for each element of X\n\
  1745. --- 203,209 ----
  1746.   asin (X): compute inverse sin (X) for each element of X\n\
  1747.   @end deftypefn");
  1748.   
  1749. !   DEFUN_MAPPER (asinh, 0, 0, 0, xasinh, 0, asinh, 0.0, 0.0, 0,
  1750.       "-*- texinfo -*-\n\
  1751.   @deftypefn {Mapping Function} {} asinh (@var{X})\n\
  1752.   asinh (X): compute the inverse hyperbolic sin (X) for each element of X\n\
  1753. ***************
  1754. *** 213,219 ****
  1755.   atan (X): compute the inverse tangent of (X) for each element of X\n\
  1756.   @end deftypefn");
  1757.   
  1758. !   DEFUN_MAPPER (atanh, 0, 0, 0, atanh, 0, atanh, -1.0, 1.0, 1,
  1759.       "-*- texinfo -*-\n\
  1760.   @deftypefn {Mapping Function} {} atanh (@var{X})\n\
  1761.   atanh (X): compute the inverse hyperbolic tanget of X for each element of X\n\
  1762. --- 215,221 ----
  1763.   atan (X): compute the inverse tangent of (X) for each element of X\n\
  1764.   @end deftypefn");
  1765.   
  1766. !   DEFUN_MAPPER (atanh, 0, 0, 0, xatanh, 0, atanh, -1.0, 1.0, 1,
  1767.       "-*- texinfo -*-\n\
  1768.   @deftypefn {Mapping Function} {} atanh (@var{X})\n\
  1769.   atanh (X): compute the inverse hyperbolic tanget of X for each element of X\n\
  1770. diff -cwr n:/project/C/octave-2.1.23.orig/src/mkbuiltins i:/project/C/octave-2.1.23/src/mkbuiltins
  1771. *** n:/project/C/octave-2.1.23.orig/src/mkbuiltins    Sat Nov 20 04:05:44 1999
  1772. --- i:/project/C/octave-2.1.23/src/mkbuiltins    Fri Dec 24 13:35:58 1999
  1773. ***************
  1774. *** 56,62 ****
  1775.   for file in $DEF_FILES; do
  1776.     fcn=`echo $file | sed 's,^\./,,; s/\.df//; s/-/_/g'`
  1777.     echo "static void"
  1778. !   echo "install_${fcn}_fcns (void)"
  1779.     echo "{"
  1780.     cat $file
  1781.     echo "}"
  1782. --- 56,62 ----
  1783.   for file in $DEF_FILES; do
  1784.     fcn=`echo $file | sed 's,^\./,,; s/\.df//; s/-/_/g'`
  1785.     echo "static void"
  1786. !   echo "install_${fcn##*/}_fcns (void)"
  1787.     echo "{"
  1788.     cat $file
  1789.     echo "}"
  1790. ***************
  1791. *** 65,71 ****
  1792.   
  1793.   for file in $VAR_FILES; do
  1794.     f=`echo $file | sed 's,^\./,,; s/-/_/g'`
  1795. !   echo "extern void symbols_of_${f} (void);"
  1796.   done
  1797.   
  1798.   cat << \EOF
  1799. --- 65,71 ----
  1800.   
  1801.   for file in $VAR_FILES; do
  1802.     f=`echo $file | sed 's,^\./,,; s/-/_/g'`
  1803. !   echo "extern void symbols_of_${f##*/} (void);"
  1804.   done
  1805.   
  1806.   cat << \EOF
  1807. ***************
  1808. *** 77,83 ****
  1809.   
  1810.   for file in $VAR_FILES; do
  1811.     f=`echo $file | sed 's,^\./,,; s/-/_/g'`
  1812. !   echo "  symbols_of_${f} ();"
  1813.   done
  1814.   
  1815.   cat << \EOF
  1816. --- 77,83 ----
  1817.   
  1818.   for file in $VAR_FILES; do
  1819.     f=`echo $file | sed 's,^\./,,; s/-/_/g'`
  1820. !   echo "  symbols_of_${f##*/} ();"
  1821.   done
  1822.   
  1823.   cat << \EOF
  1824. ***************
  1825. *** 90,96 ****
  1826.   
  1827.   for file in $DEF_FILES; do
  1828.     fcn=`echo $file | sed 's,^\./,,; s/\.df//; s/-/_/g'`
  1829. !   echo "  install_${fcn}_fcns ();"
  1830.   done
  1831.   
  1832.   cat << \EOF
  1833. --- 90,96 ----
  1834.   
  1835.   for file in $DEF_FILES; do
  1836.     fcn=`echo $file | sed 's,^\./,,; s/\.df//; s/-/_/g'`
  1837. !   echo "  install_${fcn##*/}_fcns ();"
  1838.   done
  1839.   
  1840.   cat << \EOF
  1841. diff -cwr n:/project/C/octave-2.1.23.orig/src/mkops i:/project/C/octave-2.1.23/src/mkops
  1842. *** n:/project/C/octave-2.1.23.orig/src/mkops    Sat Dec  5 00:20:22 1998
  1843. --- i:/project/C/octave-2.1.23/src/mkops    Fri Dec 24 13:35:58 1999
  1844. ***************
  1845. *** 13,19 ****
  1846.   
  1847.   for file in "$@"; do
  1848.     f=`echo $file | sed 's,^\./,,; s%^OPERATORS/op-%%; s%\.cc%%; s%-%_%g'`
  1849. !   echo "extern void install_${f}_ops (void);"
  1850.   done
  1851.   
  1852.   cat << \EOF
  1853. --- 13,19 ----
  1854.   
  1855.   for file in "$@"; do
  1856.     f=`echo $file | sed 's,^\./,,; s%^OPERATORS/op-%%; s%\.cc%%; s%-%_%g'`
  1857. !   echo "extern void install_${f#op_}_ops (void);"
  1858.   done
  1859.   
  1860.   cat << \EOF
  1861. ***************
  1862. *** 27,33 ****
  1863.   
  1864.   for file in "$@"; do
  1865.     f=`echo $file | sed 's,^\./,,; s%^OPERATORS/op-%%; s%\.cc%%; s%-%_%g'`
  1866. !   echo "  install_${f}_ops ();"
  1867.   done
  1868.   
  1869.   cat << \EOF
  1870. --- 27,33 ----
  1871.   
  1872.   for file in "$@"; do
  1873.     f=`echo $file | sed 's,^\./,,; s%^OPERATORS/op-%%; s%\.cc%%; s%-%_%g'`
  1874. !   echo "  install_${f#op_}_ops ();"
  1875.   done
  1876.   
  1877.   cat << \EOF
  1878. 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
  1879. *** n:/project/C/octave-2.1.23.orig/src/oct-hist.cc    Tue Nov 23 21:54:28 1999
  1880. --- i:/project/C/octave-2.1.23/src/oct-hist.cc    Fri Dec 24 13:35:58 1999
  1881. ***************
  1882. *** 31,36 ****
  1883. --- 31,38 ----
  1884.   
  1885.   */
  1886.   
  1887. + /* Modified by Klaus Gebhardt, 1996 */
  1888.   #ifdef HAVE_CONFIG_H
  1889.   #include <config.h>
  1890.   #endif
  1891. ***************
  1892. *** 72,77 ****
  1893. --- 74,87 ----
  1894.   #include "utils.h"
  1895.   #include "variables.h"
  1896.   
  1897. + #ifdef __EMX__
  1898. + extern "C"
  1899. + {
  1900. + #include <process.h>
  1901. +   int _IO_system (const char *, int);
  1902. + }
  1903. + #endif
  1904.   // TRUE means input is coming from temporary history file.
  1905.   bool input_from_tmp_history_file = false;
  1906.   
  1907. ***************
  1908. *** 303,309 ****
  1909.   
  1910.             int cmd_len = cmd.length ();
  1911.   
  1912. !           if (cmd[cmd_len - 1] == '\n')
  1913.           cmd.resize (cmd_len - 1);
  1914.   
  1915.             if (! cmd.empty ())
  1916. --- 313,320 ----
  1917.   
  1918.             int cmd_len = cmd.length ();
  1919.   
  1920. !           if (cmd[cmd_len - 1] == '\n' || cmd[cmd_len - 1] == '\r'
  1921. !           || cmd[cmd_len - 1] == '')
  1922.           cmd.resize (cmd_len - 1);
  1923.   
  1924.             if (! cmd.empty ())
  1925. ***************
  1926. *** 322,328 ****
  1927.   
  1928.         int len = tmp.length ();
  1929.       
  1930. !       if (len > 0 && tmp[len-1] == '\n')
  1931.       tmp.resize (len - 1);
  1932.   
  1933.         if (! tmp.empty ())
  1934. --- 333,340 ----
  1935.   
  1936.         int len = tmp.length ();
  1937.       
  1938. !       if (len > 0 &&
  1939. !       (tmp[len-1] == '\n' || tmp[len-1] == '\r' || tmp[len-1] == ''))
  1940.       tmp.resize (len - 1);
  1941.   
  1942.         if (! tmp.empty ())
  1943. ***************
  1944. *** 450,456 ****
  1945. --- 462,472 ----
  1946.     volatile octave_interrupt_handler old_interrupt_handler
  1947.       = octave_ignore_interrupts ();
  1948.   
  1949. + #ifdef __EMX__
  1950. +   _IO_system (cmd.c_str (), P_WAIT);
  1951. + #else
  1952.     system (cmd.c_str ());
  1953. + #endif
  1954.   
  1955.     octave_set_interrupt_handler (old_interrupt_handler);
  1956.   
  1957. 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
  1958. *** n:/project/C/octave-2.1.23.orig/src/oct-stream.cc    Fri Nov  5 17:55:18 1999
  1959. --- i:/project/C/octave-2.1.23/src/oct-stream.cc    Sat Dec 25 16:26:22 1999
  1960. ***************
  1961. *** 20,25 ****
  1962. --- 20,27 ----
  1963.   
  1964.   */
  1965.   
  1966. + /* Modified by Klaus Gebhardt, 1999 */
  1967.   #ifdef HAVE_CONFIG_H
  1968.   #include <config.h>
  1969.   #endif
  1970. ***************
  1971. *** 30,35 ****
  1972. --- 32,38 ----
  1973.   #include <iomanip.h>
  1974.   #include <strstream.h>
  1975.   
  1976. + #include "file-ops.h"
  1977.   #include "lo-ieee.h"
  1978.   #include "lo-mappers.h"
  1979.   #include "lo-utils.h"
  1980. ***************
  1981. *** 762,767 ****
  1982. --- 765,781 ----
  1983.   }
  1984.   
  1985.   void
  1986. + octave_base_stream::close (void)
  1987. + {
  1988. +   int status = file_ops::close (file_number ());
  1989. +   if (status >= 0)  open_state = false;
  1990. + }
  1991. + void
  1992.   octave_base_stream::error (const string& msg)
  1993.   {
  1994.     fail = true;
  1995. ***************
  1996. *** 1273,1279 ****
  1997.   
  1998.             // XXX FIXME XXX -- is this the right thing to do?
  1999.   
  2000. !           if (interactive && name () == "stdin")
  2001.               {
  2002.                 is.clear ();
  2003.   
  2004. --- 1287,1293 ----
  2005.   
  2006.             // XXX FIXME XXX -- is this the right thing to do?
  2007.   
  2008. !           if ((interactive || really_forced_interactive) && name () == "stdin")
  2009.               {
  2010.                 is.clear ();
  2011.   
  2012. ***************
  2013. *** 1353,1359 ****
  2014.   
  2015.               // XXX FIXME XXX -- is this the right thing to do?
  2016.   
  2017. !             if (interactive && name () == "stdin")
  2018.                 {
  2019.               is.clear ();
  2020.   
  2021. --- 1367,1373 ----
  2022.   
  2023.               // XXX FIXME XXX -- is this the right thing to do?
  2024.   
  2025. !             if ((interactive || really_forced_interactive) && name () == "stdin")
  2026.                 {
  2027.               is.clear ();
  2028.   
  2029. ***************
  2030. *** 1536,1542 ****
  2031.         
  2032.         // XXX FIXME XXX -- is this the right thing to do?
  2033.   
  2034. !       if (interactive && name () == "stdin")
  2035.           {
  2036.             is.clear ();
  2037.   
  2038. --- 1550,1556 ----
  2039.         
  2040.         // XXX FIXME XXX -- is this the right thing to do?
  2041.   
  2042. !       if ((interactive || really_forced_interactive) && name () == "stdin")
  2043.           {
  2044.             is.clear ();
  2045.   
  2046. ***************
  2047. *** 1588,1594 ****
  2048.   
  2049.               // XXX FIXME XXX -- is this the right thing to do?
  2050.   
  2051. !             if (interactive && name () == "stdin")
  2052.                 {
  2053.               is.clear ();
  2054.   
  2055. --- 1602,1608 ----
  2056.   
  2057.               // XXX FIXME XXX -- is this the right thing to do?
  2058.   
  2059. !             if ((interactive || really_forced_interactive) && name () == "stdin")
  2060.                 {
  2061.               is.clear ();
  2062.   
  2063. ***************
  2064. *** 1923,1928 ****
  2065. --- 1937,1943 ----
  2066.   template void
  2067.   do_printf_conv (ostream&, const char*, int, int, int, bool, const char*);
  2068.   
  2069.   int
  2070.   octave_base_stream::do_printf (printf_format_list& fmt_list,
  2071.                      const octave_value_list& args)
  2072. ***************
  2073. *** 2870,2877 ****
  2074.     ostrstream buf;
  2075.   
  2076.     buf << "\n"
  2077. !       << "  number  mode  arch       name\n"
  2078. !       << "  ------  ----  ----       ----\n";
  2079.   
  2080.     for (int i = 0; i < curr_len; i++)
  2081.       {
  2082. --- 2885,2892 ----
  2083.     ostrstream buf;
  2084.   
  2085.     buf << "\n"
  2086. !       << "  number  file handle  mode  arch       name\n"
  2087. !       << "  ------  -----------  ----  ----       ----\n";
  2088.   
  2089.     for (int i = 0; i < curr_len; i++)
  2090.       {
  2091. ***************
  2092. *** 2889,2894 ****
  2093. --- 2904,2910 ----
  2094.         buf << "  "
  2095.             << setiosflags (ios::right)
  2096.             << setw (4) << i << "     "
  2097. +           << setw (8) << os.file_number () << "     "
  2098.             << setiosflags (ios::left)
  2099.             << setw (3) << mode.c_str () << "  "
  2100.             << setw (9) << arch.c_str () << "  "
  2101. 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
  2102. *** n:/project/C/octave-2.1.23.orig/src/oct-stream.h    Fri Nov  5 09:11:58 1999
  2103. --- i:/project/C/octave-2.1.23/src/oct-stream.h    Sat Dec 25 13:53:04 1999
  2104. ***************
  2105. *** 20,25 ****
  2106. --- 20,27 ----
  2107.   
  2108.   */
  2109.   
  2110. + /* Modified by Klaus Gebhardt, 1999 */
  2111.   #if !defined (octave_octave_stream_h)
  2112.   #define octave_octave_stream_h 1
  2113.   
  2114. ***************
  2115. *** 32,37 ****
  2116. --- 34,43 ----
  2117.   class ostream;
  2118.   class ostrstream;
  2119.   
  2120. + #ifdef __EMX__
  2121. + #include <iostream.h>
  2122. + #endif
  2123.   #include <string>
  2124.   
  2125.   #include "Array.h"
  2126. ***************
  2127. *** 262,268 ****
  2128.   
  2129.     bool is_open (void) const { return open_state; }
  2130.   
  2131. !   void close (void) { open_state = false; }
  2132.   
  2133.     int file_number (void);
  2134.   
  2135. --- 268,274 ----
  2136.   
  2137.     bool is_open (void) const { return open_state; }
  2138.   
  2139. !   void close (void);
  2140.   
  2141.     int file_number (void);
  2142.   
  2143. diff -cwr n:/project/C/octave-2.1.23.orig/src/octave.cc i:/project/C/octave-2.1.23/src/octave.cc
  2144. *** n:/project/C/octave-2.1.23.orig/src/octave.cc    Fri Oct 29 22:39:24 1999
  2145. --- i:/project/C/octave-2.1.23/src/octave.cc    Fri Dec 24 18:58:02 1999
  2146. ***************
  2147. *** 22,27 ****
  2148. --- 22,29 ----
  2149.   
  2150.   // Born February 20, 1992.
  2151.   
  2152. + /* Modified by Klaus Gebhardt, 1996 */
  2153.   #ifdef HAVE_CONFIG_H
  2154.   #include <config.h>
  2155.   #endif
  2156. ***************
  2157. *** 43,48 ****
  2158. --- 45,55 ----
  2159.   #include <unistd.h>
  2160.   #endif
  2161.   
  2162. + #ifdef __EMX__
  2163. + #include <float.h>
  2164. + #include <sys/uflags.h>
  2165. + #endif
  2166.   #include "cmd-edit.h"
  2167.   #include "file-stat.h"
  2168.   #include "lo-error.h"
  2169. ***************
  2170. *** 104,110 ****
  2171.   
  2172.   // Usage message
  2173.   static const char *usage_string = 
  2174. !   "octave [-?HVdfhiqvx] [--debug] [--echo-commands] [--exec-path path]\n\
  2175.          [--help] [--info-file file] [--info-program prog] [--interactive]\n\
  2176.          [--no-history] [--no-init-file] [--no-line-editing] [--no-site-file]\n\
  2177.          [-p path] [--path path] [--silent] [--traditional] [--verbose]\n\
  2178. --- 111,117 ----
  2179.   
  2180.   // Usage message
  2181.   static const char *usage_string = 
  2182. !   "octave [-?HVdfhiIqvx] [--debug] [--echo-commands] [--exec-path path]\n\
  2183.          [--help] [--info-file file] [--info-program prog] [--interactive]\n\
  2184.          [--no-history] [--no-init-file] [--no-line-editing] [--no-site-file]\n\
  2185.          [-p path] [--path path] [--silent] [--traditional] [--verbose]\n\
  2186. ***************
  2187. *** 113,119 ****
  2188.   // This is here so that it's more likely that the usage message and
  2189.   // the real set of options will agree.  Note: the `+' must come first
  2190.   // to prevent getopt from permuting arguments!
  2191. ! static const char *short_opts = "+?HVdfhip:qvx";
  2192.   
  2193.   // Long options.  See the comments in getopt.h for the meanings of the
  2194.   // fields in this structure.
  2195. --- 120,126 ----
  2196.   // This is here so that it's more likely that the usage message and
  2197.   // the real set of options will agree.  Note: the `+' must come first
  2198.   // to prevent getopt from permuting arguments!
  2199. ! static const char *short_opts = "+?HVdfhiIp:qvx";
  2200.   
  2201.   // Long options.  See the comments in getopt.h for the meanings of the
  2202.   // fields in this structure.
  2203. ***************
  2204. *** 184,190 ****
  2205.       odb = octave_env::getenv ("OCTAVE_DB_DIR");
  2206.   
  2207.     if (odb.empty ())
  2208. !     odb = Vdata_dir + string ("/octave:") + Vlibexec_dir + string ("/octave");
  2209.   
  2210.     octave_env::putenv ("TEXMFDBS", odb);
  2211.   }
  2212. --- 191,198 ----
  2213.       odb = octave_env::getenv ("OCTAVE_DB_DIR");
  2214.   
  2215.     if (odb.empty ())
  2216. !     odb = Vdata_dir + string ("/octave") + string (SEPCHAR_STR)
  2217. !       + Vlibexec_dir + string ("/octave");
  2218.   
  2219.     octave_env::putenv ("TEXMFDBS", odb);
  2220.   }
  2221. ***************
  2222. *** 277,282 ****
  2223. --- 285,291 ----
  2224.     --info-file FILE        Use top-level info file FILE.\n\
  2225.     --info-program PROGRAM  Use PROGRAM for reading info files.\n\
  2226.     --interactive, -i       Force interactive behavior.\n\
  2227. +   -I                      Force really interactive behavior, but no pager.\n\
  2228.     --no-history, -H        Don't save commands to the history list\n\
  2229.     --no-init-file          Don't read the ~/.octaverc or .octaverc files.\n\
  2230.     --no-line-editing       Don't use readline for command-line editing.\n\
  2231. ***************
  2232. *** 418,423 ****
  2233. --- 427,436 ----
  2234.         forced_interactive = true;
  2235.         break;
  2236.   
  2237. +     case 'I':
  2238. +       really_forced_interactive = true;
  2239. +       break;
  2240.       case 'p':
  2241.         if (args.optarg ())
  2242.           bind_builtin_variable ("LOADPATH", args.optarg ());
  2243. ***************
  2244. *** 501,506 ****
  2245. --- 514,526 ----
  2246.     if (! inhibit_startup_message && reading_startup_message_printed)
  2247.       cout << endl;
  2248.   
  2249. + #if defined (__EMX__)
  2250. +   _control87 (EM_INVALID | EM_DENORMAL | EM_ZERODIVIDE | EM_OVERFLOW |
  2251. +           EM_UNDERFLOW | EM_INEXACT, MCW_EM);
  2252. +   _uflags (_UF_SBRK_MODEL, _UF_SBRK_ARBITRARY);
  2253. + #endif
  2254.     // Avoid counting commands executed from startup files.
  2255.   
  2256.     command_editor::reset_current_command_number (1);
  2257. ***************
  2258. *** 560,576 ****
  2259.     // Force input to be echoed if not really interactive, but the user
  2260.     // has forced interactive behavior.
  2261.   
  2262. !   if (! interactive && forced_interactive)
  2263.       {
  2264.         command_editor::blink_matching_paren (false);
  2265.   
  2266.         // XXX FIXME XXX -- is this the right thing to do?
  2267.   
  2268.         bind_builtin_variable ("echo_executing_commands",
  2269.                    static_cast<double> (ECHO_CMD_LINE));
  2270.       }
  2271.   
  2272. !   if (! interactive)
  2273.       line_editing = false;
  2274.   
  2275.     int retval = main_loop ();
  2276. --- 580,598 ----
  2277.     // Force input to be echoed if not really interactive, but the user
  2278.     // has forced interactive behavior.
  2279.   
  2280. !   if (! interactive && (forced_interactive || really_forced_interactive))
  2281.       {
  2282.         command_editor::blink_matching_paren (false);
  2283.   
  2284.         // XXX FIXME XXX -- is this the right thing to do?
  2285.   
  2286. + #if ! defined (__EMX__)
  2287.         bind_builtin_variable ("echo_executing_commands",
  2288.                    static_cast<double> (ECHO_CMD_LINE));
  2289. + #endif
  2290.       }
  2291.   
  2292. !   if (! (interactive || really_forced_interactive))
  2293.       line_editing = false;
  2294.   
  2295.     int retval = main_loop ();
  2296. 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
  2297. *** n:/project/C/octave-2.1.23.orig/src/OPERATORS/op-str-str.cc    Fri Oct 30 21:26:30 1998
  2298. --- i:/project/C/octave-2.1.23/src/OPERATORS/op-str-str.cc    Fri Dec 24 13:36:00 1999
  2299. ***************
  2300. *** 20,25 ****
  2301. --- 20,27 ----
  2302.   
  2303.   */
  2304.   
  2305. + /* Modified by Klaus Gebhardt, 1997 */
  2306.   #if defined (__GNUG__)
  2307.   #pragma implementation
  2308.   #endif
  2309. ***************
  2310. *** 58,77 ****
  2311.         if (cm2.rows () == 1 && cm2.columns () == 1)
  2312.       return octave_value (cm1 (0, 0) == cm2 (0, 0));
  2313.         else
  2314. !     SC_MX_BOOL_OP (char, c, cm1 (0, 0), charMatrix, m, cm2,
  2315.                  c == m (i, j), 0.0);
  2316.       }
  2317.     else
  2318.       {
  2319. !       int cm2_nr = cm2.rows ();
  2320. !       int cm2_nc = cm2.cols ();
  2321. !       if (cm2_nr == 1 && cm2_nc == 1)
  2322. !     MX_SC_BOOL_OP (charMatrix, m, cm1, char, c, cm2 (0, 0),
  2323.                  c == m (i, j), 0.0);
  2324.         else
  2325. !     MX_MX_BOOL_OP (charMatrix, m1, cm1, charMatrix, m2, cm2,
  2326. !                m1 (i, j) == m2 (i, j), "==", 0.0, 1.0);
  2327.       }
  2328.   }
  2329.   
  2330. --- 60,80 ----
  2331.         if (cm2.rows () == 1 && cm2.columns () == 1)
  2332.       return octave_value (cm1 (0, 0) == cm2 (0, 0));
  2333.         else
  2334. !     SC_MX_BOOL_OP (char, c, cm1 (0, 0), \
  2335. !                charMatrix, m, cm2, \
  2336.                  c == m (i, j), 0.0);
  2337.       }
  2338.     else
  2339.       {
  2340. !       if (cm2.rows () == 1 && cm2.columns () == 1)
  2341. !     MX_SC_BOOL_OP (charMatrix, m, cm1, \
  2342. !                char, c, cm2 (0, 0), \
  2343.                  c == m (i, j), 0.0);
  2344.         else
  2345. !     MX_MX_BOOL_OP (charMatrix, m1, cm1, \
  2346. !                charMatrix, m2, cm2, \
  2347. !                m1 (i, j) == m2 (i, j), \
  2348. !                "==", 0.0, 1.0);
  2349.       }
  2350.   }
  2351.   
  2352. diff -cwr n:/project/C/octave-2.1.23.orig/src/pager.cc i:/project/C/octave-2.1.23/src/pager.cc
  2353. *** n:/project/C/octave-2.1.23.orig/src/pager.cc    Tue Nov 23 21:54:28 1999
  2354. --- i:/project/C/octave-2.1.23/src/pager.cc    Fri Dec 24 13:36:00 1999
  2355. ***************
  2356. *** 20,25 ****
  2357. --- 20,27 ----
  2358.   
  2359.   */
  2360.   
  2361. + /* Modified by Klaus Gebhardt, 1996 */
  2362.   #ifdef HAVE_CONFIG_H
  2363.   #include <config.h>
  2364.   #endif
  2365. ***************
  2366. *** 221,227 ****
  2367.   int
  2368.   octave_pager_buf::sync (void)
  2369.   {
  2370. !   if (! interactive
  2371.         || really_flush_to_pager
  2372.         || (Vpage_screen_output && Vpage_output_immediately)
  2373.         || ! Vpage_screen_output)
  2374. --- 223,229 ----
  2375.   int
  2376.   octave_pager_buf::sync (void)
  2377.   {
  2378. !   if ((! interactive || really_forced_interactive)
  2379.         || really_flush_to_pager
  2380.         || (Vpage_screen_output && Vpage_output_immediately)
  2381.         || ! Vpage_screen_output)
  2382. ***************
  2383. *** 230,236 ****
  2384.   
  2385.         int len = pptr () - buf;
  2386.   
  2387. !       bool bypass_pager = (! interactive
  2388.                  || ! Vpage_screen_output
  2389.                  || (really_flush_to_pager
  2390.                      && Vpage_screen_output
  2391. --- 232,238 ----
  2392.   
  2393.         int len = pptr () - buf;
  2394.   
  2395. !       bool bypass_pager = ((! interactive || really_forced_interactive)
  2396.                  || ! Vpage_screen_output
  2397.                  || (really_flush_to_pager
  2398.                      && Vpage_screen_output
  2399. diff -cwr n:/project/C/octave-2.1.23.orig/src/parse.y i:/project/C/octave-2.1.23/src/parse.y
  2400. *** n:/project/C/octave-2.1.23.orig/src/parse.y    Thu Dec 16 05:51:46 1999
  2401. --- i:/project/C/octave-2.1.23/src/parse.y    Sat Dec 25 10:50:00 1999
  2402. ***************
  2403. *** 20,25 ****
  2404. --- 20,27 ----
  2405.   
  2406.   */
  2407.   
  2408. + /* Modified by Klaus Gebhardt, 1996 */
  2409.   // Parser for Octave.
  2410.   
  2411.   // C decarations.
  2412. ***************
  2413. *** 40,45 ****
  2414. --- 42,49 ----
  2415.   
  2416.   #include <strstream.h>
  2417.   
  2418. + #include <setjmp.h>
  2419.   #include "Matrix.h"
  2420.   #include "cmd-edit.h"
  2421.   #include "cmd-hist.h"
  2422. ***************
  2423. *** 57,68 ****
  2424. --- 61,76 ----
  2425.   #include "pager.h"
  2426.   #include "parse.h"
  2427.   #include "pt-all.h"
  2428. + #include "sighandlers.h"
  2429.   #include "symtab.h"
  2430.   #include "token.h"
  2431.   #include "unwind-prot.h"
  2432.   #include "utils.h"
  2433.   #include "variables.h"
  2434.   
  2435. + // Top level context (?)
  2436. + extern jmp_buf toplevel;
  2437.   // TRUE means we print 
  2438.   static bool Vdefault_eval_print_flag = true;
  2439.   
  2440. ***************
  2441. *** 283,289 ****
  2442.       { \
  2443.         global_command = 0; \
  2444.         yyerrok; \
  2445. !       if (interactive || forced_interactive) \
  2446.       YYACCEPT; \
  2447.         else \
  2448.       YYABORT; \
  2449. --- 291,297 ----
  2450.       { \
  2451.         global_command = 0; \
  2452.         yyerrok; \
  2453. !       if (interactive || forced_interactive || really_forced_interactive) \
  2454.       YYACCEPT; \
  2455.         else \
  2456.       YYABORT; \
  2457. ***************
  2458. *** 405,411 ****
  2459.   %type <subplot_axes_type> axes
  2460.   
  2461.   // Precedence and associativity.
  2462. ! %left ';' ',' '\n'
  2463.   %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
  2464.   %left EXPR_AND_AND EXPR_OR_OR
  2465.   %left EXPR_AND EXPR_OR
  2466. --- 413,419 ----
  2467.   %type <subplot_axes_type> axes
  2468.   
  2469.   // Precedence and associativity.
  2470. ! %left ';' ',' '\n' '\r' ''
  2471.   %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
  2472.   %left EXPR_AND_AND EXPR_OR_OR
  2473.   %left EXPR_AND EXPR_OR
  2474. ***************
  2475. *** 448,457 ****
  2476. --- 456,473 ----
  2477.   
  2478.   input1        : '\n'
  2479.             { $$ = 0; }
  2480. +         | '\r'
  2481. +           { $$ = 0; }
  2482. +         | ''
  2483. +           { $$ = 0; }
  2484.           | simple_list
  2485.             { $$ = $1; }
  2486.           | simple_list '\n'
  2487.             { $$ = $1; }
  2488. +         | simple_list '\r'
  2489. +           { $$ = $1; }
  2490. +         | simple_list ''
  2491. +           { $$ = $1; }
  2492.           | simple_list END_OF_INPUT
  2493.             { $$ = $1; }
  2494.           ;
  2495. ***************
  2496. *** 1039,1050 ****
  2497. --- 1055,1068 ----
  2498.             }
  2499.           | param_list1 param_list_end
  2500.             {
  2501. +                     lexer_flags.looking_at_parameter_list = false;
  2502.               lexer_flags.quote_is_transpose = false;
  2503.               $1->mark_as_formal_parameters ();
  2504.               $$ = $1;
  2505.             }
  2506.           | param_list1 ',' ELLIPSIS param_list_end
  2507.             {
  2508. +                     lexer_flags.looking_at_parameter_list = false;
  2509.               lexer_flags.quote_is_transpose = false;
  2510.               $1->mark_as_formal_parameters ();
  2511.               $1->mark_varargs ();
  2512. ***************
  2513. *** 1367,1378 ****
  2514. --- 1385,1400 ----
  2515.             { $$ = ';'; }
  2516.           | '\n'
  2517.             { $$ = '\n'; }
  2518. +         | '\r'
  2519. +           { $$ = '\r'; }
  2520.           | sep ','
  2521.             { $$ = $1; }
  2522.           | sep ';'
  2523.             { $$ = $1; }
  2524.           | sep '\n'
  2525.             { $$ = $1; }
  2526. +         | sep '\r'
  2527. +           { $$ = $1; }
  2528.           ;
  2529.   
  2530.   opt_sep        : // empty
  2531. ***************
  2532. *** 2593,2598 ****
  2533. --- 2615,2621 ----
  2534.       case 0:
  2535.       case ',':
  2536.       case '\n':
  2537. +     case '\r':
  2538.         if (warn_missing_semi)
  2539.       maybe_warn_missing_semi (list);
  2540.         break;
  2541. ***************
  2542. *** 2606,2611 ****
  2543. --- 2629,2639 ----
  2544.   void
  2545.   parse_and_execute (FILE *f)
  2546.   {
  2547. +   volatile octave_interrupt_handler old_interrupt_handler
  2548. +     = octave_ignore_interrupts ();
  2549. +   volatile jmp_buf old_toplevel = toplevel;
  2550.     unwind_protect::begin_frame ("parse_and_execute");
  2551.     
  2552.     YY_BUFFER_STATE old_buf = current_buffer ();
  2553. ***************
  2554. *** 2624,2629 ****
  2555. --- 2652,2661 ----
  2556.   
  2557.     unwind_protect_ptr (curr_sym_tab);
  2558.   
  2559. +   if (setjmp(toplevel) == 0)
  2560. +   {
  2561. +   octave_set_interrupt_handler (old_interrupt_handler);
  2562.     int retval;
  2563.     do
  2564.       {
  2565. ***************
  2566. *** 2661,2668 ****
  2567. --- 2693,2706 ----
  2568.       }
  2569.       }
  2570.     while (retval == 0);
  2571. +   }
  2572. +   else  error ("script execution interrupted ...");
  2573.   
  2574.     unwind_protect::run_frame ("parse_and_execute");
  2575. +   octave_ignore_interrupts ();
  2576. +   toplevel = old_toplevel;
  2577. +   octave_set_interrupt_handler (old_interrupt_handler);
  2578.   }
  2579.   
  2580.   static void
  2581. ***************
  2582. *** 2675,2680 ****
  2583. --- 2713,2721 ----
  2584.   void
  2585.   parse_and_execute (const string& s, bool verbose, const char *warn_for)
  2586.   {
  2587. +   volatile octave_interrupt_handler old_interrupt_handler
  2588. +     = octave_ignore_interrupts ();
  2589.     unwind_protect::begin_frame ("parse_and_execute_2");
  2590.   
  2591.     unwind_protect_bool (reading_script_file);
  2592. ***************
  2593. *** 2711,2716 ****
  2594. --- 2752,2759 ----
  2595.       error ("%s: unable to open file `%s'", warn_for, s.c_str ());
  2596.   
  2597.     unwind_protect::run_frame ("parse_and_execute_2");
  2598. +   octave_set_interrupt_handler (old_interrupt_handler);
  2599.   }
  2600.   
  2601.   static bool
  2602. ***************
  2603. *** 2782,2791 ****
  2604.         if (! have_help_text)
  2605.           {
  2606.             first_comments_seen = true;
  2607. !           help_txt += (char) c;
  2608.           }
  2609.   
  2610. !       if (c == '\n')
  2611.           {
  2612.             if (update_pos)
  2613.           {
  2614. --- 2825,2846 ----
  2615.         if (! have_help_text)
  2616.           {
  2617.             first_comments_seen = true;
  2618. !               if (c == '\r')
  2619. !                 {
  2620. !                   int d = getc (ffile);
  2621. !                   if (c != '\n' && c != '\r' && c != '')
  2622. !                     help_txt += (char) '\n';
  2623. ! #if defined (EMX09C)
  2624. !                   fseek (ffile, -1l, SEEK_CUR);
  2625. ! #else
  2626. !                   ungetc (d, ffile);
  2627. ! #endif
  2628. !                 }
  2629. !               else if (c == '')  help_txt += (char) '\n';
  2630. !               else                 help_txt += (char) c;
  2631.           }
  2632.   
  2633. !       if ((c == '\n') || (c == ''))
  2634.           {
  2635.             if (update_pos)
  2636.           {
  2637. ***************
  2638. *** 2800,2807 ****
  2639.               {
  2640.                 if (update_pos)
  2641.               current_input_column--;
  2642.                 ungetc (c, ffile);
  2643. !               if (c == '\n')
  2644.               break;
  2645.               }
  2646.             else
  2647. --- 2855,2866 ----
  2648.               {
  2649.                 if (update_pos)
  2650.               current_input_column--;
  2651. + #if defined (EMX09C)
  2652. +                       fseek (ffile, -1l, SEEK_CUR);
  2653. + #else
  2654.                 ungetc (c, ffile);
  2655. ! #endif
  2656. !               if ((c == '\n') || (c == '\r') || (c == ''))
  2657.               break;
  2658.               }
  2659.             else
  2660. ***************
  2661. *** 2819,2824 ****
  2662. --- 2878,2889 ----
  2663.           have_help_text = true;
  2664.             break;
  2665.   
  2666. +             case '\r':
  2667. +               if (first_comments_seen)  have_help_text = true;
  2668. +               if (update_pos)           current_input_column = 0;
  2669. +               continue;
  2670. +             case '':
  2671.           case '\n':
  2672.             if (first_comments_seen)
  2673.           have_help_text = true;
  2674. ***************
  2675. *** 2838,2844 ****
  2676. --- 2903,2913 ----
  2677.           default:
  2678.             if (update_pos)
  2679.           current_input_column--;
  2680. + #if defined (EMX09C)
  2681. +               fseek (ffile, -1l, SEEK_CUR);
  2682. + #else
  2683.             ungetc (c, ffile);
  2684. + #endif
  2685.             goto done;
  2686.           }
  2687.       }
  2688. ***************
  2689. *** 2865,2871 ****
  2690.   
  2691.     if (! path.empty ())
  2692.       {
  2693. !       FILE *fptr = fopen (path.c_str (), "r");
  2694.   
  2695.         if (fptr)
  2696.       {
  2697. --- 2934,2940 ----
  2698.   
  2699.     if (! path.empty ())
  2700.       {
  2701. !       FILE *fptr = fopen (path.c_str (), "rb");
  2702.   
  2703.         if (fptr)
  2704.       {
  2705. ***************
  2706. *** 3256,3262 ****
  2707.   
  2708.     octave_value_list tmp = eval_string (s, silent, parse_status, 1);
  2709.   
  2710. -   if (! tmp.empty ())
  2711.       retval = tmp(0);
  2712.   
  2713.     return retval;
  2714. --- 3325,3330 ----
  2715. 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
  2716. *** n:/project/C/octave-2.1.23.orig/src/pt-plot.cc    Tue Nov 23 21:54:28 1999
  2717. --- i:/project/C/octave-2.1.23/src/pt-plot.cc    Fri Dec 24 13:36:00 1999
  2718. ***************
  2719. *** 20,25 ****
  2720. --- 20,27 ----
  2721.   
  2722.   */
  2723.   
  2724. + /* Modified by Klaus Gebhardt, 1996 */
  2725.   #if defined (__GNUG__)
  2726.   #pragma implementation
  2727.   #endif
  2728. ***************
  2729. *** 150,162 ****
  2730.         sigemptyset (&set);
  2731.         sigaddset (&set, SIGINT);
  2732.         sigprocmask (SIG_BLOCK, &set, &oset);
  2733.   #else
  2734.        volatile octave_interrupt_handler old_interrupt_handler
  2735.       = octave_ignore_interrupts ();
  2736.   #endif
  2737.         plot_stream = new oprocstream (plot_prog.c_str ());
  2738.         if (plot_stream)
  2739.       {
  2740.         if (! *plot_stream)
  2741. --- 152,168 ----
  2742.         sigemptyset (&set);
  2743.         sigaddset (&set, SIGINT);
  2744.         sigprocmask (SIG_BLOCK, &set, &oset);
  2745. + #endif
  2746. + #if defined (__EMX__) && defined (OS2)
  2747. +       plot_stream = new oprocstream (plot_prog.c_str (), ios::out);
  2748.   #else
  2749. + #if !defined (HAVE_POSIX_SIGNALS)
  2750.        volatile octave_interrupt_handler old_interrupt_handler
  2751.       = octave_ignore_interrupts ();
  2752.   #endif
  2753.         plot_stream = new oprocstream (plot_prog.c_str ());
  2754. ! #endif
  2755.         if (plot_stream)
  2756.       {
  2757.         if (! *plot_stream)
  2758. ***************
  2759. *** 179,186 ****
  2760. --- 185,194 ----
  2761.   #if defined (HAVE_POSIX_SIGNALS)
  2762.         sigprocmask (SIG_SETMASK, &oset, 0);
  2763.   #else
  2764. + #if ! defined (__EMX__) || ! defined (OS2)
  2765.         octave_set_interrupt_handler (old_interrupt_handler);
  2766.   #endif
  2767. + #endif
  2768.       }
  2769.   
  2770.     if (! error_state && plot_stream && *plot_stream && ! initialized)
  2771. ***************
  2772. *** 1132,1137 ****
  2773. --- 1140,1146 ----
  2774.   
  2775.     char *plot_command = plot_buf.str ();
  2776.     send_to_plot_stream (plot_command);
  2777. +   sleep (2);
  2778.   
  2779.     delete [] plot_command;
  2780.   
  2781. diff -cwr n:/project/C/octave-2.1.23.orig/src/sighandlers.cc i:/project/C/octave-2.1.23/src/sighandlers.cc
  2782. *** n:/project/C/octave-2.1.23.orig/src/sighandlers.cc    Fri Nov  5 20:34:28 1999
  2783. --- i:/project/C/octave-2.1.23/src/sighandlers.cc    Fri Dec 24 16:41:02 1999
  2784. ***************
  2785. *** 20,25 ****
  2786. --- 20,27 ----
  2787.   
  2788.   */
  2789.   
  2790. + /* Modified by Klaus Gebhardt, 1995 - 1996 */
  2791.   #ifdef HAVE_CONFIG_H
  2792.   #include <config.h>
  2793.   #endif
  2794. ***************
  2795. *** 40,45 ****
  2796. --- 42,52 ----
  2797.   
  2798.   #include "cmd-edit.h"
  2799.   
  2800. + #ifdef __EMX__
  2801. + #include <float.h>
  2802. + #include <sys/uflags.h>
  2803. + #endif
  2804.   #include "error.h"
  2805.   #include "load-save.h"
  2806.   #include "pager.h"
  2807. ***************
  2808. *** 84,90 ****
  2809.   
  2810.   #if defined (__EMX__)
  2811.   #define MAYBE_ACK_SIGNAL(sig) \
  2812. !   octave_set_signal_handler (sig, SIG_ACK)
  2813.   #define ACK_USES_SIG 1
  2814.   #else
  2815.   #define MAYBE_ACK_SIGNAL(sig) \
  2816. --- 91,97 ----
  2817.   
  2818.   #if defined (__EMX__)
  2819.   #define MAYBE_ACK_SIGNAL(sig) \
  2820. !   signal (sig, SIG_ACK)
  2821.   #define ACK_USES_SIG 1
  2822.   #else
  2823.   #define MAYBE_ACK_SIGNAL(sig) \
  2824. ***************
  2825. *** 132,138 ****
  2826.       {
  2827.         been_there_done_that = true;
  2828.   
  2829. !       cerr << "error: " << sig_name << " -- stopping myself...\n";
  2830.   
  2831.         save_user_variables ();
  2832.   
  2833. --- 139,145 ----
  2834.       {
  2835.         been_there_done_that = true;
  2836.   
  2837. !       cerr << "\n\nerror: " << sig_name << " -- stopping myself...\n";
  2838.   
  2839.         save_user_variables ();
  2840.   
  2841. ***************
  2842. *** 156,161 ****
  2843. --- 163,171 ----
  2844.   
  2845.     if (can_interrupt)
  2846.       {
  2847. + #ifdef __EMX__
  2848. +       _uflags (_UF_SBRK_MODEL, _UF_SBRK_ARBITRARY);
  2849. + #endif
  2850.         jump_to_top_level ();
  2851.         panic_impossible ();
  2852.       }
  2853. ***************
  2854. *** 174,179 ****
  2855. --- 184,193 ----
  2856.     sigemptyset (&oact.sa_mask);
  2857.     sigaction (sig, &act, &oact);
  2858.     return oact.sa_handler;
  2859. + #elif defined (__EMX__)
  2860. +   sig_handler *signal_handler = signal (sig, handler);
  2861. +   MAYBE_ACK_SIGNAL(sig);
  2862. +   return signal_handler;
  2863.   #else
  2864.     return signal (sig, handler);
  2865.   #endif
  2866. ***************
  2867. *** 190,196 ****
  2868.   // Handle SIGCHLD.
  2869.   
  2870.   static RETSIGTYPE
  2871. ! sigchld_handler (int /* sig */)
  2872.   {
  2873.     volatile octave_interrupt_handler saved_interrupt_handler
  2874.        = octave_ignore_interrupts ();
  2875. --- 204,210 ----
  2876.   // Handle SIGCHLD.
  2877.   
  2878.   static RETSIGTYPE
  2879. ! sigchld_handler (int sig)
  2880.   {
  2881.     volatile octave_interrupt_handler saved_interrupt_handler
  2882.        = octave_ignore_interrupts ();
  2883. ***************
  2884. *** 202,216 ****
  2885.   #if defined (__EMX__)
  2886.     volatile sig_handler *saved_sigchld_handler
  2887.       = octave_set_signal_handler (SIGCHLD, SIG_IGN);
  2888. ! #endif
  2889.     sigset_t set, oset;
  2890.   
  2891.     BLOCK_CHILD (set, oset);
  2892.   
  2893.     int n = octave_child_list::length ();
  2894.   
  2895. !   for (int i = 0; i < n; i++)
  2896.       {
  2897.         octave_child& elt = octave_child_list::elem (i);
  2898.   
  2899. --- 216,231 ----
  2900.   #if defined (__EMX__)
  2901.     volatile sig_handler *saved_sigchld_handler
  2902.       = octave_set_signal_handler (SIGCHLD, SIG_IGN);
  2903. ! #else
  2904.     sigset_t set, oset;
  2905.   
  2906.     BLOCK_CHILD (set, oset);
  2907. + #endif
  2908.   
  2909. +   int i = 0;
  2910.     int n = octave_child_list::length ();
  2911.   
  2912. !   for (i = 0; i < n; i++)
  2913.       {
  2914.         octave_child& elt = octave_child_list::elem (i);
  2915.   
  2916. ***************
  2917. *** 226,244 ****
  2918.   
  2919.             octave_child::dead_child_handler f = elt.handler;
  2920.   
  2921. !           if (f)
  2922. !         f (pid, status);
  2923.   
  2924.             break;
  2925.           }
  2926.       }
  2927.       }
  2928.   
  2929.     octave_set_interrupt_handler (saved_interrupt_handler);
  2930.   
  2931.     UNBLOCK_CHILD (oset);
  2932. ! #ifdef __EMX__
  2933.     octave_set_signal_handler (SIGCHLD, saved_sigchld_handler);
  2934.   #endif
  2935.   
  2936. --- 241,265 ----
  2937.   
  2938.             octave_child::dead_child_handler f = elt.handler;
  2939.   
  2940. !           if (f)  f (pid, status);
  2941. !           else
  2942. !         {
  2943. !           string file = elt.filename;
  2944. !           unlink (file.c_str ());
  2945. !         }
  2946.   
  2947.             break;
  2948.           }
  2949.       }
  2950.       }
  2951.   
  2952. +   if (i == n)  waitpid (-1, NULL, WNOHANG);
  2953.     octave_set_interrupt_handler (saved_interrupt_handler);
  2954.   
  2955. + #ifndef __EMX__
  2956.     UNBLOCK_CHILD (oset);
  2957. ! #else
  2958.     octave_set_signal_handler (SIGCHLD, saved_sigchld_handler);
  2959.   #endif
  2960.   
  2961. ***************
  2962. *** 251,257 ****
  2963.   
  2964.   #if defined (__alpha__)
  2965.   static RETSIGTYPE
  2966. ! sigfpe_handler (int /* sig */)
  2967.   {
  2968.     MAYBE_ACK_SIGNAL (SIGFPE);
  2969.   
  2970. --- 272,278 ----
  2971.   
  2972.   #if defined (__alpha__)
  2973.   static RETSIGTYPE
  2974. ! sigfpe_handler (int sig)
  2975.   {
  2976.     MAYBE_ACK_SIGNAL (SIGFPE);
  2977.   
  2978. ***************
  2979. *** 261,266 ****
  2980. --- 282,291 ----
  2981.   
  2982.     if (can_interrupt)
  2983.       {
  2984. + #if defined (__EMX__)
  2985. +       _control87 (EM_INVALID | EM_DENORMAL | EM_ZERODIVIDE | EM_OVERFLOW |
  2986. +           EM_UNDERFLOW | EM_INEXACT, MCW_EM);
  2987. + #endif
  2988.         jump_to_top_level ();
  2989.         panic_impossible ();
  2990.       }
  2991. ***************
  2992. *** 312,318 ****
  2993.   }
  2994.   
  2995.   static RETSIGTYPE
  2996. ! sigpipe_handler (int /* sig */)
  2997.   {
  2998.     MAYBE_ACK_SIGNAL (SIGPIPE);
  2999.   
  3000. --- 337,343 ----
  3001.   }
  3002.   
  3003.   static RETSIGTYPE
  3004. ! sigpipe_handler (int sig)
  3005.   {
  3006.     MAYBE_ACK_SIGNAL (SIGPIPE);
  3007.   
  3008. ***************
  3009. *** 335,345 ****
  3010.     octave_interrupt_handler retval;
  3011.   
  3012.   #ifdef SIGINT
  3013. !   retval.int_handler = octave_set_signal_handler (SIGINT, sigint_handler);
  3014.   #endif
  3015.   
  3016.   #ifdef SIGBREAK
  3017. !   retval.brk_handler = octave_set_signal_handler (SIGBREAK, sigint_handler);
  3018.   #endif
  3019.   
  3020.     return retval;
  3021. --- 360,374 ----
  3022.     octave_interrupt_handler retval;
  3023.   
  3024.   #ifdef SIGINT
  3025. !   octave_set_signal_handler (SIGINT, sigint_handler);
  3026. !   retval.int_handler = sigint_handler;
  3027. !   MAYBE_ACK_SIGNAL (SIGINT);
  3028.   #endif
  3029.   
  3030.   #ifdef SIGBREAK
  3031. !   octave_set_signal_handler (SIGBREAK, sigint_handler);
  3032. !   retval.brk_handler = sigint_handler;
  3033. !   MAYBE_ACK_SIGNAL (SIGBREAK);
  3034.   #endif
  3035.   
  3036.     return retval;
  3037. ***************
  3038. *** 362,377 ****
  3039. --- 391,429 ----
  3040.   }
  3041.   
  3042.   octave_interrupt_handler
  3043. + octave_set_interrupt_handler (RETSIGTYPE (*f)(int))
  3044. + {
  3045. +   octave_interrupt_handler retval;
  3046. +   if (f)
  3047. +     {
  3048. + #ifdef SIGINT
  3049. +       retval.int_handler = octave_set_signal_handler (SIGINT, f);
  3050. +       MAYBE_ACK_SIGNAL (SIGINT);
  3051. + #endif
  3052. + #ifdef SIGBREAK
  3053. +       retval.brk_handler = octave_set_signal_handler (SIGBREAK, f);
  3054. +       MAYBE_ACK_SIGNAL (SIGBREAK);
  3055. + #endif
  3056. +     }
  3057. +   return retval;
  3058. + }
  3059. + octave_interrupt_handler
  3060.   octave_set_interrupt_handler (const volatile octave_interrupt_handler& h)
  3061.   {
  3062.     octave_interrupt_handler retval;
  3063.   
  3064.   #ifdef SIGINT
  3065.     retval.int_handler = octave_set_signal_handler (SIGINT, h.int_handler);
  3066. +   MAYBE_ACK_SIGNAL (SIGINT);
  3067.   #endif
  3068.   
  3069.   #ifdef SIGBREAK
  3070.     retval.brk_handler = octave_set_signal_handler (SIGBREAK, h.brk_handler);
  3071. +   MAYBE_ACK_SIGNAL (SIGBREAK);
  3072.   #endif
  3073.   
  3074.     return retval;
  3075. ***************
  3076. *** 465,472 ****
  3077. --- 517,528 ----
  3078.   #endif
  3079.   
  3080.   #ifdef SIGTERM
  3081. + #ifdef __EMX__
  3082. +   signal (SIGTERM, SIG_DFL);
  3083. + #else
  3084.     octave_set_signal_handler (SIGTERM, generic_sig_handler);
  3085.   #endif
  3086. + #endif
  3087.   
  3088.   #ifdef SIGTRAP
  3089.     octave_set_signal_handler (SIGTRAP, generic_sig_handler);
  3090. ***************
  3091. *** 639,648 ****
  3092.   }
  3093.   
  3094.   void
  3095. ! octave_child_list::insert (pid_t pid, octave_child::dead_child_handler f)
  3096.   {
  3097.     if (instance_ok ())
  3098. !     instance->do_insert (pid, f);
  3099.   }
  3100.   
  3101.   void
  3102. --- 695,705 ----
  3103.   }
  3104.   
  3105.   void
  3106. ! octave_child_list::insert (pid_t pid, octave_child::dead_child_handler f,
  3107. !                string name)
  3108.   {
  3109.     if (instance_ok ())
  3110. !     instance->do_insert (pid, f, name);
  3111.   }
  3112.   
  3113.   void
  3114. ***************
  3115. *** 667,673 ****
  3116.   }
  3117.   
  3118.   void
  3119. ! octave_child_list::do_insert (pid_t pid, octave_child::dead_child_handler f)
  3120.   {
  3121.     // Insert item in first open slot, increasing size of list if
  3122.     // necessary.
  3123. --- 724,731 ----
  3124.   }
  3125.   
  3126.   void
  3127. ! octave_child_list::do_insert (pid_t pid, octave_child::dead_child_handler f,
  3128. !                   string name)
  3129.   {
  3130.     // Insert item in first open slot, increasing size of list if
  3131.     // necessary.
  3132. ***************
  3133. *** 680,686 ****
  3134.   
  3135.         if (tmp.pid < 0)
  3136.       {
  3137. !       list (i) = octave_child (pid, f);
  3138.         enlarge = false;
  3139.         break;
  3140.       }
  3141. --- 738,744 ----
  3142.   
  3143.         if (tmp.pid < 0)
  3144.       {
  3145. !       list (i) = octave_child (pid, f, name);
  3146.         enlarge = false;
  3147.         break;
  3148.       }
  3149. ***************
  3150. *** 698,704 ****
  3151.           list.resize (total_len * 2);
  3152.       }
  3153.   
  3154. !       list (curr_len) = octave_child (pid, f);
  3155.         curr_len++;
  3156.       }
  3157.   }
  3158. --- 756,762 ----
  3159.           list.resize (total_len * 2);
  3160.       }
  3161.   
  3162. !       list (curr_len) = octave_child (pid, f, name);
  3163.         curr_len++;
  3164.       }
  3165.   }
  3166. ***************
  3167. *** 715,720 ****
  3168. --- 773,795 ----
  3169.         if (tmp.pid == pid)
  3170.       {
  3171.         tmp.pid = -1;
  3172. +       octave_child::dead_child_handler f = tmp.handler;
  3173. +       if (f)
  3174. +         {
  3175. +           int status;
  3176. +           if (waitpid (pid, &status, WNOHANG) <= 0)  status = 127;
  3177. +           f (pid, status);
  3178. +         }
  3179. +       else
  3180. +         {
  3181. +           string file = tmp.filename;
  3182. +           unlink (file.c_str ());
  3183. +         }
  3184.         break;
  3185.       }
  3186.       }
  3187. diff -cwr n:/project/C/octave-2.1.23.orig/src/sighandlers.h i:/project/C/octave-2.1.23/src/sighandlers.h
  3188. *** n:/project/C/octave-2.1.23.orig/src/sighandlers.h    Tue Jun  3 22:56:14 1997
  3189. --- i:/project/C/octave-2.1.23/src/sighandlers.h    Fri Dec 24 13:36:00 1999
  3190. ***************
  3191. *** 30,38 ****
  3192. --- 30,42 ----
  3193.   
  3194.   // This file should always be included after config.h!
  3195.   
  3196. + /* Modified by Klaus Gebhardt, 1996 */
  3197.   #if !defined (octave_sighandlers_h)
  3198.   #define octave_sighandlers_h 1
  3199.   
  3200. + #include <string>
  3201.   #include <Array.h>
  3202.   
  3203.   #include "syswait.h"
  3204. ***************
  3205. *** 65,72 ****
  3206.   
  3207.   typedef RETSIGTYPE sig_handler (int);
  3208.   
  3209. - // XXX FIXME XXX -- the data should probably be private...
  3210.   struct
  3211.   octave_interrupt_handler
  3212.   {
  3213. --- 69,74 ----
  3214. ***************
  3215. *** 118,128 ****
  3216.   
  3217.     typedef void (*dead_child_handler) (pid_t, int);
  3218.   
  3219. !   octave_child (pid_t id = -1, dead_child_handler f = 0)
  3220. !     : pid (id), handler (f) { }
  3221.   
  3222.     octave_child (const octave_child& oc)
  3223. !     : pid (oc.pid), handler (oc.handler) { }
  3224.   
  3225.     octave_child& operator = (const octave_child& oc)
  3226.       {
  3227. --- 120,130 ----
  3228.   
  3229.     typedef void (*dead_child_handler) (pid_t, int);
  3230.   
  3231. !   octave_child (pid_t id = -1, dead_child_handler f = 0, string name = "")
  3232. !     : pid (id), handler (f), filename (name) { }
  3233.   
  3234.     octave_child (const octave_child& oc)
  3235. !     : pid (oc.pid), handler (oc.handler), filename (oc.filename) { }
  3236.   
  3237.     octave_child& operator = (const octave_child& oc)
  3238.       {
  3239. ***************
  3240. *** 130,135 ****
  3241. --- 132,138 ----
  3242.       {
  3243.         pid = oc.pid;
  3244.         handler = oc.handler;
  3245. +       filename = oc.filename;
  3246.       }
  3247.         return *this;
  3248.       }
  3249. ***************
  3250. *** 141,146 ****
  3251. --- 144,152 ----
  3252.   
  3253.     // The function we call if this child dies.
  3254.     dead_child_handler handler;
  3255. +   // The file to remove if this child dies.
  3256. +   string filename;
  3257.   };
  3258.   
  3259.   class
  3260. ***************
  3261. *** 156,162 ****
  3262.   
  3263.     static bool instance_ok (void);
  3264.   
  3265. !   static void insert (pid_t pid, octave_child::dead_child_handler f);
  3266.   
  3267.     static void remove (pid_t pid);
  3268.   
  3269. --- 162,169 ----
  3270.   
  3271.     static bool instance_ok (void);
  3272.   
  3273. !   static void insert (pid_t pid, octave_child::dead_child_handler f,
  3274. !               string name = "");
  3275.   
  3276.     static void remove (pid_t pid);
  3277.   
  3278. ***************
  3279. *** 172,178 ****
  3280.   
  3281.     static octave_child_list *instance;
  3282.   
  3283. !   void do_insert (pid_t pid, octave_child::dead_child_handler f);
  3284.   
  3285.     void do_remove (pid_t pid);
  3286.   
  3287. --- 179,186 ----
  3288.   
  3289.     static octave_child_list *instance;
  3290.   
  3291. !   void do_insert (pid_t pid, octave_child::dead_child_handler f,
  3292. !           string name = "");
  3293.   
  3294.     void do_remove (pid_t pid);
  3295.   
  3296. diff -cwr n:/project/C/octave-2.1.23.orig/src/syscalls.cc i:/project/C/octave-2.1.23/src/syscalls.cc
  3297. *** n:/project/C/octave-2.1.23.orig/src/syscalls.cc    Fri Nov 19 06:15:26 1999
  3298. --- i:/project/C/octave-2.1.23/src/syscalls.cc    Sat Dec 25 12:58:02 1999
  3299. ***************
  3300. *** 25,30 ****
  3301. --- 25,32 ----
  3302.   //
  3303.   //   mkfifo  unlink  waitpid
  3304.   
  3305. + /* Modified by Klaus Gebhardt, 1996 */
  3306.   #ifdef HAVE_CONFIG_H
  3307.   #include <config.h>
  3308.   #endif
  3309. ***************
  3310. *** 32,37 ****
  3311. --- 34,40 ----
  3312.   #include <cerrno>
  3313.   #include <cstdio>
  3314.   #include <cstring>
  3315. + #include <csignal>
  3316.   
  3317.   #ifdef HAVE_UNISTD_H
  3318.   #ifdef HAVE_SYS_TYPES_H
  3319. ***************
  3320. *** 48,53 ****
  3321. --- 51,58 ----
  3322.   #include "file-stat.h"
  3323.   #include "oct-syscalls.h"
  3324.   
  3325. + #include <process.h>
  3326.   #include "defun.h"
  3327.   #include "error.h"
  3328.   #include "gripes.h"
  3329. ***************
  3330. *** 56,61 ****
  3331. --- 61,68 ----
  3332.   #include "oct-obj.h"
  3333.   #include "oct-stdstrm.h"
  3334.   #include "oct-stream.h"
  3335. + #include "oct-fstrm.h"
  3336. + #include "sighandlers.h"
  3337.   #include "sysdep.h"
  3338.   #include "syswait.h"
  3339.   #include "utils.h"
  3340. ***************
  3341. *** 89,95 ****
  3342.     return m;
  3343.   }
  3344.   
  3345. ! DEFUN (dup2, args, ,
  3346.    "-*- texinfo -*-\n\
  3347.   @deftypefn {Built-in Function} {[@var{fid}, @var{msg}] =} dup2 (@var{old}, @var{new})\n\
  3348.   Duplicate a file descriptor.\n\
  3349. --- 96,154 ----
  3350.     return m;
  3351.   }
  3352.   
  3353. ! #if defined (__EMX__) && defined (OS2)
  3354. ! DEFUN (_dup, args, ,
  3355. !  "[FID, MSG] = _dup (old): duplicate a file descriptor")
  3356. ! {
  3357. !   octave_value_list retval;
  3358. !   retval(1) = string ();
  3359. !   retval(0) = -1.0;
  3360. !   int nargin = args.length ();
  3361. !   if (nargin == 1)
  3362. !     {
  3363. ! #if defined (HAVE_DUP)
  3364. !       double d_old = args(0).double_value ();
  3365. !       if (! error_state)
  3366. !     {
  3367. !       if (static_cast<int> (d_old) == d_old)
  3368. !         {
  3369. !           int i_old = static_cast<int> (d_old);
  3370. !           // XXX FIXME XXX -- are these checks sufficient?
  3371. !           if (i_old >= 0)
  3372. !         {
  3373. !           string msg;
  3374. !           int status = octave_syscalls::dup (i_old, msg);
  3375. !           retval(0) = static_cast<double> (status);
  3376. !           if (status < 0)
  3377. !             retval(1) = msg;
  3378. !         }
  3379. !           else
  3380. !         error ("_dup: invalid file id");
  3381. !         }
  3382. !       else
  3383. !         error ("_dup: argument must be integer value");
  3384. !     }
  3385. !       else
  3386. !     error ("_dup: argument must be integer value");
  3387. ! #else
  3388. !       gripe_not_supported ("_dup");
  3389. ! #endif
  3390. !     }
  3391. !   else
  3392. !     print_usage ("_dup");
  3393. !   return retval;
  3394. ! }
  3395. ! DEFUN (_dup2, args, ,
  3396.    "-*- texinfo -*-\n\
  3397.   @deftypefn {Built-in Function} {[@var{fid}, @var{msg}] =} dup2 (@var{old}, @var{new})\n\
  3398.   Duplicate a file descriptor.\n\
  3399. ***************
  3400. *** 108,125 ****
  3401.   
  3402.     if (nargin == 2)
  3403.       {
  3404. !       octave_stream old_stream
  3405. !     = octave_stream_list::lookup (args(0), "dup2");
  3406.   
  3407.         if (! error_state)
  3408.       {
  3409. !       octave_stream new_stream
  3410. !         = octave_stream_list::lookup (args(1), "dup2");
  3411. !       if (! error_state)
  3412.           {
  3413. !           int i_old = old_stream.file_number ();
  3414. !           int i_new = new_stream.file_number ();
  3415.   
  3416.             if (i_old >= 0 && i_new >= 0)
  3417.           {
  3418. --- 167,182 ----
  3419.   
  3420.     if (nargin == 2)
  3421.       {
  3422. !       double d_old = args(0).double_value ();
  3423. !       double d_new = args(1).double_value ();
  3424.   
  3425.         if (! error_state)
  3426.       {
  3427. !       if ((static_cast<int> (d_old) == d_old) &&
  3428. !           (static_cast<int> (d_new) == d_new))
  3429.           {
  3430. !           int i_old = static_cast<int> (d_old);
  3431. !           int i_new = static_cast<int> (d_new);
  3432.   
  3433.             if (i_old >= 0 && i_new >= 0)
  3434.           {
  3435. ***************
  3436. *** 128,142 ****
  3437.             int status = octave_syscalls::dup2 (i_old, i_new, msg);
  3438.   
  3439.             retval(0) = static_cast<double> (status);
  3440.             retval(1) = msg;
  3441.           }
  3442.           }
  3443.       }
  3444.         else
  3445. !     error ("dup2: invalid stream");
  3446.       }
  3447.     else
  3448. !     print_usage ("dup2");
  3449.   
  3450.     return retval;
  3451.   }
  3452. --- 185,382 ----
  3453.             int status = octave_syscalls::dup2 (i_old, i_new, msg);
  3454.   
  3455.             retval(0) = static_cast<double> (status);
  3456. +           if (status < 0)
  3457. +             retval(1) = msg;
  3458. +         }
  3459. +             else
  3460. +         error ("_dup2: invalid file id");
  3461. +           }
  3462. +         else
  3463. +          error ("_dup2: arguments must be integer values");
  3464. +     }
  3465. +       else
  3466. +     error ("_dup2: invalid stream");
  3467. +     }
  3468. +   else
  3469. +     print_usage ("_dup2");
  3470. +   return retval;
  3471. + }
  3472. + DEFUN (_close, args, ,
  3473. +  "[RETVAL, MSG] = _close (fid): close a file handle")
  3474. + {
  3475. +   octave_value_list retval;
  3476. +   retval(1) = string ();
  3477. +   retval(0) = -1.0;
  3478. +   int nargin = args.length ();
  3479. +   if (nargin == 1)
  3480. +     {
  3481. +       double d_old = args(0).double_value ();
  3482. +       if (! error_state)
  3483. +     {
  3484. +       if (static_cast<int> (d_old) == d_old)
  3485. +         {
  3486. +           int i_old = static_cast<int> (d_old);
  3487. +           // XXX FIXME XXX -- are these checks sufficient?
  3488. +           if (i_old >= 0)
  3489. +         {
  3490. +           int status = file_ops::close (i_old);
  3491. +           retval(0) = (double) status;
  3492. +           if (status < 0)
  3493. +             retval(1) = strerror (errno);
  3494. +         }
  3495. +           else
  3496. +         error ("_close: invalid file id");
  3497. +         }
  3498. +       else
  3499. +         error ("_close: argument must be integer value");
  3500. +     }
  3501. +     }
  3502. +   else
  3503. +     print_usage ("_close");
  3504. +   return retval;
  3505. + }
  3506. + DEFUN (_fdopen, args, ,
  3507. +  "[FID, MSG] = _fdopen (fid, mode): create a stream for file handle")
  3508. + {
  3509. +   octave_value_list retval;
  3510. +   retval(1) = string ();
  3511. +   retval(0) = -1.0;
  3512. +   int nargin = args.length ();
  3513. +   if (nargin == 2)
  3514. +     {
  3515. +       if (args(1).is_string ())
  3516. +     {
  3517. +       string mode = args(1).string_value ();
  3518. +       double d_old = args(0).double_value ();
  3519. +       if (! error_state)
  3520. +         {
  3521. +           if (static_cast<int> (d_old) == d_old)
  3522. +         {
  3523. +           int i_old = static_cast<int> (d_old);
  3524. +           // XXX FIXME XXX -- are these checks sufficient?
  3525. +           if (i_old >= 0)
  3526. +             {
  3527. +               string msg;
  3528. +               FILE *f = static_cast<FILE *> (file_ops::fdopen (i_old, mode, msg));
  3529.                 retval(1) = msg;
  3530. +               if (f)
  3531. +             {
  3532. +               if (mode[0] == 'r')
  3533. +                 {
  3534. +                   octave_istdiostream *is
  3535. +                 = new octave_istdiostream ("fdopen", f);
  3536. +                   retval(0) = octave_stream_list::insert (is);
  3537. +                 }
  3538. +               else if (mode[0] == 'w')
  3539. +                 {
  3540. +                   octave_ostdiostream *os
  3541. +                 = new octave_ostdiostream ("fdopen", f);
  3542. +                   retval(0) = octave_stream_list::insert (os);
  3543. +                 }
  3544. +               else
  3545. +                 error ("_fdopen: invalid mode");
  3546. +             }
  3547. +               else
  3548. +             error ("_fdopen: error opening file id");
  3549. +             }
  3550. +           else
  3551. +             error ("_fdopen: invalid file id");
  3552. +         }
  3553. +           else
  3554. +         error ("_fdopen: argument must be integer value");
  3555. +         }
  3556. +       else
  3557. +         error ("_fdopen: argument must be integer value");
  3558. +     }
  3559. +       else
  3560. +     error ("_fdopen: mode must be a string");
  3561. +     }
  3562. +   else
  3563. +     print_usage ("_fdopen");
  3564. +   return retval;
  3565. + }
  3566. + #endif
  3567. + DEFUN (spawn, args, ,
  3568. +  "[STATUS, MSG] = spawn (mode, file, args): run a program")
  3569. + {
  3570. +   octave_value_list retval;
  3571. +   retval(1) = string ();
  3572. +   retval(0) = -1.0;
  3573. +   int nargin = args.length ();
  3574. +   if (nargin == 2 || nargin == 3)
  3575. +     {
  3576. +       string mode_strg = args(0).string_value ();
  3577. +       string exec_file = args(1).string_value ();
  3578. +       if (! error_state)
  3579. +     {
  3580. +       string_vector exec_args;
  3581. +       if (nargin == 3)
  3582. +         {
  3583. +           string_vector tmp = args(2).all_strings ();
  3584. +           if (! error_state)
  3585. +         {
  3586. +           int len = tmp.length ();
  3587. +           exec_args.resize (len + 1);
  3588. +           exec_args[0] = exec_file;
  3589. +           for (int i = 0; i < len; i++)
  3590. +             exec_args[i+1] = tmp[i];
  3591. +         }
  3592. +           else
  3593. +         error ("exec: arguments must be strings");
  3594.           }
  3595. +       else
  3596. +         {
  3597. +           exec_args.resize (1);
  3598. +           exec_args[0] = exec_file;
  3599. +         }
  3600. +       if (! error_state)
  3601. +         {
  3602. +           string msg;
  3603. +           int status = octave_syscalls::spawnvp (mode_strg, exec_file, exec_args, msg);
  3604. +           retval(0) = static_cast<double> (status);
  3605. +           retval(1) = msg;
  3606.           }
  3607.       }
  3608.         else
  3609. !     error ("spawn: first two arguments must be strings");
  3610.       }
  3611.     else
  3612. !     print_usage ("spawn");
  3613.     
  3614.     return retval;
  3615.   }
  3616. ***************
  3617. *** 219,227 ****
  3618.     return retval;
  3619.   }
  3620.   
  3621. ! DEFUN (fcntl, args, ,
  3622.    "-*- texinfo -*-\n\
  3623. ! @deftypefn {Built-in Function} {[@var{err}, @var{msg}] =} fcntl (@var{fid}, @var{request}, @var{arg})\n\
  3624.   Change the properties of the open file @var{fid}.  The following values\n\
  3625.   may be passed as @var{request}:\n\
  3626.   \n\
  3627. --- 459,468 ----
  3628.     return retval;
  3629.   }
  3630.   
  3631. ! #if defined (__EMX__) && defined (OS2)
  3632. ! DEFUN (_fcntl, args, ,
  3633.    "-*- texinfo -*-\n\
  3634. ! @deftypefn {Built-in Function} {[@var{err}, @var{msg}] =} _fcntl (@var{fid}, @var{request}, @var{arg})\n\
  3635.   Change the properties of the open file @var{fid}.  The following values\n\
  3636.   may be passed as @var{request}:\n\
  3637.   \n\
  3638. ***************
  3639. *** 290,296 ****
  3640.       {
  3641.         // XXX FIXME XXX -- Need better checking here?
  3642.         if (fid < 0)
  3643. !         error ("fcntl: invalid file id");
  3644.         else
  3645.           {
  3646.             string msg;
  3647. --- 531,537 ----
  3648.       {
  3649.         // XXX FIXME XXX -- Need better checking here?
  3650.         if (fid < 0)
  3651. !         error ("_fcntl: invalid file id");
  3652.         else
  3653.           {
  3654.             string msg;
  3655. ***************
  3656. *** 302,314 ****
  3657.           }
  3658.       }
  3659.         else
  3660. !     error ("fcntl: file id, request, and argument must be integers");
  3661.       }
  3662.     else
  3663. !     print_usage ("fcntl");
  3664.   
  3665.     return retval;
  3666.   }
  3667.   
  3668.   DEFUN (fork, args, ,
  3669.    "-*- texinfo -*-\n\
  3670. --- 543,556 ----
  3671.           }
  3672.       }
  3673.         else
  3674. !     error ("_fcntl: file id, request, and argument must be integers");
  3675.       }
  3676.     else
  3677. !     print_usage ("_fcntl");
  3678.   
  3679.     return retval;
  3680.   }
  3681. + #endif
  3682.   
  3683.   DEFUN (fork, args, ,
  3684.    "-*- texinfo -*-\n\
  3685. ***************
  3686. *** 572,577 ****
  3687. --- 814,870 ----
  3688.     return retval;
  3689.   }
  3690.   
  3691. + #if defined (__EMX__) && defined (OS2)
  3692. + DEFUN (_pipe, args, ,
  3693. +   "[FIDS, STATUS, MSG] = _pipe (): create an interprocess channel.\n\
  3694. + \n\
  3695. + Return the FIDS corresponding to the reading and writing ends of\n\
  3696. + the pipe, as a vector.\n\
  3697. + \n\
  3698. + You must open the FIDS using _fdopen!\n\
  3699. + \n\
  3700. + If successful, STATUS is 0 and MSG is an empty string.  Otherwise,\n\
  3701. + STATUS is nonzero and MSG contains a system-dependent error message.")
  3702. + {
  3703. +   octave_value_list retval;
  3704. +   retval(2) = string ();
  3705. +   retval(1) = -1.0;
  3706. +   retval(0) = Matrix ();
  3707. +   int nargin = args.length ();
  3708. +   if (nargin == 0)
  3709. +     {
  3710. + #if defined (HAVE_PIPE)
  3711. +       int fid[2];
  3712. +       string msg;
  3713. +       int status = octave_syscalls::pipe (fid, msg);
  3714. +       if (status < 0)  retval(2) = msg;
  3715. +       else
  3716. +     {
  3717. +       Matrix file_ids (1, 2);
  3718. +       file_ids (0, 0) = (double) fid[0];
  3719. +       file_ids (0, 1) = (double) fid[1];
  3720. +           retval(0) = file_ids;
  3721. +       retval(1) = (double) status;
  3722. +     }      
  3723. + #else
  3724. +       gripe_not_supported ("_pipe");
  3725. + #endif
  3726. +     }
  3727. +   else
  3728. +     print_usage ("_pipe");
  3729. +   return retval;
  3730. + }
  3731. + #endif
  3732.   DEFUN (pipe, args, ,
  3733.     "-*- texinfo -*-\n\
  3734.   @deftypefn {Built-in Function} {[@var{file_ids}, @var{err}, @var{msg}] =} pipe ()\n\
  3735. ***************
  3736. *** 854,860 ****
  3737. --- 1147,1166 ----
  3738.           {
  3739.             string msg;
  3740.   
  3741. + #ifdef __EMX__
  3742. +           volatile octave_interrupt_handler saved_interrupt_handler
  3743. +         = octave_ignore_interrupts ();
  3744. +           volatile sig_handler *saved_sigchld_handler
  3745. +         = octave_set_signal_handler (SIGCHLD, SIG_IGN);
  3746. + #endif
  3747.             pid_t status = octave_syscalls::waitpid (pid, options, msg);
  3748. + #ifdef __EMX__
  3749. +           octave_set_interrupt_handler (saved_interrupt_handler);
  3750. +           octave_set_signal_handler (SIGCHLD, saved_sigchld_handler);
  3751. + #endif
  3752.   
  3753.             retval(0) = static_cast<double> (status);
  3754.             retval(1) = msg;
  3755. diff -cwr n:/project/C/octave-2.1.23.orig/src/sysdep.cc i:/project/C/octave-2.1.23/src/sysdep.cc
  3756. *** n:/project/C/octave-2.1.23.orig/src/sysdep.cc    Tue Nov 23 20:07:14 1999
  3757. --- i:/project/C/octave-2.1.23/src/sysdep.cc    Fri Dec 24 13:37:50 1999
  3758. ***************
  3759. *** 20,25 ****
  3760. --- 20,27 ----
  3761.   
  3762.   */
  3763.   
  3764. + /* Modified by Klaus Gebhardt, 1996 */
  3765.   #ifdef HAVE_CONFIG_H
  3766.   #include <config.h>
  3767.   #endif
  3768. ***************
  3769. *** 56,61 ****
  3770. --- 58,68 ----
  3771.   #include <sys/ioctl.h>
  3772.   #endif
  3773.   
  3774. + #ifdef __EMX__
  3775. + #include <float.h>
  3776. + #include <sys/uflags.h>
  3777. + #endif
  3778.   #if defined (HAVE_FLOATINGPOINT_H)
  3779.   #include <floatingpoint.h>
  3780.   #endif
  3781. ***************
  3782. *** 68,73 ****
  3783. --- 75,92 ----
  3784.   #include <sys/utsname.h>
  3785.   #endif
  3786.   
  3787. + #ifdef __EMX__
  3788. + #include <readline/readline.h>
  3789. + #include <readline/tilde.h>
  3790. + #include <sys/ioctl.h>
  3791. + extern "C"
  3792. + {
  3793. +   extern void tputs ();
  3794. +   extern char *term_clrpag;
  3795. +   extern void _rl_output_character_function ();
  3796. + }
  3797. + #endif
  3798.   #include "cmd-edit.h"
  3799.   #include "file-ops.h"
  3800.   #include "lo-mappers.h"
  3801. ***************
  3802. *** 127,132 ****
  3803. --- 146,153 ----
  3804.   {
  3805.     _control87 ((EM_INVALID | EM_DENORMAL | EM_ZERODIVIDE | EM_OVERFLOW
  3806.              | EM_UNDERFLOW | EM_INEXACT), MCW_EM);
  3807. +   _uflags (_UF_SBRK_MODEL, _UF_SBRK_ARBITRARY);
  3808.   }
  3809.   #endif
  3810.   
  3811. ***************
  3812. *** 313,318 ****
  3813. --- 334,340 ----
  3814.   kbhit (void)
  3815.   {
  3816.     int c;
  3817. +   flush_octave_stdout ();
  3818.     raw_mode (1);
  3819.     c = cin.get ();
  3820.     raw_mode (0);
  3821. ***************
  3822. *** 415,421 ****
  3823.   
  3824.     // XXX FIXME XXX -- add timeout and default value args?
  3825.   
  3826. !   if (interactive)
  3827.       {
  3828.         int c = kbhit ();
  3829.         char *s = new char [2];
  3830. --- 437,443 ----
  3831.   
  3832.     // XXX FIXME XXX -- add timeout and default value args?
  3833.   
  3834. !   if (interactive || really_forced_interactive)
  3835.       {
  3836.         int c = kbhit ();
  3837.         char *s = new char [2];
  3838. ***************
  3839. *** 609,614 ****
  3840. --- 631,657 ----
  3841.   
  3842.   DEFALIAS (EXTPROC, extproc);
  3843.   
  3844. + DEFUN (add_to_command_number, args, ,
  3845. +        "add_to_command_number: add argument to the current command number")
  3846. + {
  3847. +   octave_value_list retval;
  3848. +   int nargin;
  3849. +   if ((nargin = args.length ()) != 1)
  3850. +     {
  3851. +       print_usage ("add_to_command_number");
  3852. +       return retval;
  3853. +     }
  3854. +   double tmp_d = args(0).double_value ();
  3855. +   if (error_state || (static_cast<int> (tmp_d) != tmp_d))
  3856. +     error ("add_to_command_number: expecting integer as argument");
  3857. +   else
  3858. +     command_editor::add_current_command_number (static_cast<int> (tmp_d));
  3859. +   return retval;
  3860. + }
  3861.   #endif
  3862.   
  3863.   /*
  3864. diff -cwr n:/project/C/octave-2.1.23.orig/src/toplev.cc i:/project/C/octave-2.1.23/src/toplev.cc
  3865. *** n:/project/C/octave-2.1.23.orig/src/toplev.cc    Wed Nov  3 20:54:52 1999
  3866. --- i:/project/C/octave-2.1.23/src/toplev.cc    Sat Dec 25 19:15:42 1999
  3867. ***************
  3868. *** 20,25 ****
  3869. --- 20,27 ----
  3870.   
  3871.   */
  3872.   
  3873. + /* Modified by Klaus Gebhardt, 1996 - 1999 */
  3874.   #ifdef HAVE_CONFIG_H
  3875.   #include <config.h>
  3876.   #endif
  3877. ***************
  3878. *** 77,82 ****
  3879. --- 79,92 ----
  3880.   #include "variables.h"
  3881.   #include <version.h>
  3882.   
  3883. + #ifdef __EMX__
  3884. + extern "C"
  3885. + {
  3886. + #include <process.h>
  3887. +   int _IO_system (const char *, int);
  3888. + }
  3889. + #endif
  3890.   // TRUE means we are exiting via the builtin exit or quit functions.
  3891.   static bool quitting_gracefully = false;
  3892.   
  3893. ***************
  3894. *** 98,103 ****
  3895. --- 108,117 ----
  3896.   
  3897.     if (setjmp (toplevel) != 0)
  3898.       {
  3899. + #if defined (__EMX__) && defined (OS2)
  3900. +       unwind_protect::run_all ();
  3901. + #endif
  3902.         raw_mode (0);
  3903.   
  3904.         cout << "\n";
  3905. ***************
  3906. *** 114,119 ****
  3907. --- 128,138 ----
  3908.     int retval;
  3909.     do
  3910.       {
  3911. + #ifdef __EMX__
  3912. +       can_interrupt = 1;
  3913. +       octave_catch_interrupts ();
  3914. + #endif
  3915.         curr_sym_tab = top_level_sym_tab;
  3916.   
  3917.         reset_parser ();
  3918. ***************
  3919. *** 128,134 ****
  3920.   
  3921.         global_command = 0;
  3922.   
  3923. !       if (! (interactive || forced_interactive))
  3924.           {
  3925.             bool quit = (tree_return_command::returning
  3926.                  || tree_break_command::breaking);
  3927. --- 147,154 ----
  3928.   
  3929.         global_command = 0;
  3930.   
  3931. !       if (! (interactive || forced_interactive
  3932. !          || really_forced_interactive))
  3933.           {
  3934.             bool quit = (tree_return_command::returning
  3935.                  || tree_break_command::breaking);
  3936. ***************
  3937. *** 145,151 ****
  3938.   
  3939.         if (error_state)
  3940.           {
  3941. !           if (! (interactive || forced_interactive))
  3942.           break;
  3943.           }
  3944.         else
  3945. --- 165,172 ----
  3946.   
  3947.         if (error_state)
  3948.           {
  3949. !           if (! (interactive || forced_interactive
  3950. !              || really_forced_interactive))
  3951.           break;
  3952.           }
  3953.         else
  3954. ***************
  3955. *** 169,174 ****
  3956. --- 190,199 ----
  3957.   {
  3958.     do_octave_atexit ();
  3959.   
  3960. + #if defined (__EMX__)
  3961. +   _sleep2 (500);
  3962. + #endif
  3963.     exit (retval == EOF ? 0 : retval);
  3964.   }
  3965.   
  3966. ***************
  3967. *** 296,307 ****
  3968.   
  3969.   // Execute a shell command.
  3970.   
  3971.   static void
  3972.   cleanup_iprocstream (void *p)
  3973.   {
  3974.     iprocstream *cmd = static_cast<iprocstream *> (p);
  3975.   
  3976. !   octave_child_list::remove (cmd->pid ());
  3977.   
  3978.     delete cmd;
  3979.   }
  3980. --- 321,341 ----
  3981.   
  3982.   // Execute a shell command.
  3983.   
  3984. + static int cmd_status = -1;
  3985. + static int cmd_pid    = -1;
  3986. + static void
  3987. + cmd_death_handler (pid_t, int status)
  3988. + {
  3989. +   cmd_status = status;
  3990. + }
  3991.   static void
  3992.   cleanup_iprocstream (void *p)
  3993.   {
  3994.     iprocstream *cmd = static_cast<iprocstream *> (p);
  3995.   
  3996. !   octave_child_list::remove (cmd_pid);
  3997.   
  3998.     delete cmd;
  3999.   }
  4000. ***************
  4001. *** 313,320 ****
  4002. --- 347,359 ----
  4003.   
  4004.     iprocstream *cmd = new iprocstream (cmd_str.c_str ());
  4005.   
  4006. +   cmd_status = -1;
  4007.     if (cmd)
  4008.       {
  4009. +       cmd_pid = cmd->pid ();
  4010. +       octave_child_list::insert (cmd_pid, cmd_death_handler);
  4011.         unwind_protect::add (cleanup_iprocstream, cmd);
  4012.   
  4013.         if (*cmd)
  4014. ***************
  4015. *** 344,350 ****
  4016.         while (cmd->get (ch))
  4017.           output_buf.put (ch);
  4018.   
  4019. !       int cmd_status = cmd->close ();
  4020.   
  4021.         if (WIFEXITED (cmd_status))
  4022.           cmd_status = WEXITSTATUS (cmd_status);
  4023. --- 383,389 ----
  4024.         while (cmd->get (ch))
  4025.           output_buf.put (ch);
  4026.   
  4027. !       cmd_status = cmd->close ();
  4028.   
  4029.         if (WIFEXITED (cmd_status))
  4030.           cmd_status = WEXITSTATUS (cmd_status);
  4031. ***************
  4032. *** 421,427 ****
  4033. --- 460,470 ----
  4034.   
  4035.         string cmd_str = args(0).string_value ();
  4036.   
  4037. + #if defined (__EMX__) && defined (OS2)
  4038. +       enum exec_type { sync, async, pm };
  4039. + #else
  4040.         enum exec_type { sync, async };
  4041. + #endif
  4042.   
  4043.         exec_type type = sync;
  4044.   
  4045. ***************
  4046. *** 437,444 ****
  4047. --- 480,495 ----
  4048.               type = sync;
  4049.             else if (type_str == "async")
  4050.               type = async;
  4051. + #if defined (__EMX__) && defined (OS2)
  4052. +           else if (type_str == "pm")
  4053. +             type = pm;
  4054. +           else
  4055. +             error ("system: third arg must be \"sync\" , \"async\""
  4056. +                "or \"pm\"");
  4057. + #else
  4058.             else
  4059.               error ("system: third arg must be \"sync\" or \"async\"");
  4060. + #endif
  4061.           }
  4062.             else
  4063.           error ("system: third argument must be a string");
  4064. ***************
  4065. *** 449,456 ****
  4066. --- 500,512 ----
  4067.   
  4068.         if (! error_state)
  4069.       {
  4070. + #if defined (__EMX__) && defined (OS2)
  4071. +       if (type == async || type == pm)
  4072. + #else
  4073.         if (type == async)
  4074. + #endif
  4075.           {
  4076. + #ifndef __EMX__
  4077.             pid_t pid = fork ();
  4078.   
  4079.             if (pid < 0) 
  4080. ***************
  4081. *** 466,478 ****
  4082. --- 522,555 ----
  4083.           }
  4084.             else
  4085.           retval(0) = static_cast<double> (pid);
  4086. + #else
  4087. +           pid_t pid;
  4088. +           int p_mode;
  4089. + #ifdef OS2
  4090. +           if (type == pm)  p_mode = P_PM;
  4091. +           else             p_mode = P_NOWAIT;
  4092. + #else
  4093. +           p_mode = P_NOWAIT;
  4094. + #endif
  4095. +           pid = _IO_system (cmd_str.c_str (), p_mode);
  4096. +           if (pid < 0)
  4097. +         error ("system: spawn failed -- can't create child process");
  4098. +           else
  4099. +         retval(0) = (double) pid;
  4100. + #endif
  4101.           }
  4102.         else if (return_output)
  4103.           retval = run_command_and_return_output (cmd_str);
  4104.         else
  4105.           {
  4106. + #ifdef __EMX__
  4107. +           int status = _IO_system (cmd_str.c_str (), P_WAIT);
  4108. + #else
  4109.             int status = system (cmd_str.c_str ());
  4110. + #endif
  4111.   
  4112. + #ifndef __EMX__
  4113.             // The value in status is as returned by waitpid.  If
  4114.             // the process exited normally, extract the actual exit
  4115.             // status of the command.  Otherwise, return 127 as a
  4116. ***************
  4117. *** 480,485 ****
  4118. --- 557,565 ----
  4119.   
  4120.             if (WIFEXITED (status))
  4121.           status = WEXITSTATUS (status);
  4122. +           else
  4123. +         status = 127;
  4124. + #endif
  4125.   
  4126.             retval = static_cast<double> (status);
  4127.           }
  4128. ***************
  4129. *** 493,501 ****
  4130.   
  4131.   DEFALIAS (shell_cmd, system);
  4132.   
  4133. ! // XXX FIXME XXX -- this should really be static, but that causes
  4134. ! // problems on some systems.
  4135. ! SLStack<string> octave_atexit_functions;
  4136.   
  4137.   void
  4138.   do_octave_atexit (void)
  4139. --- 573,579 ----
  4140.   
  4141.   DEFALIAS (shell_cmd, system);
  4142.   
  4143. ! static SLStack<string> octave_atexit_functions;
  4144.   
  4145.   void
  4146.   do_octave_atexit (void)
  4147. ***************
  4148. *** 530,536 ****
  4149.   
  4150.         flush_octave_stdout ();
  4151.   
  4152. !       if (!quitting_gracefully && (interactive || forced_interactive))
  4153.       cout << "\n";
  4154.       }
  4155.   }
  4156. --- 608,615 ----
  4157.   
  4158.         flush_octave_stdout ();
  4159.   
  4160. !       if (!quitting_gracefully &&
  4161. !       (interactive || forced_interactive || really_forced_interactive))
  4162.       cout << "\n";
  4163.       }
  4164.   }
  4165. diff -cwr n:/project/C/octave-2.1.23.orig/src/utils.cc i:/project/C/octave-2.1.23/src/utils.cc
  4166. *** n:/project/C/octave-2.1.23.orig/src/utils.cc    Tue Nov 23 21:54:30 1999
  4167. --- i:/project/C/octave-2.1.23/src/utils.cc    Fri Dec 24 13:37:50 1999
  4168. ***************
  4169. *** 20,25 ****
  4170. --- 20,27 ----
  4171.   
  4172.   */
  4173.   
  4174. + /* Modified by Klaus Gebhardt, 1996 */
  4175.   #ifdef HAVE_CONFIG_H
  4176.   #include <config.h>
  4177.   #endif
  4178. ***************
  4179. *** 90,96 ****
  4180. --- 92,100 ----
  4181.   void
  4182.   jump_to_top_level (void)
  4183.   {
  4184. + #if ! defined (__EMX__) || ! defined (OS2)
  4185.     unwind_protect::run_all ();
  4186. + #endif
  4187.   
  4188.     longjmp (toplevel, 1);
  4189.   }
  4190. diff -cwr n:/project/C/octave-2.1.23.orig/src/variables.cc i:/project/C/octave-2.1.23/src/variables.cc
  4191. *** n:/project/C/octave-2.1.23.orig/src/variables.cc    Tue Dec 14 08:11:52 1999
  4192. --- i:/project/C/octave-2.1.23/src/variables.cc    Fri Dec 24 16:46:12 1999
  4193. ***************
  4194. *** 20,25 ****
  4195. --- 20,27 ----
  4196.   
  4197.   */
  4198.   
  4199. + /* Modified by Klaus Gebhardt, 1996 - 1998 */
  4200.   #ifdef HAVE_CONFIG_H
  4201.   #include <config.h>
  4202.   #endif
  4203. ***************
  4204. *** 33,38 ****
  4205. --- 35,41 ----
  4206.   #include "oct-env.h"
  4207.   #include "glob-match.h"
  4208.   #include "str-vec.h"
  4209. + #include "lo-mappers.h"
  4210.   
  4211.   #include <defaults.h>
  4212.   #include "defun.h"
  4213. ***************
  4214. *** 44,49 ****
  4215. --- 47,55 ----
  4216.   #include "lex.h"
  4217.   #include "oct-map.h"
  4218.   #include "oct-obj.h"
  4219. + #ifndef __EMX__
  4220. + #include "oct-procbuf.h"
  4221. + #endif
  4222.   #include "ov.h"
  4223.   #include "pager.h"
  4224.   #include "parse.h"
  4225. ***************
  4226. *** 1221,1226 ****
  4227. --- 1227,1267 ----
  4228.   
  4229.     return retval;
  4230.   }
  4231. + #ifdef __EMX__
  4232. + // We are using a general procbuf!
  4233. + // So this has to be defined here.
  4234. + // Klaus Gebhardt, 1998
  4235. + static int Vkluge_procbuf_delay = 0;
  4236. + static int
  4237. + kluge_procbuf_delay (void)
  4238. + {
  4239. +   double val;
  4240. +   if (builtin_real_scalar_variable ("kluge_procbuf_delay", val)
  4241. +       && ! xisnan (val))
  4242. +     {
  4243. +       int ival = NINT (val);
  4244. +       if (ival >= 0 && (double) ival == val)
  4245. +         {
  4246. +           Vkluge_procbuf_delay = ival;
  4247. +           return 0;
  4248. +         }
  4249. +     }
  4250. +   gripe_invalid_value_specified ("kluge_procbuf_delay");
  4251. +   return -1;
  4252. + }
  4253. + void
  4254. + symbols_of_oct_procbuf (void)
  4255. + {
  4256. +   DEFVAR (kluge_procbuf_delay, static_cast<double> (Vkluge_procbuf_delay),
  4257. +           kluge_procbuf_delay,
  4258. +     "number of microseconds to delay in the parent after forking\n\
  4259. + (not used under OS/2)");
  4260. + }
  4261. + #endif
  4262.   
  4263.   DEFUN (__dump_symtab_info__, args, ,
  4264.     "__dump_symtab_info__ (): print raw symbol table statistices")
  4265. diff -cwr n:/project/C/octave-2.1.23.orig/src/version.h i:/project/C/octave-2.1.23/src/version.h
  4266. *** n:/project/C/octave-2.1.23.orig/src/version.h    Sat Dec 18 03:06:04 1999
  4267. --- i:/project/C/octave-2.1.23/src/version.h    Fri Dec 24 13:37:52 1999
  4268. ***************
  4269. *** 23,28 ****
  4270. --- 23,59 ----
  4271.   #if !defined (octave_version_h)
  4272.   #define octave_version_h 1
  4273.   
  4274. + /* Modified by Klaus Gebhardt, 1996 - 1998 */
  4275. + #if defined (__EMX__) && defined (OS2)
  4276. + #define OCTAVE_VERSION "2.1.23"
  4277. + #define OCTAVE_OS2_PATCHLEVEL "2.1.23-b01"
  4278. + #define OCTAVE_COPYRIGHT \
  4279. + "Copyright (C) 1996, 1997, 1998 John W. Eaton.\n\
  4280. + OS/2-Port by Klaus Gebhardt, 1996 - 1999."
  4281. + #define OCTAVE_NAME_AND_VERSION \
  4282. + "Octave " OCTAVE_VERSION " for OS/2 2.x, Warp 3 and Warp 4.\n(Patchlevel " \
  4283. + OCTAVE_OS2_PATCHLEVEL ")"
  4284. + #define OCTAVE_NAME_VERSION_AND_COPYRIGHT \
  4285. +   OCTAVE_NAME_AND_VERSION ".\n" OCTAVE_COPYRIGHT "\n\
  4286. + This is free software with ABSOLUTELY NO WARRANTY."
  4287. + #define OCTAVE_STARTUP_MESSAGE \
  4288. +   OCTAVE_NAME_VERSION_AND_COPYRIGHT "\n\
  4289. + For details, type `warranty'.\n\
  4290. + \n\
  4291. + *** This is a development version of Octave.  Development releases\n\
  4292. + *** are provided for people who want to help test, debug, and improve\n\
  4293. + *** Octave.\n\
  4294. + ***\n\
  4295. + *** If you want a stable, well-tested version of Octave, you should be\n\
  4296. + *** using one of the stable releases (when this development release\n\
  4297. + *** was made, the latest stable version was 2.0.13)."
  4298. + #else
  4299.   #define OCTAVE_VERSION "2.1.23"
  4300.   
  4301.   #define OCTAVE_COPYRIGHT \
  4302. ***************
  4303. *** 47,52 ****
  4304. --- 78,84 ----
  4305.   *** using one of the stable releases (when this development release\n\
  4306.   *** was made, the latest stable version was 2.0.14)."
  4307.   
  4308. + #endif
  4309.   #endif
  4310.   
  4311.   /*
  4312. 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
  4313. *** n:/project/C/octave-2.1.23.orig/scripts/image/colormap.m    Wed Dec 15 21:48:40 1999
  4314. --- i:/project/C/octave-2.1.23/scripts/image/colormap.m    Fri Dec 24 20:47:06 1999
  4315. ***************
  4316. *** 1,4 ****
  4317. ! ## Copyright (C) 1996, 1997 John W. Eaton
  4318.   ##
  4319.   ## This file is part of Octave.
  4320.   ##
  4321. --- 1,4 ----
  4322. ! ## Copyright (C) 1996 John W. Eaton
  4323.   ##
  4324.   ## This file is part of Octave.
  4325.   ##
  4326. ***************
  4327. *** 33,39 ****
  4328.   ## With no arguments, @code{colormap} returns the current color map.
  4329.   ## @end deftypefn
  4330.   
  4331. ! ## Author: Tony Richardson <arichard@stark.cc.oh.us>
  4332.   ## Created: July 1994
  4333.   ## Adapted-By: jwe
  4334.   
  4335. --- 33,39 ----
  4336.   ## With no arguments, @code{colormap} returns the current color map.
  4337.   ## @end deftypefn
  4338.   
  4339. ! ## Author: Tony Richardson <amr@mpl.ucsd.edu>
  4340.   ## Created: July 1994
  4341.   ## Adapted-By: jwe
  4342.   
  4343. ***************
  4344. *** 46,80 ****
  4345.     endif
  4346.   
  4347.     if (nargin == 1)
  4348.       if (isstr (map))
  4349.         if (strcmp (map, "default"))
  4350. !         map = gray ();
  4351.         else
  4352. !     unwind_protect
  4353. !       save_default_eval_print_flag = default_eval_print_flag;
  4354. !       default_eval_print_flag = 0;
  4355. !       map = eval (map);
  4356. !     unwind_protect_cleanup
  4357. !       default_eval_print_flag = save_default_eval_print_flag;
  4358. !     end_unwind_protect
  4359. !       endif
  4360. !     endif
  4361. !     if (! isempty (map))
  4362. !       if (columns (map) != 3)
  4363. !     error( "colormap: map must have 3 columns: [R,G,B]." );
  4364. !       endif
  4365. !       if (min (min (map)) < 0 || max (max (map)) > 1)
  4366. !         error( "colormap: map must have values in [0,1]." );
  4367.         endif
  4368.         ## Set the new color map
  4369.         __current_color_map__ = map;
  4370.       endif
  4371.     endif
  4372.   
  4373.     ## Return current color map.
  4374.     cmap = __current_color_map__;
  4375.   
  4376.   endfunction
  4377. --- 46,65 ----
  4378.     endif
  4379.   
  4380.     if (nargin == 1)
  4381.       if (isstr (map))
  4382.         if (strcmp (map, "default"))
  4383. !         __current_color_map__ = gray ();
  4384.         else
  4385. !         error ("invalid argument");
  4386.         endif
  4387. +     else
  4388.         ## Set the new color map
  4389.         __current_color_map__ = map;
  4390.       endif
  4391.     endif
  4392.   
  4393.     ## Return current color map.
  4394.     cmap = __current_color_map__;
  4395.   
  4396.   endfunction
  4397. 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
  4398. *** n:/project/C/octave-2.1.23.orig/scripts/image/gray.m    Wed Dec 15 21:48:40 1999
  4399. --- i:/project/C/octave-2.1.23/scripts/image/gray.m    Fri Dec 24 20:47:06 1999
  4400. ***************
  4401. *** 1,4 ****
  4402. ! ## Copyright (C) 1996, 1997 John W. Eaton
  4403.   ##
  4404.   ## This file is part of Octave.
  4405.   ##
  4406. --- 1,4 ----
  4407. ! ## Copyright (C) 1996 John W. Eaton
  4408.   ##
  4409.   ## This file is part of Octave.
  4410.   ##
  4411. ***************
  4412. *** 24,30 ****
  4413.   ## omitted, 64 is assumed.
  4414.   ## @end deftypefn
  4415.   
  4416. ! ## Author: Tony Richardson <arichard@stark.cc.oh.us>
  4417.   ## Created: July 1994
  4418.   ## Adapted-By: jwe
  4419.   
  4420. --- 24,30 ----
  4421.   ## omitted, 64 is assumed.
  4422.   ## @end deftypefn
  4423.   
  4424. ! ## Author: Tony Richardson <amr@mpl.ucsd.edu>
  4425.   ## Created: July 1994
  4426.   ## Adapted-By: jwe
  4427.   
  4428. 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
  4429. *** n:/project/C/octave-2.1.23.orig/scripts/image/gray2ind.m    Wed Dec 15 21:48:40 1999
  4430. --- i:/project/C/octave-2.1.23/scripts/image/gray2ind.m    Fri Dec 24 20:47:06 1999
  4431. ***************
  4432. *** 1,4 ****
  4433. ! ## Copyright (C) 1996, 1997 John W. Eaton
  4434.   ##
  4435.   ## This file is part of Octave.
  4436.   ##
  4437. --- 1,4 ----
  4438. ! ## Copyright (C) 1996 John W. Eaton
  4439.   ##
  4440.   ## This file is part of Octave.
  4441.   ##
  4442. ***************
  4443. *** 22,28 ****
  4444.   ## Convert a gray scale intensity image to an Octave indexed image.
  4445.   ## @end deftypefn
  4446.   
  4447. ! ## Author: Tony Richardson <arichard@stark.cc.oh.us>
  4448.   ## Created: July 1994
  4449.   ## Adapted-By: jwe
  4450.   
  4451. --- 22,28 ----
  4452.   ## Convert a gray scale intensity image to an Octave indexed image.
  4453.   ## @end deftypefn
  4454.   
  4455. ! ## Author: Tony Richardson <amr@mpl.ucsd.edu>
  4456.   ## Created: July 1994
  4457.   ## Adapted-By: jwe
  4458.   
  4459. 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
  4460. *** n:/project/C/octave-2.1.23.orig/scripts/image/image.m    Wed Dec 15 21:48:40 1999
  4461. --- i:/project/C/octave-2.1.23/scripts/image/image.m    Fri Dec 24 21:01:04 1999
  4462. ***************
  4463. *** 1,4 ****
  4464. ! ## Copyright (C) 1996, 1997 John W. Eaton
  4465.   ##
  4466.   ## This file is part of Octave.
  4467.   ##
  4468. --- 1,4 ----
  4469. ! ## Copyright (C) 1996 John W. Eaton
  4470.   ##
  4471.   ## This file is part of Octave.
  4472.   ##
  4473. ***************
  4474. *** 21,27 ****
  4475.   ## @deftypefn {Function File} {} image (@var{x}, @var{zoom})
  4476.   ## Display a matrix as a color image.  The elements of @var{x} are indices
  4477.   ## into the current colormap and should have values between 1 and the
  4478. ! ## length of the colormap.  If @var{zoom} is omitted, a value of 4 is
  4479.   ## assumed. 
  4480.   ## @end deftypefn
  4481.   
  4482. --- 21,27 ----
  4483.   ## @deftypefn {Function File} {} image (@var{x}, @var{zoom})
  4484.   ## Display a matrix as a color image.  The elements of @var{x} are indices
  4485.   ## into the current colormap and should have values between 1 and the
  4486. ! ## length of the colormap.  If @var{zoom} is omitted, a value of 1 is
  4487.   ## assumed. 
  4488.   ## @end deftypefn
  4489.   
  4490. ***************
  4491. *** 30,66 ****
  4492.   ## Author: Tony Richardson <arichard@stark.cc.oh.us>
  4493.   ## Created: July 1994
  4494.   ## Adapted-By: jwe
  4495.   
  4496.   function image (x, zoom)
  4497.   
  4498.     if (nargin == 0)
  4499.       ## Load Bobbie Jo Richardson (Born 3/16/94)
  4500. !     x = loadimage ("default.img");
  4501. !     zoom = 2;
  4502.     elseif (nargin == 1)
  4503. !     zoom = 4;
  4504.     elseif (nargin > 2)
  4505.       usage ("image (matrix, [zoom])");
  4506.     endif
  4507.   
  4508. !   ppm_name = tmpnam ();
  4509.   
  4510. !   saveimage (ppm_name, x, "ppm");
  4511.   
  4512. !   ## Start the viewer.  Try xv, then xloadimage.
  4513.   
  4514. !   xv = sprintf ("xv -expand %f %s", zoom, ppm_name);
  4515. !   xloadimage = sprintf ("xloadimage -zoom %f %s", zoom*100, ppm_name);
  4516. !   rm = sprintf ("rm -f %s", ppm_name);
  4517. !   ## Need to let the shell clean up the tmp file because we are putting
  4518. !   ## the viewer in the background.
  4519. !   command = sprintf ("( %s || %s && %s ) > /dev/null 2>&1 &",
  4520. !              xv, xloadimage, rm);
  4521. !   system (command);
  4522.   
  4523.   endfunction
  4524. --- 30,56 ----
  4525.   ## Author: Tony Richardson <arichard@stark.cc.oh.us>
  4526.   ## Created: July 1994
  4527.   ## Adapted-By: jwe
  4528. + ## Modified by Klaus Gebhardt, 1996 - 1997
  4529.   
  4530.   function image (x, zoom)
  4531.   
  4532.     if (nargin == 0)
  4533.       ## Load Bobbie Jo Richardson (Born 3/16/94)
  4534. !     [x, map] = loadimage ("default.img");
  4535.     elseif (nargin == 1)
  4536. !     zoom = 1;
  4537.     elseif (nargin > 2)
  4538.       usage ("image (matrix, [zoom])");
  4539.     endif
  4540.   
  4541. !   pnm_name = tmpnam ();
  4542.   
  4543. !   saveimage (pnm_name, x, "pnm");
  4544.   
  4545. !   ## Start the viewer.
  4546. !   i = findstr (pnm_name, "/");
  4547. !   pnm_name (i) = "\\";
  4548.   
  4549. !   system (sprintf ("oct-view %s %f", pnm_name, zoom));
  4550.   
  4551.   endfunction
  4552. 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
  4553. *** n:/project/C/octave-2.1.23.orig/scripts/image/imagesc.m    Wed Dec 15 21:48:40 1999
  4554. --- i:/project/C/octave-2.1.23/scripts/image/imagesc.m    Fri Dec 24 20:47:06 1999
  4555. ***************
  4556. *** 1,4 ****
  4557. ! ## Copyright (C) 1996, 1997 John W. Eaton
  4558.   ##
  4559.   ## This file is part of Octave.
  4560.   ##
  4561. --- 1,4 ----
  4562. ! ## Copyright (C) 1996 John W. Eaton
  4563.   ##
  4564.   ## This file is part of Octave.
  4565.   ##
  4566. ***************
  4567. *** 27,40 ****
  4568.   
  4569.   ## SEE ALSO: image, imshow
  4570.   
  4571. ! ## Author: Tony Richardson <arichard@stark.cc.oh.us>
  4572.   ## Created: July 1994
  4573.   ## Adapted-By: jwe
  4574.   
  4575. ! function y = imagesc (x, zoom)
  4576.   
  4577.     if (nargin < 1 || nargin > 2)
  4578. !     usage ("imagesc (matrix, [zoom])");
  4579.     elseif (nargin == 1)
  4580.       zoom = 4;
  4581.     endif
  4582. --- 27,40 ----
  4583.   
  4584.   ## SEE ALSO: image, imshow
  4585.   
  4586. ! ## Author: Tony Richardson <amr@mpl.ucsd.edu>
  4587.   ## Created: July 1994
  4588.   ## Adapted-By: jwe
  4589.   
  4590. ! function x = imagesc (x, zoom)
  4591.   
  4592.     if (nargin < 1 || nargin > 2)
  4593. !     usage ("image (matrix, [zoom])");
  4594.     elseif (nargin == 1)
  4595.       zoom = 4;
  4596.     endif
  4597. ***************
  4598. *** 48,59 ****
  4599.     ## length (colormap) inclusive.
  4600.   
  4601.     if (maxval == minval)
  4602. !     y = ones (high, wide);
  4603.     else
  4604.       ## Rescale values to between 1 and length (colormap) inclusive.
  4605. !     y = round ((x - minval) / (maxval - minval) * (rows (colormap) - 1)) + 1;
  4606.     endif
  4607.   
  4608. !   image (y, zoom);
  4609.   
  4610.   endfunction
  4611. --- 48,59 ----
  4612.     ## length (colormap) inclusive.
  4613.   
  4614.     if (maxval == minval)
  4615. !     x = ones (high, wide);
  4616.     else
  4617.       ## Rescale values to between 1 and length (colormap) inclusive.
  4618. !     x = fix ((x - minval) / (maxval - minval) * (length (colormap) - 1)) + 1;
  4619.     endif
  4620.   
  4621. !   image (x, zoom);
  4622.   
  4623.   endfunction
  4624. 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
  4625. *** n:/project/C/octave-2.1.23.orig/scripts/image/imshow.m    Wed Dec 15 21:48:40 1999
  4626. --- i:/project/C/octave-2.1.23/scripts/image/imshow.m    Fri Dec 24 20:47:06 1999
  4627. ***************
  4628. *** 1,4 ****
  4629. ! ## Copyright (C) 1996, 1997 John W. Eaton
  4630.   ##
  4631.   ## This file is part of Octave.
  4632.   ##
  4633. --- 1,4 ----
  4634. ! ## Copyright (C) 1996 John W. Eaton
  4635.   ##
  4636.   ## This file is part of Octave.
  4637.   ##
  4638. ***************
  4639. *** 37,43 ****
  4640.   
  4641.   ## SEE ALSO: image, imagesc, colormap, gray2ind, rgb2ind.
  4642.   
  4643. ! ## Author: Tony Richardson <arichard@stark.cc.oh.us>
  4644.   ## Created: July 1994
  4645.   ## Adapted-By: jwe
  4646.   
  4647. --- 37,43 ----
  4648.   
  4649.   ## SEE ALSO: image, imagesc, colormap, gray2ind, rgb2ind.
  4650.   
  4651. ! ## Author: Tony Richardson <amr@mpl.ucsd.edu>
  4652.   ## Created: July 1994
  4653.   ## Adapted-By: jwe
  4654.   
  4655. 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
  4656. *** n:/project/C/octave-2.1.23.orig/scripts/image/ind2gray.m    Wed Dec 15 21:48:40 1999
  4657. --- i:/project/C/octave-2.1.23/scripts/image/ind2gray.m    Fri Dec 24 20:47:08 1999
  4658. ***************
  4659. *** 1,4 ****
  4660. ! ## Copyright (C) 1996, 1997 John W. Eaton
  4661.   ##
  4662.   ## This file is part of Octave.
  4663.   ##
  4664. --- 1,4 ----
  4665. ! ## Copyright (C) 1996 John W. Eaton
  4666.   ##
  4667.   ## This file is part of Octave.
  4668.   ##
  4669. ***************
  4670. *** 26,32 ****
  4671.   
  4672.   ## SEE ALSO: gray2ind, rgb2ntsc, image, colormap
  4673.   
  4674. ! ## Author: Tony Richardson <arichard@stark.cc.oh.us>
  4675.   ## Created: July 1994
  4676.   ## Adapted-By: jwe
  4677.   
  4678. --- 26,32 ----
  4679.   
  4680.   ## SEE ALSO: gray2ind, rgb2ntsc, image, colormap
  4681.   
  4682. ! ## Author: Tony Richardson <amr@mpl.ucsd.edu>
  4683.   ## Created: July 1994
  4684.   ## Adapted-By: jwe
  4685.   
  4686. 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
  4687. *** n:/project/C/octave-2.1.23.orig/scripts/image/ind2rgb.m    Wed Dec 15 21:48:42 1999
  4688. --- i:/project/C/octave-2.1.23/scripts/image/ind2rgb.m    Fri Dec 24 20:47:08 1999
  4689. ***************
  4690. *** 1,4 ****
  4691. ! ## Copyright (C) 1996, 1997 John W. Eaton
  4692.   ##
  4693.   ## This file is part of Octave.
  4694.   ##
  4695. --- 1,4 ----
  4696. ! ## Copyright (C) 1996 John W. Eaton
  4697.   ##
  4698.   ## This file is part of Octave.
  4699.   ##
  4700. ***************
  4701. *** 25,31 ****
  4702.   
  4703.   ## SEE ALSO: rgb2ind, image, imshow, ind2gray, gray2ind.
  4704.   
  4705. ! ## Author: Tony Richardson <arichard@stark.cc.oh.us>
  4706.   ## Created: July 1994
  4707.   ## Adapted-By: jwe
  4708.   
  4709. --- 25,31 ----
  4710.   
  4711.   ## SEE ALSO: rgb2ind, image, imshow, ind2gray, gray2ind.
  4712.   
  4713. ! ## Author: Tony Richardson <amr@mpl.ucsd.edu>
  4714.   ## Created: July 1994
  4715.   ## Adapted-By: jwe
  4716.   
  4717. 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
  4718. *** n:/project/C/octave-2.1.23.orig/scripts/image/loadimage.m    Wed Dec 15 21:48:42 1999
  4719. --- i:/project/C/octave-2.1.23/scripts/image/loadimage.m    Fri Dec 24 20:53:40 1999
  4720. ***************
  4721. *** 25,64 ****
  4722.   
  4723.   ## SEE ALSO: saveimage, load, save
  4724.   
  4725. ! ## Author: Tony Richardson <arichard@stark.cc.oh.us>
  4726. ! ## Created: July 1994
  4727. ! ## Adapted-By: jwe
  4728.   
  4729. ! function [img_retval, map_retval] = loadimage (filename)
  4730.   
  4731. !   if (nargin != 1)
  4732. !     usage ("[img, map] = loadimage (filename)");
  4733.     elseif (! isstr (filename))
  4734.       error ("loadimage: expecting filename as a string");
  4735.     endif
  4736.   
  4737. !   file = file_in_path (IMAGEPATH, filename);
  4738. !   if (isempty (file))
  4739. !     error ("loadimage: unable to find image file");
  4740.     endif
  4741.   
  4742. !   ## The file is assumed to have variables img and map, or X and map.
  4743.   
  4744. !   eval (['load ', file]);
  4745.   
  4746. !   if (exist ("img"))
  4747. !     img_retval = img;
  4748. !   elseif (exist ("X"))
  4749. !     img_retval = X;
  4750. !   else
  4751. !     error ("loadimage: invalid image file found");
  4752.     endif
  4753.   
  4754. !   if (exist ("map"))
  4755. !     map_retval = map;
  4756. !   else
  4757. !     error ("loadimage: invalid image file found");
  4758. !   endif
  4759.   
  4760.   endfunction
  4761. --- 25,55 ----
  4762.   
  4763.   ## SEE ALSO: saveimage, load, save
  4764.   
  4765. ! ## Author: Klaus Gebhardt <110114.1371@compuserve.com>
  4766. ! ## Created: November 1996
  4767.   
  4768. ! function [X, map] = loadimage (filename, fmt)
  4769.   
  4770. !   if (nargin != 1 && nargin != 2)
  4771. !     usage ("loadimage (filename[, fmt])");
  4772.     elseif (! isstr (filename))
  4773.       error ("loadimage: expecting filename as a string");
  4774.     endif
  4775.   
  4776. !   if (nargin == 1)
  4777. !     fmt = "img";
  4778.     endif
  4779.   
  4780. !   if (! isstr (fmt))
  4781. !     error ("loadimage: expecting fmt as a string");
  4782. !   endif
  4783.   
  4784. !   file = file_in_path (IMAGEPATH, filename);
  4785.   
  4786. !   if (isempty (file))
  4787. !     error ("loadimage: unable to find image file");
  4788.     endif
  4789.   
  4790. !   eval (sprintf ("[X, map] = %s_dec (file);", fmt));
  4791.   
  4792.   endfunction
  4793. 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
  4794. *** n:/project/C/octave-2.1.23.orig/scripts/image/ntsc2rgb.m    Wed Dec 15 21:48:42 1999
  4795. --- i:/project/C/octave-2.1.23/scripts/image/ntsc2rgb.m    Fri Dec 24 20:47:08 1999
  4796. ***************
  4797. *** 1,4 ****
  4798. ! ## Copyright (C) 1996, 1997 John W. Eaton
  4799.   ##
  4800.   ## This file is part of Octave.
  4801.   ##
  4802. --- 1,4 ----
  4803. ! ## Copyright (C) 1996 John W. Eaton
  4804.   ##
  4805.   ## This file is part of Octave.
  4806.   ##
  4807. ***************
  4808. *** 22,28 ****
  4809.   ## Image format conversion.
  4810.   ## @end deftypefn
  4811.   
  4812. ! ## Author: Tony Richardson <arichard@stark.cc.oh.us>
  4813.   ## Created: July 1994
  4814.   ## Adapted-By: jwe
  4815.   
  4816. --- 22,28 ----
  4817.   ## Image format conversion.
  4818.   ## @end deftypefn
  4819.   
  4820. ! ## Author: Tony Richardson <amr@mpl.ucsd.edu>
  4821.   ## Created: July 1994
  4822.   ## Adapted-By: jwe
  4823.   
  4824. 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
  4825. *** n:/project/C/octave-2.1.23.orig/scripts/image/ocean.m    Wed Dec 15 21:48:42 1999
  4826. --- i:/project/C/octave-2.1.23/scripts/image/ocean.m    Fri Dec 24 20:47:08 1999
  4827. ***************
  4828. *** 1,4 ****
  4829. ! ## Copyright (C) 1996, 1997 John W. Eaton
  4830.   ##
  4831.   ## This file is part of Octave.
  4832.   ##
  4833. --- 1,4 ----
  4834. ! ## Copyright (C) 1996 John W. Eaton
  4835.   ##
  4836.   ## This file is part of Octave.
  4837.   ##
  4838. ***************
  4839. *** 23,29 ****
  4840.   ## is omitted, 64 is assumed.
  4841.   ## @end deftypefn
  4842.   
  4843. ! ## Author: Tony Richardson <arichard@stark.cc.oh.us>
  4844.   ## Created: July 1994
  4845.   ## Adapted-By: jwe
  4846.   
  4847. --- 23,29 ----
  4848.   ## is omitted, 64 is assumed.
  4849.   ## @end deftypefn
  4850.   
  4851. ! ## Author: Tony Richardson <amr@mpl.ucsd.edu>
  4852.   ## Created: July 1994
  4853.   ## Adapted-By: jwe
  4854.   
  4855. 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
  4856. *** n:/project/C/octave-2.1.23.orig/scripts/image/rgb2ind.m    Wed Dec 15 21:48:42 1999
  4857. --- i:/project/C/octave-2.1.23/scripts/image/rgb2ind.m    Fri Dec 24 20:47:08 1999
  4858. ***************
  4859. *** 1,4 ****
  4860. ! ## Copyright (C) 1996, 1997 John W. Eaton
  4861.   ##
  4862.   ## This file is part of Octave.
  4863.   ##
  4864. --- 1,4 ----
  4865. ! ## Copyright (C) 1996 John W. Eaton
  4866.   ##
  4867.   ## This file is part of Octave.
  4868.   ##
  4869. ***************
  4870. *** 26,32 ****
  4871.   ##
  4872.   ## Bugs: The color map may have duplicate entries.
  4873.   
  4874. ! ## Author: Tony Richardson <arichard@stark.cc.oh.us>
  4875.   ## Created: July 1994
  4876.   ## Adapted-By: jwe
  4877.   
  4878. --- 26,32 ----
  4879.   ##
  4880.   ## Bugs: The color map may have duplicate entries.
  4881.   
  4882. ! ## Author: Tony Richardson <amr@mpl.ucsd.edu>
  4883.   ## Created: July 1994
  4884.   ## Adapted-By: jwe
  4885.   
  4886. 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
  4887. *** n:/project/C/octave-2.1.23.orig/scripts/image/rgb2ntsc.m    Wed Dec 15 21:48:42 1999
  4888. --- i:/project/C/octave-2.1.23/scripts/image/rgb2ntsc.m    Fri Dec 24 20:47:08 1999
  4889. ***************
  4890. *** 1,4 ****
  4891. ! ## Copyright (C) 1996, 1997 John W. Eaton
  4892.   ##
  4893.   ## This file is part of Octave.
  4894.   ##
  4895. --- 1,4 ----
  4896. ! ## Copyright (C) 1996 John W. Eaton
  4897.   ##
  4898.   ## This file is part of Octave.
  4899.   ##
  4900. ***************
  4901. *** 22,28 ****
  4902.   ## Image format conversion.
  4903.   ## @end deftypefn
  4904.   
  4905. ! ## Author: Tony Richardson <arichard@stark.cc.oh.us>
  4906.   ## Created: July 1994
  4907.   ## Adapted-By: jwe
  4908.   
  4909. --- 22,28 ----
  4910.   ## Image format conversion.
  4911.   ## @end deftypefn
  4912.   
  4913. ! ## Author: Tony Richardson <amr@mpl.ucsd.edu>
  4914.   ## Created: July 1994
  4915.   ## Adapted-By: jwe
  4916.   
  4917. 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
  4918. *** n:/project/C/octave-2.1.23.orig/scripts/image/saveimage.m    Tue Dec 14 21:40:06 1999
  4919. --- i:/project/C/octave-2.1.23/scripts/image/saveimage.m    Fri Dec 24 20:58:58 1999
  4920. ***************
  4921. *** 19,41 ****
  4922.   
  4923.   ## -*- texinfo -*-
  4924.   ## @deftypefn {Function File} {} saveimage (@var{file}, @var{x}, @var{fmt}, @var{map})
  4925. ! ## Save the matrix @var{x} to @var{file} in image format @var{fmt}.  Valid
  4926. ! ## values for @var{fmt} are
  4927. ! ## 
  4928. ! ## @table @code
  4929. ! ## @item "img"
  4930. ! ## Octave's image format.  The current colormap is also saved in the file.
  4931. ! ## 
  4932. ! ## @item "ppm"
  4933. ! ## Portable pixmap format.
  4934. ! ## 
  4935. ! ## @item "ps"
  4936. ! ## PostScript format.  Note that images saved in PostScript format can not
  4937. ! ## be read back into Octave with loadimage.
  4938. ! ## @end table
  4939. ! ## 
  4940. ! ## If the fourth argument is supplied, the specified colormap will also be
  4941. ! ## saved along with the image.
  4942.   ## 
  4943.   ## Note: if the colormap contains only two entries and these entries are
  4944.   ## black and white, the bitmap ppm and PostScript formats are used.  If the
  4945. --- 19,25 ----
  4946.   
  4947.   ## -*- texinfo -*-
  4948.   ## @deftypefn {Function File} {} saveimage (@var{file}, @var{x}, @var{fmt}, @var{map})
  4949. ! ## Save the matrix @var{x} to @var{file} in image format @var{fmt}.
  4950.   ## 
  4951.   ## Note: if the colormap contains only two entries and these entries are
  4952.   ## black and white, the bitmap ppm and PostScript formats are used.  If the
  4953. ***************
  4954. *** 44,104 ****
  4955.   ## otherwise the full color formats are used.
  4956.   ## @end deftypefn
  4957.   
  4958. ! ## The conversion to PostScript is based on pbmtolps.c, which was
  4959. ! ## written by
  4960. ! ##
  4961. ! ##   George Phillips <phillips@cs.ubc.ca>
  4962. ! ##   Department of Computer Science
  4963. ! ##   University of British Columbia
  4964. ! ##
  4965. ! ## and is part of the portable bitmap utilities,
  4966. ! ## SEE ALSO: loadimage, save, load, colormap
  4967. ! ## Author: Tony Richardson <arichard@stark.cc.oh.us>
  4968. ! ## Created: July 1994
  4969. ! ## Adapted-By: jwe
  4970. ! ## Rewritten by jwe to avoid using octoppm and pbm routines so that
  4971. ! ## people who don't have the the pbm stuff installed can still use this
  4972. ! ## function.
  4973. ! ##
  4974. ! ## The conversion to PostScript is based on pnmtops.c, which is part of
  4975. ! ## the portable bitmap utilties and bears this copyright notice:
  4976. ! ##
  4977. ! ## Copyright (C) 1989 by Jef Poskanzer.
  4978. ! ##
  4979. ! ## Permission to use, copy, modify, and distribute this software and its
  4980. ! ## documentation for any purpose and without fee is hereby granted, provided
  4981. ! ## that the above copyright notice appear in all copies and that both that
  4982. ! ## copyright notice and this permission notice appear in supporting
  4983. ! ## documentation.  This software is provided "as is" without express or
  4984. ! ## implied warranty.
  4985.   
  4986. ! function saveimage (filename, img, img_form, map)
  4987.   
  4988. !   if (nargin < 2 || nargin > 4)
  4989. !     usage ("saveimage (filename, matrix, [format, [colormap]])");
  4990.     endif
  4991.   
  4992.     if (nargin < 4)
  4993.       map = colormap ();
  4994.     endif
  4995.   
  4996. -   [map_nr, map_nc] = size (map);
  4997. -   if (map_nc != 3)
  4998. -     error ("colormap should be an N x 3 matrix");
  4999. -   endif
  5000.     if (nargin < 3)
  5001.       img_form = "img";
  5002.     elseif (! isstr (img_form))
  5003.       error ("image format specification must be a string");
  5004. -   elseif (! (strcmp (img_form, "img")
  5005. -              || strcmp (img_form, "ppm")
  5006. -          || strcmp (img_form, "ps")))
  5007. -     error ("unsupported image format specification");
  5008.     endif
  5009.   
  5010.     if (! is_matrix (img))
  5011. --- 28,50 ----
  5012.   ## otherwise the full color formats are used.
  5013.   ## @end deftypefn
  5014.   
  5015. ! ## Author: Klaus Gebhardt <100114.1371@compuserve.com>
  5016. ! ## Created: November 1996
  5017.   
  5018. ! function saveimage (filename, img, img_form, map, opt)
  5019.   
  5020. !   if (nargin < 2 || nargin > 5)
  5021. !     usage ("saveimage (filename, matrix, [format, [colormap, [opt]]])");
  5022.     endif
  5023.   
  5024.     if (nargin < 4)
  5025.       map = colormap ();
  5026.     endif
  5027.   
  5028.     if (nargin < 3)
  5029.       img_form = "img";
  5030.     elseif (! isstr (img_form))
  5031.       error ("image format specification must be a string");
  5032.     endif
  5033.   
  5034.     if (! is_matrix (img))
  5035. ***************
  5036. *** 109,307 ****
  5037.       error ("file name must be a string");
  5038.     endif
  5039.   
  5040. !   ## If we just want Octave image format, save and return.
  5041. !   if (strcmp (img_form, "img"))
  5042. !     eval (strcat ("save -ascii ", filename, " map img"));
  5043. !     return;
  5044. !   endif
  5045. !   ## Convert to another format if requested.
  5046. !   grey = all (map(:,1) == map(:,2) && map(:,1) == map (:,3));
  5047. !   pbm = pgm = ppm = 0;
  5048. !   map_sz = map_nr * map_nc;
  5049. !   map = reshape (map, map_sz, 1);
  5050. !   idx = find (map > 1);
  5051. !   map (idx) = ones (size (idx));
  5052. !   idx = find (map < 0);
  5053. !   map (idx) = zeros (size (idx));
  5054. !   map = round (255 * map);
  5055. !   bw = (map_nr == 2
  5056. !         && ((map(1,1) == 0 && map(2,1) == 255)
  5057. !             || (map(1,1) == 255 && map(2,1) == 0)));
  5058. !   img = round (img');
  5059. !   [img_nr, img_nc] = size (img);
  5060. !   img_sz = img_nr * img_nc;
  5061. !   img = reshape (img, img_sz, 1);
  5062. !   idx = find (img > map_nr);
  5063. !   img (idx) = ones (size (idx)) * map_nr;
  5064. !   idx = find (img <= 0);
  5065. !   img (idx) = ones (size (idx));
  5066. !   if (strcmp (img_form, "ppm"))
  5067. !     if (grey && map_nr == 2 && bw)
  5068. !       if (map(1) != 0)
  5069. !           map = [1; 0];
  5070. !       else
  5071. !           map = [0; 1];
  5072. !       endif
  5073. !       n_long = rem (img_nc, 8);
  5074. !       tmp = zeros (ceil (img_nc/8), img_nr);
  5075. !       for i = 1:img_nr
  5076. !     idx = (i-1)*img_nc+1:i*img_nc;
  5077. !           if (n_long > 0)
  5078. !       img_row = [map(img(idx)); (zeros (8-n_long, 1))];
  5079. !     else
  5080. !             img_row = map(img(idx));
  5081. !     endif
  5082. !     img_row
  5083. !     tmp
  5084. !     if (img_nc < 8)
  5085. !       for j = 1:8
  5086. !         tmp(:,i) = tmp(:,i) + img_row (j) * 2^(8-j);
  5087. !       endfor
  5088. !     else
  5089. !       for j = 1:8
  5090. !         tmp(:,i) = tmp(:,i) + img_row (j:8:img_nc) * 2^(8-j);
  5091. !       endfor
  5092. !     endif
  5093. !       endfor
  5094. !       fid = fopen (filename, "w");
  5095. !       fprintf (fid, "P4\n%d %d\n", img_nr, img_nc);
  5096. !       fwrite (fid, tmp, "char");
  5097. !       fprintf (fid, "\n");
  5098. !       fclose (fid);
  5099. !     elseif (grey)
  5100. !       fid = fopen (filename, "w");
  5101. !       fprintf (fid, "P5\n%d %d\n255\n", img_nr, img_nc);
  5102. !       fwrite (fid, map(img), "uchar");
  5103. !       fprintf (fid, "\n");
  5104. !       fclose (fid);
  5105. !     else
  5106. !       img_idx = ((1:3:3*img_sz)+2)';
  5107. !       map_idx = ((2*map_nr+1):map_sz)';
  5108. !       tmap = map(map_idx);
  5109. !       tmp(img_idx--) = tmap(img);
  5110. !       map_idx = map_idx - map_nr;
  5111. !       tmap = map(map_idx);
  5112. !       tmp(img_idx--) = tmap(img);
  5113. !       map_idx = map_idx - map_nr;
  5114. !       tmap = map(map_idx);
  5115. !       tmp(img_idx--) = tmap(img);
  5116. !       fid = fopen (filename, "w");
  5117. !       fprintf (fid, "P6\n%d %d\n255\n", img_nr, img_nc);
  5118. !       fwrite (fid, tmp, "uchar");
  5119. !       fprintf (fid, "\n");
  5120. !       fclose (fid);
  5121. !     endif
  5122. !   elseif (strcmp (img_form, "ps") == 1)
  5123. !     if (! grey)
  5124. !       error ("must have a greyscale color map for conversion to PostScript");
  5125. !     endif
  5126. !     bps = 8;
  5127. !     dpi = 300;
  5128. !     pagewid = 612;
  5129. !     pagehgt = 762;
  5130. !     MARGIN = 0.95;
  5131. !     devpix = dpi / 72.0 + 0.5;
  5132. !     pixfac = 72.0 / dpi * devpix;
  5133. !     ## Compute padding to round cols * bps up to the nearest multiple of 8
  5134. !     ## (nr and nc are switched because we transposed the image above).
  5135. !     padright = (((img_nr * bps + 7) / 8) * 8 - img_nr * bps) / bps;
  5136. !     scols = img_nr * pixfac;
  5137. !     srows = img_nc * pixfac;
  5138. !     scale = 1;
  5139. !     if (scols > pagewid * MARGIN || srows > pagehgt * MARGIN)
  5140. !       if (scols > pagewid * MARGIN)
  5141. !     scale = scale * (pagewid / scols * MARGIN);
  5142. !     scols = scale * img_nr * pixfac;
  5143. !     srows = scale * img_nc * pixfac;
  5144. !       endif
  5145. !       if (srows > pagehgt * MARGIN)
  5146. !     scale = scale * (pagehgt / srows * MARGIN);
  5147. !     scols = scale * img_nr * pixfac;
  5148. !     srows = scale * img_nc * pixfac;
  5149. !       endif
  5150. !       warning ("image too large for page, rescaling to %g", scale);
  5151. !     endif
  5152. !     llx = (pagewid - scols) / 2;
  5153. !     lly = (pagehgt - srows) / 2;
  5154. !     urx = llx + fix (scols + 0.5);
  5155. !     ury = lly + fix (srows + 0.5);
  5156. !     fid = fopen (filename, "w");
  5157. !     fprintf (fid, "%%!PS-Adobe-2.0 EPSF-2.0\n");
  5158. !     fprintf (fid, "%%%%Creator: Octave %s (saveimage.m)\n", OCTAVE_VERSION);
  5159. !     fprintf (fid, "%%%%Title: %s\n", filename);
  5160. !     fprintf (fid, "%%%%Pages: 1\n");
  5161. !     fprintf (fid, "%%%%BoundingBox: %d %d %d %d\n",
  5162. !              fix (llx), fix (lly), fix (urx), fix (ury));
  5163. !     fprintf (fid, "%%%%EndComments\n" );
  5164. !     fprintf (fid, "/readstring {\n");
  5165. !     fprintf (fid, "  currentfile exch readhexstring pop\n");
  5166. !     fprintf (fid, "} bind def\n");
  5167. !     fprintf (fid, "/picstr %d string def\n",
  5168. !              fix ((img_nr + padright) * bps / 8));
  5169. !     fprintf (fid, "%%%%EndProlog\n");
  5170. !     fprintf (fid, "%%%%Page: 1 1\n");
  5171. !     fprintf (fid, "gsave\n");
  5172. !     fprintf (fid, "%g %g translate\n", llx, lly);
  5173. !     fprintf (fid, "%g %g scale\n", scols, srows);
  5174. !     fprintf (fid, "%d %d %d\n", img_nr, img_nc, bps);
  5175. !     fprintf (fid, "[ %d 0 0 -%d 0 %d ]\n", img_nr, img_nc, img_nc);
  5176. !     fprintf (fid, "{ picstr readstring }\n" );
  5177. !     fprintf (fid, "image\n" );
  5178. !     img = map(img);
  5179. !     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";
  5180. !     fprintf (fid, fmt, img);
  5181. !     if (rem (img_sz, 30) != 0)
  5182. !       fprintf (fid, "\n" );
  5183. !     endif
  5184. !     fprintf (fid, "grestore\n" );
  5185. !     fprintf (fid, "showpage\n" );
  5186. !     fprintf (fid, "%%%%Trailer\n" );
  5187. !     fclose (fid);
  5188.     else
  5189. !     error ("saveimage: what happened to the image type?");
  5190.     endif
  5191.   
  5192.   endfunction
  5193. --- 55,64 ----
  5194.       error ("file name must be a string");
  5195.     endif
  5196.   
  5197. !   if (nargin < 5)
  5198. !     eval (sprintf ("%s_enc (filename, map, img);", img_form));
  5199.     else
  5200. !     eval (sprintf ("%s_enc (filename, map, img, opt);", img_form));
  5201.     endif
  5202.   
  5203.   endfunction
  5204. 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
  5205. *** n:/project/C/octave-2.1.23.orig/scripts/miscellaneous/bug_report.m    Tue Feb  3 09:11:14 1998
  5206. --- i:/project/C/octave-2.1.23/scripts/miscellaneous/bug_report.m    Fri Dec 24 20:47:08 1999
  5207. ***************
  5208. *** 24,29 ****
  5209. --- 24,30 ----
  5210.   ## you are finished editing.
  5211.   
  5212.   ## Author: jwe
  5213. + ## Modified by Klaus Gebhardt, 1997
  5214.   
  5215.   function bug_report ()
  5216.   
  5217. ***************
  5218. *** 49,55 ****
  5219.         endif
  5220.       endif
  5221.   
  5222. !     cmd = "octave-bug";
  5223.   
  5224.       if (length (subject) > 0)
  5225.         cmd = sprintf ("%s -s \"%s\"", cmd, subject);
  5226. --- 50,56 ----
  5227.         endif
  5228.       endif
  5229.   
  5230. !     cmd = "/octave-bug";
  5231.   
  5232.       if (length (subject) > 0)
  5233.         cmd = sprintf ("%s -s \"%s\"", cmd, subject);
  5234. 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
  5235. *** n:/project/C/octave-2.1.23.orig/scripts/miscellaneous/popen2.m    Wed Oct 20 05:49:38 1999
  5236. --- i:/project/C/octave-2.1.23/scripts/miscellaneous/popen2.m    Sat Dec 25 12:59:36 1999
  5237. ***************
  5238. *** 46,52 ****
  5239.   ## @end example
  5240.   ## @end deftypefn
  5241.   
  5242. ! ## Author: jwe
  5243.   
  5244.   function [in, out, pid] = popen2 (command, args)
  5245.   
  5246. --- 46,52 ----
  5247.   ## @end example
  5248.   ## @end deftypefn
  5249.   
  5250. ! ## Author: Klaus Gebhardt, 1997
  5251.   
  5252.   function [in, out, pid] = popen2 (command, args)
  5253.   
  5254. ***************
  5255. *** 56,106 ****
  5256.   
  5257.     if (nargin == 1 || nargin == 2)
  5258.   
  5259. -     if (nargin == 1)
  5260. -       args = "";
  5261. -     endif
  5262.       if (isstr (command))
  5263.   
  5264. !       [stdin_pipe, stdin_status] = pipe ();
  5265. !       [stdout_pipe, stdout_status] = pipe ();
  5266.   
  5267. !       if (stdin_status == 0 && stdout_status == 0)
  5268.   
  5269. !     pid = fork ();
  5270.   
  5271. !     if (pid == 0)
  5272.   
  5273. !       fclose (stdin_pipe (2));
  5274. !       fclose (stdout_pipe (1));
  5275.   
  5276. !       dup2 (stdin_pipe (1), stdin);
  5277. !       fclose (stdin_pipe (1));
  5278.   
  5279. !       dup2 (stdout_pipe (2), stdout);
  5280. !       fclose (stdout_pipe (2));
  5281.   
  5282. !       if (exec (command, args) < 0)
  5283. !         error ("popen2: unable to start process `%s'", command);
  5284. !         exit (0);
  5285.         endif
  5286.   
  5287. !     elseif (pid)
  5288.   
  5289. !       fclose (stdin_pipe (1));
  5290. !       fclose (stdout_pipe (2));
  5291.   
  5292. -       if (fcntl (stdout_pipe (1), __F_SETFL__, __O_NONBLOCK__) < 0)
  5293. -         error ("popen2: error setting file mode");
  5294.         else
  5295. !         in = stdin_pipe (2);
  5296. !         out = stdout_pipe (1);
  5297.         endif
  5298.   
  5299. !     elseif (pid < 0)
  5300. !       error ("popen2: fork failed -- unable to create child process");
  5301.       endif
  5302. !       else
  5303.       error ("popen2: pipe creation failed");
  5304.         endif
  5305.       else
  5306. --- 56,122 ----
  5307.   
  5308.     if (nargin == 1 || nargin == 2)
  5309.   
  5310.       if (isstr (command))
  5311.   
  5312. !       [r_pipe,  r_status]  = _pipe ();
  5313. !       [w_pipe,  w_status]  = _pipe ();
  5314.   
  5315. !       if ((r_status != -1) && (w_status != -1))
  5316.   
  5317. !     r_parent_end = r_pipe(1);
  5318. !     r_child_end  = r_pipe(2);
  5319. !     _fcntl (r_parent_end, F_SETFD, 1);
  5320. !     r_org = _dup (1);
  5321.   
  5322. !     w_parent_end = w_pipe(2);
  5323. !     w_child_end  = w_pipe(1);
  5324. !     _fcntl (w_parent_end, F_SETFD, 1);
  5325. !     w_org = _dup (0);
  5326.   
  5327. !     if ((r_org != -1) && (w_org != -1))
  5328.   
  5329. !       _dup2 (r_child_end, 1);  _close (r_child_end);  r_child_end = -1;
  5330. !       _dup2 (w_child_end, 0);  _close (w_child_end);  w_child_end = -1;
  5331.   
  5332. !       if (nargin == 1)
  5333. !         pid = spawn ("nowait", command);
  5334. !       else
  5335. !         pid = spawn ("nowait", command, args);
  5336. !       endif
  5337.   
  5338. !       _dup2 (r_org, 1);  _close (r_org);
  5339. !       _dup2 (w_org, 0);  _close (w_org);
  5340. !     endif
  5341. !     if (r_child_end != -1)
  5342. !       _close (r_child_end);
  5343.         endif
  5344.   
  5345. !     if (w_child_end != -1)
  5346. !       _close (w_child_end);
  5347. !     endif
  5348.   
  5349. !     if (pid < 0)
  5350. !       _close (r_parent_end);
  5351. !       _close (w_parent_end);
  5352. !       error ("popen2: unable to start process `%s'", command);
  5353. !     else
  5354. !       out = _fdopen (r_parent_end, "r");
  5355. !       in  = _fdopen (w_parent_end, "w");
  5356. !     endif
  5357.   
  5358.         else
  5359. !     if (r_status != -1)
  5360. !       _close (r_pipe(1));
  5361. !       _close (r_pipe(2));
  5362.         endif
  5363.   
  5364. !     if (w_status != -1)
  5365. !       _close (w_pipe(1));
  5366. !       _close (w_pipe(2));
  5367.       endif
  5368.       error ("popen2: pipe creation failed");
  5369.         endif
  5370.       else
  5371. diff -cwr n:/project/C/octave-2.1.23.orig/scripts/startup/octaverc i:/project/C/octave-2.1.23/scripts/startup/octaverc
  5372. *** n:/project/C/octave-2.1.23.orig/scripts/startup/octaverc    Wed Jul 24 19:05:42 1996
  5373. --- i:/project/C/octave-2.1.23/scripts/startup/octaverc    Fri Dec 24 21:06:24 1999
  5374. ***************
  5375. *** 2,4 ****
  5376. --- 2,37 ----
  5377.   ##
  5378.   ## This file should contain any commands that should be executed each
  5379.   ## time Octave starts for every user at this site.
  5380. + ## System-wide startup file
  5381. + ## Octave 2.1.23 for OS/2
  5382. + ## (c) 1996 - 1999, Klaus Gebhardt
  5383. + PS1 = "octave:\\#>";
  5384. + EDITOR = "e";
  5385. + oct_home = "h:/apps/science/octave";
  5386. + if length(getenv("OCTAVE_HOME"))
  5387. +   oct_home = getenv("OCTAVE_HOME");
  5388. + endif
  5389. + LOADPATH  = sprintf ("%s/scripts//;%s/dlfcn/examples", oct_home, oct_home);
  5390. + INFO_FILE = sprintf ("%s/doc/octave", oct_home);
  5391. + if length(file_in_path(getenv("PATH"),"less.exe"))
  5392. +   PAGER = sprintf("%s -ce",file_in_path(getenv("PATH"),"less.exe"));
  5393. + else
  5394. +   PAGER = "more";
  5395. + endif
  5396. + if length(getenv("GNUPLOT"))
  5397. +   gnuplot_binary = sprintf ("%s/gnuplot.exe", getenv("GNUPLOT"));
  5398. + else
  5399. +   gnuplot_binary = "gnuplot";
  5400. + endif
  5401. + implicit_str_to_num_ok     = 1;
  5402. + ok_to_lose_imaginary_part  = 1;
  5403. + ignore_function_time_stamp = 1;
  5404. + auto_unload_dot_oct_files  = 1;
  5405. diff -cwr n:/project/C/octave-2.1.23.orig/doc/conf.tex i:/project/C/octave-2.1.23/doc/conf.tex
  5406. *** n:/project/C/octave-2.1.23.orig/doc/conf.tex    Fri Dec 24 11:01:34 1999
  5407. --- i:/project/C/octave-2.1.23/doc/conf.tex    Fri Dec 24 13:37:54 1999
  5408. ***************
  5409. *** 2,7 ****
  5410.   @c This is part of the Octave manual.
  5411.   @c For copying conditions, see the file gpl.tex.
  5412.   
  5413. ! @set VERSION 2.0.5
  5414. ! @set OCTAVEHOME /usr/local
  5415. ! @set TARGETHOSTTYPE i586-pc-linux-gnu
  5416. --- 2,7 ----
  5417.   @c This is part of the Octave manual.
  5418.   @c For copying conditions, see the file gpl.tex.
  5419.   
  5420. ! @set VERSION 2.1.23
  5421. ! @set OCTAVEHOME 
  5422. ! @set TARGETHOSTTYPE i486-pc-os/2
  5423. 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
  5424. *** n:/project/C/octave-2.1.23.orig/doc/faq/oct-faq.tex    Fri Dec 24 11:01:34 1999
  5425. --- i:/project/C/octave-2.1.23/doc/faq/oct-faq.tex    Fri Dec 24 13:37:54 1999
  5426. ***************
  5427. *** 1,3 ****
  5428. --- 1,4 ----
  5429. + % Modified by Klaus Gebhardt, 1997
  5430.   \input texinfo.tex      @c -*-texinfo-*-
  5431.   
  5432.   @setfilename oct-faq.
  5433. ***************
  5434. *** 19,24 ****
  5435. --- 20,33 ----
  5436.   @top
  5437.   @unnumbered Preface
  5438.   @cindex FAQ for Octave, latest version
  5439. + @macro email{text}
  5440. + (\text\)
  5441. + @end macro
  5442. + @macro url{text}
  5443. + (\text\)
  5444. + @end macro
  5445.   @end ifinfo
  5446.   
  5447.   This is a list of frequently asked questions (FAQ) for Octave users.
  5448. 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
  5449. *** n:/project/C/octave-2.1.23.orig/doc/interpreter/control.tex    Fri Dec 24 11:01:34 1999
  5450. --- i:/project/C/octave-2.1.23/doc/interpreter/control.tex    Fri Dec 24 13:37:54 1999
  5451. ***************
  5452. *** 330,338 ****
  5453.               default: 
  5454.   @table @var
  5455.   @item tsam = 0  
  5456. ! @math{outlist = []}
  5457.   @item tsam > 0  
  5458. ! @math{outlist = 1:@code{rows}(@var{c})}
  5459.   @end table
  5460.    
  5461.    Unlike states, discrete/continous outputs may appear in any order.
  5462. --- 330,338 ----
  5463.               default: 
  5464.   @table @var
  5465.   @item tsam = 0  
  5466. ! @code{outlist = []}
  5467.   @item tsam > 0  
  5468. ! @code{outlist = 1:@code{rows}(@var{c})}
  5469.   @end table
  5470.    
  5471.    Unlike states, discrete/continous outputs may appear in any order.
  5472. 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
  5473. *** n:/project/C/octave-2.1.23.orig/doc/interpreter/install.tex    Fri Dec 24 11:01:36 1999
  5474. --- i:/project/C/octave-2.1.23/doc/interpreter/install.tex    Fri Dec 24 13:37:54 1999
  5475. ***************
  5476. *** 444,449 ****
  5477. --- 444,457 ----
  5478.   @email{bug-octave@@bevo.che.wisc.edu} if you are interested in helping
  5479.   make a binary distribution available for your system.)
  5480.   
  5481. + Also, binary distributions are limited to static binaries that do not
  5482. + support dynamic linking.  For earlier versions of Octave, I tried
  5483. + distributing dynamically linked binaries but that proved to be too much
  5484. + trouble to support.  If you want to have a copy of Octave that includes
  5485. + all the features described in this manual, you will have to build it
  5486. + from the sources yourself, or find someone else who is willing to do it
  5487. + for you.
  5488.   @menu
  5489.   * Installing Octave from a Binary Distribution::  
  5490.   * Creating a Binary Distribution::  
  5491. ***************
  5492. *** 563,568 ****
  5493.   @end example
  5494.   
  5495.   This will create a compressed tar file ready for distribution.
  5496. ! It will have a name like
  5497.   @file{octave-@value{VERSION}-@value{TARGETHOSTTYPE}.tar.gz}
  5498.   @end itemize
  5499. --- 571,576 ----
  5500.   @end example
  5501.   
  5502.   This will create a compressed tar file ready for distribution.
  5503. ! It will contain statically linked binaries and have a name like
  5504.   @file{octave-@value{VERSION}-@value{TARGETHOSTTYPE}.tar.gz}
  5505.   @end itemize
  5506. 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
  5507. *** n:/project/C/octave-2.1.23.orig/doc/interpreter/octave.tex    Fri Dec 24 11:01:38 1999
  5508. --- i:/project/C/octave-2.1.23/doc/interpreter/octave.tex    Fri Dec 24 13:37:54 1999
  5509. ***************
  5510. *** 3,8 ****
  5511. --- 3,9 ----
  5512.   % Copyright (C) 1996, 1997 John W. Eaton
  5513.   % This is part of the Octave manual.
  5514.   % For copying conditions, see the file gpl.tex.
  5515. + % Modified by Klaus Gebhardt, 1997
  5516.   
  5517.   \input texinfo
  5518.   @setfilename octave.
  5519. ***************
  5520. *** 13,18 ****
  5521. --- 14,27 ----
  5522.   * Octave: (octave).    Interactive language for numerical computations.
  5523.   END-INFO-DIR-ENTRY
  5524.   @end format
  5525. + @macro email{text}
  5526. + (\text\)
  5527. + @end macro
  5528. + @macro url{text}
  5529. + (\text\)
  5530. + @end macro
  5531.   @end ifinfo
  5532.   
  5533.   @c Settings for printing on 8-1/2 by 11 inch paper:
  5534. ***************
  5535. *** 38,44 ****
  5536.   @c This file doesn't include a chapter, so it must not be included
  5537.   @c if you want to run the Emacs function texinfo-multiple-files-update.
  5538.   
  5539. ! @include conf.tex
  5540.   
  5541.   @settitle GNU Octave
  5542.   
  5543. --- 47,53 ----
  5544.   @c This file doesn't include a chapter, so it must not be included
  5545.   @c if you want to run the Emacs function texinfo-multiple-files-update.
  5546.   
  5547. ! @include ../conf.tex
  5548.   
  5549.   @settitle GNU Octave
  5550.   
  5551. 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
  5552. *** n:/project/C/octave-2.1.23.orig/doc/interpreter/poly.tex    Fri Dec 24 11:01:38 1999
  5553. --- i:/project/C/octave-2.1.23/doc/interpreter/poly.tex    Fri Dec 24 13:37:54 1999
  5554. ***************
  5555. *** 10,24 ****
  5556.   In Octave, a polynomial is represented by its coefficients (arranged
  5557.   in descending order).  For example, a vector
  5558.   @iftex
  5559.   @end iftex
  5560.   @ifinfo
  5561. !  $c$
  5562.   @end ifinfo
  5563.   of length
  5564.   @iftex
  5565.   @tex
  5566.    $N+1$
  5567.   @end tex
  5568.   @ifinfo
  5569.    @var{N+1}
  5570.   @end ifinfo
  5571. --- 10,26 ----
  5572.   In Octave, a polynomial is represented by its coefficients (arranged
  5573.   in descending order).  For example, a vector
  5574.   @iftex
  5575. +  $c$
  5576.   @end iftex
  5577.   @ifinfo
  5578. !  @var{c}
  5579.   @end ifinfo
  5580.   of length
  5581.   @iftex
  5582.   @tex
  5583.    $N+1$
  5584.   @end tex
  5585. + @end iftex
  5586.   @ifinfo
  5587.    @var{N+1}
  5588.   @end ifinfo
  5589. 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
  5590. *** n:/project/C/octave-2.1.23.orig/doc/liboctave/gpl.tex    Fri Dec 24 11:01:42 1999
  5591. --- i:/project/C/octave-2.1.23/doc/liboctave/gpl.tex    Fri Dec 24 13:37:54 1999
  5592. ***************
  5593. *** 1,4 ****
  5594. ! @c Copyright (C) 1996, 1997 John W. Eaton
  5595.   @c This is part of the Octave manual.
  5596.   @c For copying conditions, see the file gpl.tex.
  5597.   
  5598. --- 1,4 ----
  5599. ! @c Copyright (C) 1996 John W. Eaton
  5600.   @c This is part of the Octave manual.
  5601.   @c For copying conditions, see the file gpl.tex.
  5602.   
  5603. 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
  5604. *** n:/project/C/octave-2.1.23.orig/doc/liboctave/liboct.tex    Fri Dec 24 11:01:42 1999
  5605. --- i:/project/C/octave-2.1.23/doc/liboctave/liboct.tex    Fri Dec 24 13:37:54 1999
  5606. ***************
  5607. *** 1,6 ****
  5608. --- 1,7 ----
  5609.   % Copyright (C) 1996, 1997 John W. Eaton
  5610.   % This is part of the Octave manual.
  5611.   % For copying conditions, see the file gpl.tex.
  5612. + % Modified by Klaus Gebhardt, 1997
  5613.   
  5614.   \input texinfo  @c -*-texinfo-*-
  5615.   @setfilename liboct.
  5616. ***************
  5617. *** 28,38 ****
  5618.   @c This file doesn't include a chapter, so it must not be included
  5619.   @c if you want to run the Emacs function texinfo-multiple-files-update.
  5620.   
  5621. ! @c @include conf.tex
  5622.   
  5623.   @settitle Octave C++ Classes
  5624.   
  5625.   @ifinfo
  5626.   
  5627.   Copyright (C) 1996, 1997 John W. Eaton.
  5628.   
  5629. --- 29,47 ----
  5630.   @c This file doesn't include a chapter, so it must not be included
  5631.   @c if you want to run the Emacs function texinfo-multiple-files-update.
  5632.   
  5633. ! @include ../conf.tex
  5634.   
  5635.   @settitle Octave C++ Classes
  5636.   
  5637.   @ifinfo
  5638. + @macro email{text}
  5639. + (\text\)
  5640. + @end macro
  5641. + @macro url{text}
  5642. + (\text\)
  5643. + @end macro
  5644.   
  5645.   Copyright (C) 1996, 1997 John W. Eaton.
  5646.   
  5647.