changeset 16066:1a2f1001d07d

maint: merge away extra head on default
author John W. Eaton <jwe@octave.org>
date Sat, 16 Feb 2013 18:58:58 -0500
parents f837bdd535f7 (diff) 9bfbe785e726 (current diff)
children 0df6c1c73e21
files
diffstat 19 files changed, 210 insertions(+), 211 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/files-dockwidget.cc	Mon Feb 11 16:26:08 2013 -0500
+++ b/libgui/src/files-dockwidget.cc	Sat Feb 16 18:58:58 2013 -0500
@@ -36,7 +36,7 @@
 #include <QHeaderView>
 
 files_dock_widget::files_dock_widget (QWidget *p)
-  : QDockWidget (p)
+  : octave_dock_widget (p)
 {
   setObjectName ("FilesDockWidget");
   setWindowIcon (QIcon(":/actions/icons/logo.png"));
@@ -114,11 +114,6 @@
     completer = new QCompleter (_file_system_model, this);
   _current_directory->setCompleter (completer);
 
-  connect (this, SIGNAL (visibilityChanged (bool)),
-           this, SLOT (handle_visibility_changed (bool)));
-  // topLevelChanged is emitted when floating property changes (floating = true)
-  connect (this, SIGNAL (topLevelChanged(bool)), this, SLOT(top_level_changed(bool)));
-
   setFocusProxy (_current_directory);
 }
 
@@ -203,28 +198,3 @@
   //if (settings.value ("showHiddenFiles").toBool ())
   // TODO: React on option for hidden files.
 }
-
-void
-files_dock_widget::handle_visibility_changed (bool visible)
-{
-  if (visible)
-    emit active_changed (true);
-}
-
-void
-files_dock_widget::closeEvent (QCloseEvent *e)
-{
-  emit active_changed (false);
-  QDockWidget::closeEvent (e);
-}
-
-// slot for signal that is emitted when floating property changes
-void
-files_dock_widget::top_level_changed (bool floating)
-{
-  if(floating)
-    {
-      setWindowFlags(Qt::Window);  // make a window from the widget when floating
-      show();                      // make it visible again since setWindowFlags hides it
-    }
-}
--- a/libgui/src/files-dockwidget.h	Mon Feb 11 16:26:08 2013 -0500
+++ b/libgui/src/files-dockwidget.h	Sat Feb 16 18:58:58 2013 -0500
@@ -35,14 +35,14 @@
 #include <QAction>
 #include <QTreeView>
 
-#include <QDockWidget>
 #include <QLineEdit>
+#include "octave-dock-widget.h"
 
 /**
    \class files_dock_widget
    \brief Dock widget to display files in the current directory.
 */
