Permalink
Browse files

Create init directory of stuff that has to come before loading lib. P…

…arallels bashdb.
  • Loading branch information...
1 parent f96c54b commit 9d4da830013a5a33264e3cf98396054d0fba0294 @rocky committed May 6, 2011
View
@@ -17,13 +17,10 @@
AUTOMAKE_OPTIONS = dist-bzip2
-SUBDIRS = command data lib doc test
+SUBDIRS = command data init lib doc test
pkgdata_DATA = \
- dbg-pre.sh \
- dbg-io.sh \
dbg-main.sh \
- dbg-opts.sh \
dbg-trace.sh \
getopts_long.sh
View
@@ -0,0 +1,65 @@
+# complete.sh - gdb-like 'complete' command
+#
+# Copyright (C) 2010, 2011 Rocky Bernstein <rocky@gnu.org>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2, or
+# (at your option) any later version.
+#
+# This program 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 this program; see the file COPYING. If not, write to
+# the Free Software Foundation, 59 Temple Place, Suite 330, Boston,
+# MA 02111 USA.
+
+if [[ $0 == ${.sh.file##*/} ]] ; then
+ # source ../init/require.sh
+ # FIXME: require loses scope for typeset -A...
+ source ../lib/help.sh
+ source ../lib/alias.sh
+fi
+
+_Dbg_help_add complete \
+'complete PREFIX-STR...
+
+Show command completion strings for PREFIX-STR
+' 1
+
+_Dbg_do_complete() {
+ typeset -a args; args=($@)
+ _Dbg_matches=()
+ if (( ${#args[@]} == 2 )) ; then
+ _Dbg_subcmd_complete ${args[0]} ${args[1]}
+ elif (( ${#args[@]} == 1 )) ; then
+ # FIXME: add in aliases
+ typeset -a COMPREPLY
+ typeset list
+ list="${!_Dbg_debugger_commands[@]}"
+ compgen_opt_words "$list" "${args[0]}"
+ _Dbg_matches=( ${COMPREPLY[@]} )
+ fi
+ typeset -i i
+ for (( i=0; i < ${#_Dbg_matches[@]} ; i++ )) ; do
+ _Dbg_msg ${_Dbg_matches[$i]}
+ done
+}
+
+# Demo it.
+if [[ $0 == ${.sh.file##*/} ]] ; then
+ source ../lib/complete.sh
+ source ./help.sh
+ source ../lib/msg.sh
+ _Dbg_libdir='..'
+ for _Dbg_file in ${_Dbg_libdir}/command/d*.sh ; do
+ source $_Dbg_file
+ done
+
+ _Dbg_args='complete'
+ _Dbg_do_help complete
+ _Dbg_do_complete d
+fi
View
@@ -70,15 +70,16 @@ AC_PATH_PROG(RM, rm, true)
AC_CONFIG_FILES([ \
Makefile \
+ command/Makefile \
command/info_sub/Makefile \
command/set_sub/Makefile \
command/show_sub/Makefile \
- command/Makefile \
- data/Makefile \
- doc/Makefile \
- dbg-trace.sh \
- lib/Makefile \
- test/Makefile \
+ data/Makefile \
+ doc/Makefile \
+ dbg-trace.sh \
+ init/Makefile \
+ lib/Makefile \
+ test/Makefile \
test/data/Makefile \
test/example/Makefile \
test/integration/Makefile \
View
@@ -16,9 +16,11 @@
# the Free Software Foundation, 59 Temple Place, Suite 330, Boston,
# MA 02111 USA.
-# Stuff common to kshdb and dbg-trace. Include the rest of options
-# processing. Also includes things which have to come before other includes
-. ${_Dbg_libdir}/dbg-pre.sh
+# Code that specifically has to come first.
+# Note: "init" comes first and "cmds" has to come after "io".
+for _Dbg_file in pre io ; do
+ source ${_Dbg_libdir}/init/${_Dbg_file}.sh
+done
# All debugger lib code has to come before debugger command code.
typeset _Dbg_file
View
@@ -0,0 +1,2 @@
+/Makefile
+/Makefile.in
View
@@ -0,0 +1,5 @@
+pkgdatadir = ${datadir}/@PACKAGE@/init
+pkgdata_DATA = $(wildcard *.sh)
+
+EXTRA_DIST = $(pkgdata_DATA)
+MOSTLYCLEANFILES = *.orig *.rej
File renamed without changes.
File renamed without changes.
@@ -95,7 +95,7 @@ _Dbg_tempname() {
}
# Process command-line options
-. ${_Dbg_libdir}/dbg-opts.sh
+. ${_Dbg_libdir}/init/opts.sh
OPTLIND=1
_Dbg_parse_options "$@"
@@ -109,7 +109,7 @@ abs_top_srcdir=${abs_top_srcdir%%/}/
_Dbg_libdir=$abs_top_srcdir
set -- '-q' # Don't need to show banner
-. ${abs_top_srcdir}dbg-pre.sh
+. ${abs_top_srcdir}init/pre.sh
. ${abs_top_srcdir}lib/fns.sh
. ${abs_top_srcdir}lib/journal.sh
. ${abs_top_srcdir}lib/break.sh
@@ -24,7 +24,7 @@ do_opts_test() {
# typeset -p expected_eval
# typeset -p expected_value
- . ${abs_top_srcdir}/dbg-opts.sh
+ . ${abs_top_srcdir}/init/opts.sh
OPTLIND=1
_Dbg_parse_options "$@"
assertEquals "$assert_msg" "$expected_value" "$(eval $expected_eval)"
@@ -58,7 +58,7 @@ abs_top_srcdir=${abs_top_srcdir%%/}/
_Dbg_libdir=$abs_top_srcdir
set -- -q # Don't need to show banner
-. $abs_top_srcdir/dbg-pre.sh
+. $abs_top_srcdir/init/pre.sh
. $abs_top_srcdir/lib/filecache.sh
. $abs_top_srcdir/lib/file.sh
@@ -56,7 +56,7 @@ abs_top_srcdir=${abs_top_srcdir%%/}/
_Dbg_libdir=$abs_top_srcdir
set -- -q # Don't need to show banner
-. ${abs_top_srcdir}dbg-pre.sh
+. ${abs_top_srcdir}init/pre.sh
. ${abs_top_srcdir}lib/filecache.sh
. ${abs_top_srcdir}lib/file.sh
@@ -115,7 +115,7 @@ abs_top_srcdir=${abs_top_srcdir%%/}/
_Dbg_libdir=$abs_top_srcdir
set -- -q # Don't need to show banner
-. $abs_top_srcdir/dbg-pre.sh
+. $abs_top_srcdir/init/pre.sh
. $abs_top_srcdir/lib/msg.sh
. $abs_top_srcdir/lib/fns.sh
. $abs_top_srcdir/lib/frame.sh
@@ -40,7 +40,7 @@ fi
_Dbg_libdir=$abs_top_srcdir
set -- -q # Don't need to show banner
-. ${abs_top_srcdir}dbg-pre.sh
+. ${abs_top_srcdir}init/pre.sh
. ${abs_top_srcdir}lib/filecache.sh
. ${abs_top_srcdir}lib/file.sh
. ${abs_top_srcdir}lib/fns.sh
@@ -44,7 +44,7 @@ abs_top_srcdir=${abs_top_srcdir%%/}/
_Dbg_libdir=$abs_top_srcdir
set -- -q # Don't need to show banner
-. $abs_top_srcdir/dbg-pre.sh
+. $abs_top_srcdir/init/pre.sh
. $abs_top_srcdir/lib/journal.sh
# load shunit2
@@ -32,7 +32,7 @@ test_do_show_version()
# load shunit2
top_srcdir=@top_srcdir@
_Dbg_libdir=@top_srcdir@
-. ${top_srcdir}/dbg-pre.sh
+. ${top_srcdir}/init/pre.sh
# load shunit2
srcdir=@srcdir@
@@ -25,7 +25,7 @@ abs_top_srcdir=${abs_top_srcdir%%/}/
_Dbg_libdir=$abs_top_srcdir
set -- -q # Don't need to show banner
-. $abs_top_srcdir/dbg-pre.sh
+. $abs_top_srcdir/init/pre.sh
. $abs_top_srcdir/lib/journal.sh
. $abs_top_srcdir/lib/save-restore.sh

0 comments on commit 9d4da83

Please sign in to comment.