<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,7 +1,7 @@
 ;;; zshdb.el --- zsh Debugger mode via GUD and zshdb
 ;;; $Id: zshdb.el,v 1.43 2007/11/30 01:58:43 rockyb Exp $
 
-;; Copyright (C) 2002, 2006, 2007 Rocky Bernstein (rocky@gnu.org) 
+;; Copyright (C) 2002, 2006, 2007, 2008 Rocky Bernstein (rocky@gnu.org) 
 ;;                    and Masatake YAMATO (jet@gyve.org)
 
 ;; This program is free software; you can redistribute it and/or modify</diff>
      <filename>emacs/zshdb.el</filename>
    </modified>
    <modified>
      <diff>@@ -85,7 +85,7 @@ _Dbg_save_breakpoints() {
 # Enable/disable breakpoint or watchpoint by entry numbers.
 _Dbg_enable_disable() {
   if (($# == 0)) ; then
-    _Dbg_errmsg &quot;Expecting a list of breakpoint/watchpoint numbers. Got none.&quot;
+    _Dbg_errmsg 'Expecting a list of breakpoint/watchpoint numbers. Got none.'
     return 1
   fi
   typeset -i on=$1
@@ -146,7 +146,7 @@ function _Dbg_print_brkpt_count {
   fi
 }
 
-# clear all breakpoints
+# Clear all breakpoints.
 _Dbg_clear_all_brkpt() {
   _Dbg_write_journal_eval &quot;_Dbg_brkpt_file2linenos=()&quot;
   _Dbg_write_journal_eval &quot;_Dbg_brkpt_file2brkpt=()&quot;
@@ -156,6 +156,7 @@ _Dbg_clear_all_brkpt() {
   _Dbg_write_journal_eval &quot;_Dbg_brkpt_enable=()&quot;
   _Dbg_write_journal_eval &quot;_Dbg_brkpt_counts=()&quot;
   _Dbg_write_journal_eval &quot;_Dbg_brkpt_onetime=()&quot;
+  _Dbg_write_journal_eval &quot;_Dbg_brkpt_count=0&quot;
 }
 
 # Internal routine to a set breakpoint unconditonally. 
@@ -200,108 +201,115 @@ _Dbg_set_brkpt() {
   _Dbg_write_journal &quot;_Dbg_brkpt_max=$_Dbg_brkpt_max&quot;
 }
 
-# Internal routine to unset the actual breakpoint arrays
+# Internal routine to unset the actual breakpoint arrays.
+# 0 is returned if successful
 _Dbg_unset_brkpt_arrays() {
-  typeset -i del=$1
-  _Dbg_write_journal_eval &quot;_Dbg_brkpt_line[$del]=''&quot;
-  _Dbg_write_journal_eval &quot;_Dbg_brkpt_counts[$del]=''&quot;
-  _Dbg_write_journal_eval &quot;_Dbg_brkpt_file[$del]=''&quot;
-  _Dbg_write_journal_eval &quot;_Dbg_brkpt_enable[$del]=0&quot;
-  _Dbg_write_journal_eval &quot;_Dbg_brkpt_cond[$del]=0&quot;
-  _Dbg_write_journal_eval &quot;_Dbg_brkpt_onetime[$del]=''&quot;
-  ((_Dbg_brkpt_count--))
+    (( $# != 1 )) &amp;&amp; return 1
+    typeset -i del=$1
+    _Dbg_write_journal_eval &quot;_Dbg_brkpt_line[$del]=''&quot;
+    _Dbg_write_journal_eval &quot;_Dbg_brkpt_counts[$del]=''&quot;
+    _Dbg_write_journal_eval &quot;_Dbg_brkpt_file[$del]=''&quot;
+    _Dbg_write_journal_eval &quot;_Dbg_brkpt_enable[$del]=0&quot;
+    _Dbg_write_journal_eval &quot;_Dbg_brkpt_cond[$del]=0&quot;
+    _Dbg_write_journal_eval &quot;_Dbg_brkpt_onetime[$del]=''&quot;
+    ((_Dbg_brkpt_count--))
+    return 0
 }
 
 # Internal routine to delete a breakpoint by file/line.
+# The number of breakpoints unset returned.
 _Dbg_unset_brkpt() {
-  typeset -r filename=$1
-  typeset -i line=$2
-  typeset -r filevar=$(_Dbg_file2var $filename)
-  typeset -r fullname=$(_Dbg_expand_filename $filename)
-  typeset -i found=0
+    (( $# != 2 )) &amp;&amp; return 0
+    typeset -r filename=$1
+    typeset -i line=$2
+    typeset -r filevar=$(_Dbg_file2var $filename)
+    typeset -r fullname=$(_Dbg_expand_filename $filename)
+    typeset -i found=0
   
-  ## typeset -r entries=`_Dbg_get_assoc_array_entry &quot;_Dbg_brkpt_$filevar&quot; $line`
-  typeset -i del
-  for del in $entries ; do 
-    if [[ -z ${_Dbg_brkpt_file[$del]} ]] ; then
-      _Dbg_msg &quot;No breakpoint found at $filename:$line&quot;
-      continue
-    fi
-    typeset brkpt_fullname=$(_Dbg_expand_filename ${_Dbg_brkpt_file[$del]})
-    if [[ $brkpt_fullname != $fullname ]] ; then 
-      _Dbg_errmsg &quot;Brkpt inconsistency:&quot; \
-	&quot;${filename[$line]} lists ${_Dbg_brkpt_file[$del]} at entry $del&quot;
-    else
-      _Dbg_unset_brkpt_arrays $del
-      ((found++))
-      ((_Dbg_brkpt_count--))
-    fi
-  done
-  _Dbg_write_journal_eval &quot;unset _Dbg_brkpt_${filevar[$line]}&quot;
-  return $found
+    typeset -i del
+    for del in $entries ; do 
+	if [[ -z ${_Dbg_brkpt_file[$del]} ]] ; then
+	    _Dbg_msg &quot;No breakpoint found at $filename:$line&quot;
+	    continue
+	fi
+	typeset brkpt_fullname=$(_Dbg_expand_filename ${_Dbg_brkpt_file[$del]})
+	if [[ $brkpt_fullname != $fullname ]] ; then 
+	    _Dbg_errmsg &quot;Brkpt inconsistency:&quot; \
+		&quot;${filename[$line]} lists ${_Dbg_brkpt_file[$del]} at entry $del&quot;
+	else
+	    _Dbg_unset_brkpt_arrays $del
+	    ((found++))
+	    ((_Dbg_brkpt_count--))
+	fi
+    done
+    _Dbg_write_journal_eval &quot;unset _Dbg_brkpt_${filevar[$line]}&quot;
+    return $found
 }
 
 # Routine to a delete breakpoint by entry number: $1.
 # Returns whether or not anything was deleted.
 _Dbg_delete_brkpt_entry() {
-  (( $# == 0 )) &amp;&amp; return 0
-  typeset -r  del=&quot;$1&quot;
-  typeset -i  i
-  typeset -i  found=0
-  
-  if [[ -z ${_Dbg_brkpt_file[$del]} ]] ; then
-      _Dbg_errmsg &quot;No breakpoint number $del.&quot;
-      return 0
-  fi
-  typeset    source_file=${_Dbg_brkpt_file[$del]}
-  typeset -i lineno=${_Dbg_brkpt_line[$del]}
-  typeset -i try 
-  typeset -a new_lineno_val; new_lineno_val=()
-  typeset -a new_brkpt_nos; new_brkpt_nos=()
-  typeset -i i=-1
-  typeset -a brkpt_nos
-  brkpt_nos=(${_Dbg_brkpt_file2brkpt[$source_file]})
-  for try in ${_Dbg_brkpt_file2linenos[$source_file]} ; do 
-      ((i++))
-      if (( brkpt_nos[i] == del )) ; then
-	  if (( try != $lineno )) ; then
-	      _Dbg_errmsg 'internal brkpt structure inconsistency'
-	      return 0
-	  fi
-	  _Dbg_unset_brkpt_arrays $del
-	  ((found++))
-      else
-	  new_lineno_val+=$try
-	  new_brkpt_nos+=${brkpt_nos[$i]}
-      fi
-  done
-  set +x
-  if (( found &gt; 0 )) ; then
-      if (( ${#new_lineno_val[@]} == 0 )) ; then 
-	  _Dbg_write_journal_eval &quot;unset '_Dbg_brkpt_file2linenos[$source_file]'&quot;
-	  _Dbg_write_journal_eval &quot;unset '_Dbg_brkpt_file2brkpt[$source_file]'&quot;
-      else
-	  _Dbg_write_journal_eval &quot;_Dbg_brkpt_file2linenos[$source_file]=${new_lineno_val}&quot;
-	  _Dbg_write_journal_eval &quot;_Dbg_brkpt_file2brkpt[$source_file]=${new_brkpt_nos}&quot;
-      fi
-  fi
-
-  return $found
+    (( $# == 0 )) &amp;&amp; return 0
+    typeset -r  del=&quot;$1&quot;
+    typeset -i  i
+    typeset -i  found=0
+    
+    if [[ -z ${_Dbg_brkpt_file[$del]} ]] ; then
+	_Dbg_errmsg &quot;No breakpoint number $del.&quot;
+	return 0
+    fi
+    typeset    source_file=${_Dbg_brkpt_file[$del]}
+    typeset -i lineno=${_Dbg_brkpt_line[$del]}
+    typeset -i try 
+    typeset -a new_lineno_val; new_lineno_val=()
+    typeset -a new_brkpt_nos; new_brkpt_nos=()
+    typeset -i i=-1
+    typeset -a brkpt_nos
+    brkpt_nos=(${_Dbg_brkpt_file2brkpt[$source_file]})
+    for try in ${_Dbg_brkpt_file2linenos[$source_file]} ; do 
+	((i++))
+	if (( brkpt_nos[i] == del )) ; then
+	    if (( try != $lineno )) ; then
+		_Dbg_errmsg 'internal brkpt structure inconsistency'
+		return 0
+	    fi
+	    _Dbg_unset_brkpt_arrays $del
+	    ((found++))
+	else
+	    new_lineno_val+=$try
+	    new_brkpt_nos+=${brkpt_nos[$i]}
+	fi
+    done
+    if (( found &gt; 0 )) ; then
+	if (( ${#new_lineno_val[@]} == 0 )) ; then 
+	    _Dbg_write_journal_eval &quot;unset '_Dbg_brkpt_file2linenos[$source_file]'&quot;
+	    _Dbg_write_journal_eval &quot;unset '_Dbg_brkpt_file2brkpt[$source_file]'&quot;
+	else
+	    _Dbg_write_journal_eval &quot;_Dbg_brkpt_file2linenos[$source_file]=${new_lineno_val}&quot;
+	    _Dbg_write_journal_eval &quot;_Dbg_brkpt_file2brkpt[$source_file]=${new_brkpt_nos}&quot;
+	fi
+    fi
+    
+    return $found
 }
 
 # Enable/disable breakpoint(s) by entry numbers.
 _Dbg_enable_disable_brkpt() {
+  (($# != 3)) &amp;&amp; return 1
   typeset -i on=$1
   typeset en_dis=$2
   typeset -i i=$3
   if [[ -n &quot;${_Dbg_brkpt_file[$i]}&quot; ]] ; then
     if [[ ${_Dbg_brkpt_enable[$i]} == $on ]] ; then
       _Dbg_errmsg &quot;Breakpoint entry $i already $en_dis so nothing done.&quot;
+      return 1
     else
       _Dbg_write_journal_eval &quot;_Dbg_brkpt_enable[$i]=$on&quot;
       _Dbg_msg &quot;Breakpoint entry $i $en_dis.&quot;
+      return 0
     fi
   else
     _Dbg_errmsg &quot;Breakpoint entry $i doesn't exist so nothing done.&quot;
+    return 1
   fi
 }</diff>
      <filename>lib/break.sh</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>50805388b91f9a1e398a7e490f90561c7fe8103b</id>
    </parent>
  </parents>
  <author>
    <name>R. Bernstein</name>
    <email>rocky@gnu.org</email>
  </author>
  <url>http://github.com/rocky/zshdb/commit/9da3702a9ce31d12a13a860f0ae5c36a1268a629</url>
  <id>9da3702a9ce31d12a13a860f0ae5c36a1268a629</id>
  <committed-date>2008-11-02T07:22:59-08:00</committed-date>
  <authored-date>2008-11-02T07:22:59-08:00</authored-date>
  <message>Add more parameter checking; journal more. Mostly minor changes.</message>
  <tree>b628f0a984a3c506057a5cf12ff176417eb7996c</tree>
  <committer>
    <name>R. Bernstein</name>
    <email>rocky@gnu.org</email>
  </committer>
</commit>