-class files_dock_widget : public QDockWidget
+class files_dock_widget : public octave_dock_widget
 {
   Q_OBJECT
   public:
@@ -51,6 +51,7 @@
   ~files_dock_widget ();
 
 public slots:
+
   /** Slot for handling a change in directory via double click. */
   void item_double_clicked (const QModelIndex & index);
 
@@ -68,12 +69,6 @@
   /** Tells the widget to react on changed settings. */
   void notice_settings ();
 
-  /** Slot to steer changing visibility from outside. */
-  void handle_visibility_changed (bool visible);
-
-  /** Slot when floating property changes */
-  void top_level_changed (bool floating);
-
 signals:
   /** Emitted, whenever the user requested to open a file. */
   void open_file (const QString& fileName);
@@ -81,11 +76,7 @@
   /** Emitted, whenever the currently displayed directory changed. */
   void displayed_directory_changed (const QString& directory);
 
-  /** Custom signal that tells if a user has clicke away that dock widget. */
-  void active_changed (bool active);
-
 protected:
-  void closeEvent (QCloseEvent *event);
 
 private:
   // TODO: Add toolbar with buttons for navigating the path, creating dirs, etc
--- a/libgui/src/history-dockwidget.cc	Mon Feb 11 16:26:08 2013 -0500
+++ b/libgui/src/history-dockwidget.cc	Sat Feb 16 18:58:58 2013 -0500
@@ -37,7 +37,7 @@
 #include "octave-link.h"
 
 history_dock_widget::history_dock_widget (QWidget * p)
-  : QDockWidget (p)
+  : octave_dock_widget (p)
 {
   setObjectName ("HistoryDockWidget");
   construct ();
@@ -71,23 +71,11 @@
 
   widget ()->setLayout (vbox_layout);
 
-  connect (_filter_line_edit,
-           SIGNAL (textEdited (QString)),
-           &_sort_filter_proxy_model,
-           SLOT (setFilterWildcard (QString)));
+  connect (_filter_line_edit, SIGNAL (textEdited (QString)),
+           &_sort_filter_proxy_model, SLOT (setFilterWildcard (QString)));
 
-  connect (_history_list_view,
-           SIGNAL (doubleClicked (QModelIndex)),
-           this,
-           SLOT (handle_double_click (QModelIndex)));
-
-  connect (this,
-           SIGNAL (visibilityChanged (bool)),
-           this,
-           SLOT (handle_visibility_changed (bool)));
-
-  // topLevelChanged is emitted when floating property changes (floating = true)
-  connect (this, SIGNAL (topLevelChanged(bool)), this, SLOT(top_level_changed(bool)));
+  connect (_history_list_view, SIGNAL (doubleClicked (QModelIndex)),
+           this, SLOT (handle_double_click (QModelIndex)));
 
   _update_history_model_timer.setInterval (200);
   _update_history_model_timer.setSingleShot (true);
@@ -142,13 +130,6 @@
 }
 
 void
-history_dock_widget::handle_visibility_changed (bool visible)
-{
-  if (visible)
-    emit active_changed (true);
-}
-
-void
 history_dock_widget::request_history_model_update ()
 {
   octave_link::post_event (this, &history_dock_widget::update_history_callback);
@@ -161,24 +142,6 @@
 }
 
 void
-history_dock_widget::closeEvent (QCloseEvent *e)
-{
-  emit active_changed (false);
-  QDockWidget::closeEvent (e);
-}
-
-// slot for signal that is emitted when floating property changes
-void
-history_dock_widget::top_level_changed (bool floating)
-{
-  if(floating)
-    {
-      setWindowFlags(Qt::Window);  // make a window from the widget when floating
-      show();                      // make it visible again since setWindowFlags hides it
-    }
-}
-
-void
 history_dock_widget::update_history_callback (void)
 {
   static bool scroll_window = false;
--- a/libgui/src/history-dockwidget.h	Mon Feb 11 16:26:08 2013 -0500
+++ b/libgui/src/history-dockwidget.h	Sat Feb 16 18:58:58 2013 -0500
@@ -23,25 +23,22 @@
 #ifndef HISTORYDOCKWIDGET_H
 #define HISTORYDOCKWIDGET_H
 
-#include <QDockWidget>
 #include <QLineEdit>
 #include <QListView>
 #include <QSortFilterProxyModel>
 #include <QStringListModel>
 #include <QTimer>
+#include "octave-dock-widget.h"
 
-class history_dock_widget : public QDockWidget
+class history_dock_widget : public octave_dock_widget
 {
   Q_OBJECT
   public:
   history_dock_widget (QWidget *parent = 0);
 
 public slots:
-  void handle_visibility_changed (bool visible);
   void request_history_model_update ();
   void reset_model ();
-  /** Slot when floating property changes */
-  void top_level_changed (bool floating);
 
 signals:
   void information (const QString& message);
@@ -49,10 +46,8 @@
   /** Emitted, whenever the user double-clicked a command in the history. */
   void command_double_clicked (const QString& command);
 
-  /** Custom signal that tells if a user has clicked away that dock widget. */
-  void active_changed (bool active);
 protected:
-  void closeEvent (QCloseEvent *event);
+
 private slots:
   void handle_double_click (QModelIndex modelIndex);
   void handle_contextmenu_copy(bool flag);
--- a/libgui/src/m-editor/file-editor-interface.h	Mon Feb 11 16:26:08 2013 -0500
+++ b/libgui/src/m-editor/file-editor-interface.h	Sat Feb 16 18:58:58 2013 -0500
@@ -23,22 +23,19 @@
 #ifndef FILEEDITORINTERFACE_H
 #define FILEEDITORINTERFACE_H
 
-#include <QDockWidget>
 #include <QMenu>
 #include <QToolBar>
+#include "octave-dock-widget.h"
 
-class file_editor_interface : public QDockWidget
+class file_editor_interface : public octave_dock_widget
 {
   Q_OBJECT
 
   public:
   file_editor_interface (QWidget *p)
-    : QDockWidget (p)
+    : octave_dock_widget (p)
   {
     setObjectName ("FileEditor");
-
-    connect (this, SIGNAL (visibilityChanged (bool)), this,
-             SLOT (handle_visibility_changed (bool)));
   }
 
   virtual ~file_editor_interface () { }
@@ -56,22 +53,12 @@
   virtual void request_open_file () = 0;
   virtual void request_open_file (const QString& fileName) = 0;
 
-signals:
-  void active_changed (bool active);
+//signals:
 
-protected:
-  void closeEvent (QCloseEvent *e)
-  {
-    emit active_changed (false);
-    QDockWidget::closeEvent (e);
-  }
+//protected:
 
-protected slots:
-  void handle_visibility_changed (bool visible)
-  {
-    if (visible)
-      emit active_changed (true);
-  }
+//protected slots:
+
 };
 
 #endif // FILEEDITORINTERFACE_H
--- a/libgui/src/m-editor/file-editor.cc	Mon Feb 11 16:26:08 2013 -0500
+++ b/libgui/src/m-editor/file-editor.cc	Sat Feb 16 18:58:58 2013 -0500
@@ -517,17 +517,6 @@
   emit fetab_settings_changed ();
 }
 
-// slot for signal that is emitted when floating property changes
-void
-file_editor::top_level_changed (bool floating)
-{
-  if(floating)
-    {
-      setWindowFlags(Qt::Window);  // make a window from the widget when floating
-      show();                      // make it visible again since setWindowFlag hides it
-    }
-}
-
 void
 file_editor::construct ()
 {
@@ -751,8 +740,6 @@
            SIGNAL (tabCloseRequested (int)), this, SLOT (handle_tab_close_request (int)));
   connect (_tab_widget,
            SIGNAL (currentChanged(int)), this, SLOT (active_tab_changed (int)));
-  // topLevelChanged is emitted when floating property changes (floating = true)
-  connect (this, SIGNAL (topLevelChanged(bool)), this, SLOT(top_level_changed(bool)));
 
   resize (500, 400);
   setWindowIcon (QIcon(":/actions/icons/logo.png"));
--- a/libgui/src/m-editor/file-editor.h	Mon Feb 11 16:26:08 2013 -0500
+++ b/libgui/src/m-editor/file-editor.h	Sat Feb 16 18:58:58 2013 -0500
@@ -123,9 +123,6 @@
   void handle_mru_add_file (const QString& file_name);
   void check_conflict_save (const QString& fileName, bool remove_on_success);
 
-  /** Slot when floating property changes */
-  void top_level_changed (bool floating);
-
   /** Tells the editor to react on changed settings. */
   void notice_settings ();
 
--- a/libgui/src/module.mk	Mon Feb 11 16:26:08 2013 -0500
+++ b/libgui/src/module.mk	Sat Feb 16 18:58:58 2013 -0500
@@ -73,7 +73,8 @@
   src/moc-workspace-view.cc \
   src/octave-adapter/moc-octave-main-thread.cc \
   src/qtinfo/moc-parser.cc \
-  src/qtinfo/moc-webinfo.cc
+  src/qtinfo/moc-webinfo.cc \
+  src/moc-octave-dock-widget.cc
 
 octave_gui_RC = src/qrc-resource.cc
 
@@ -86,6 +87,7 @@
 BUILT_SOURCES += $(octave_gui_UI_H)
 
 noinst_HEADERS += \
+  src/octave-dock-widget.h \
   src/documentation-dockwidget.h \
   src/files-dockwidget.h \
   src/history-dockwidget.h \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libgui/src/octave-dock-widget.h	Sat Feb 16 18:58:58 2013 -0500
@@ -0,0 +1,81 @@
+/*
+
+Copyright (C) 2012-2013 Richard Crozier
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#ifndef OCTAVEDOCKWIDGET_H
+#define OCTAVEDOCKWIDGET_H
+
+#include <QDockWidget>
+//#include <QMenu>
+//#include <QToolBar>
+
+class octave_dock_widget : public QDockWidget
+{
+  Q_OBJECT
+
+  public:
+  octave_dock_widget (QWidget *p)
+    : QDockWidget (p)
+  {
+    connect (this, SIGNAL (visibilityChanged (bool)),
+             this, SLOT (handle_visibility_changed (bool)));
+
+    connect (this, SIGNAL (topLevelChanged(bool)),
+             this, SLOT(top_level_changed(bool)));
+  }
+
+  virtual ~octave_dock_widget () { }
+
+signals:
+  /** Custom signal that tells if a user has clicked away
+   *  that dock widget, i.e the active dock widget has
+   *  changed. */
+  virtual void active_changed (bool active);
+
+protected:
+  virtual void closeEvent (QCloseEvent *e)
+  {
+    emit active_changed (false);
+    QDockWidget::closeEvent (e);
+  }
+
+protected slots:
+
+  /** Slot to steer changing visibility from outside. */
+  virtual void handle_visibility_changed (bool visible)
+  {
+    if (visible)
+      emit active_changed (true);
+  }
+
+  /** Slot when floating property changes */
+  virtual void top_level_changed (bool floating)
+  {
+    if(floating)
+      {
+        setWindowFlags(Qt::Window);  // make a window from the widget when floating
+        show();                      // make it visible again since setWindowFlags hides it
+      }
+  }
+
+};
+
+#endif // OCTAVEDOCKWIDGET_H
--- a/libgui/src/terminal-dockwidget.cc	Mon Feb 11 16:26:08 2013 -0500
+++ b/libgui/src/terminal-dockwidget.cc	Sat Feb 16 18:58:58 2013 -0500
@@ -27,7 +27,7 @@
 #include "terminal-dockwidget.h"
 
 terminal_dock_widget::terminal_dock_widget (QTerminal *terminal, QWidget *p)
-  : QDockWidget (p)
+  : octave_dock_widget (p)
 {
   setObjectName ("TerminalDockWidget");
   setWindowIcon (QIcon(":/actions/icons/logo.png"));
@@ -39,27 +39,3 @@
   connect (this, SIGNAL (topLevelChanged(bool)), this, SLOT(top_level_changed(bool)));
 }
 
-void
-terminal_dock_widget::closeEvent (QCloseEvent *e)
-{
-  emit active_changed (false);
-  QDockWidget::closeEvent (e);
-}
-
-void
-terminal_dock_widget::handle_visibility_changed (bool visible)
-{
-  if (visible)
-    emit active_changed (true);
-}
-
-// slot for signal that is emitted when floating property changes
-void
-terminal_dock_widget::top_level_changed (bool floating)
-{
-  if(floating)
-    {
-      setWindowFlags(Qt::Window);  // make a window from the widget when floating
-      show();                      // make it visible again since setWindowFlags hides it
-    }
-}
--- a/libgui/src/terminal-dockwidget.h	Mon Feb 11 16:26:08 2013 -0500
+++ b/libgui/src/terminal-dockwidget.h	Sat Feb 16 18:58:58 2013 -0500
@@ -23,25 +23,21 @@
 #ifndef TERMINALDOCKWIDGET_H
 #define TERMINALDOCKWIDGET_H
 
-#include <QDockWidget>
 #include "QTerminal.h"
+#include "octave-dock-widget.h"
 
-class terminal_dock_widget : public QDockWidget
+class terminal_dock_widget : public octave_dock_widget
 {
   Q_OBJECT
   public:
   terminal_dock_widget (QTerminal *terminal, QWidget *parent = 0);
 
 signals:
-  void active_changed (bool active);
 
 public slots:
-  void handle_visibility_changed (bool visible);
-  /** Slot when floating property changes */
-  void top_level_changed (bool floating);
 
 protected:
-  void closeEvent (QCloseEvent *event);
+
 };
 
 
--- a/libinterp/Makefile.am	Mon Feb 11 16:26:08 2013 -0500
+++ b/libinterp/Makefile.am	Sat Feb 16 18:58:58 2013 -0500
@@ -356,7 +356,9 @@
   DOCSTRINGS \
   $(BUILT_NODISTFILES) \
   $(OCT_FILES) \
-  $(OCT_STAMP_FILES)
+  $(OCT_STAMP_FILES) \
+  $(TST_FILES)
 
 MAINTAINERCLEANFILES = \
   $(BUILT_DISTFILES)
+
--- a/libinterp/interpfcn/input.cc	Mon Feb 11 16:26:08 2013 -0500
+++ b/libinterp/interpfcn/input.cc	Sat Feb 16 18:58:58 2013 -0500
@@ -843,8 +843,8 @@
 
 DEFUN (input, args, nargout,
   "-*- texinfo -*-\n\
-@deftypefn  {Built-in Function} {} input (@var{prompt})\n\
-@deftypefnx {Built-in Function} {} input (@var{prompt}, \"s\")\n\
+@deftypefn  {Built-in Function} {@var{ans} =} input (@var{prompt})\n\
+@deftypefnx {Built-in Function} {@var{ans} =} input (@var{prompt}, \"s\")\n\
 Print a prompt and wait for user input.  For example,\n\
 \n\
 @example\n\
@@ -874,7 +874,8 @@
 Because there may be output waiting to be displayed by the pager, it is\n\
 a good idea to always call @code{fflush (stdout)} before calling\n\
 @code{input}.  This will ensure that all pending output is written to\n\
-the screen before your prompt.  @xref{Input and Output}.\n\
+the screen before your prompt.\n\
+@seealso{yes_or_no, kbhit}\n\
 @end deftypefn")
 {
   octave_value_list retval;
@@ -909,12 +910,14 @@
 
 DEFUN (yes_or_no, args, ,
   "-*- texinfo -*-\n\
-@deftypefn {Built-in Function} {} yes_or_no (@var{prompt})\n\
-Ask the user a yes-or-no question.  Return 1 if the answer is yes.\n\
-Takes one argument, which is the string to display to ask the\n\
-question.  It should end in a space; @samp{yes-or-no-p} adds\n\
-@samp{(yes or no) } to it.  The user must confirm the answer with\n\
-RET and can edit it until it has been confirmed.\n\
+@deftypefn {Built-in Function} {@var{ans} =} yes_or_no (\"@var{prompt}\")\n\
+Ask the user a yes-or-no question.  Return logical true if the answer is yes\n\
+or false if the answer is no.  Takes one argument, @var{prompt}, which is\n\
+the string to display when asking the question.  @var{prompt} should end in\n\
+a space; @code{yes-or-no} adds the string @samp{(yes or no) } to it.  The\n\
+user must confirm the answer with @key{RET} and can edit it until it has\n\
+been confirmed.\n\
+@seealso{input}\n\
 @end deftypefn")
 {
   octave_value retval;
@@ -986,7 +989,7 @@
 DEFUN (keyboard, args, ,
   "-*- texinfo -*-\n\
 @deftypefn  {Built-in Function} {} keyboard ()\n\
-@deftypefnx {Built-in Function} {} keyboard (@var{prompt})\n\
+@deftypefnx {Built-in Function} {} keyboard (\"@var{prompt}\")\n\
 This function is normally used for simple debugging.  When the\n\
 @code{keyboard} function is executed, Octave prints a prompt and waits\n\
 for user input.  The input strings are then evaluated and the results\n\
--- a/libinterp/interpfcn/oct-hist.cc	Mon Feb 11 16:26:08 2013 -0500
+++ b/libinterp/interpfcn/oct-hist.cc	Sat Feb 16 18:58:58 2013 -0500
@@ -377,7 +377,9 @@
   int hist_count = hlist.length () - 1;  // switch to zero-based indexing
 
   // The current command line is already part of the history list by
-  // the time we get to this point.  Delete it from the list.
+  // the time we get to this point.  Delete the cmd from the list when
+  // executing 'edit_history' so that it doesn't show up in the history
+  // but the actual commands performed will.
 
   if (! insert_curr)
     command_history::remove (hist_count);
@@ -521,13 +523,15 @@
           continue;
         }
 
-      if (first)
-        {
-          first = 0;
-          edit_history_repl_hist (line);
-        }
-      else
-        edit_history_add_hist (line);
+      // Command 'edit history' has already been removed in
+      // mk_tmp_hist_file ()
+      //if (first)
+      //  {
+      //    first = 0;
+      //    edit_history_repl_hist (line);
+      //  }
+      //else
+      edit_history_add_hist (line);
 
       delete [] line;
     }
@@ -638,27 +642,30 @@
 
 DEFUN (history, args, nargout,
   "-*- texinfo -*-\n\
-@deftypefn {Command} history options\n\
-@deftypefnx {Built-in Function} {@var{h} = } history (@var{opt1}, @var{opt2}, @dots{})\n\
+@deftypefn  {Command} {} history\n\
+@deftypefnx {Command} {} history @var{opt1} @dots{}\n\
+@deftypefnx {Built-in Function} {@var{h} =} history ()\n\
+@deftypefnx {Built-in Function} {@var{h} =} history (@var{opt1}, @dots{})\n\
 If invoked with no arguments, @code{history} displays a list of commands\n\
 that you have executed.  Valid options are:\n\
 \n\
 @table @code\n\
-@item -w @var{file}\n\
-Write the current history to the file @var{file}.  If the name is\n\
-omitted, use the default history file (normally @file{~/.octave_hist}).\n\
+@item   @var{n}\n\
+@itemx -@var{n}\n\
+Display only the most recent @var{n} lines of history.\n\
+\n\
+@item -q\n\
+Don't number the displayed lines of history.  This is useful for cutting\n\
+and pasting commands using the X Window System.\n\
 \n\
 @item -r @var{file}\n\
 Read the file @var{file}, appending its contents to the current\n\
 history list.  If the name is omitted, use the default history file\n\
 (normally @file{~/.octave_hist}).\n\
 \n\
-@item @var{n}\n\
-Display only the most recent @var{n} lines of history.\n\
-\n\
-@item -q\n\
-Don't number the displayed lines of history.  This is useful for cutting\n\
-and pasting commands using the X Window System.\n\
+@item -w @var{file}\n\
+Write the current history to the file @var{file}.  If the name is\n\
+omitted, use the default history file (normally @file{~/.octave_hist}).\n\
 @end table\n\
 \n\
 For example, to display the five most recent commands that you have\n\
--- a/libinterp/interpfcn/sysdep.cc	Mon Feb 11 16:26:08 2013 -0500
+++ b/libinterp/interpfcn/sysdep.cc	Sat Feb 16 18:58:58 2013 -0500
@@ -619,8 +619,9 @@
 
 DEFUN (kbhit, args, ,
   "-*- texinfo -*-\n\
-@deftypefn {Built-in Function} {} kbhit ()\n\
-Read a single keystroke from the keyboard.  If called with one\n\
+@deftypefn  {Built-in Function} {} kbhit ()\n\
+@deftypefnx {Built-in Function} {} kbhit (1)\n\
+Read a single keystroke from the keyboard.  If called with an\n\
 argument, don't wait for a keypress.  For example,\n\
 \n\
 @example\n\
@@ -636,8 +637,9 @@
 @end example\n\
 \n\
 @noindent\n\
-identical to the above example, but don't wait for a keypress,\n\
+is identical to the above example, but doesn't wait for a keypress,\n\
 returning the empty string if no key is available.\n\
+@seealso{input}\n\
 @end deftypefn")
 {
   octave_value retval;
--- a/liboctave/Makefile.am	Mon Feb 11 16:26:08 2013 -0500
+++ b/liboctave/Makefile.am	Sat Feb 16 18:58:58 2013 -0500
@@ -135,5 +135,7 @@
 
 nobase_liboctavetests_DATA = $(TST_FILES)
 
-DISTCLEANFILES += $(BUILT_INCS)
+DISTCLEANFILES += \
+  $(BUILT_INCS) \
+  $(TST_FILES)
 
--- a/scripts/io/textread.m	Mon Feb 11 16:26:08 2013 -0500
+++ b/scripts/io/textread.m	Sat Feb 16 18:58:58 2013 -0500
@@ -1,4 +1,4 @@
-## Copyright (C) 2009-2012 Eric Chassande-Mottin, CNRS (France)
+## Copyright (C) 2009-2013 Eric Chassande-Mottin, CNRS (France)
 ##
 ## This file is part of Octave.
 ##
@@ -79,10 +79,22 @@
 
   ## Skip header lines if requested
   headerlines = find (strcmpi (varargin, "headerlines"), 1);
-  ## Beware of zero valued headerline, fskipl would skip to EOF
-  if (! isempty (headerlines) && (varargin{headerlines + 1} > 0))
-    fskipl (fid, varargin{headerlines + 1});
-    varargin(headerlines:headerlines+1) = [];
+  if (! isempty (headerlines))
+    ## Beware of missing or wrong headerline value
+    if (headerlines  == numel (varargin)
+       || ! isnumeric (varargin{headerlines + 1}))
+      error ("missing or illegal value for 'headerlines'" );
+    endif
+    ## Avoid conveying floats to fskipl
+    varargin{headerlines + 1} = round (varargin{headerlines + 1});
+    ## Beware of zero valued headerline, fskipl would skip to EOF
+    if (varargin{headerlines + 1} > 0)
+      fskipl (fid, varargin{headerlines + 1});
+      varargin(headerlines:headerlines+1) = [];
+      nargin = nargin - 2;
+    elseif (varargin{headerlines + 1} < 0)
+      warning ("textread: negative headerline value ignored");
+    endif
   endif
   st_pos = ftell (fid);
 
@@ -98,7 +110,7 @@
   if (! isempty (endofline))
     ## 'endofline' option set by user.
     if (! ischar (varargin{endofline + 1}));
-      error ("textread: character value required for EndOfLine");
+      error ("character value required for EndOfLine");
     endif
   else
     ## Determine EOL from file.  Search for EOL candidates in first BUFLENGTH chars
@@ -188,4 +200,6 @@
 %!error textread (1)
 %!error <arguments must be strings> textread (1, "%f")
 %!error <arguments must be strings> textread ("fname", 1)
-
+%!error <missing or illegal value for> textread (file_in_loadpath ("textread.m"), "", "headerlines")
+%!error <missing or illegal value for> textread (file_in_loadpath ("textread.m"), "", "headerlines", 'hh')
+%!error <character value required for> textread (file_in_loadpath ("textread.m"), "%s", "endofline", true)
--- a/scripts/io/textscan.m	Mon Feb 11 16:26:08 2013 -0500
+++ b/scripts/io/textscan.m	Sat Feb 16 18:58:58 2013 -0500
@@ -1,4 +1,4 @@
-## Copyright (C) 2010-2012 Ben Abbott <bpabbott@mac.com>
+## Copyright (C) 2010-2013 Ben Abbott <bpabbott@mac.com>
 ##
 ## This file is part of Octave.
 ##
@@ -167,14 +167,23 @@
     st_pos = ftell (fid);
     ## Skip header lines if requested
     headerlines = find (strcmpi (args, "headerlines"), 1);
-    ## Beware of zero valued headerline, fskipl would skip to EOF
-    if (! isempty (headerlines) && (args{headerlines + 1} > 0))
-      fskipl (fid, args{headerlines + 1});
-      args(headerlines:headerlines+1) = [];
-      st_pos = ftell (fid);
+    if (! isempty (headerlines))
+      ## Beware of missing or wrong headerline value
+      if (headerlines  == numel (args)
+         || ! isnumeric (args{headerlines + 1}))
+        error ("Missing or illegal value for 'headerlines'" );
+      endif
+      ## Avoid conveying floats to fskipl
+      args{headerlines + 1} = round (args{headerlines + 1});
+      if (args{headerlines + 1} > 0)
+        ## Beware of zero valued headerline, fskipl would skip to EOF
+        fskipl (fid, args{headerlines + 1});
+        args(headerlines:headerlines+1) = [];
+        st_pos = ftell (fid);
+      elseif (args{headerlines + 1} < 0)
+        warning ("textscan.m: negative headerline value ignored");
+      endif
     endif
-    ## Read a first file chunk. Rest follows after endofline processing
-    [str, count] = fscanf (fid, "%c", BUFLENGTH);
   endif
 
   ## Check for empty result
@@ -497,3 +506,7 @@
 %!   rh = strtrim (rh);
 %!   assert (strcmp (lh, rh));
 %! end
+
+%!error <missing or illegal value for> textread (file_in_loadpath ("textscan.m"), "", "headerlines")
+%!error <missing or illegal value for> textread (file_in_loadpath ("textscan.m"), "", "headerlines", 'hh')
+%!error <character value required for> textread (file_in_loadpath ("textscan.m"), "", "endofline", true)
--- a/scripts/statistics/distributions/binopdf.m	Mon Feb 11 16:26:08 2013 -0500
+++ b/scripts/statistics/distributions/binopdf.m	Sat Feb 16 18:58:58 2013 -0500
@@ -64,6 +64,12 @@
                   + x(k).*log (p(k)) + (n(k)-x(k)).*log (1-p(k)));
   endif
 
+  ## Special case inputs
+  ksp = k & (p == 0) & (x == 0);
+  pdf(ksp) = 1; 
+  ksp = k & (p == 1) & (x == n);
+  pdf(ksp) = 1; 
+
 endfunction
 
 
@@ -82,6 +88,11 @@
 %!assert (binopdf (x, 2, 0.5*[0 -1 NaN 3 1]), [0 NaN NaN NaN 0])
 %!assert (binopdf ([x, NaN], 2, 0.5), [y, NaN], tol)
 
+## Test Special input values
+%!assert (binopdf (0, 3, 0), 1);
+%!assert (binopdf (2, 2, 1), 1);
+%!assert (binopdf (1, 2, 1), 0);
+
 %% Test class of input preserved
 %!assert (binopdf (single ([x, NaN]), 2, 0.5), single ([y, NaN]))
 %!assert (binopdf ([x, NaN], single (2), 0.5), single ([y, NaN]))