cgdb-0.6.7/000755 000765 000024 00000000000 12074766277 013432 5ustar00mmuellerstaff000000 000000 cgdb-0.6.7/aclocal.m4000644 000765 000024 00000112672 12074766251 015273 0ustar00mmuellerstaff000000 000000 # generated automatically by aclocal 1.13.1 -*- Autoconf -*- # Copyright (C) 1996-2012 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, [m4_warning([this file was generated for autoconf 2.69. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) # Copyright (C) 2002-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.13' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.13.1], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.13.1])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to # '$srcdir', '$srcdir/..', or '$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is '.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [dnl Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50])dnl # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ([2.52])dnl m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], [$1], [CXX], [depcc="$CXX" am_compiler_list=], [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], [$1], [UPC], [depcc="$UPC" am_compiler_list=], [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi am__universal=false m4_case([$1], [CC], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac], [CXX], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac]) for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES. AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE([dependency-tracking], [dnl AS_HELP_STRING( [--enable-dependency-tracking], [do not reject slow dependency extractors]) AS_HELP_STRING( [--disable-dependency-tracking], [speeds up one-time build])]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl AC_SUBST([am__nodep])dnl _AM_SUBST_NOTMAKE([am__nodep])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named 'Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running 'make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each '.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.65])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [AC_DIAGNOSE([obsolete], [$0: two- and three-arguments forms are deprecated.]) m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if( m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), [ok:ok],, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) AM_MISSING_PROG([AUTOCONF], [autoconf]) AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) AM_MISSING_PROG([AUTOHEADER], [autoheader]) AM_MISSING_PROG([MAKEINFO], [makeinfo]) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # AC_SUBST([mkdir_p], ['$(MKDIR_P)']) # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES([CC])], [m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES([CXX])], [m4_define([AC_PROG_CXX], m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES([OBJC])], [m4_define([AC_PROG_OBJC], m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], [_AM_DEPENDENCIES([OBJCXX])], [m4_define([AC_PROG_OBJCXX], m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl ]) AC_REQUIRE([AM_SILENT_RULES])dnl dnl The testsuite driver may need to know about EXEEXT, so add the dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl ]) dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST([install_sh])]) # Copyright (C) 2003-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Copyright (C) 1998-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_LEX # ----------- # Autoconf leaves LEX=: if lex or flex can't be found. Change that to a # "missing" invocation, for better error output. AC_DEFUN([AM_PROG_LEX], [AC_PREREQ([2.50])dnl AC_REQUIRE([AM_MISSING_HAS_RUN])dnl AC_REQUIRE([AC_PROG_LEX])dnl if test "$LEX" = :; then LEX=${am_missing_run}flex fi]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from 'make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # Copyright (C) 1999-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_CC_C_O # -------------- # Like AC_PROG_CC_C_O, but changed for automake. AC_DEFUN([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC_C_O])dnl AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([compile])dnl # FIXME: we rely on the cache variable name because # there is no other way. set dummy $CC am_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']` eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o if test "$am_t" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi dnl Make sure AC_PROG_CC is never called again, or it will override our dnl setting of CC. m4_define([AC_PROG_CC], [m4_fatal([AC_PROG_CC cannot be called after AM_PROG_CC_C_O])]) ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it is modern enough. # If it is, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= AC_MSG_WARN(['missing' script is too old or missing]) fi ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # -------------------- # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), [1])]) # _AM_SET_OPTIONS(OPTIONS) # ------------------------ # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi if test "$[2]" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT([yes]) # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi AC_CONFIG_COMMANDS_PRE( [AC_MSG_CHECKING([that generated files are newer than configure]) if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi AC_MSG_RESULT([done])]) rm -f conftest.file ]) # Copyright (C) 2009-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SILENT_RULES([DEFAULT]) # -------------------------- # Enable less verbose build rules; with the default set to DEFAULT # ("yes" being less verbose, "no" or empty being verbose). AC_DEFUN([AM_SILENT_RULES], [AC_ARG_ENABLE([silent-rules], [dnl AS_HELP_STRING( [--enable-silent-rules], [less verbose build output (undo: "make V=1")]) AS_HELP_STRING( [--disable-silent-rules], [verbose build output (undo: "make V=0")])dnl ]) case $enable_silent_rules in @%:@ ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; esac dnl dnl A few 'make' implementations (e.g., NonStop OS and NextStep) dnl do not support nested variable expansions. dnl See automake bug#9928 and bug#10237. am_make=${MAKE-make} AC_CACHE_CHECK([whether $am_make supports nested variables], [am_cv_make_support_nested_variables], [if AS_ECHO([['TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi]) if test $am_cv_make_support_nested_variables = yes; then dnl Using '$V' instead of '$(V)' breaks IRIX make. AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AC_SUBST([AM_V])dnl AM_SUBST_NOTMAKE([AM_V])dnl AC_SUBST([AM_DEFAULT_V])dnl AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl AC_SUBST([AM_DEFAULT_VERBOSITY])dnl AM_BACKSLASH='\' AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) # Copyright (C) 2001-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor 'install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in "make install-strip", and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # -------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of 'v7', 'ustar', or 'pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AC_SUBST([AMTAR], ['$${TAR-tar}']) m4_if([$1], [v7], [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], [m4_case([$1], [ustar],, [pax],, [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' _am_tools=${am_cv_prog_tar_$1-$_am_tools} # Do not fold the above two line into one, because Tru64 sh and # Solaris sh will not grok spaces in the rhs of '-'. for _am_tool in $_am_tools do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR m4_include([config/readline_check_version.m4]) cgdb-0.6.7/AUTHORS000644 000765 000024 00000002145 12074441140 014457 0ustar00mmuellerstaff000000 000000 Active Maintainers Bob Rossi is a co founder of cgdb and the main developer. He can be reached at "bob_rossi *at* cox *dot* net". Mike Mueller is a co founder of cgdb. He can be reached at "mmueller *at* cs *dot* uri *dot* edu". Package Maintainers Robert Lemmen is the package maintainer for debian. He can be reached at "robertle *at* semistable *dot* com". Jens Frederich generates binaries for Mac OS X. He can be reached at "jfrederich *at* gmail *dot* com". Contributors Peter Kovacs wrote the cgdbrc infrastructure. He is not longer an active contributor. He can be reached at "peter *at* kovax *dot* org". Steve Folta changed cgdb so that the colors could be completely configurable via the cgdbrc file. This also paved the way for letting cgdb run with a white background color. He can be reached at "steve *at* folta *dot* net". Iain Buclaw provided a syntax highlighter for the D language, so cgdb plays nicely in a gdc development environment. He can be reached at "ibuclaw *at* gdcproject *dot* org". For more information please see http://cgdb.sourceforge.net/ cgdb-0.6.7/cgdb/000755 000765 000024 00000000000 12074766277 014331 5ustar00mmuellerstaff000000 000000 cgdb-0.6.7/ChangeLog000644 000765 000024 00000000000 12074441140 015145 0ustar00mmuellerstaff000000 000000 cgdb-0.6.7/config/000755 000765 000024 00000000000 12074766276 014676 5ustar00mmuellerstaff000000 000000 cgdb-0.6.7/config.h.in000644 000765 000024 00000012342 12074766261 015450 0ustar00mmuellerstaff000000 000000 /* config.h.in. Generated from configure.in by autoheader. */ /* Define to 1 if you have the header file. */ #undef HAVE_CTYPE_H /* curses library */ #undef HAVE_CURSES /* Define to 1 if you have the header file. */ #undef HAVE_CURSES_H /* Cygwin environment */ #undef HAVE_CYGWIN /* have /dev/ptmx */ #undef HAVE_DEV_PTMX /* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ #undef HAVE_DOPRNT /* Define to 1 if you have the header file. */ #undef HAVE_ERRNO_H /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H /* have getopt_long */ #undef HAVE_GETOPT_H /* Define to 1 if you have the header file. */ #undef HAVE_GRP_H /* Define to 1 if you have the header file. */ #undef HAVE_HISTORY_H /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the `m' library (-lm). */ #undef HAVE_LIBM /* readline library available */ #undef HAVE_LIBREADLINE /* Define to 1 if you have the header file. */ #undef HAVE_LIBUTIL_H /* Define to 1 if you have the header file. */ #undef HAVE_LIMITS_H /* Linux environment */ #undef HAVE_LINUX /* Define to 1 if you have the header file. */ #undef HAVE_MATH_H /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* ncurses library */ #undef HAVE_NCURSES /* Define to 1 if you have the header file. */ #undef HAVE_NCURSES_CURSES_H /* Define to 1 if you have the openpty function */ #undef HAVE_OPENPTY /* Define to 1 if you have the header file. */ #undef HAVE_PTY_H /* Define to 1 if you have the header file. */ #undef HAVE_PWD_H /* Define to 1 if you have the header file. */ #undef HAVE_READLINE_H /* Define to 1 if you have the header file. */ #undef HAVE_READLINE_HISTORY_H /* Define to 1 if you have the header file. */ #undef HAVE_READLINE_READLINE_H /* Define to 1 if you have the header file. */ #undef HAVE_REGEX_H /* Define to 1 if you have the header file. */ #undef HAVE_SIGNAL_H /* Define to 1 if you have the header file. */ #undef HAVE_STDARG_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDIO_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_IOCTL_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SELECT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STROPTS_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TIME_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have that is POSIX.1 compatible. */ #undef HAVE_SYS_WAIT_H /* Define to 1 if you have the header file. */ #undef HAVE_TERMIOS_H /* Define to 1 if you have the header file. */ #undef HAVE_TIME_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to 1 if you have the header file. */ #undef HAVE_UTIL_H /* Define to 1 if you have the `vprintf' function. */ #undef HAVE_VPRINTF /* Define to 1 if your C compiler doesn't accept -c and -o together. */ #undef NO_MINUS_C_MINUS_O /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define as the return type of signal handlers (`int' or `void'). */ #undef RETSIGTYPE /* encoded version of the installed readline library */ #undef RL_READLINE_VERSION /* major version of installed readline library */ #undef RL_VERSION_MAJOR /* minor version of installed readline library */ #undef RL_VERSION_MINOR /* Define to 1 if the `setpgrp' function takes no argument. */ #undef SETPGRP_VOID /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Version number of package */ #undef VERSION /* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a `char[]'. */ #undef YYTEXT_POINTER /* Define to empty if `const' does not conform to ANSI C. */ #undef const /* Define to `int' if doesn't define. */ #undef gid_t /* Define to `int' if does not define. */ #undef mode_t /* Define to `int' if does not define. */ #undef pid_t /* Define to `unsigned int' if does not define. */ #undef size_t /* Define to `int' if doesn't define. */ #undef uid_t cgdb-0.6.7/configure000755 000765 000024 00000642324 12074766252 015345 0ustar00mmuellerstaff000000 000000 #! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69 for cgdb 0.6.7. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then _as_can_reexec=no; export _as_can_reexec; # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 as_fn_exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='cgdb' PACKAGE_TARNAME='cgdb' PACKAGE_VERSION='0.6.7' PACKAGE_STRING='cgdb 0.6.7' PACKAGE_BUGREPORT='' PACKAGE_URL='' # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS RL_MINOR RL_MAJOR RL_VERSION EGREP GREP CPP host_os host_vendor host_cpu host build_os build_vendor build_cpu build YFLAGS YACC LEXLIB LEX_OUTPUT_ROOT LEX RANLIB am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE am__nodep AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__quote am__include DEPDIR OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC AM_BACKSLASH AM_DEFAULT_VERBOSITY AM_DEFAULT_V AM_V am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking enable_silent_rules enable_dependency_tracking with_readline with_ncurses with_curses ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS YACC YFLAGS CPP' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures cgdb 0.6.7 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/cgdb] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of cgdb 0.6.7:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-silent-rules less verbose build output (undo: "make V=1") --disable-silent-rules verbose build output (undo: "make V=0") --enable-dependency-tracking do not reject slow dependency extractors --disable-dependency-tracking speeds up one-time build Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-readline=PREFIX Use system installed readline library --with-ncurses=PREFIX Use system installed ncurses library --with-curses=PREFIX Use system installed curses library Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory YACC The `Yet Another Compiler Compiler' implementation to use. Defaults to the first program found out of: `bison -y', `byacc', `yacc'. YFLAGS The list of arguments that will be passed by default to $YACC. This script will default YFLAGS to the empty string to avoid a default value of `-d' given by some make applications. CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to the package provider. _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF cgdb configure 0.6.7 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_check_type LINENO TYPE VAR INCLUDES # ------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache # variable VAR accordingly. ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof ($2)) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof (($2))) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else eval "$3=yes" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by cgdb $as_me 0.6.7, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_aux_dir= for ac_dir in config "$srcdir"/config; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then as_fn_error $? "cannot find install-sh, install.sh, or shtool in config \"$srcdir\"/config" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. ac_config_headers="$ac_config_headers config.h" am__api_version='1.13' # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". as_fn_error $? "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi if test "$2" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$2" = conftest.file ) then # Ok. : else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi rm -f conftest.file test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} fi if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if ${ac_cv_path_mkdir+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. MKDIR_P="$ac_install_sh -d" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null # Check whether --enable-silent-rules was given. if test "${enable_silent_rules+set}" = set; then : enableval=$enable_silent_rules; fi case $enable_silent_rules in # ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=1;; esac am_make=${MAKE-make} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 $as_echo_n "checking whether $am_make supports nested variables... " >&6; } if ${am_cv_make_support_nested_variables+:} false; then : $as_echo_n "(cached) " >&6 else if $as_echo 'TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 $as_echo "$am_cv_make_support_nested_variables" >&6; } if test $am_cv_make_support_nested_variables = yes; then AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AM_BACKSLASH='\' if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='cgdb' VERSION='0.6.7' cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # mkdir_p='$(MKDIR_P)' # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AMTAR='$${TAR-tar}' am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 $as_echo_n "checking for style of include used by $am_make... " >&6; } am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from 'make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 $as_echo "$_am_result" >&6; } rm -f confinc confmf # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then : enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi if test "x$CC" != xcc; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC and cc understand -c and -o together" >&5 $as_echo_n "checking whether $CC and cc understand -c and -o together... " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether cc understands -c and -o together" >&5 $as_echo_n "checking whether cc understands -c and -o together... " >&6; } fi set dummy $CC; ac_cc=`$as_echo "$2" | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` if eval \${ac_cv_prog_cc_${ac_cc}_c_o+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF # Make sure it works both with $CC and with simple cc. # We do the test twice because some compilers refuse to overwrite an # existing .o file with -o, though they will create one. ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&5' rm -f conftest2.* if { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -f conftest2.$ac_objext && { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then eval ac_cv_prog_cc_${ac_cc}_c_o=yes if test "x$CC" != xcc; then # Test first that cc exists at all. if { ac_try='cc -c conftest.$ac_ext >&5' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then ac_try='cc -c conftest.$ac_ext -o conftest2.$ac_objext >&5' rm -f conftest2.* if { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -f conftest2.$ac_objext && { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # cc works too. : else # cc exists but doesn't like -o. eval ac_cv_prog_cc_${ac_cc}_c_o=no fi fi fi else eval ac_cv_prog_cc_${ac_cc}_c_o=no fi rm -f core conftest* fi if eval test \$ac_cv_prog_cc_${ac_cc}_c_o = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "#define NO_MINUS_C_MINUS_O 1" >>confdefs.h fi # FIXME: we rely on the cache variable name because # there is no other way. set dummy $CC am_cc=`echo $2 | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o if test "$am_t" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 $as_echo "$RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 $as_echo "$ac_ct_RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi for ac_prog in flex lex do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_LEX+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$LEX"; then ac_cv_prog_LEX="$LEX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_LEX="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi LEX=$ac_cv_prog_LEX if test -n "$LEX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LEX" >&5 $as_echo "$LEX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$LEX" && break done test -n "$LEX" || LEX=":" if test "x$LEX" != "x:"; then cat >conftest.l <<_ACEOF %% a { ECHO; } b { REJECT; } c { yymore (); } d { yyless (1); } e { /* IRIX 6.5 flex 2.5.4 underquotes its yyless argument. */ yyless ((input () != 0)); } f { unput (yytext[0]); } . { BEGIN INITIAL; } %% #ifdef YYTEXT_POINTER extern char *yytext; #endif int main (void) { return ! yylex () + ! yywrap (); } _ACEOF { { ac_try="$LEX conftest.l" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$LEX conftest.l") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking lex output file root" >&5 $as_echo_n "checking lex output file root... " >&6; } if ${ac_cv_prog_lex_root+:} false; then : $as_echo_n "(cached) " >&6 else if test -f lex.yy.c; then ac_cv_prog_lex_root=lex.yy elif test -f lexyy.c; then ac_cv_prog_lex_root=lexyy else as_fn_error $? "cannot find output from $LEX; giving up" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_lex_root" >&5 $as_echo "$ac_cv_prog_lex_root" >&6; } LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root if test -z "${LEXLIB+set}"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking lex library" >&5 $as_echo_n "checking lex library... " >&6; } if ${ac_cv_lib_lex+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_LIBS=$LIBS ac_cv_lib_lex='none needed' for ac_lib in '' -lfl -ll; do LIBS="$ac_lib $ac_save_LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ `cat $LEX_OUTPUT_ROOT.c` _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_lex=$ac_lib fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext test "$ac_cv_lib_lex" != 'none needed' && break done LIBS=$ac_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lex" >&5 $as_echo "$ac_cv_lib_lex" >&6; } test "$ac_cv_lib_lex" != 'none needed' && LEXLIB=$ac_cv_lib_lex fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether yytext is a pointer" >&5 $as_echo_n "checking whether yytext is a pointer... " >&6; } if ${ac_cv_prog_lex_yytext_pointer+:} false; then : $as_echo_n "(cached) " >&6 else # POSIX says lex can declare yytext either as a pointer or an array; the # default is implementation-dependent. Figure out which it is, since # not all implementations provide the %pointer and %array declarations. ac_cv_prog_lex_yytext_pointer=no ac_save_LIBS=$LIBS LIBS="$LEXLIB $ac_save_LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define YYTEXT_POINTER 1 `cat $LEX_OUTPUT_ROOT.c` _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_prog_lex_yytext_pointer=yes fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_lex_yytext_pointer" >&5 $as_echo "$ac_cv_prog_lex_yytext_pointer" >&6; } if test $ac_cv_prog_lex_yytext_pointer = yes; then $as_echo "#define YYTEXT_POINTER 1" >>confdefs.h fi rm -f conftest.l $LEX_OUTPUT_ROOT.c fi if test "$LEX" = :; then LEX=${am_missing_run}flex fi for ac_prog in 'bison -y' byacc do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_YACC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$YACC"; then ac_cv_prog_YACC="$YACC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_YACC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi YACC=$ac_cv_prog_YACC if test -n "$YACC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $YACC" >&5 $as_echo "$YACC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$YACC" && break done test -n "$YACC" || YACC="yacc" # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } if ${ac_cv_build+:} false; then : $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } if ${ac_cv_host+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac case $host in *-*-linux*) $as_echo "#define HAVE_LINUX 1" >>confdefs.h ;; *-*-cygwin*) $as_echo "#define HAVE_CYGWIN 1" >>confdefs.h ;; *) ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sys/wait.h that is POSIX.1 compatible" >&5 $as_echo_n "checking for sys/wait.h that is POSIX.1 compatible... " >&6; } if ${ac_cv_header_sys_wait_h+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #ifndef WEXITSTATUS # define WEXITSTATUS(stat_val) ((unsigned int) (stat_val) >> 8) #endif #ifndef WIFEXITED # define WIFEXITED(stat_val) (((stat_val) & 255) == 0) #endif int main () { int s; wait (&s); s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_sys_wait_h=yes else ac_cv_header_sys_wait_h=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_sys_wait_h" >&5 $as_echo "$ac_cv_header_sys_wait_h" >&6; } if test $ac_cv_header_sys_wait_h = yes; then $as_echo "#define HAVE_SYS_WAIT_H 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in pty.h sys/stropts.h util.h libutil.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in termios.h do : ac_fn_c_check_header_mongrel "$LINENO" "termios.h" "ac_cv_header_termios_h" "$ac_includes_default" if test "x$ac_cv_header_termios_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_TERMIOS_H 1 _ACEOF else as_fn_error $? "CGDB requires termios.h to build." "$LINENO" 5 fi done for ac_header in sys/select.h do : ac_fn_c_check_header_mongrel "$LINENO" "sys/select.h" "ac_cv_header_sys_select_h" "$ac_includes_default" if test "x$ac_cv_header_sys_select_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SYS_SELECT_H 1 _ACEOF else as_fn_error $? "CGDB requires sys/select.h to build." "$LINENO" 5 fi done for ac_header in errno.h do : ac_fn_c_check_header_mongrel "$LINENO" "errno.h" "ac_cv_header_errno_h" "$ac_includes_default" if test "x$ac_cv_header_errno_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_ERRNO_H 1 _ACEOF else as_fn_error $? "CGDB requires errno.h to build." "$LINENO" 5 fi done for ac_header in fcntl.h do : ac_fn_c_check_header_mongrel "$LINENO" "fcntl.h" "ac_cv_header_fcntl_h" "$ac_includes_default" if test "x$ac_cv_header_fcntl_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_FCNTL_H 1 _ACEOF else as_fn_error $? "CGDB requires fcntl.h to build." "$LINENO" 5 fi done for ac_header in grp.h do : ac_fn_c_check_header_mongrel "$LINENO" "grp.h" "ac_cv_header_grp_h" "$ac_includes_default" if test "x$ac_cv_header_grp_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_GRP_H 1 _ACEOF else as_fn_error $? "CGDB requires grp.h to build." "$LINENO" 5 fi done for ac_header in pwd.h do : ac_fn_c_check_header_mongrel "$LINENO" "pwd.h" "ac_cv_header_pwd_h" "$ac_includes_default" if test "x$ac_cv_header_pwd_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_PWD_H 1 _ACEOF else as_fn_error $? "CGDB requires pwd.h to build." "$LINENO" 5 fi done for ac_header in signal.h do : ac_fn_c_check_header_mongrel "$LINENO" "signal.h" "ac_cv_header_signal_h" "$ac_includes_default" if test "x$ac_cv_header_signal_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SIGNAL_H 1 _ACEOF else as_fn_error $? "CGDB requires signal.h to build." "$LINENO" 5 fi done for ac_header in stdarg.h do : ac_fn_c_check_header_mongrel "$LINENO" "stdarg.h" "ac_cv_header_stdarg_h" "$ac_includes_default" if test "x$ac_cv_header_stdarg_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STDARG_H 1 _ACEOF else as_fn_error $? "CGDB requires stdarg.h to build." "$LINENO" 5 fi done for ac_header in stdio.h do : ac_fn_c_check_header_mongrel "$LINENO" "stdio.h" "ac_cv_header_stdio_h" "$ac_includes_default" if test "x$ac_cv_header_stdio_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STDIO_H 1 _ACEOF else as_fn_error $? "CGDB requires stdio.h to build." "$LINENO" 5 fi done for ac_header in stdlib.h do : ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" if test "x$ac_cv_header_stdlib_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STDLIB_H 1 _ACEOF else as_fn_error $? "CGDB requires stdlib.h to build." "$LINENO" 5 fi done for ac_header in string.h do : ac_fn_c_check_header_mongrel "$LINENO" "string.h" "ac_cv_header_string_h" "$ac_includes_default" if test "x$ac_cv_header_string_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRING_H 1 _ACEOF else as_fn_error $? "CGDB requires string.h to build." "$LINENO" 5 fi done for ac_header in sys/ioctl.h do : ac_fn_c_check_header_mongrel "$LINENO" "sys/ioctl.h" "ac_cv_header_sys_ioctl_h" "$ac_includes_default" if test "x$ac_cv_header_sys_ioctl_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SYS_IOCTL_H 1 _ACEOF else as_fn_error $? "CGDB requires sys/ioctl.h to build." "$LINENO" 5 fi done for ac_header in sys/stat.h do : ac_fn_c_check_header_mongrel "$LINENO" "sys/stat.h" "ac_cv_header_sys_stat_h" "$ac_includes_default" if test "x$ac_cv_header_sys_stat_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SYS_STAT_H 1 _ACEOF else as_fn_error $? "CGDB requires sys/stat.h to build." "$LINENO" 5 fi done for ac_header in sys/time.h do : ac_fn_c_check_header_mongrel "$LINENO" "sys/time.h" "ac_cv_header_sys_time_h" "$ac_includes_default" if test "x$ac_cv_header_sys_time_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SYS_TIME_H 1 _ACEOF else as_fn_error $? "CGDB requires sys/time.h to build." "$LINENO" 5 fi done for ac_header in time.h do : ac_fn_c_check_header_mongrel "$LINENO" "time.h" "ac_cv_header_time_h" "$ac_includes_default" if test "x$ac_cv_header_time_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_TIME_H 1 _ACEOF else as_fn_error $? "CGDB requires time.h to build." "$LINENO" 5 fi done for ac_header in sys/types.h do : ac_fn_c_check_header_mongrel "$LINENO" "sys/types.h" "ac_cv_header_sys_types_h" "$ac_includes_default" if test "x$ac_cv_header_sys_types_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SYS_TYPES_H 1 _ACEOF else as_fn_error $? "CGDB requires sys/types.h to build." "$LINENO" 5 fi done for ac_header in unistd.h do : ac_fn_c_check_header_mongrel "$LINENO" "unistd.h" "ac_cv_header_unistd_h" "$ac_includes_default" if test "x$ac_cv_header_unistd_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_UNISTD_H 1 _ACEOF else as_fn_error $? "CGDB requires unistd.h to build." "$LINENO" 5 fi done for ac_header in ctype.h do : ac_fn_c_check_header_mongrel "$LINENO" "ctype.h" "ac_cv_header_ctype_h" "$ac_includes_default" if test "x$ac_cv_header_ctype_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_CTYPE_H 1 _ACEOF else as_fn_error $? "CGDB requires ctype.h to build." "$LINENO" 5 fi done for ac_header in limits.h do : ac_fn_c_check_header_mongrel "$LINENO" "limits.h" "ac_cv_header_limits_h" "$ac_includes_default" if test "x$ac_cv_header_limits_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIMITS_H 1 _ACEOF else as_fn_error $? "CGDB requires limits.h to build." "$LINENO" 5 fi done for ac_header in math.h do : ac_fn_c_check_header_mongrel "$LINENO" "math.h" "ac_cv_header_math_h" "$ac_includes_default" if test "x$ac_cv_header_math_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_MATH_H 1 _ACEOF else as_fn_error $? "CGDB requires math.h to build." "$LINENO" 5 fi done for ac_header in regex.h do : ac_fn_c_check_header_mongrel "$LINENO" "regex.h" "ac_cv_header_regex_h" "$ac_includes_default" if test "x$ac_cv_header_regex_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_REGEX_H 1 _ACEOF else as_fn_error $? "CGDB requires regex.h to build." "$LINENO" 5 fi done for ac_header in curses.h do : ac_fn_c_check_header_mongrel "$LINENO" "curses.h" "ac_cv_header_curses_h" "$ac_includes_default" if test "x$ac_cv_header_curses_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_CURSES_H 1 _ACEOF else for ac_header in ncurses/curses.h do : ac_fn_c_check_header_mongrel "$LINENO" "ncurses/curses.h" "ac_cv_header_ncurses_curses_h" "$ac_includes_default" if test "x$ac_cv_header_ncurses_curses_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_NCURSES_CURSES_H 1 _ACEOF else as_fn_error $? "CGDB requires curses.h or ncurses/curses.h to build." "$LINENO" 5 fi done fi done for ac_header in getopt.h do : ac_fn_c_check_header_mongrel "$LINENO" "getopt.h" "ac_cv_header_getopt_h" "$ac_includes_default" if test "x$ac_cv_header_getopt_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_GETOPT_H 1 _ACEOF $as_echo "#define HAVE_GETOPT_H 1" >>confdefs.h fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for /dev/ptmx" >&5 $as_echo_n "checking for /dev/ptmx... " >&6; } if ${ac_cv_file__dev_ptmx+:} false; then : $as_echo_n "(cached) " >&6 else test "$cross_compiling" = yes && as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5 if test -r "/dev/ptmx"; then ac_cv_file__dev_ptmx=yes else ac_cv_file__dev_ptmx=no fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_file__dev_ptmx" >&5 $as_echo "$ac_cv_file__dev_ptmx" >&6; } if test "x$ac_cv_file__dev_ptmx" = xyes; then : $as_echo "#define HAVE_DEV_PTMX 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 $as_echo_n "checking for an ANSI C-conforming const... " >&6; } if ${ac_cv_c_const+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __cplusplus /* Ultrix mips cc rejects this sort of thing. */ typedef int charset[2]; const charset cs = { 0, 0 }; /* SunOS 4.1.1 cc rejects this. */ char const *const *pcpcc; char **ppc; /* NEC SVR4.0.2 mips cc rejects this. */ struct point {int x, y;}; static struct point const zero = {0,0}; /* AIX XL C 1.02.0.0 rejects this. It does not let you subtract one const X* pointer from another in an arm of an if-expression whose if-part is not a constant expression */ const char *g = "string"; pcpcc = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ ++pcpcc; ppc = (char**) pcpcc; pcpcc = (char const *const *) ppc; { /* SCO 3.2v4 cc rejects this sort of thing. */ char tx; char *t = &tx; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 0; if (s) return 0; } { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ int x[] = {25, 17}; const int *foo = &x[0]; ++foo; } { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ typedef const int *iptr; iptr p = 0; ++p; } { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; } bx; struct s *b = &bx; b->j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; if (!foo) return 0; } return !cs[0] && !zero.x; #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_const=yes else ac_cv_c_const=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 $as_echo "$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then $as_echo "#define const /**/" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uid_t in sys/types.h" >&5 $as_echo_n "checking for uid_t in sys/types.h... " >&6; } if ${ac_cv_type_uid_t+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "uid_t" >/dev/null 2>&1; then : ac_cv_type_uid_t=yes else ac_cv_type_uid_t=no fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_uid_t" >&5 $as_echo "$ac_cv_type_uid_t" >&6; } if test $ac_cv_type_uid_t = no; then $as_echo "#define uid_t int" >>confdefs.h $as_echo "#define gid_t int" >>confdefs.h fi ac_fn_c_check_type "$LINENO" "mode_t" "ac_cv_type_mode_t" "$ac_includes_default" if test "x$ac_cv_type_mode_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define mode_t int _ACEOF fi ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default" if test "x$ac_cv_type_pid_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define pid_t int _ACEOF fi ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" if test "x$ac_cv_type_size_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define size_t unsigned int _ACEOF fi if test $ac_cv_c_compiler_gnu = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC needs -traditional" >&5 $as_echo_n "checking whether $CC needs -traditional... " >&6; } if ${ac_cv_prog_gcc_traditional+:} false; then : $as_echo_n "(cached) " >&6 else ac_pattern="Autoconf.*'x'" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include Autoconf TIOCGETP _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "$ac_pattern" >/dev/null 2>&1; then : ac_cv_prog_gcc_traditional=yes else ac_cv_prog_gcc_traditional=no fi rm -f conftest* if test $ac_cv_prog_gcc_traditional = no; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include Autoconf TCGETA _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "$ac_pattern" >/dev/null 2>&1; then : ac_cv_prog_gcc_traditional=yes fi rm -f conftest* fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_gcc_traditional" >&5 $as_echo "$ac_cv_prog_gcc_traditional" >&6; } if test $ac_cv_prog_gcc_traditional = yes; then CC="$CC -traditional" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether setpgrp takes no argument" >&5 $as_echo_n "checking whether setpgrp takes no argument... " >&6; } if ${ac_cv_func_setpgrp_void+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : as_fn_error $? "cannot check setpgrp when cross compiling" "$LINENO" 5 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { /* If this system has a BSD-style setpgrp which takes arguments, setpgrp(1, 1) will fail with ESRCH and return -1, in that case exit successfully. */ return setpgrp (1,1) != -1; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_setpgrp_void=no else ac_cv_func_setpgrp_void=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_setpgrp_void" >&5 $as_echo "$ac_cv_func_setpgrp_void" >&6; } if test $ac_cv_func_setpgrp_void = yes; then $as_echo "#define SETPGRP_VOID 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking return type of signal handlers" >&5 $as_echo_n "checking return type of signal handlers... " >&6; } if ${ac_cv_type_signal+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { return *(signal (0, 0)) (0) == 1; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_type_signal=int else ac_cv_type_signal=void fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_signal" >&5 $as_echo "$ac_cv_type_signal" >&6; } cat >>confdefs.h <<_ACEOF #define RETSIGTYPE $ac_cv_type_signal _ACEOF for ac_func in vprintf do : ac_fn_c_check_func "$LINENO" "vprintf" "ac_cv_func_vprintf" if test "x$ac_cv_func_vprintf" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_VPRINTF 1 _ACEOF ac_fn_c_check_func "$LINENO" "_doprnt" "ac_cv_func__doprnt" if test "x$ac_cv_func__doprnt" = xyes; then : $as_echo "#define HAVE_DOPRNT 1" >>confdefs.h fi fi done ac_fn_c_check_func "$LINENO" "putenv" "ac_cv_func_putenv" if test "x$ac_cv_func_putenv" = xyes; then : else as_fn_error $? "CGDB requires putenv to build." "$LINENO" 5 fi ac_fn_c_check_func "$LINENO" "select" "ac_cv_func_select" if test "x$ac_cv_func_select" = xyes; then : else as_fn_error $? "CGDB requires select to build." "$LINENO" 5 fi ac_fn_c_check_func "$LINENO" "strdup" "ac_cv_func_strdup" if test "x$ac_cv_func_strdup" = xyes; then : else as_fn_error $? "CGDB requires strdup to build." "$LINENO" 5 fi ac_fn_c_check_func "$LINENO" "strerror" "ac_cv_func_strerror" if test "x$ac_cv_func_strerror" = xyes; then : else as_fn_error $? "CGDB requires strerror to build." "$LINENO" 5 fi ac_fn_c_check_func "$LINENO" "openpty" "ac_cv_func_openpty" if test "x$ac_cv_func_openpty" = xyes; then : $as_echo "#define HAVE_OPENPTY 1" >>confdefs.h fi opt_with_readline_prefix=no use_ncurses_library=yes opt_with_ncurses_prefix=no opt_with_curses_prefix=no # Check whether --with-readline was given. if test "${with_readline+set}" = set; then : withval=$with_readline; opt_with_readline_prefix=$withval fi # Check whether --with-ncurses was given. if test "${with_ncurses+set}" = set; then : withval=$with_ncurses; opt_with_ncurses_prefix=$withval fi # Check whether --with-curses was given. if test "${with_curses+set}" = set; then : withval=$with_curses; opt_with_curses_prefix=$withval use_ncurses_library=no fi if test "$opt_with_readline_prefix" != "no"; then # If set to "yes", it is on the compilers include path. if test "$opt_with_readline_prefix" != "yes"; then LDFLAGS="-L$opt_with_readline_prefix/lib $LDFLAGS" CFLAGS="-I$opt_with_readline_prefix/include -I$opt_with_readline_prefix/include/readline $CFLAGS" CPPFLAGS="-I$opt_with_readline_prefix/include -I$opt_with_readline_prefix/include/readline $CPPFLAGS" fi fi if test "$opt_with_ncurses_prefix" != "no"; then # If set to "yes", it is on the compilers include path. if test "$opt_with_curses_prefix" != "yes"; then LDFLAGS="-L$opt_with_ncurses_prefix/lib $LDFLAGS" CFLAGS="-I$opt_with_ncurses_prefix/include -I$opt_with_ncurses_prefix/include/ncurses $CFLAGS" CPPFLAGS="-I$opt_with_ncurses_prefix/include -I$opt_with_ncurses_prefix/include/ncurses $CPPFLAGS" fi fi if test "$opt_with_curses_prefix" != "no"; then # If set to "yes", it is on the compilers include path. if test "$opt_with_curses_prefix" != "yes"; then LDFLAGS="-L$opt_with_curses_prefix/lib $LDFLAGS" CFLAGS="-I$opt_with_curses_prefix/include $CFLAGS" CPPFLAGS="-I$opt_with_curses_prefix/include $CPPFLAGS" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for log10 in -lm" >&5 $as_echo_n "checking for log10 in -lm... " >&6; } if ${ac_cv_lib_m_log10+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char log10 (); int main () { return log10 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_m_log10=yes else ac_cv_lib_m_log10=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_log10" >&5 $as_echo "$ac_cv_lib_m_log10" >&6; } if test "x$ac_cv_lib_m_log10" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBM 1 _ACEOF LIBS="-lm $LIBS" fi if test "$use_ncurses_library" = "yes"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for initscr in -lncurses" >&5 $as_echo_n "checking for initscr in -lncurses... " >&6; } if ${ac_cv_lib_ncurses_initscr+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lncurses $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char initscr (); int main () { return initscr (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_ncurses_initscr=yes else ac_cv_lib_ncurses_initscr=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ncurses_initscr" >&5 $as_echo "$ac_cv_lib_ncurses_initscr" >&6; } if test "x$ac_cv_lib_ncurses_initscr" = xyes; then : $as_echo "#define HAVE_NCURSES 1" >>confdefs.h else as_fn_error $? "cgdb needs ncurses/curses to build. ncurses is strongly recommended. If your system does not have ncurses get it! If that is not an option try 'configure --with-curses.' You can try --with-ncurses=/foo/ncurses to tell configure where ncurses is." "$LINENO" 5 fi curses_lib_name="ncurses" fi if test "$use_ncurses_library" = "no"; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: ***************************************************** cgdb may not run properly when linked against curses! *****************************************************" >&5 $as_echo "$as_me: WARNING: ***************************************************** cgdb may not run properly when linked against curses! *****************************************************" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: checking for initscr in -lcurses" >&5 $as_echo_n "checking for initscr in -lcurses... " >&6; } if ${ac_cv_lib_curses_initscr+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lcurses $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char initscr (); int main () { return initscr (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_curses_initscr=yes else ac_cv_lib_curses_initscr=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_curses_initscr" >&5 $as_echo "$ac_cv_lib_curses_initscr" >&6; } if test "x$ac_cv_lib_curses_initscr" = xyes; then : $as_echo "#define HAVE_CURSES 1" >>confdefs.h else as_fn_error $? "cgdb needs ncurses/curses to build. ncurses is strongly recommended. If your system does not have ncurses get it! You can try --with-curses=/foo/curses to tell configure where curses is." "$LINENO" 5 fi curses_lib_name="curses" fi if test "X$bash_cv_termcap_lib" = "X"; then _bash_needmsg=yes else { $as_echo "$as_me:${as_lineno-$LINENO}: checking which library has the termcap functions" >&5 $as_echo_n "checking which library has the termcap functions... " >&6; } _bash_needmsg= fi if ${bash_cv_termcap_lib+:} false; then : $as_echo_n "(cached) " >&6 else as_ac_Lib=`$as_echo "ac_cv_lib_$curses_lib_name''_tgetent" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tgetent in -l$curses_lib_name" >&5 $as_echo_n "checking for tgetent in -l$curses_lib_name... " >&6; } if eval \${$as_ac_Lib+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-l$curses_lib_name $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char tgetent (); int main () { return tgetent (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$as_ac_Lib=yes" else eval "$as_ac_Lib=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi eval ac_res=\$$as_ac_Lib { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : bash_cv_termcap_lib=lib$curses_lib_name else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tgetent in -ltinfo" >&5 $as_echo_n "checking for tgetent in -ltinfo... " >&6; } if ${ac_cv_lib_tinfo_tgetent+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ltinfo $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char tgetent (); int main () { return tgetent (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_tinfo_tgetent=yes else ac_cv_lib_tinfo_tgetent=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_tinfo_tgetent" >&5 $as_echo "$ac_cv_lib_tinfo_tgetent" >&6; } if test "x$ac_cv_lib_tinfo_tgetent" = xyes; then : bash_cv_termcap_lib=libtinfo else ac_fn_c_check_func "$LINENO" "tgetent" "ac_cv_func_tgetent" if test "x$ac_cv_func_tgetent" = xyes; then : bash_cv_termcap_lib=libc else bash_cv_termcap_lib=gnutermcap fi fi fi fi if test "X$_bash_needmsg" = "Xyes"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking which library has the termcap functions" >&5 $as_echo_n "checking which library has the termcap functions... " >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: using $bash_cv_termcap_lib" >&5 $as_echo "using $bash_cv_termcap_lib" >&6; } if test $bash_cv_termcap_lib = gnutermcap && test -z "$prefer_curses"; then LDFLAGS="$LDFLAGS -L./lib/termcap" TERMCAP_LIB="./lib/termcap/libtermcap.a" TERMCAP_DEP="./lib/termcap/libtermcap.a" elif test $bash_cv_termcap_lib = libtinfo; then TERMCAP_LIB=-ltinfo TERMCAP_DEP= elif test $bash_cv_termcap_lib = lib$curses_lib_name; then TERMCAP_LIB=-l$curses_lib_name TERMCAP_DEP= elif test $bash_cv_termcap_lib = libc; then TERMCAP_LIB= TERMCAP_DEP= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking version of installed readline library" >&5 $as_echo_n "checking version of installed readline library... " >&6; } # What a pain in the ass this is. # save cpp and ld options _save_CFLAGS="$CFLAGS" _save_LDFLAGS="$LDFLAGS" _save_LIBS="$LIBS" # Don't set ac_cv_rl_prefix if the caller has already assigned a value. This # allows the caller to do something like $_rl_prefix=$withval if the user # specifies --with-installed-readline=PREFIX as an argument to configure if test -z "$ac_cv_rl_prefix"; then test "x$prefix" = xNONE && ac_cv_rl_prefix=$ac_default_prefix || ac_cv_rl_prefix=${prefix} fi eval ac_cv_rl_includedir=${ac_cv_rl_prefix}/include eval ac_cv_rl_libdir=${ac_cv_rl_prefix}/lib LIBS="$LIBS -lreadline ${TERMCAP_LIB}" CFLAGS="$CFLAGS -I${ac_cv_rl_includedir}" LDFLAGS="$LDFLAGS -L${ac_cv_rl_libdir}" if ${ac_cv_rl_version+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_rl_version='4.2' else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include main() { FILE *fp; fp = fopen("conftest.rlv", "w"); if (fp == 0) exit(1); fprintf(fp, "%s\n", rl_library_version ? rl_library_version : "0.0"); fclose(fp); exit(0); } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_rl_version=`cat conftest.rlv` else ac_cv_rl_version='0.0' fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi CFLAGS="$_save_CFLAGS" LDFLAGS="$_save_LDFLAGS" LIBS="$_save_LIBS" RL_MAJOR=0 RL_MINOR=0 # ( case "$ac_cv_rl_version" in 2*|3*|4*|5*|6*|7*|8*|9*) RL_MAJOR=`echo $ac_cv_rl_version | sed 's:\..*$::'` RL_MINOR=`echo $ac_cv_rl_version | sed -e 's:^.*\.::' -e 's:[a-zA-Z]*$::'` ;; esac # ((( case $RL_MAJOR in [0-9][0-9]) _RL_MAJOR=$RL_MAJOR ;; [0-9]) _RL_MAJOR=0$RL_MAJOR ;; *) _RL_MAJOR=00 ;; esac # ((( case $RL_MINOR in [0-9][0-9]) _RL_MINOR=$RL_MINOR ;; [0-9]) _RL_MINOR=0$RL_MINOR ;; *) _RL_MINOR=00 ;; esac RL_VERSION="0x${_RL_MAJOR}${_RL_MINOR}" # Readline versions greater than 4.2 have these defines in readline.h if test "$ac_cv_rl_version" = '0.0' ; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Could not test version of installed readline library." >&5 $as_echo "$as_me: WARNING: Could not test version of installed readline library." >&2;} elif test $RL_MAJOR -gt 4 || { test $RL_MAJOR = 4 && test $RL_MINOR -gt 2 ; } ; then # set these for use by the caller RL_PREFIX=$ac_cv_rl_prefix RL_LIBDIR=$ac_cv_rl_libdir RL_INCLUDEDIR=$ac_cv_rl_includedir { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_rl_version" >&5 $as_echo "$ac_cv_rl_version" >&6; } else cat >>confdefs.h <<_ACEOF #define RL_READLINE_VERSION $RL_VERSION _ACEOF cat >>confdefs.h <<_ACEOF #define RL_VERSION_MAJOR $RL_MAJOR _ACEOF cat >>confdefs.h <<_ACEOF #define RL_VERSION_MINOR $RL_MINOR _ACEOF # set these for use by the caller RL_PREFIX=$ac_cv_rl_prefix RL_LIBDIR=$ac_cv_rl_libdir RL_INCLUDEDIR=$ac_cv_rl_includedir { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_rl_version" >&5 $as_echo "$ac_cv_rl_version" >&6; } fi case "$ac_cv_rl_version" in 5.1*|5.2*|5.3*|5.4*|5.5*|5.6*|5.7*|5.8*|5.9*|6*|7*|8*|9*) ;; *) as_fn_error $? "CGDB requires GNU readline 5.1 or greater to link. If you used --with-readline instead of using the system readline library, make sure to set the correct readline library on the linker search path via LD_LIBRARY_PATH or some other facility." "$LINENO" 5 ;; esac $as_echo "#define HAVE_LIBREADLINE 1" >>confdefs.h for ac_header in readline.h do : ac_fn_c_check_header_mongrel "$LINENO" "readline.h" "ac_cv_header_readline_h" "$ac_includes_default" if test "x$ac_cv_header_readline_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_READLINE_H 1 _ACEOF is_readline_header_found="true" else is_readline_header_found="false" fi done if test "x$is_readline_header_found" = "xfalse"; then for ac_header in readline/readline.h do : ac_fn_c_check_header_mongrel "$LINENO" "readline/readline.h" "ac_cv_header_readline_readline_h" "$ac_includes_default" if test "x$ac_cv_header_readline_readline_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_READLINE_READLINE_H 1 _ACEOF is_readline_header_found="true" else is_readline_header_found="false" fi done if test "x$is_readline_header_found" = "xfalse"; then as_fn_error $? "cgdb needs readline.h or readline/readline.h to build" "$LINENO" 5 fi fi for ac_header in history.h do : ac_fn_c_check_header_mongrel "$LINENO" "history.h" "ac_cv_header_history_h" "$ac_includes_default" if test "x$ac_cv_header_history_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_HISTORY_H 1 _ACEOF is_history_header_found="true" else is_history_header_found="false" fi done if test "x$is_history_header_found" = "xfalse"; then for ac_header in readline/history.h do : ac_fn_c_check_header_mongrel "$LINENO" "readline/history.h" "ac_cv_header_readline_history_h" "$ac_includes_default" if test "x$ac_cv_header_readline_history_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_READLINE_HISTORY_H 1 _ACEOF is_history_header_found="true" else is_readline_header_found="false" fi done if test "x$is_history_header_found" = "xfalse"; then as_fn_error $? "cgdb needs history.h or readline/history.h to build" "$LINENO" 5 fi fi LIBS="-lreadline $TERMCAP_LIB $LIBS" if test "$TERMCAP_LIB" != "-l$curses_lib_name"; then LIBS="-l$curses_lib_name $LIBS" fi ac_config_files="$ac_config_files Makefile lib/Makefile lib/adt/Makefile lib/gdbmi/Makefile lib/kui/Makefile lib/rline/Makefile lib/tgdb/Makefile lib/tgdb/annotate-two/Makefile lib/tgdb/gdbmi/Makefile lib/tgdb/tgdb-base/Makefile lib/tokenizer/Makefile lib/util/Makefile doc/Makefile cgdb/Makefile test/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs { $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 $as_echo_n "checking that generated files are newer than configure... " >&6; } if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 $as_echo "done" >&6; } if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then as_fn_error $? "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by cgdb $as_me 0.6.7, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to the package provider." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ cgdb config.status 0.6.7 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "lib/Makefile") CONFIG_FILES="$CONFIG_FILES lib/Makefile" ;; "lib/adt/Makefile") CONFIG_FILES="$CONFIG_FILES lib/adt/Makefile" ;; "lib/gdbmi/Makefile") CONFIG_FILES="$CONFIG_FILES lib/gdbmi/Makefile" ;; "lib/kui/Makefile") CONFIG_FILES="$CONFIG_FILES lib/kui/Makefile" ;; "lib/rline/Makefile") CONFIG_FILES="$CONFIG_FILES lib/rline/Makefile" ;; "lib/tgdb/Makefile") CONFIG_FILES="$CONFIG_FILES lib/tgdb/Makefile" ;; "lib/tgdb/annotate-two/Makefile") CONFIG_FILES="$CONFIG_FILES lib/tgdb/annotate-two/Makefile" ;; "lib/tgdb/gdbmi/Makefile") CONFIG_FILES="$CONFIG_FILES lib/tgdb/gdbmi/Makefile" ;; "lib/tgdb/tgdb-base/Makefile") CONFIG_FILES="$CONFIG_FILES lib/tgdb/tgdb-base/Makefile" ;; "lib/tokenizer/Makefile") CONFIG_FILES="$CONFIG_FILES lib/tokenizer/Makefile" ;; "lib/util/Makefile") CONFIG_FILES="$CONFIG_FILES lib/util/Makefile" ;; "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; "cgdb/Makefile") CONFIG_FILES="$CONFIG_FILES cgdb/Makefile" ;; "test/Makefile") CONFIG_FILES="$CONFIG_FILES test/Makefile" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_tt=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi # Compute "$ac_file"'s index in $config_headers. _am_arg="$ac_file" _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'`/stamp-h$_am_stamp_count ;; :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || { # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named 'Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running 'make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir=$dirpart/$fdir; as_fn_mkdir_p # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi cgdb-0.6.7/configure.in000644 000765 000024 00000021030 12074766251 015727 0ustar00mmuellerstaff000000 000000 dnl Process this file with autoconf to produce a configure script. AC_PREREQ(2.5) AC_INIT(cgdb, 0.6.7) AC_CONFIG_AUX_DIR(config) AC_CONFIG_HEADERS(config.h) AM_INIT_AUTOMAKE dnl Checks for programs. AC_PROG_CC AM_PROG_CC_C_O AC_PROG_INSTALL AC_PROG_RANLIB AM_PROG_LEX AC_PROG_YACC dnl determine if we are running in linux, cygwin, solaris, or freebsd AC_CANONICAL_HOST case $host in *-*-linux*) AC_DEFINE(HAVE_LINUX, 1, Linux environment) ;; *-*-cygwin*) AC_DEFINE(HAVE_CYGWIN, 1, Cygwin environment) ;; *) ;; esac dnl Checks for header files. AC_HEADER_STDC AC_HEADER_SYS_WAIT dnl determine if terminal headers are available for opening pty dnl these need only be optionally available AC_CHECK_HEADERS(pty.h sys/stropts.h util.h libutil.h) AC_CHECK_HEADERS([termios.h],,[AC_MSG_ERROR([CGDB requires termios.h to build.])]) AC_CHECK_HEADERS([sys/select.h],,[AC_MSG_ERROR([CGDB requires sys/select.h to build.])]) AC_CHECK_HEADERS([errno.h],,[AC_MSG_ERROR([CGDB requires errno.h to build.])]) AC_CHECK_HEADERS([fcntl.h],,[AC_MSG_ERROR([CGDB requires fcntl.h to build.])]) AC_CHECK_HEADERS([grp.h],,[AC_MSG_ERROR([CGDB requires grp.h to build.])]) AC_CHECK_HEADERS([pwd.h],,[AC_MSG_ERROR([CGDB requires pwd.h to build.])]) AC_CHECK_HEADERS([signal.h],,[AC_MSG_ERROR([CGDB requires signal.h to build.])]) AC_CHECK_HEADERS([stdarg.h],,[AC_MSG_ERROR([CGDB requires stdarg.h to build.])]) AC_CHECK_HEADERS([stdio.h],,[AC_MSG_ERROR([CGDB requires stdio.h to build.])]) AC_CHECK_HEADERS([stdlib.h],,[AC_MSG_ERROR([CGDB requires stdlib.h to build.])]) AC_CHECK_HEADERS([string.h],,[AC_MSG_ERROR([CGDB requires string.h to build.])]) AC_CHECK_HEADERS([sys/ioctl.h],,[AC_MSG_ERROR([CGDB requires sys/ioctl.h to build.])]) AC_CHECK_HEADERS([sys/stat.h],,[AC_MSG_ERROR([CGDB requires sys/stat.h to build.])]) AC_CHECK_HEADERS([sys/time.h],,[AC_MSG_ERROR([CGDB requires sys/time.h to build.])]) AC_CHECK_HEADERS([time.h],,[AC_MSG_ERROR([CGDB requires time.h to build.])]) AC_CHECK_HEADERS([sys/types.h],,[AC_MSG_ERROR([CGDB requires sys/types.h to build.])]) AC_CHECK_HEADERS([unistd.h],,[AC_MSG_ERROR([CGDB requires unistd.h to build.])]) AC_CHECK_HEADERS([ctype.h],,[AC_MSG_ERROR([CGDB requires ctype.h to build.])]) AC_CHECK_HEADERS([limits.h],,[AC_MSG_ERROR([CGDB requires limits.h to build.])]) AC_CHECK_HEADERS([math.h],,[AC_MSG_ERROR([CGDB requires math.h to build.])]) AC_CHECK_HEADERS([regex.h],,[AC_MSG_ERROR([CGDB requires regex.h to build.])]) AC_CHECK_HEADERS([curses.h],,[ AC_CHECK_HEADERS([ncurses/curses.h],,[ AC_MSG_ERROR([CGDB requires curses.h or ncurses/curses.h to build.])])]) dnl Check for getopt.h, If this is here then getopt_long can be used. AC_CHECK_HEADERS([getopt.h], [AC_DEFINE(HAVE_GETOPT_H, 1, have getopt_long)]) dnl determine if /dev/ptmx is available for pseudo terminals AC_CHECK_FILE([/dev/ptmx], [AC_DEFINE(HAVE_DEV_PTMX, 1, have /dev/ptmx)]) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_TYPE_UID_T AC_TYPE_MODE_T AC_TYPE_PID_T AC_TYPE_SIZE_T dnl Checks for library functions. AC_PROG_GCC_TRADITIONAL AC_FUNC_SETPGRP AC_TYPE_SIGNAL AC_FUNC_VPRINTF AC_CHECK_FUNC([putenv],,AC_MSG_ERROR([CGDB requires putenv to build.])) AC_CHECK_FUNC([select],,AC_MSG_ERROR([CGDB requires select to build.])) AC_CHECK_FUNC([strdup],,AC_MSG_ERROR([CGDB requires strdup to build.])) AC_CHECK_FUNC([strerror],,AC_MSG_ERROR([CGDB requires strerror to build.])) AC_CHECK_FUNC([openpty],[AC_DEFINE(HAVE_OPENPTY, 1, [Define to 1 if you have the openpty function])],) dnl Default variables dnl If ncurses is yes after arguments, than use ncurses. Otherwise, use curses opt_with_readline_prefix=no use_ncurses_library=yes opt_with_ncurses_prefix=no opt_with_curses_prefix=no dnl argument to configure AC_ARG_WITH(readline, AC_HELP_STRING([--with-readline=PREFIX], [Use system installed readline library]), opt_with_readline_prefix=$withval) AC_ARG_WITH(ncurses, AC_HELP_STRING([--with-ncurses=PREFIX], [Use system installed ncurses library]), opt_with_ncurses_prefix=$withval) AC_ARG_WITH(curses, AC_HELP_STRING([--with-curses=PREFIX], [Use system installed curses library]), opt_with_curses_prefix=$withval use_ncurses_library=no) if test "$opt_with_readline_prefix" != "no"; then # If set to "yes", it is on the compilers include path. if test "$opt_with_readline_prefix" != "yes"; then LDFLAGS="-L$opt_with_readline_prefix/lib $LDFLAGS" CFLAGS="-I$opt_with_readline_prefix/include -I$opt_with_readline_prefix/include/readline $CFLAGS" CPPFLAGS="-I$opt_with_readline_prefix/include -I$opt_with_readline_prefix/include/readline $CPPFLAGS" fi fi dnl ncurses-prefix argument if test "$opt_with_ncurses_prefix" != "no"; then # If set to "yes", it is on the compilers include path. if test "$opt_with_curses_prefix" != "yes"; then LDFLAGS="-L$opt_with_ncurses_prefix/lib $LDFLAGS" CFLAGS="-I$opt_with_ncurses_prefix/include -I$opt_with_ncurses_prefix/include/ncurses $CFLAGS" CPPFLAGS="-I$opt_with_ncurses_prefix/include -I$opt_with_ncurses_prefix/include/ncurses $CPPFLAGS" fi fi if test "$opt_with_curses_prefix" != "no"; then # If set to "yes", it is on the compilers include path. if test "$opt_with_curses_prefix" != "yes"; then LDFLAGS="-L$opt_with_curses_prefix/lib $LDFLAGS" CFLAGS="-I$opt_with_curses_prefix/include $CFLAGS" CPPFLAGS="-I$opt_with_curses_prefix/include $CPPFLAGS" fi fi dnl Checking for log10 function in math - I would like to remove this AC_CHECK_LIB(m, log10) dnl readline and ncurses/curses configure magic is difficult. dnl A prerequisite is that CGDB needs either ncurses or curses to link. dnl A prerequisite is that readline needs tgetent to link. dnl However, I'm not sure if ncurses or curses provides tgetent all the time. dnl So, here's the algorithm: dnl Part 1: Detecting ncurses/curses dnl Check for ncurses (for CGDB) dnl Check for curses (for CGDB) dnl If found ncurses or curses, continue. Otherwise quit. dnl dnl Part 2: Detecting tgetent dnl Check for tgetent in ncurses or curses (the one found above) dnl Check for tgetent in tinfo dnl Check for tgetent in libc dnl If found tgetent, continue. Otherwise quit. dnl Part 1: Detecting ncurses/curses dnl If the user want ncurses, Try to find it and add it to the linking library. if test "$use_ncurses_library" = "yes"; then AC_CHECK_LIB(ncurses, initscr, [AC_DEFINE(HAVE_NCURSES, 1, ncurses library)], AC_MSG_ERROR([cgdb needs ncurses/curses to build. ncurses is strongly recommended. If your system does not have ncurses get it! If that is not an option try 'configure --with-curses.' You can try --with-ncurses=/foo/ncurses to tell configure where ncurses is.])) curses_lib_name="ncurses" fi dnl If the user want curses, Warn them that cgdb does not run perfect against it. if test "$use_ncurses_library" = "no"; then AC_MSG_WARN([ ***************************************************** cgdb may not run properly when linked against curses! *****************************************************]) AC_CHECK_LIB(curses, initscr, [AC_DEFINE(HAVE_CURSES, 1, curses library)], AC_MSG_ERROR([cgdb needs ncurses/curses to build. ncurses is strongly recommended. If your system does not have ncurses get it! You can try --with-curses=/foo/curses to tell configure where curses is.])) curses_lib_name="curses" fi dnl Make sure there is a version of readline that CGDB supports. dnl Simply putting 5.1* -> 5.9* just to take into accout future versions. RL_LIB_READLINE_VERSION case "$ac_cv_rl_version" in 5.1*|5.2*|5.3*|5.4*|5.5*|5.6*|5.7*|5.8*|5.9*|6*|7*|8*|9*) ;; *) AC_MSG_ERROR([CGDB requires GNU readline 5.1 or greater to link. If you used --with-readline instead of using the system readline library, make sure to set the correct readline library on the linker search path via LD_LIBRARY_PATH or some other facility.]) ;; esac dnl This will DEFINE the readline headers. RL_LIB_READLINE_INCLUDES dnl Made it this far, add the readline and termcap LIBS LIBS="-lreadline $TERMCAP_LIB $LIBS" dnl Add the ncurses/curses lib, if it's not the same as the termcap lib if test "$TERMCAP_LIB" != "-l$curses_lib_name"; then LIBS="-l$curses_lib_name $LIBS" fi AC_OUTPUT( Makefile \ lib/Makefile \ lib/adt/Makefile \ lib/gdbmi/Makefile \ lib/kui/Makefile \ lib/rline/Makefile \ lib/tgdb/Makefile \ lib/tgdb/annotate-two/Makefile \ lib/tgdb/gdbmi/Makefile \ lib/tgdb/tgdb-base/Makefile \ lib/tokenizer/Makefile \ lib/util/Makefile \ doc/Makefile \ cgdb/Makefile \ test/Makefile ) cgdb-0.6.7/COPYING000644 000765 000024 00000043110 12074441140 014437 0ustar00mmuellerstaff000000 000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 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 of the License, 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; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. cgdb-0.6.7/doc/000755 000765 000024 00000000000 12074766277 014177 5ustar00mmuellerstaff000000 000000 cgdb-0.6.7/INSTALL000644 000765 000024 00000017227 12074441140 014447 0ustar00mmuellerstaff000000 000000 Basic Installation ================== These are generic installation instructions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, a file `config.cache' that saves the results of its tests to speed up reconfiguring, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.in' is used to create `configure' by a program called `autoconf'. You only need `configure.in' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. If you're using `csh' on an old version of System V, you might need to type `sh ./configure' instead to prevent `csh' from trying to execute `configure' itself. Running `configure' takes awhile. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package. 4. Type `make install' to install the programs and any data files and documentation. 5. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. You can give `configure' initial values for variables by setting them in the environment. Using a Bourne-compatible shell, you can do that on the command line like this: CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure Or on systems that have the `env' program, you can do it like this: env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you must use a version of `make' that supports the `VPATH' variable, such as GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. If you have to use a `make' that does not supports the `VPATH' variable, you have to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. Installation Names ================== By default, `make install' will install the package's files in `/usr/local/bin', `/usr/local/man', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PATH'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you give `configure' the option `--exec-prefix=PATH', the package will use PATH as the prefix for installing programs and libraries. Documentation and other data files will still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=PATH' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Specifying the System Type ========================== There may be some features `configure' can not figure out automatically, but needs to determine by the type of host the package will run on. Usually `configure' can figure that out, but if it prints a message saying it can not guess the host type, give it the `--host=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name with three fields: CPU-COMPANY-SYSTEM See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the host type. If you are building compiler tools for cross-compiling, you can also use the `--target=TYPE' option to select the type of system they will produce code for and the `--build=TYPE' option to select the type of system on which you are compiling the package. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Operation Controls ================== `configure' recognizes the following options to control how it operates. `--cache-file=FILE' Use and save the results of the tests in FILE instead of `./config.cache'. Set FILE to `/dev/null' to disable caching, for debugging `configure'. `--help' Print a summary of the options to `configure', and exit. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `--version' Print the version of Autoconf used to generate the `configure' script, and exit. `configure' also accepts some other, not widely useful, options. cgdb-0.6.7/lib/000755 000765 000024 00000000000 12074766277 014200 5ustar00mmuellerstaff000000 000000 cgdb-0.6.7/Makefile.am000644 000765 000024 00000001014 12074441140 015435 0ustar00mmuellerstaff000000 000000 # The difference between SUBDIRS and DIST_SUBDIRS is that the # readline directory simply needs to be copied as is, where as # the rest of the directories have a make dist rule run on them SUBDIRS=lib cgdb doc test DIST_SUBDIRS=lib cgdb doc test # The order is important here. # various is the lowest level, so it must be done first. # TGDB uses various, so it is done next. # CGDB uses both various and TGDB, so it is done last. doxygen: cd lib; doxygen Doxyfile cd lib/tgdb; doxygen Doxyfile cd cgdb; doxygen Doxyfile cgdb-0.6.7/Makefile.in000644 000765 000024 00000056572 12074766252 015507 0ustar00mmuellerstaff000000 000000 # Makefile.in generated by automake 1.13.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = . DIST_COMMON = INSTALL NEWS README AUTHORS ChangeLog \ $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/configure $(am__configure_deps) \ $(srcdir)/config.h.in COPYING TODO config/compile \ config/config.guess config/config.sub config/depcomp \ config/install-sh config/mdate-sh config/missing \ config/texinfo.tex config/ylwrap $(top_srcdir)/config/compile \ $(top_srcdir)/config/config.guess \ $(top_srcdir)/config/config.sub \ $(top_srcdir)/config/install-sh $(top_srcdir)/config/missing ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/config/readline_check_version.m4 \ $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ cscope distdir dist dist-all distcheck am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \ $(LISP)config.h.in # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags CSCOPE = cscope DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ if test -d "$(distdir)"; then \ find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -rf "$(distdir)" \ || { sleep 5 && rm -rf "$(distdir)"; }; \ else :; fi am__post_remove_distdir = $(am__remove_distdir) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best DIST_TARGETS = dist-gzip distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ RL_MAJOR = @RL_MAJOR@ RL_MINOR = @RL_MINOR@ RL_VERSION = @RL_VERSION@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ YACC = @YACC@ YFLAGS = @YFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ # The difference between SUBDIRS and DIST_SUBDIRS is that the # readline directory simply needs to be copied as is, where as # the rest of the directories have a make dist rule run on them SUBDIRS = lib cgdb doc test DIST_SUBDIRS = lib cgdb doc test all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: am--refresh: Makefile @: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \ $(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: $(am__configure_deps) $(am__cd) $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): config.h: stamp-h1 @if test ! -f $@; then rm -f stamp-h1; else :; fi @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status config.h $(srcdir)/config.h.in: $(am__configure_deps) ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f stamp-h1 touch $@ distclean-hdr: -rm -f config.h stamp-h1 # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. # To change the values of 'make' variables: instead of editing Makefiles, # (1) if the variable is set in 'config.status', edit 'config.status' # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. $(am__recursive_targets): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscope: cscope.files test ! -s cscope.files \ || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS) clean-cscope: -rm -f cscope.files cscope.files: clean-cscope cscopelist cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -rm -f cscope.out cscope.in.out cscope.po.out cscope.files distdir: $(DISTFILES) $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done -test -n "$(am__skip_mode_fix)" \ || find "$(distdir)" -type d ! -perm -755 \ -exec chmod u+rwx,go+rx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__post_remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 $(am__post_remove_distdir) dist-lzip: distdir tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz $(am__post_remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__post_remove_distdir) dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__post_remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__post_remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__post_remove_distdir) dist dist-all: $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' $(am__post_remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lz*) \ lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir) chmod u+w $(distdir) mkdir $(distdir)/_build $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 $(am__post_remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @test -n '$(distuninstallcheck_dir)' || { \ echo 'ERROR: trying to run $@ with an empty' \ '$$(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ $(am__cd) '$(distuninstallcheck_dir)' || { \ echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-recursive all-am: Makefile config.h installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-generic distclean-hdr distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: .MAKE: $(am__recursive_targets) all install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ am--refresh check check-am clean clean-cscope clean-generic \ cscope cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \ dist-gzip dist-lzip dist-shar dist-tarZ dist-xz dist-zip \ distcheck distclean distclean-generic distclean-hdr \ distclean-tags distcleancheck distdir distuninstallcheck dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs installdirs-am \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \ uninstall-am # The order is important here. # various is the lowest level, so it must be done first. # TGDB uses various, so it is done next. # CGDB uses both various and TGDB, so it is done last. doxygen: cd lib; doxygen Doxyfile cd lib/tgdb; doxygen Doxyfile cd cgdb; doxygen Doxyfile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: cgdb-0.6.7/NEWS000644 000765 000024 00000056333 12074766264 014137 0ustar00mmuellerstaff000000 000000 cgdb-0.6.7 (01/14/2013) * Changed documentation license from GFDL to GPL (github #6). * Fixed a hang on MacOS when quitting cgdb while inferior is running (github #1 and #5). * Fixed a crash when pressing 'n' in source window (github #5). * Fixed a bug opening files (and toggling breakpoints in files) with special characters (e.g. space) in their names. cgdb-0.6.6 (09/06/2011) * Fixed a compile error on Cygwin 1.7 (signature for path conversion functions changed). * Fixed a segfault on 64-bit systems in rline.c due to a missing prototype of cgdb_malloc. Thanks to Pietro Cerutti for reporting and diagnosing this one! * Fixed a bug in the file dialog. When searching for a file, and you hit enter to select it, CGDB would sometimes skip to the next file that matches and open that file instead. * CGDB should now build out of the box on Cygwin again. CGDB used to only support building against curses.h. Now it also supports building against ncurses/curses.h. * No longer set the prompt to (gdb) on startup. cgdb-0.6.5 (01/01/2010) * Turn autosourcereload to on by default. This matches GDB's behavior. * CGDB should successfully build on Mac OS X 10.5. Thanks Kyle McKay for sending in this patch. * Add support for :up and :down in the cgdb status bar. Thanks Benoit Pierre for reporting this. * Enhanced tgdb in a2 mode. It now understands GNAT's pre-instance-choice, instance-choice, post-instance-choice extension. * Made searching and :commands a little more vi-like. If you abort a search, you can still recall the last search with 'n' or 'N'. If you backspace to the beginning of the line, a :command or /search is aborted. * Added some new cgdb commands. :c is now a synonym for :continue :f is now a synonym for :finish :n is now a synonym for :next :r is not a synonym for :run :s is now a synonym for :step :start is a new command that will send "start" to the debugger :kill is a new command that will send "kill" to the debugger * Shortcut mode has been removed from cgdb. If you liked it, you can put these commands in your cgdbrc file, map r :run map c :continue map f :finish map n :next map s :step and you will get the same functionality. Do not forget that, F5 is the same as 'run'. F6 is the same as 'continue'. F7 is the same as 'finish'. F8 is the same as 'next'. F10 is the same as 'step'. are always available. * Added a feature to CGDB which allows it to ask readline what key sequence it uses for the Home and End keys. That way, if the terminfo database is wrong, but the OS vendor modified /etc/inputrc, CGDB will have a working Home and End key. * CGDB fully supports the use of maps now. The feature is similar in nature to the vim map feature. It supports map, unmap, imap and iunmap. The map/unmap work in CGDB mode and the imap/iunmap work in GDB mode. * Added the cgdbmodekey configuration option. This allows the user to change the key that switches them from GDB mode to CGDB mode. The default value is the Escape key. This is useful for users that want to use readline in vi-mode. * Fixed a bug in CGDB where the Insert and Delete keys were not recognized properly all of the time. cgdb-0.6.4 (04/28/2007) * CGDB can now be compiled with -jN option. It would fail previously. * CGDB should now build on freebsd with out any patches. * Added a new highlighting group, SelectedLineNr. From the documentation: This represents the group that is used when CGDB is displaying the currently selected line. This is the line that the cursor is on. * CGDB shuts down now when it receives C-d (control d), just like GDB does. * Changed the GDB prompt from "(tgdb)" to "(gdb)". I think users will be more comfortable with "(gdb)". * Fixed a serious bug in CGDB. After the user entered a command CGDB would not accept any more commands. This would only happen sometimes, if at all. This is due to the fact that CGDB had a bug in it that was sensitive to the amount of data that the read system call returns to it. * Fixed a bug in CGDB where it would not show a file in the source viewer if there was a space in the path. * Removed the escdelay option. It has been replaced by the timeout, timeoutlen, ttimeout and ttimeoutlen options. Please see the CGDB manual for more documentation on these options. * Fixed a bug in libkui. If the user quickly typed ESC followed by an 'o' while in the GDB window, the 'o' character would not get processed by CGDB until another character was hit. * CGDB has improved it's -d (Set debugger to use) command line option. CGDB used to force the user to have a space between the -d and the debugger to use, like "cgdb -d /usr/bin/gdb". Now the user can also start CGDB like "cgdb -d/usr/bin/gdb". * CGDB now honor's the '--' command line option, which will allow the user to explicitly say when they want to end passing arguments to CGDB and begin passing arguments to the debugger. * Fixed another bug in the configure script. If the getopt.h header file is not available on the system, then CGDB will fail to configure. It should finish, and most likely build successfully. * Fixed yet another bug in the auto tools scripts. cgdb-0.6.3 would improperly install gdbmi_driver if make was invoked like 'make DESTDIR=/foo install'. * Fixed another bug in the configure script. If the curses.h header file is not available on the system, then CGDB will fail to configure. It would previously configure and then end up with a compile error. cgdb-0.6.3 (06/03/2006) * CGDB will no longer crash if you attempt to do a regular expression search with / when there is no file in the source viewer. * CGDB now uses a psuedo terminal (PTY) to start GDB on, instead of using a pipe. Jens Frederich reported that on a Mac, typing Ctrl-C while the inferior was running would cause GDB to shut down, thus causing CGDB to shut down. This patch fixes that problem. At the same time, this patch caused GDB to ask the user several other questions regarding shared breakpoints, and quiting while the inferior is running. Thus, CGDB acts more as if you were just using GDB. * CGDB is now maintained in a subversion repository instead of a CVS repository. Although this might not appear to effect end users, it is possible that there will be problems associated with this switch. For this reason, I have documented this here. * Fixed another bug in the configure script. CGDB should now be able to configure itself on a Mac. Thanks to Jens Frederich for finding and reporting this problem. * CGDB no longer packages the generated auto tool files in CVS. However, the distributions will have these files. This means you will need autoconf, autoheader and automake installed to compile CGDB from CVS. * CGDB now compiles according to the c89 standard. This should help with porting to older systems. * The file cgdb.txt is now installed into $PREFIX/share/cgdb/cgdb.txt. This is the file CGDB will now use to display the manual when :help is typed. This prevents CGDB from copying the data into the users home directory. cgdb-0.6.2 (04/09/2006) * CGDB should run on solaris 2.5 again. I don't think it would since CGDB .6.0. * Fixed a bug in the configure script that was probably added in .6.0 when the large readline integration was done. It was possible for readline to choose the wrong termcap library, because of a bad autoconf macro that CGDB was using. This could potentially cause the screen to get corrupted. * Fixed a bug in the syntax highlighter for C strings. A line like char *s = "\""; would cause the highlighter to break and most of the file after that would be displayed in red (string literal color). * The message 'CGDB had unexpected results, ...' will no longer be displayed when CGDB can not parse a breakpoint. This message was being displayed when a watchpoint was issued by the user. It does not fix any bugs though, just stops the message from being displayed. cgdb-0.6.1 (03/06/2006) * An improvement for tab completion support. With certain versions of GDB, an extra line "server complete ..." would be added to the list of possible completions. This is no longer added. I believe this would only happen with really old versions of GDB. * Improved tab completion support in readline for quoted data. For instance tab completing C++ member functions like b 'foo::b will now produce b 'foo::bar()'. * Improved tab completion support. This comes in 2 forms. First, CGDB honors the readline variable rl_completion_query_items. If the number of completions is greater than this variable, then the user will be asked if they want the completion to happen. Second, after each page of completions, the user will be asked if they want more completions to be displayed or not. * Thanks to Steve Folta for sending in a patch which added support in CGDB for configuring the syntax colors. The colors used to be hard coded and could not be changed. Now just use the ":highlight" command to change the default colors. There is a new section in the manual called "CGDB highlighting groups" that describes the new functionality. * Again, thanks to Steve Folta for getting CGDB to run on terminals with background colors besides black. CGDB used to paint the terminal background color black regardless of what it was. Now it respects the background color. This feature only works when linked to ncurses. If you have curses, CGDB will force the background black. * CGDB broke it's terminal resizing functionality in cgdb-0.6.0. This is now working again. The bug was introduced while bringing readline into the same address space as CGDB. * The man page now get's installed when 'make install' is done. cgdb-0.6.0 (01/30/2006) * There is a new manual for CGDB. The text version is located in cgdb/doc/cgdb.txt. The info version is available at cgdb/doc/cgdb.info. The text, html, pdf, info and possibly other versions are avialable at http://cgdb.sourceforge.net/documentation.shtml * There is a new CGDB man page. It is located in cgdb/doc/cgdb.1. * Fix a crash in CGDB if the user would type ':e' or ':edit' in the source window, and the source window was empty. This crash is considered not very significant, since I can't understand why the user would try to refresh the file, if it didn't exist. * Removed the :q! and :quit! commands, since they don't do anything different than :q or :quit. * Fix a bug regarding the CGDB source viewer displaying breakpoints. If you used the file dialog to open a file, and the file was an absolute path, CGDB would display the file. If it was the first time CGDB encountered this file, then when you set a breakpoint, CGDB would not display the line as having a breakpoint in the source window, even though the breakpoint was actually being set. This is now fixed. * CGDB now supports getting the initial line, as well as the initial file that GDB is on when it first starts the inferior. It used to only determine the initial file. * CGDB now supports when the terminal does not have control flow turned on. If control flow (XON/XOFF) is off, the ^s and ^q will go directly to readline instead of freezing and restarting the terminal. * CGDB now allows the user to use the \ character for line continuation purposes. GDB handles this and now CGDB also handles this. Before this, CGDB would break if the user attempted to do line continuation. * CGDB no longer needs to do a fork to communicate data back and forth to readline, it runs readline in it's own process context. This is a huge improvement because it means that when you run CGDB you should only see 1 process executing instead of the usual 2. * CGDB now supports tab completion. This has been a long awaited missing feature of CGDB. * CGDB now depends on readline 5.1. * Fix a bug in the c/c++ syntax highlighter. If a file had "\\" as a string literal, the CGDB syntax tokenizer would be built incorrectly resulting in incorrect file highlighting. cgdb-0.5.3 (08/08/2005) * CGDB now can detect the version of readline that it is going to link against. By doing this, it can alert the user at configure time if the readline version is OK to build CGDB with. If it is not OK, configure will fail. * CGDB has changed it's user interface in a way that is not backwards compatible. The 't' key, now sets a temporary breakpoint. The 't' key used to put CGDB into insert mode in the TTY window. Now 'I' does that. * CGDB is now capable of setting a temporary breakpoint thanks to Marcel Lanz. He sent in a patch with the functionality. Hitting 't' set's a temporary breakpoint. * It was reported that the "Windows" Key would cause CGDB to shut down. This has been fixed. * Added a new 'arrowstyle' option, see README for documentation * Add the ^l command to the Source window. CGDB will now clear and redraw the screen when this command is received. * It is now required to have the GNU history library in order to configure CGDB successfully. This was always the case, but the configure checks wouldn't catch it. * Get readline configure check to only look for libreadline. Not libedit, ... Future version of CGDB will depend on functionality that only readline will contains. cgdb-0.5.2 (05/21/2005) * Attempt to get autoconf/automake machinery working with command, make DESTDIR=... install. This should simplify the job of package maintainers. * Added the --with-readline-prefix autoconf option. This makes configuring CGDB much easier when readline is in a non standard place. * Fixed major bug in CGDB-0.5.1 that prevented it from running on Solaris 9, FreeBSD 5.2.1 and probably many others. CGDB would hang when trying to read input. This bug made it impossible to use CGDB on those platforms. libkui is the cause of this problem and was a replacement input library for CGDB in cgdb-0.5.1. The bug is now fixed. cgdb-0.5.1 (04/02/2005) * fixed crash when user tries to set a breakpoint on a file that's not a source file. This would happen if you typed ':help' to get into the help, and then tried to set a breakpoint using the spacebar. * obsolete the b and f commands. These were responsible for moving between the previous and the next source file. They made CGDB unstable and I don't think they were in the spirit of a vi/vim clone. * fixed an annoying bug that appeared while searching for a string. If you canceled the source view regex search by hitting ESC, 2 bad things would happen. You would end up on the line that you cancelled at The currently displayed line would stay the line you can cancelled at, even when you start moving around again. * reworked the signal handling code when GDB dies. Now CGDB handles the SIGCHLD and passes the signal notification to TGDB. This fixes a race condition that occurred, even though the race condition appeared to be harmless. * Several memory runtime fixes found thanks to valgrind. This could potentially fix crash's that I just never ran into. * Fix a bug in the c/c++ syntax highlighter. If a file had a dos file format and the C++ style comment // was used, then the file displayed would be completely unreadable. This is because the trailing '\r' would get grouped with the comment. * Fix CGDB command line interface. If the user invoked CGDB like this, 'cgdb --args ./main one two three', then CGDB would hang or crash. This was because it use to add extra command line options to GDB on the end. Now it prepends the options to GDB, so that the --args command line can still be honored. * Added new logger interface. This traps all errors to a file or a file descriptor. There is now a mechanism to write warnings and errors to a file for inspection by the user. * Removed deprecated libinput from the various subdirectory. It has been replaced by libkui. * Added 'set asr' or autosourcereload option to CGDB. It is off by default. It is capable of reloading a source file when CGDB detects that a file has been modified. To turn this feature on do ':set asr'. * The :edit [:e] colon command has been implemented. It forces CGDB to reload the current file in the source viewer. cgdb-0.5.0 (07/14/2004) * "progs" directory is no longer installed in a potentially read-only directory. It is installed now in top_builddir, instead of top_srcdir. * Added libkui into CGDB. This is the fisrt of the 4 new libraries designed to make CGDB flexible and modular. Because of this, the version number has been bumped up to .5.0. * Fixed crash in TGDB when buffering commands. If the user hit 'n' ... fast, while GDB was not responding, or working on a command, the buffering code in TGDB would enter a bad command into a queue, causing it to crash when it tries to execute the command. * Fix crash in CGDB when parsing command line parameters. I think this crash showed up when I starting compiling CGDB with 3.3 instead of 2.95. It would crash when trying to pass the --pid argument to GDB through CGDB. cgdb-0.4.2 (05/10/2004) * CGDB now compiles again on AIX 4.3. Fixed Makefile.am in various/util/src to not have a space between the -L and the path. cgdb-0.4.1 (04/26/2004) * Removed a memory leak from CGDB. When debugging applications that output a lot of text, CGDB would reportedly grow well over 400MB. Thanks to the sender of this patch, who decided to keep themselves anonymous. * Removed all instances of PATH_MAX and replaced with FSUTIL_PATH_MAX. PATH_MAX is not defined on HURD, and thus CGDB wouldn't compile in that environment. * Fixed TGDB bug. Tab completion was broken during cgdb-0.4.0 release. cgdb-0.4.0 (10/28/2003) * Added 'wrapscan' option (abbreviated 'ws'). Note that this means that 'ws' no longer means winsplit, since this isn't the standard vi meaning. Fixed bug where 'n' jumps to the top of file when no search was previously done. * Fixed bug in TGDB. It would not return TGDB_ABSOLUTE_SOURCE_DENIED if TGDB called 'info source' and there was no line that returned the absolute source path. * Fixed bug in TGDB. TGDB would not query GDB for breakpoints on startup. However, the user can set breakpoints in there .gdbinit. TGDB now gets all breakpoints on startup. This fixes a bug in CGDB. The breakpoint will now be highlighted. * Fixed CGDB bug. When searching for text, CGDB would search for the next occurrence of the string from where it last found an occurrence, rather than where the users cursor is. * Fixed crash in TGDB. It would try to parse watchpoints. It will no longer do this. * Added new feature. CGDB added the 'set showtgdbcommands' option. If this is set, CGDB will show all the commands that it is sending to GDB to get work done. Otherwise, if its not set, CGDB will not show the user the commands. The default value is off. Although, I currently have mine set :). After all, you never can be to sure what this program is doing ... * Fixed bug in TGDB. TGDB used to return a newline for the front end to print when a GUI command was issued. This made sure the output of the command happened on a different line than the prompt. If the user ran many commands in a row through CGDB, you would see an extra new line appear. Now TGDB returns a new line when the command is actually given to GDB, not when the command is issued. * Fixed bug in TGDB. TGDB would not return the correct file:line if the user ran a command file through gdb on init and the file instructed gdb to set a breakpoint and run. CGDB would display line 1 of the correct file instead of the correct line. * Fixed bug in TGDB/CGDB. TGDB would return TGDB_UPDATE_SOURCE_FILES when there was no source files in the list ( ex. if the inferior was compiled without debug). This would cause CGDB to act buggy when the user tried to open the filedlg on a program that was not compiled with debug. The first time you would open the file dialog it would display a blank screen. The second time it would give you an error but it would put you in the file dialog mode, even though it displayed the CGDB source window. Both of these bugs should be fixed. * Fixed bug in TGDB/CGDB. It was not properly parsing the breakpoint information out of GDB. When using C++, GDB would output data that TGDB did not expect. TGDB can now parse the data properly. The result is that CGDB now displays all of the breakpoints in the source window. It used to not display them all. cgdb-0.3.4 * Fixed bug in cgdb. If the user hit 'o' in cgdb, then got out of the file dialog, the next time ^c was typed in the gdb window, the prompt would not refresh itself properly. * Fixed ada highlighting bug. String literals were not being highlighted. * Temporarily fixed the ^c bug. The data at the console is now cleared when the user hits ^c. A better fix will be arranged for when full signal handling support is integrated. * Fixed libinput bug. If the user held down '\n' for a long time, and then hit any other key, an extra '\n' would come out and then the other key. This was *very* annoying when holding down the '\n' key to continue nexting. * Fixed highlighting bug. This ( '\"' ) would start a string literal in C/C++. cgdb-0.3.3b * Fixed string literal bug where files don't highlight properly in C/C++. cgdb-0.3.3a * Fixed bug in the file dialog window. It would not accept the enter key, so the user could never select a file. cgdb-0.3.3 * Fixed tab bug, where tab spaces were being displayed incorrectly in the source window. Now cgdb can handle tabs in a file properly. * Added VI-style page up/page down commands. Deprecated old Shift-J and Shift-K page up/page down style commands. * Fixed bug in ada highlighter. The file would not be displayed correctly when trying to highlight an ada source file. cgdb-0.3.2 * Fast tokenizer replaces older hand written one. CGDB now can syntax highlight a 15000+ line ada or c file in fractions of a second compared to the second it used to take. Believe me, 1 second to load a file can get frustrating when you wait enough times. :) * CGDB now reads $HOME/.cgdb/cgdbrc, this is useful for automating any commands the user would normally type into the status bar. This is a *great* first attempt at making cgdb configurable. * There are *many* new options to type into the status bar, they are all listed in the README file, or from :help, check it out. cgdb-0.6.7/README000644 000765 000024 00000001163 12074441140 014266 0ustar00mmuellerstaff000000 000000 CGDB ==== CGDB is a very lightweight console frontend to the GNU debugger. It provides a split screen interface showing the GDB session below and the program's source code above. The interface is modelled after vim's, so vim users should feel right at home using it. Screenshot, downloads, and documentation are available from the home page: http://cgdb.github.com/ Official source releases are available in the downloads section, but will be moved soon (since Github is killing this feature): https://github.com/cgdb/cgdb/downloads This README will be updated with the new location when suitable hosting has been found. cgdb-0.6.7/test/000755 000765 000024 00000000000 12074766277 014411 5ustar00mmuellerstaff000000 000000 cgdb-0.6.7/TODO000644 000765 000024 00000017520 12074441140 014102 0ustar00mmuellerstaff000000 000000 Bug fixes/improvement for cgdb-0.6.3 [x] Configure should not accept yacc. bison needs to be available to build CGDB. Document in manual that bison is required and that yacc is not good enough. - This is fixed, however, users will not need bison installed to build CGDB. bluffer_ [ ] Look at passing ^z to GDB [ ] Look at how CGDB could allow itself to debug curses applications by putting itself in the backgroud when the inferior runs. [ ] If you single step into a system library call (or any library call for that matter where the source isn't available), CGDB should show [NO SOURCE], instead of displaying the last source position available. Maybe make this an option. neosun_ [ ] Upload mac osx binary. [ ] Setup nightly distribution for download. [ ] Add key mapping support to cgdbrc. [ ] Look into getopts, it generates the usage/getopts/man/texinfo data. This could replace the already done work of generating a man page. [ ] Figure out how to get extra prototypes out of cgdb.h [ ] Provide a single interface to the user, that process's GDB output. When a command is finished a different return value will be sent then when a command is stil being processed. Also, when a command is finished, then the user can look at the tgdb_responses. [ ] Re-arrange the a2 subsystem to be easier and better to modify This could include writing a quick flex/bison parser that could make a parse tree of the annotation command. [ ] Add a key binding to get to the currently executing line. 'p' was suggested for this. [ ] Cursor isn't shown in xterm - TGDB interface changes [ ] Modify TGDB to not automatically run commands. (ie. initial list command) [ ] The 'info breakpoints' is automatically done for the client. This could either be a request that is done each time, a request that's done once for asychronous updates. [ ] The asynchronous source updates. This could be done with the same techniques as above. - TGDB interface changes [ ] Modify the tgdb_response data structure to incorporate into it the associated tgdb_request data structure. Make sure to remove the cgdb.c:last_request variable. [ ] Free tgdb_request data structures. - Fix ACS_VLINE problem. This char is not available everywhere and should be a runtime option. Check with jonathon to make sure this problem is fixed. (Actually, check on ALL ACS characters, we use several of them.) Bug fixes/improvement for cgdb-0.6.1 [x] Tab completion is broken in CGDB when using gnat 3.15p If you tab on 'r -e E' you will get back 'server complete r -e E', instead of nothing. [x] is_finished is not set if tgdb_process exists in first return statement [x] Add Steve Folta's color patch. [x] Fix cgdb.1 to be in release. Also in make install. [x] Automatically generate man pages using help2man. [x] Tab completion feature request from cgdb.sf.net [x] Document the new Highlight command. [x] Test the new Highlight command. [x] Logo message could be displayed to have :help in window [x] Breakpoint's made in thread's do not apper in browser, this is because there is a newline in the field 5 info: 0xb6f4e552 (\n) (\032)(\032)field 5(\n) in SpeexCodec::Consume(TelEngine::DataBlock const&, unsigned long)(\n) at speexcodec.cpp:162(\n) breakpoint already hit 1 time(\n) (\n) (\032)(\032)breakpoints-table-end(\n) - Use valgrind to get rid of most memory leaks. Bug fixes/improvement for cgdb-0.6.0 Closed: [x] Use valgrind to get rid of most memory leaks. [x] Add documentation to CGDB. I think texinfo is the prefered way to do this, it generates info and html pages. For man pages, looking at help2man might be a good idea. [x] If GDB responds with a fullname in the file dialog, then when the file is selected, CGDB only knows about the fullname. When breakpoints are then set, it doesn't work because the filename is absolute, and CGDB doesn't know the relative component. This is a major bug. [x] Strip readline out of TGDB and put it into CGDB. This is in preparation for removing the rlctx code. - TGDB interface changes [x] Modify TGDB to not automatically run commands. (ie. initial list command) [x] The file and line discovery is now not done automatically. CGDB requests this functionality after it creates the TGDB instance. [x] Remove the tgdb_set_prompt_change_callback, and add it to the tgdb_response mechanism. [x] TGDB will no longer buffer commands. It will receive and process 1 command at a time. [x] Provide an TGDB queue interface, which can be used by CGDB and tgdb_driver to provide a buffer of commands that are similar. Other client can maintain there own queue if they want to. [x] Each of the functions that will cause TGDB to do commands, like tgdb_get_inferior_source_files, tgdb_get_absolute_path, ... will return a 'tgdb_input_command' data structure. [x] The client can make TGDB process a command by giving it the tgdb_input_command function. [x] Alternativly, the client can put the command data structure into the TGDB queue. [x] Remove the tgdb_set_prompt_update_callback function. Because TGDB will no longer buffer callbacks, the user will know when another command is being executed. [x] Make each command return the request as the return type, instead of as the parameter. If the value returns as NULL, there was an error. [x] Document INTERFACE_REQUEST_COMMANDS [x] Empty command queue when the ^c signal is reached. [should this be done in CGDB or TGDB]? Done in TGDB. [x] Delete all annotations that are not being used. [x] revamp the tgdb_response data structure to simply be a union with an enum, which selects the appropriate values. This would be a self documenting data structure. Bug fixes/improvement for cgdb-0.5.3 Closed: - Get readline library to only build the static library. - Update FAQ, it's wrong. - Fix runtime error with arrow style long and regex searching. - Should package readline with CGDB? No! - Make sure arrowstyle option is commented. - Get ^l to refresh the screen. - Fix compiler warning ../../../../cgdb/tgdb/tgdb-base/src/tgdb.c: In function `tgdb_recv_debugger_data': ../../../../cgdb/tgdb/tgdb-base/src/tgdb.c:1254: warning: passing arg 5 of `tgdb_client_parse_io' from incompatible pointer type Bug fixes for cgdb-0.5.2 Closed: - Make DESTDIR work in Makefile for installing CGDB http://sourceforge.net/mailarchive/forum.php?thread_id=6966700&forum_id=26100 - Make the autoconf stuff check for version .5.1 of readline - Fix bug on sf.net. It is a compile error that happens to show up as a warning in cygwin. Fix the warning and the error might go away. Bug fixes for cgdb-0.5.1 Closed: - Fix race condition on waitpid - Fix --args command line option - Make sure when EOF is read that CGDB dies. Bug fixes before cgdb-0.3.2 release. Bugs: o Fix ws option. It doesn't lock properly. Resize window real small, then resize it big, its not the correct percent. o Make ws option receive a percent, so we can make it any size. Not just the 5 choices originally desired. It would be more flexible this way. I would be silly if someone needed 35% ... However, making it take a percent does not solve the whole problem. The user needs to start at one of these offsets. How should this be done? Closed: o Fix 'set sc' flicker problem. When user hits 'n', a flicker occurs. o Fix resizing to fast bug. ( Only handle last resize, not all ). This is easy to reproduce when running over the Internet. :) This doesn't really seem to be the problem. However, the potential bug is still fixed. o Make -/+ go to either full screen or 2 lines off, on odd or even size. This was fixed by adding option winminheight :) (Ben's idea), Now you can make the value whatever you want it to be. cgdb-0.6.7/test/config/000755 000765 000024 00000000000 12074441140 015631 5ustar00mmuellerstaff000000 000000 cgdb-0.6.7/test/kui.base/000755 000765 000024 00000000000 12074441140 016065 5ustar00mmuellerstaff000000 000000 cgdb-0.6.7/test/Makefile.am000644 000765 000024 00000000114 12074441140 016414 0ustar00mmuellerstaff000000 000000 AUTOMAKE_OPTIONS = dejagnu EXTRA_DIST = kui.base config DEJATOOL = kui.base cgdb-0.6.7/test/Makefile.in000644 000765 000024 00000027576 12074766253 016471 0ustar00mmuellerstaff000000 000000 # Makefile.in generated by automake 1.13.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = test DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/config/readline_check_version.m4 \ $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) RUNTESTDEFAULTFLAGS = --tool $$tool --srcdir $$srcdir EXPECT = expect RUNTEST = runtest DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ RL_MAJOR = @RL_MAJOR@ RL_MINOR = @RL_MINOR@ RL_VERSION = @RL_VERSION@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ YACC = @YACC@ YFLAGS = @YFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = dejagnu EXTRA_DIST = kui.base config DEJATOOL = kui.base all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu test/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu test/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): tags TAGS: ctags CTAGS: cscope cscopelist: check-DEJAGNU: site.exp srcdir='$(srcdir)'; export srcdir; \ EXPECT=$(EXPECT); export EXPECT; \ if $(SHELL) -c "$(RUNTEST) --version" > /dev/null 2>&1; then \ exit_status=0; l='$(DEJATOOL)'; for tool in $$l; do \ if $(RUNTEST) $(AM_RUNTESTFLAGS) $(RUNTESTDEFAULTFLAGS) $(RUNTESTFLAGS); \ then :; else exit_status=1; fi; \ done; \ else echo "WARNING: could not find '$(RUNTEST)'" 1>&2; :;\ fi; \ exit $$exit_status site.exp: Makefile $(EXTRA_DEJAGNU_SITE_CONFIG) @echo 'Making a new site.exp file ...' @echo '## these variables are automatically generated by make ##' >site.tmp @echo '# Do not edit here. If you wish to override these values' >>site.tmp @echo '# edit the last section' >>site.tmp @echo 'set srcdir "$(srcdir)"' >>site.tmp @echo "set objdir `pwd`" >>site.tmp @echo 'set build_alias "$(build_alias)"' >>site.tmp @echo 'set build_triplet $(build_triplet)' >>site.tmp @echo 'set host_alias "$(host_alias)"' >>site.tmp @echo 'set host_triplet $(host_triplet)' >>site.tmp @list='$(EXTRA_DEJAGNU_SITE_CONFIG)'; for f in $$list; do \ echo "## Begin content included from file $$f. Do not modify. ##" \ && cat `test -f "$$f" || echo '$(srcdir)/'`$$f \ && echo "## End content included from file $$f. ##" \ || exit 1; \ done >> site.tmp @echo "## End of auto-generated content; you can edit from here. ##" >> site.tmp @if test -f site.exp; then \ sed -e '1,/^## End of auto-generated content.*##/d' site.exp >> site.tmp; \ fi @-rm -f site.bak @test ! -f site.exp || mv site.exp site.bak @mv site.tmp site.exp distclean-DEJAGNU: -rm -f site.exp site.bak -l='$(DEJATOOL)'; for tool in $$l; do \ rm -f $$tool.sum $$tool.log; \ done distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) check-DEJAGNU check: check-am all-am: Makefile installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-DEJAGNU distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: all all-am check check-DEJAGNU check-am clean clean-generic \ cscopelist-am ctags-am distclean distclean-DEJAGNU \ distclean-generic distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic pdf pdf-am ps ps-am tags-am uninstall \ uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: cgdb-0.6.7/test/kui.base/basic.exp000644 000765 000024 00000035033 12074441140 017670 0ustar00mmuellerstaff000000 000000 # Don't wait for more than 10 seconds set timeout 3 # Create a mappings file to test the KUI set mapping_output [open /tmp/map.txt w 0600] # Simple map puts $mapping_output "map gg up" # Simple map that tests that the first map is replaced puts $mapping_output "map abc def" puts $mapping_output "map abc ghi" # Test 2 maps, where one is a subest of the other puts $mapping_output "map partial_abc mmm" puts $mapping_output "map partial_abcdef nnn" # Test the double mapping puts $mapping_output "map first second" puts $mapping_output "map second third" # This section attempts to test the builtin macro extensions like, # , , ... # Test the special character mappings puts $mapping_output "map special_space_cr pargc" # Test each pattern, where X is a lowercase letter foreach {val} {a b c d e f g h i j k l m n o p q r s t u v w x y z} { set upperValue [string toupper $val] puts $mapping_output "map special_shift_$upperValue " puts $mapping_output "map special_ctrl_$upperValue " } # Test , , , ... puts $mapping_output "map special_Esc " puts $mapping_output "map special_Up " puts $mapping_output "map special_Down " puts $mapping_output "map special_Left " puts $mapping_output "map special_Right " puts $mapping_output "map special_Home " puts $mapping_output "map special_End " puts $mapping_output "map special_PageUp " puts $mapping_output "map special_PageDown " puts $mapping_output "map special_Del " puts $mapping_output "map special_Insert " foreach {val} {1 2 3 4 5 6 7 8 9 10 11 12} { puts $mapping_output "map special_F$val " } puts $mapping_output "map special_Nul " puts $mapping_output "map special_Bs " puts $mapping_output "map special_Tab " puts $mapping_output "map special_Nl " puts $mapping_output "map special_Ff " puts $mapping_output "map special_Cr " puts $mapping_output "map special_Return " puts $mapping_output "map special_Enter " puts $mapping_output "map special_Space " puts $mapping_output "map special_Lt " puts $mapping_output "map special_Bslash " puts $mapping_output "map special_Bar " # Test that unmap works # First, unmap something that doesn't exist puts $mapping_output "unmap does_not_exist" # Then, map something, and then unmap it puts $mapping_output "map map_to_unmap bar" puts $mapping_output "unmap map_to_unmap" # Then, map something, and then unmap it twice puts $mapping_output "map map_to_unmap2 bar" puts $mapping_output "unmap map_to_unmap2" puts $mapping_output "unmap map_to_unmap2" # Test the example in the documenation puts $mapping_output "map ab foo" puts $mapping_output "unmap ab" close $mapping_output # Start the KUI if [kui_start --file=/tmp/map.txt] then { puts "Error starting program" exit 1 } # Test ESC key set test "test ESC char" send "\033" expect { -re "CGDB_KEY_ESC\\\[27\\\]$kui_prompt$" { pass "$test"} timeout { fail "timeout $test" } } # Test hardcoded up/down/rigt/left/home/end keys set test "test up key" send "\033\[A" expect { -re "CGDB_KEY_UP\\\[27\\\]\\\[91\\\]\\\[65\\\]$kui_prompt$" { pass "$test"} timeout { fail "timeout $test" } } set test "test down key" send "\033\[B" expect { -re "CGDB_KEY_DOWN\\\[27\\\]\\\[91\\\]\\\[66\\\]$kui_prompt$" { pass "$test"} timeout { fail "timeout $test" } } set test "test right key" send "\033\[C" expect { -re "CGDB_KEY_RIGHT\\\[27\\\]\\\[91\\\]\\\[67\\\]$kui_prompt$" { pass "$test"} timeout { fail "timeout $test" } } set test "test left key" send "\033\[D" expect { -re "CGDB_KEY_LEFT\\\[27\\\]\\\[91\\\]\\\[68\\\]$kui_prompt$" { pass "$test"} timeout { fail "timeout $test" } } set test "test home key" send "\033\[H" expect { -re "CGDB_KEY_HOME\\\[27\\\]\\\[91\\\]\\\[72\\\]$kui_prompt$" { pass "$test"} timeout { fail "timeout $test" } } set test "test end key" send "\033\[F" expect { -re "CGDB_KEY_END\\\[27\\\]\\\[91\\\]\\\[70\\\]$kui_prompt$" { pass "$test"} timeout { fail "timeout $test" } } # Test hardcoded msdos up/down/right/left keys # NOTE: The kui always returns the the keys with the same escape sequence as # above. This is be design. Readline expects these key sequences to mean the # same thing. So these keys will always work, regardless of what the termcap # says. set test "test msdos up key" send "\033\[0A" expect { -re "CGDB_KEY_UP\\\[27\\\]\\\[91\\\]\\\[65\\\]$kui_prompt$" { pass "$test"} timeout { fail "timeout $test" } } set test "test msdos left key" send "\033\[0B" expect { -re "CGDB_KEY_LEFT\\\[27\\\]\\\[91\\\]\\\[68\\\]$kui_prompt$" { pass "$test"} timeout { fail "timeout $test" } } set test "test msdos right key" send "\033\[0C" expect { -re "CGDB_KEY_RIGHT\\\[27\\\]\\\[91\\\]\\\[67\\\]$kui_prompt$" { pass "$test"} timeout { fail "timeout $test" } } set test "test msdos down key" send "\033\[0D" expect { -re "CGDB_KEY_DOWN\\\[27\\\]\\\[91\\\]\\\[66\\\]$kui_prompt$" { pass "$test"} timeout { fail "timeout $test" } } # Test second hardcoded up/down/rigt/left/home/end keys set test "test second up key" send "\033OA" expect { -re "CGDB_KEY_UP\\\[27\\\]\\\[91\\\]\\\[65\\\]$kui_prompt$" { pass "$test"} timeout { fail "timeout $test" } } set test "test second down key" send "\033OB" expect { -re "CGDB_KEY_DOWN\\\[27\\\]\\\[91\\\]\\\[66\\\]$kui_prompt$" { pass "$test"} timeout { fail "timeout $test" } } set test "test second right key" send "\033OC" expect { -re "CGDB_KEY_RIGHT\\\[27\\\]\\\[91\\\]\\\[67\\\]$kui_prompt$" { pass "$test"} timeout { fail "timeout $test" } } set test "test second left key" send "\033OD" expect { -re "CGDB_KEY_LEFT\\\[27\\\]\\\[91\\\]\\\[68\\\]$kui_prompt$" { pass "$test"} timeout { fail "timeout $test" } } set test "test second home key" send "\033OH" expect { -re "CGDB_KEY_HOME\\\[27\\\]\\\[91\\\]\\\[72\\\]$kui_prompt$" { pass "$test"} timeout { fail "timeout $test" } } set test "test second end key" send "\033OF" expect { -re "CGDB_KEY_END\\\[27\\\]\\\[91\\\]\\\[70\\\]$kui_prompt$" { pass "$test"} timeout { fail "timeout $test" } } # Test all X combinations, where X is all the characters. # not testing q, cause it shuts down the kui foreach {val} {a b c d e f g h i j k l m n o p r s t u v w x y z} { set test "test simple char $val" send "$val" expect { -re "$val$kui_prompt$" { pass "$test"} timeout { fail "timeout $test" } } } foreach {val} {A B C D E F G H I J K L M N O P Q R S T U V W X Y Z} { set test "test simple upper case char $val" send "$val" expect { -re "$val$kui_prompt$" { pass "$test"} timeout { fail "timeout $test" } } } # Test all combinations, where X is all the characters. # h i j, is not in the list because it is currently broken # m is not in the list because ctrl-m starts a mapping. set counter 1 foreach {val} {a b c d e f g h i j k l m n o p q r s t u v w x y} { set testval [format %c $counter] set test "test ctrl-$val" set upper [string toupper $val] set expected_testval "CGDB_KEY_CTRL_$upper\\\[$counter\\\]" send "$testval" expect { -re "$expected_testval$kui_prompt$" { pass "$test"} timeout { fail "timeout $test" } } set counter [expr $counter+1] } # Test mappings set test "testing map from mapping file" send "gg" expect { -re "up$kui_prompt$" { pass "$test"} timeout { fail "timeout $test" } } set test "test simple map" send "abc" expect { -re "ghi$kui_prompt$" { pass "$test"} timeout { fail "timeout $test" } } set test "test simple partial matching map" send "abf" expect { -re "abf$kui_prompt$" { pass "$test"} timeout { fail "timeout $test" } } set test "test map that is a subset of another map" send "partial_abc" expect { -re "mmm$kui_prompt$" { pass "$test"} timeout { fail "timeout $test" } } set test "test map that is a subset of another map, plus another char" send "partial_abcd" expect { -re "mmmd$kui_prompt$" { pass "$test"} timeout { fail "timeout $test" } } set test "test map that is a subset of another map, plus two more char" send "partial_abcde" expect { -re "mmmde$kui_prompt$" { pass "$test"} timeout { fail "timeout $test" } } set test "test map that is a superset of another map" send "partial_abcdef" expect { -re "nnn$kui_prompt$" { pass "$test"} timeout { fail "timeout $test" } } set test "test map that is a superset of another map plus another char" send "partial_abcdefg" expect { -re "nnn${kui_prompt}g$kui_prompt$" { pass "$test"} timeout { fail "timeout $test" } } set test "test that mappings are recursive" send "first" expect { -re "third$kui_prompt$" { pass "$test"} timeout { fail "timeout $test" } } set test "test that mappings are recursive plus extra chars" send "firstxyz" expect { -re "third${kui_prompt}x${kui_prompt}y${kui_prompt}z${kui_prompt}$" { pass "$test"} timeout { fail "timeout $test" } } # Test the use of CGDB hard coded values set test send "special_space_cr" expect { -re "p argcCGDB_KEY_CTRL_M\\\[.*\\\]${kui_prompt}$" { pass "$test"} timeout { fail "timeout $test" } } # Test each pattern, where X is a lowercase letter set counter 1 foreach {val} {a b c d e f g h i j k l m n o p q r s t u v w x y z} { set upperValue [string toupper $val] set shift_special_value "special_shift_$upperValue" set ctrl_special_value "special_ctrl_$upperValue" set test "testing in a map" send "$shift_special_value" expect { -re "$upperValue${kui_prompt}$" { pass "$test"} timeout { fail "timeout $test" } } # If you send a ^z, the process will be put in the background if {$val != "z"} { set test "testing in a map" send "$ctrl_special_value" expect { -re "CGDB_KEY_CTRL_$upperValue\\\[$counter\\\]${kui_prompt}$" { pass "$test"} timeout { fail "timeout $test" } } } set counter [expr $counter+1] } # Test , , , ... set test "testing " send "special_Esc" expect { -re "CGDB_KEY_ESC\\\[27\\\]${kui_prompt}$" { pass "$test"} timeout { fail "timeout $test" } } set test "testing " send "special_Up" expect { -re "CGDB_KEY_UP\\\[27\\\]\\\[91\\\]\\\[65\\\]$kui_prompt$" { pass "$test"} timeout { fail "timeout $test" } } set test "testing " send "special_Down" expect { -re "CGDB_KEY_DOWN\\\[27\\\]\\\[91\\\]\\\[66\\\]$kui_prompt$" { pass "$test"} timeout { fail "timeout $test" } } set test "testing " send "special_Left" expect { -re "CGDB_KEY_LEFT\\\[27\\\]\\\[91\\\]\\\[68\\\]$kui_prompt$" { pass "$test"} timeout { fail "timeout $test" } } set test "testing " send "special_Right" expect { -re "CGDB_KEY_RIGHT\\\[27\\\]\\\[91\\\]\\\[67\\\]$kui_prompt$" { pass "$test"} timeout { fail "timeout $test" } } set test "testing " send "special_Home" expect { -re "CGDB_KEY_HOME\\\[27\\\]\\\[91\\\]\\\[72\\\]$kui_prompt$" { pass "$test"} timeout { fail "timeout $test" } } set test "testing " send "special_End" expect { -re "CGDB_KEY_END\\\[27\\\]\\\[91\\\]\\\[70\\\]$kui_prompt$" { pass "$test"} timeout { fail "timeout $test" } } set test "testing " send "special_PageUp" expect { -re "CGDB_KEY_PPAGE\\\[.*\\\]\\\[.*\\\]\\\[.*\\\]\\\[.*\\\]$kui_prompt$" { pass "$test"} timeout { fail "timeout $test" } } set test "testing " send "special_PageDown" expect { -re "CGDB_KEY_NPAGE\\\[.*\\\]\\\[.*\\\]\\\[.*\\\]\\\[.*\\\]$kui_prompt$" { pass "$test"} timeout { fail "timeout $test" } } set test "testing " send "special_Del" expect { -re "CGDB_KEY_DC\\\[.*\\\]\\\[.*\\\]\\\[.*\\\]$kui_prompt$" { pass "$test"} timeout { fail "timeout $test" } } set test "testing " send "special_Insert" expect { -re "CGDB_KEY_IC\\\[.*\\\]\\\[.*\\\]\\\[.*\\\]$kui_prompt$" { pass "$test"} timeout { fail "timeout $test" } } foreach {val} {1 2 3 4 5 6 7 8 9 10 11 12} { send "special_F$val" expect { -re "CGDB_KEY_F$val\\\[.*\\\]\\\[.*\\\]\\\[.*\\\]$kui_prompt$" { pass "$test"} timeout { fail "timeout $test" } } } # How to test? #set test "testing " #send "special_Nul" #expect { # -re "\0" # timeout { # fail "timeout $test" # } #} set test "testing " send "special_Bs" expect { -re "CGDB_KEY_CTRL_H\\\[8\\\]$kui_prompt$" { pass "$test"} timeout { fail "timeout $test" } } set test "testing " send "special_Tab" expect { -re "CGDB_KEY_CTRL_I\\\[9\\\]$kui_prompt$" { pass "$test"} timeout { fail "timeout $test" } } set test "testing " send "special_Nl" expect { -re "CGDB_KEY_CTRL_J\\\[10\\\]$kui_prompt$" { pass "$test"} timeout { fail "timeout $test" } } set test "testing " send "special_Ff" expect { -re "CGDB_KEY_CTRL_L\\\[12\\\]$kui_prompt$" { pass "$test"} timeout { fail "timeout $test" } } set test "testing " send "special_Cr" expect { -re "CGDB_KEY_CTRL_M\\\[13\\\]$kui_prompt$" { pass "$test"} timeout { fail "timeout $test" } } set test "testing " send "special_Return" expect { -re "CGDB_KEY_CTRL_M\\\[13\\\]$kui_prompt$" { pass "$test"} timeout { fail "timeout $test" } } set test "testing " send "special_Enter" expect { -re "CGDB_KEY_CTRL_M\\\[13\\\]$kui_prompt$" { pass "$test"} timeout { fail "timeout $test" } } set test "testing " send "special_Space" expect { -re " $kui_prompt$" { pass "$test"} timeout { fail "timeout $test" } } set test "testing " send "special_Lt" expect { -re "<$kui_prompt$" { pass "$test"} timeout { fail "timeout $test" } } set test "testing " send "special_Bslash" expect { -re "\\\\$kui_prompt$" { pass "$test"} timeout { fail "timeout $test" } } set test "testing " send "special_Bar" expect { -re "\\|$kui_prompt$" { pass "$test"} timeout { fail "timeout $test" } } # Test previously broken functionality set test "key not detected until next key hit" send "\033o" expect { -re "CGDB_KEY_ESC\\\[27\\\]o${kui_prompt}$" { pass "$test"} timeout { fail "timeout $test" } } # Make sure that maps that have been unmapped no longer work set test "check that unmapping works" send "map_to_unmap" expect { -re "bar${kui_prompt}$" { fail "$test"} timeout { pass "$test" } } # Make sure the example in the documentation is OK set test "check that unmapping example in the documentation works" send "a b" expect { -re "foo${kui_prompt}$" { fail "$test"} timeout { pass "$test" } } cgdb-0.6.7/test/config/unix.exp000644 000765 000024 00000001735 12074441140 017340 0ustar00mmuellerstaff000000 000000 # This file is in charge of starting up the kui_driver. # The rest of the tests assume that the program has already been started. set timeout 3 global KUI_DRIVER if ![info exists TGDB_DRIVER] { set KUI_DRIVER "../lib/kui/kui_driver" } if ![info exists kui_prompt] then { set kui_prompt "(\r\n)?\[(\]kui\[)\] " } # kui_exit -- quit and cleanup proc tgdb_exit {} { send "q\n" } # # kui_start -- start tgdb running # proc kui_start { map_path } { global KUI_DRIVER global kui_prompt global spawn_id global verbose set kui_args "" if { [llength $map_path] == 1} { set kui_args [lindex $map_path 0] } if { $verbose > 1 } { send_user "starting $KUI_DRIVER\n" } spawn $KUI_DRIVER $kui_args expect { -re "No such file.*" { perror "Can't start $KUI_DRIVER" ; return -1; } -re ".*$kui_prompt$" { return 0; } timeout { perror "Failed to spawn $KUI_DRIVER (timeout)"; return -1; } } return -1 } cgdb-0.6.7/lib/adt/000755 000765 000024 00000000000 12074766276 014747 5ustar00mmuellerstaff000000 000000 cgdb-0.6.7/lib/gdbmi/000755 000765 000024 00000000000 12074766276 015261 5ustar00mmuellerstaff000000 000000 cgdb-0.6.7/lib/kui/000755 000765 000024 00000000000 12074766277 014770 5ustar00mmuellerstaff000000 000000 cgdb-0.6.7/lib/Makefile.am000644 000765 000024 00000000062 12074441140 016205 0ustar00mmuellerstaff000000 000000 SUBDIRS = util rline adt gdbmi tgdb kui tokenizer cgdb-0.6.7/lib/Makefile.in000644 000765 000024 00000040423 12074766253 016242 0ustar00mmuellerstaff000000 000000 # Makefile.in generated by automake 1.13.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = lib DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/config/readline_check_version.m4 \ $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ RL_MAJOR = @RL_MAJOR@ RL_MINOR = @RL_MINOR@ RL_VERSION = @RL_VERSION@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ YACC = @YACC@ YFLAGS = @YFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = util rline adt gdbmi tgdb kui tokenizer all: all-recursive .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu lib/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu lib/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. # To change the values of 'make' variables: instead of editing Makefiles, # (1) if the variable is set in 'config.status', edit 'config.status' # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. $(am__recursive_targets): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: .MAKE: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ check-am clean clean-generic cscopelist-am ctags ctags-am \ distclean distclean-generic distclean-tags distdir dvi dvi-am \ html html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ pdf-am ps ps-am tags tags-am uninstall uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: cgdb-0.6.7/lib/rline/000755 000765 000024 00000000000 12074766276 015310 5ustar00mmuellerstaff000000 000000 cgdb-0.6.7/lib/tgdb/000755 000765 000024 00000000000 12074766277 015120 5ustar00mmuellerstaff000000 000000 cgdb-0.6.7/lib/tokenizer/000755 000765 000024 00000000000 12074766277 016212 5ustar00mmuellerstaff000000 000000 cgdb-0.6.7/lib/util/000755 000765 000024 00000000000 12074766276 015154 5ustar00mmuellerstaff000000 000000 cgdb-0.6.7/lib/util/fork_util.c000644 000765 000024 00000013454 12074441140 017301 0ustar00mmuellerstaff000000 000000 #if HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #if HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #if HAVE_STDIO_H #include #endif /* HAVE_STDIO_H */ #if HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #if HAVE_SYS_STAT_H #include #endif #if HAVE_SIGNAL_H #include #endif /* HAVE_SIGNAL_H */ #if HAVE_ERRNO_H #include #endif /* HAVE_ERRNO_H */ #include "fork_util.h" #include "sys_util.h" #include "fs_util.h" #include "pseudo.h" #include "logger.h" #include "terminal.h" struct pty_pair { int masterfd; int slavefd; char slavename[SLAVE_SIZE]; }; pty_pair_ptr pty_pair_create(void) { int val; static char local_slavename[SLAVE_SIZE]; pty_pair_ptr ptr = (pty_pair_ptr) cgdb_malloc(sizeof (struct pty_pair)); if (!ptr) return NULL; ptr->masterfd = -1; ptr->slavefd = -1; ptr->slavename[0] = 0; val = pty_open(&(ptr->masterfd), &(ptr->slavefd), local_slavename, SLAVE_SIZE, NULL, NULL); if (val == -1) { logger_write_pos(logger, __FILE__, __LINE__, "PTY open"); return NULL; } strncpy(ptr->slavename, local_slavename, SLAVE_SIZE); return ptr; } int pty_pair_destroy(pty_pair_ptr pty_pair) { if (!pty_pair) return -1; cgdb_close(pty_pair->masterfd); cgdb_close(pty_pair->slavefd); if (pty_release(pty_pair->slavename) == -1) { logger_write_pos(logger, __FILE__, __LINE__, "pty_release error"); return -1; } free(pty_pair); return 0; } int pty_pair_get_masterfd(pty_pair_ptr pty_pair) { if (!pty_pair) return -1; return pty_pair->masterfd; } int pty_pair_get_slavefd(pty_pair_ptr pty_pair) { if (!pty_pair) return -1; return pty_pair->slavefd; } const char *pty_pair_get_slavename(pty_pair_ptr pty_pair) { if (!pty_pair) return NULL; return pty_pair->slavename; } int pty_free_process(int *masterfd, char *sname) { cgdb_close(*masterfd); if (pty_release(sname) == -1) { logger_write_pos(logger, __FILE__, __LINE__, "pty_release error"); return -1; } return 0; } /** * Utility function that frees up memory. * * \param argc * The number of items in argv * * \param argv * free is called on each of these */ void free_memory(int argc, char *argv[]) { int i; /* Free the local list */ for (i = 0; i < argc; i++) free(argv[i]); free(argv); } /* free_memory: utility function that frees up memory. * * s: if NULL, left alone, otherwise pty_release is called on it * fd: if -1, left alone, otherwise close is called on it * argc: The number of items in argv * argv: free is called on each of these * * Returns -1 if any call fails, otherwise 0 */ static int pty_free_memory(char *s, int fd, int argc, char *argv[]) { int error = 0, i; if (s && pty_release(s) == -1) { logger_write_pos(logger, __FILE__, __LINE__, "pty_release failed"); error = -1; } if (fd != -1 && close(fd) == -1) { logger_write_pos(logger, __FILE__, __LINE__, "close failed"); error = -1; } /* Free the local list */ for (i = 0; i < argc; i++) free(argv[i]); free(argv); return error; } int invoke_debugger(const char *path, int argc, char *argv[], int *in, int *out, int choice, char *filename) { pid_t pid; const char *const GDB = "gdb"; const char *const NW = "--nw"; const char *const X = "-x"; const char *const ANNOTATE_TWO = "--annotate=2"; const char *const GDBMI = "-i=mi2"; char *F = filename; char **local_argv; int i, j = 0, extra = 6; int malloc_size = argc + extra; char slavename[64]; int masterfd; /* Copy the argv into the local_argv, and NULL terminate it. * sneak in the path name, the user did not type that */ local_argv = (char **) cgdb_malloc((malloc_size) * sizeof (char *)); if (path) local_argv[j++] = cgdb_strdup(path); else local_argv[j++] = cgdb_strdup(GDB); /* NOTE: These options have to come first, since if the user * typed '--args' to GDB, everything at the end of the * users options become parameters to the inferior. */ local_argv[j++] = cgdb_strdup(NW); /* add the init file that the user did not type */ if (choice == 0) local_argv[j++] = cgdb_strdup(ANNOTATE_TWO); else if (choice == 1) local_argv[j++] = cgdb_strdup(GDBMI); local_argv[j++] = cgdb_strdup(X); local_argv[j++] = cgdb_strdup(F); /* copy in all the data the user entered */ for (i = 0; i < argc; i++) local_argv[j++] = cgdb_strdup(argv[i]); local_argv[j] = NULL; /* Fork into two processes with a shared pty pipe */ pid = pty_fork(&masterfd, slavename, SLAVE_SIZE, NULL, NULL); if (pid == -1) { /* error, free memory and return */ pty_free_memory(slavename, masterfd, argc, local_argv); logger_write_pos(logger, __FILE__, __LINE__, "fork failed"); return -1; } else if (pid == 0) { /* child */ FILE *fd = fopen(slavename, "r"); if (fd) tty_set_echo(fileno(fd), 0); /* If this is not called, when user types ^c SIGINT gets sent to gdb */ setsid(); execvp(local_argv[0], local_argv); /* Will get here if exec failed. This will happen when the * - "gdb" is not on the users path, or if * - user specified a different program via the -d option and it was * not able to be exec'd. */ exit(0); } *in = masterfd; *out = masterfd; free_memory(malloc_size, local_argv); return pid; } cgdb-0.6.7/lib/util/fork_util.h000644 000765 000024 00000004262 12074441140 017303 0ustar00mmuellerstaff000000 000000 #ifndef __FORK_UTIL_H__ #define __FORK_UTIL_H__ /** * This code probably belongs in a separate file, or maybe in pseudo.h. However, * I don't want to change that in the rl BRANCH. */ struct pty_pair; typedef struct pty_pair *pty_pair_ptr; /** * Create a new pty pair context. * * \return * A new pty_pair on success, NULL on error. */ pty_pair_ptr pty_pair_create(void); /** * Destroy the pty pair context. * * \param pty_pair * The pty_pair context to destroy * * \return * 0 on success or -1 on error */ int pty_pair_destroy(pty_pair_ptr pty_pair); /** * Get the masterfd from the pty pair. * * \param pty_pair * The pair to get the masterfd from. * * \return * The master fd on success or -1 on error. */ int pty_pair_get_masterfd(pty_pair_ptr pty_pair); /** * Get the slavefd from the pty pair. * * \param pty_pair * The pair to get the slavefd from. * * \return * The slave fd on success or -1 on error. */ int pty_pair_get_slavefd(pty_pair_ptr pty_pair); /** * Get the slave device name from the pty pair. * * \param pty_pair * The pair to get the slave device name from. * * \return * The slave device name or NULL on error. * The return data should not be modified. */ const char *pty_pair_get_slavename(pty_pair_ptr pty_pair); /* invoke_debugger: Forks and execs the path. * path: The path to the path. * argc: The number of parameters to the path. * argv: an array of pointers to null-terminated strings that represent * the argument list available to the new program. * The first argument, by convention, should point to the file * name associated with the file being executed. The array of * pointers must be terminated by a NULL pointer. * in: Writing to this fd, will write to the STDIN of new program. * out: Reading from fd, will read from the STDOUT-STDERR of new program. * choice: 0 for annotate 2, 1 for gdbmi * filename: The name of the init file for annotate 2 * * Return: -1 on error, pid of child on success */ int invoke_debugger(const char *path, int argc, char *argv[], int *in, int *out, int choice, char *filename); #endif cgdb-0.6.7/lib/util/fs_util.c000644 000765 000024 00000007112 12074441140 016742 0ustar00mmuellerstaff000000 000000 #if HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #if HAVE_STDIO_H #include #endif /* HAVE_STDIO_H */ #if HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #if HAVE_SYS_STAT_H #include #endif #if HAVE_SIGNAL_H #include #endif /* HAVE_SIGNAL_H */ #if HAVE_ERRNO_H #include #endif /* HAVE_ERRNO_H */ #if HAVE_CYGWIN #include #endif /* HAVE_CYGWIN */ #include "fs_util.h" #include "logger.h" #define MAXLINE 4096 /* TODO: The cgywin_conv functions used here are deprecated. */ int fs_util_is_valid(const char *dir) { char actual_dir[FSUTIL_PATH_MAX]; #ifdef HAVE_CYGWIN char cygwin_actual_dir[FSUTIL_PATH_MAX]; #endif if (dir == NULL) { logger_write_pos(logger, __FILE__, __LINE__, "$HOME is not set"); return 0; } /* Get the directory to check */ #ifdef HAVE_CYGWIN cygwin_conv_to_full_win32_path(dir, cygwin_actual_dir); strncpy(actual_dir, cygwin_actual_dir, strlen(cygwin_actual_dir) + 1); #else strncpy(actual_dir, dir, strlen(dir) + 1); #endif /* Check if directory dir is readable and writeable */ if (access(actual_dir, R_OK | W_OK) == -1) { if (errno == ENOENT) { logger_write_pos(logger, __FILE__, __LINE__, "directory '%s' is not set", dir); return 0; } logger_write_pos(logger, __FILE__, __LINE__, "directory '%s' does not have read/write permissions", dir); return 0; } return 1; } int fs_util_create_dir(const char *dir) { char actual_dir[FSUTIL_PATH_MAX]; struct stat st; #ifdef HAVE_CYGWIN char cygwin_actual_dir[FSUTIL_PATH_MAX]; #endif if (dir == NULL) { logger_write_pos(logger, __FILE__, __LINE__, "dir is NULL"); return 0; } /* Get the directory to check */ #ifdef HAVE_CYGWIN cygwin_conv_to_full_win32_path(dir, cygwin_actual_dir); strncpy(actual_dir, cygwin_actual_dir, strlen(cygwin_actual_dir) + 1); #else strncpy(actual_dir, dir, strlen(dir) + 1); #endif /* Check to see if already exists, if does not exist continue */ if (!stat(actual_dir, &st)) { /* The file exists, see if it is a directory */ if (S_ISDIR(st.st_mode)) return 1; else { logger_write_pos(logger, __FILE__, __LINE__, "file %d is not a directory", actual_dir); return 0; } } else { /* The file does not exist, create it */ if (errno == ENOENT) { if (mkdir(actual_dir, 0755) == -1) { logger_write_pos(logger, __FILE__, __LINE__, "directory %s could not be made", actual_dir); return 0; } else return 1; } /* Error */ return 0; } return 1; } int fs_util_create_dir_in_base(const char *base, const char *dirname) { char dir[FSUTIL_PATH_MAX]; /* Make surr the directory is valid */ if (!fs_util_is_valid(base)) { logger_write_pos(logger, __FILE__, __LINE__, "fs_util_is_valid error"); return -1; } sprintf(dir, "%s/%s", base, dirname); return fs_util_create_dir(dir); } void fs_util_get_path(const char *base, const char *name, char *path) { char dir[FSUTIL_PATH_MAX]; sprintf(dir, "%s/%s", base, name); #ifdef HAVE_CYGWIN cygwin_conv_to_full_win32_path(dir, path); #else strncpy(path, dir, strlen(dir) + 1); #endif } cgdb-0.6.7/lib/util/fs_util.h000644 000765 000024 00000004116 12074441140 016750 0ustar00mmuellerstaff000000 000000 #ifndef __FS_UTIL_H__ #define __FS_UTIL_H__ /******************************************************************************* * * This is the file system unit. All attempts to access the file system should * be directed through this unit. * * All char pointers passed to functions in this unit should be FSUTIL_PATH_MAX * in length at a minumum. Unfortunatly, the POSIX PATH_MAX can't be used here * since it isn't defined with the HURD OS. * * Anyways, I think in the long run the static buffer will not be the best * option and it should be replaced with a dynamic data structure. However, * for the sake of time, it is done this way. ******************************************************************************/ #define FSUTIL_PATH_MAX 1024 /* fs_util_is_valid: * ----------------- * * Checks to see if the directory dir exists and has read/write permissions. * * dir - The directory to check. * * Returns 1 on succes and 0 on failure */ int fs_util_is_valid(const char *dir); /* fs_util_create_dir: * ------------------- * * Creates the directory dir * * dir - The directory to create. * * Returns * 1 on succes or if dir already exists. * 0 on failure. */ int fs_util_create_dir(const char *dir); /* fs_util_create_dir_in_base: * --------------------------- * * Creates the directory dirname in directory base * First calls fs_util_is_valid for base before trying to create directory. * * * base - The directory to put the new directory dirname * dirname - Then name of the directory to create in directory base * * Returns * 1 on succes or if dir already exists. * 0 on failure. */ int fs_util_create_dir_in_base(const char *base, const char *dirname); /* fs_util_get_path: * ----------------- * * Returns the path of the directory/file name in directory base * ex. base=/usr/local, dirname=bin => path=/usr/local/bin * * base - The directory to put the new directory dirname * name - Then name of the name to create in directory base */ void fs_util_get_path(const char *base, const char *name, char *path); #endif cgdb-0.6.7/lib/util/io.c000644 000765 000024 00000016421 12074441140 015707 0ustar00mmuellerstaff000000 000000 #if HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #if HAVE_STDIO_H #include #endif /* HAVE_STDIO_H */ #if HAVE_STDARG_H #include #endif /* HAVE_STDARG_H */ #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_ERRNO_H #include #endif /* HAVE_ERRNO_H */ #if HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #if HAVE_SYS_STAT_H #include #endif #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #ifdef HAVE_FCNTL_H #include #endif /* HAVE_FCNTL_H */ #if HAVE_SYS_TYPES_H #include #endif /* HAVE_SYS_TYPES_H */ #ifdef HAVE_SYS_TIME_H #include #endif #ifdef HAVE_SYS_SELECT_H #include #endif /* HAVE_SYS_SELECT_H */ #if HAVE_ERRNO_H #include #endif /* HAVE_ERRNO_H */ #include "io.h" #include "logger.h" #define MAXLINE 4096 static FILE *dfd = NULL; static int debug_on = 0; static const char *debug_begin = ""; static const char *debug_end = ""; static void process_error(void) { if (errno == EINTR) logger_write_pos(logger, __FILE__, __LINE__, "ERRNO = EINTR"); else if (errno == EAGAIN) logger_write_pos(logger, __FILE__, __LINE__, "ERRNO = EAGAIN"); else if (errno == EIO) logger_write_pos(logger, __FILE__, __LINE__, "ERRNO = EIO"); else if (errno == EISDIR) logger_write_pos(logger, __FILE__, __LINE__, "ERRNO = EISDIR"); else if (errno == EBADF) logger_write_pos(logger, __FILE__, __LINE__, "ERRNO = EBADF"); else if (errno == EINVAL) logger_write_pos(logger, __FILE__, __LINE__, "ERRNO = EINVAL"); else if (errno == EFAULT) logger_write_pos(logger, __FILE__, __LINE__, "ERRNO = EFAULT"); } int io_debug_init(const char *filename) { char config_dir[MAXLINE]; if (filename == NULL) return -1; strcpy(config_dir, filename); if ((dfd = fopen(config_dir, "w")) == NULL) { logger_write_pos(logger, __FILE__, __LINE__, "could not open debug file"); return -1; } /* A nifty trick to have debug dump to the terminal * dfd = stderr;*/ debug_on = 1; return 0; } void io_debug_write(const char *write) { fprintf(dfd, "%s%s%s", debug_begin, write, debug_end); fflush(dfd); } void io_debug_write_fmt(const char *fmt, ...) { va_list ap; char va_buf[MAXLINE]; va_start(ap, fmt); #ifdef HAVE_VSNPRINTF vsnprintf(va_buf, sizeof (va_buf), fmt, ap); /* this is safe */ #else vsprintf(va_buf, fmt, ap); /* this is not safe */ #endif va_end(ap); fprintf(dfd, "%s", va_buf); fflush(dfd); } int io_read_byte(char *c, int source) { int ret_val = 0; if ((ret_val = read(source, c, 1)) == 0) { return -1; } else if (ret_val == -1) { logger_write_pos(logger, __FILE__, __LINE__, "I/O error"); process_error(); return -1; } return 0; } int io_write_byte(int dest, char c) { if (write(dest, &c, 1) != 1) return -1; return 0; } int io_rw_byte(int source, int dest) { char c; if (read(source, &c, 1) != 1) { logger_write_pos(logger, __FILE__, __LINE__, "I/O error"); process_error(); return -1; } if (write(dest, &c, 1) != 1) { logger_write_pos(logger, __FILE__, __LINE__, "I/O error"); return -1; } return 0; } ssize_t io_read(int fd, void *buf, size_t count) { ssize_t amountRead; tgdb_read: if ((amountRead = read(fd, buf, count)) == -1) { /* error */ if (errno == EINTR) goto tgdb_read; else if (errno != EIO) { logger_write_pos(logger, __FILE__, __LINE__, "error reading from fd"); return -1; } else { return 0; /* Happens on EOF for some reason */ } } else if (amountRead == 0) { /* EOF */ return 0; } else { char *tmp = (char *) buf; tmp[amountRead] = '\0'; if (debug_on == 1) { int i; fprintf(dfd, "%s", debug_begin); for (i = 0; i < amountRead; ++i) { if (((char *) buf)[i] == '\r') fprintf(dfd, "(%s)", "\\r"); else if (((char *) buf)[i] == '\n') fprintf(dfd, "(%s)\n", "\\n"); else if (((char *) buf)[i] == '\032') fprintf(dfd, "(%s)", "\\032"); else if (((char *) buf)[i] == '\b') fprintf(dfd, "(%s)", "\\b"); else fprintf(dfd, "%c", ((char *) buf)[i]); } fprintf(dfd, "%s", debug_end); fflush(dfd); } return amountRead; } } ssize_t io_writen(int fd, const void *vptr, size_t n) { ssize_t nwritten; size_t nleft = n; const char *ptr = (const char *) vptr; while (nleft > 0) { if ((nwritten = write(fd, ptr, nleft)) <= 0) { if (errno == EINTR) nwritten = 0; else return -1; } nleft -= nwritten; ptr += nwritten; } return (n); } void io_display_char(FILE * fd, char c) { if (c == '\r') fprintf(fd, "(%s)", "\\r"); else if (c == '\n') fprintf(fd, "(%s)\n", "\\n"); else if (c == '\032') fprintf(fd, "(%s)", "\\032"); else if (c == '\b') fprintf(fd, "(%s)", "\\b"); else fprintf(fd, "(%c)", c); fflush(fd); } int io_data_ready(int fd, int ms) { int ret; #if defined(HAVE_SYS_SELECT_H) fd_set readfds, exceptfds; struct timeval timeout; struct timeval *timeout_ptr = &timeout; FD_ZERO(&readfds); FD_ZERO(&exceptfds); FD_SET(fd, &readfds); FD_SET(fd, &exceptfds); timeout.tv_sec = ms / 1000; timeout.tv_usec = (ms % 1000) * 1000; /* Enforce blocking semantics if the user requested it */ if (ms == -1) timeout_ptr = NULL; ret = select(fd + 1, &readfds, (fd_set *) NULL, &exceptfds, timeout_ptr); if (ret == -1) { logger_write_pos(logger, __FILE__, __LINE__, "Errno(%d)\n", errno); return -1; } if (ret <= 0) return 0; /* Nothing to read. */ else return 1; #endif } int io_getchar(int fd, unsigned int ms, int *key) { char c; int ret; int flag = 0; int val; if (!key) return -1; val = io_data_ready(fd, ms); if (val == -1) { logger_write_pos(logger, __FILE__, __LINE__, "Errno(%d)\n", errno); return -1; } if (val == 0) return 0; /* Nothing to read. */ /* Set nonblocking */ flag = fcntl(fd, F_GETFL, 0); fcntl(fd, F_SETFL, flag | O_NONBLOCK); read_again: /* Read a char */ ret = read(fd, &c, 1); if (ret == -1 && errno == EAGAIN) c = 0; /* No data available */ else if (ret == -1 && errno == EINTR) goto read_again; else if (ret == -1) { c = 0; logger_write_pos(logger, __FILE__, __LINE__, "Errno(%d)\n", errno); } else if (ret == 0) { c = 0; ret = -1; logger_write_pos(logger, __FILE__, __LINE__, "Read returned nothing\n"); } /* Set to original state */ fcntl(fd, F_SETFL, flag); if (ret == -1) return -1; *key = c; return 1; } cgdb-0.6.7/lib/util/io.h000644 000765 000024 00000006515 12074441140 015717 0ustar00mmuellerstaff000000 000000 #ifndef __IO_H__ #define __IO_H__ #if HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #if HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #if HAVE_STDIO_H #include #endif /* HAVE_STDIO_H */ #define MAX_LINE 4096 /* The Next three function handle reading and writing of bytes */ /* io_read_byte: reads the byte c from source. * Return: -1 on error, 0 on success */ int io_read_byte(char *c, int source); /* io_write_byte: Writes the byte 'c' to dest. * Return: -1 on error, 0 on success */ int io_write_byte(int dest, char c); /* io_rw_byte: Reads a byte from source and writes it to dest. * Return: -1 on error, 0 on success */ int io_rw_byte(int source, int dest); /* io_read: Attempts to read count bytes from fd and stores the * data into buf. * Returns: The amount read on success. * 0 on EOF and * -1 on error */ ssize_t io_read(int fd, void *buf, size_t count); /* io_writen: This will write n bytes of vptr to fd. * * It recieves: * fd - The file descriptor to write to. * n - The number of bytes to write. * vptr - A pointer to the data to be written. * * RETURN: The number of bytes written (should always be n bytes) * -1 on error. */ ssize_t io_writen(int fd, const void *vptr, size_t n); /* io_debug_init: Puts tgdb in a mode where it writes a debug log of everything * that is read from gdb. That is basically the entire session. This info * is usefull in determining what is going on under tgdb since the gui * is good at hiding that info from the user. * * filename is the file that the debug info will go to. If it is null, the * debug data will be writting to $HOME/.tgdb/tgdb_debug.txt * * Returns: 0 on success, or -1 if can not open file. */ int io_debug_init(const char *filename); /* io_debug_write: Writes null terminated data cstring to debug file. */ void io_debug_write(const char *write); void io_debug_write_fmt(const char *fmt, ...); /* io_display_char: Displays the char c in fd. * This is usefull when c is a '\r' or '\n' because it will be displayed * that way in the file. */ void io_display_char(FILE * fd, char c); /* io_data_ready: * -------------- * * fd the descriptor to check for. * ms the amount of time in milliseconds to wait. * pass 0, if you do not want to wait. * pass -1, if you want the read to block. * * This function checks to see if data is ready on FD. * If this function returns 1 then at least one byte can be read. * * Return: 1 if data is ready, 0 if it's not, or -1 on error */ int io_data_ready(int fd, int ms); /** * Read in 1 charachter. * * If no I/O is ready, then the function will wait ms milliseconds waiting * for input. After that amount of time, this function will return, with * or without input. * * This function is non blocking if ms is 0. * * \param fd * The descriptor to read in from. * * \param ms * The The amount of time in milliseconds to wait for input. * Pass 0, if you do not want to wait. * Pass -1, if you want to block indefinately. * * \param key * The character read if the return value is successful * * @return * -1 on error, 0 if no data is ready, 1 on success */ int io_getchar(int fd, unsigned int ms, int *key); #endif /* __IO_H__ */ cgdb-0.6.7/lib/util/logger.c000644 000765 000024 00000010362 12074441140 016555 0ustar00mmuellerstaff000000 000000 #if HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #if HAVE_STDIO_H #include #endif /* HAVE_STDIO_H */ #if HAVE_STDARG_H #include /* ANSI C header file */ #endif /* HAVE_STDARG_H */ #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_ERRNO_H #include #endif /* HAVE_ERRNO_H */ #define MAXLINE 4096 #include "logger.h" struct logger *logger = NULL; struct logger { /** The name of the file that is being logged to. */ char *log_file; /** * The file descriptor being written to. * NULL if there is no current file being written to. */ FILE *fd; /** * A flag telling if this logger has had any data written to it * since it was opened. */ int used; /** * A flag to tell if the logger is currently recording data * passed to it. * 1 if it is recording. * 0 if it is not. */ int recording; }; struct logger *logger_create(void) { struct logger *log; log = (struct logger *) malloc(sizeof (struct logger)); if (!log) return NULL; log->log_file = NULL; log->fd = NULL; log->used = 0; log->recording = 1; return log; } int logger_destroy(struct logger *log) { if (!log) return 0; if (log->log_file) { free(log->log_file); log->log_file = NULL; } if (log->fd) { fclose(log->fd); log->fd = NULL; } free(log); log = NULL; return 0; } /** * This is used to close or discard the data was being used to * write to a file, descriptor or whatever else. * After this is called, another file or descriptor can be setup, * and the logger should use that from then on. * * \param log * The logger context. * * \return * 0 on success, or -1 on error. */ static int logger_close_writer(struct logger *log) { if (!log) return -1; /* A file is being written to */ if (log->log_file) { free(log->log_file); log->log_file = NULL; fclose(log->fd); log->fd = NULL; /* A descriptor was passed in, discard it */ } else if (log->fd) { log->fd = NULL; } log->used = 0; return 0; } int logger_set_file(struct logger *log, const char *file) { if (!log) return -1; if (!file) return -1; /* prepare for writing */ if (logger_close_writer(log) == -1) return -1; log->fd = fopen(file, "w"); /* If the open failed, just return */ if (!log->fd) { printf("Error: Could not open file %s for writing\n", file); return -1; } log->log_file = strdup(file); return 0; } int logger_set_fd(struct logger *log, FILE * fd) { if (!log) return -1; if (!fd) return -1; /* prepare for writing */ if (logger_close_writer(log) == -1) return -1; log->fd = fd; return 0; } int logger_get_file(struct logger *log, char **file) { if (!file) return -1; *file = 0; if (!log) return -1; *file = log->log_file; return 0; } int logger_write_pos(struct logger *log, const char *file, int line, const char *fmt, ...) { va_list ap; char va_buf[MAXLINE]; if (!log) return -1; /* It's OK to write nothing */ if (!fmt) return 0; if (!log->recording) return 0; /* Get the buffer with format */ va_start(ap, fmt); #ifdef HAVE_VSNPRINTF vsnprintf(va_buf, sizeof (va_buf), fmt, ap); /* this is safe */ #else vsprintf(va_buf, fmt, ap); /* this is not safe */ #endif va_end(ap); fprintf(log->fd, "%s:%d %s\n", file, line, va_buf); log->used = 1; return 0; } int logger_has_recv_data(struct logger *log, int *has_recv_data) { if (!has_recv_data) return -1; *has_recv_data = 0; if (!log) return 0; *has_recv_data = log->used; return 0; } int logger_set_record(struct logger *log, int record) { if (!log) return -1; if (record == 1) log->recording = 1; if (record == 0) log->recording = 0; return 0; } int logger_is_recording(struct logger *log) { if (!log) return -1; return log->recording; } cgdb-0.6.7/lib/util/logger.h000644 000765 000024 00000010522 12074441140 016560 0ustar00mmuellerstaff000000 000000 #ifndef __LOGGER_H__ #define __LOGGER_H__ #if HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #if HAVE_STDIO_H #include #endif /* HAVE_STDIO_H */ /* Doxygen headers {{{ */ /*! * \file * logger.h * * \brief * This interface is intended to be the abstraction layer between an application * and any data logging that application needs to perform. */ /* }}} */ /* struct logger {{{ */ /** * @name Creating and destroying a logger * * A log context is basically a way to store data into a file. * You can initialize the logger, give it data, and then close it. */ /*@{*/ struct logger; typedef struct logger *logger_ptr; /** * Create a logger context. * * \return * The new instance of a logger, or NULL on error */ struct logger *logger_create(void); /** * Destroy a logger context. * * \param log * The instance to destroy * * \return * 0 on succes, or -1 on error. */ int logger_destroy(struct logger *log); /*@}*/ /*@{*/ /** * @name Setting file names * These functions control where the logger writes to */ /** * Tells the logger which file to write to. * * If a file was already being written to, this will close that * file and start writing to the new file. * * If a descriptor was being written to, the descriptor will be * discarded, and the new file will be written to. * * \param log * The logger to set the file to. * * \param file * The name of the file to write to * * \return * 0 on success, or -1 on error */ int logger_set_file(struct logger *log, const char *file); /** * Get's the file that the logger is writting to. * This could be used to tell the user what file the error's * are being sent to. * * \param log * The logger context * * \param file * On return, this will be set to the file that the logger is * writing to. The memory returned should not be modified. * * \return * 0 on success, or -1 on error */ int logger_get_file(struct logger *log, char **file); /** * Set's the stream that the logger should write to. * The stream should be open, before being passed in, the * logger doesn't attempt to open or close it in any way, * it only writes to the stream. * * If a file was already being written to, this will close that * file and start writing to the new descriptor. * * If a descriptor was being written to, the descriptor will be * discarded, and the new descriptor will be used. * * \param log * The logger context * * \param fd * The file descriptor the logger should write to. * * \return * 0 on success, or -1 on error */ int logger_set_fd(struct logger *log, FILE * fd); /*@}*/ /*@{*/ /** * @name Writing to the logger * These functions allow the client to write data to the logger */ /** * Write data to the logger, including a position * * \param log * The logger context to write to. * * \param file * The name of the file the error was produced in * * \param line * The line number the error came from * * \param fmt * The format of the error message * * \param ... * The data to write * * \return * 0 on succes, -1 on error */ int logger_write_pos(struct logger *log, const char *file, int line, const char *fmt, ...); /*@}*/ /*@{*/ /** * @name Querying the status of the logger * These functions query the logger to find out information about it. */ /** * Checks to see if the logger has had any data written to it. * * \param log * The logger context * * \param has_recv_data * This will return as 1 if data has been written to the logger since * it was created, otherwise, it will return as 0. * * \return * 0 on succes, -1 on error */ int logger_has_recv_data(struct logger *log, int *has_recv_data); /** * This tells the logger if it should be recording the data that * is sent to it or not. By default, the logger will record data * that is written to it. * * \param log * The logger context * * \param record * 1 if you wish to have the logger record the data ( default ) * 0 if you wish the logger to ignore the data it recieves. * * \return * 0 on succes, -1 on error */ int logger_set_record(struct logger *log, int record); /** * Checks to see if the logger is currently recording. * * \param log * The logger context * * \return * 1 if it is recording, 0 otherwise. */ int logger_is_recording(struct logger *log); /*@}*/ extern struct logger *logger; /* }}} */ #endif cgdb-0.6.7/lib/util/Makefile.am000644 000765 000024 00000000414 12074441140 017163 0ustar00mmuellerstaff000000 000000 noinst_LIBRARIES = libutil.a libutil_a_SOURCES = \ fork_util.c \ fork_util.h \ fs_util.c \ fs_util.h \ io.c \ io.h \ logger.c \ logger.h \ pseudo.c \ pseudo.h \ sys_util.c \ sys_util.h \ terminal.c \ terminal.h cgdb-0.6.7/lib/util/Makefile.in000644 000765 000024 00000036310 12074766253 017217 0ustar00mmuellerstaff000000 000000 # Makefile.in generated by automake 1.13.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = lib/util DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/config/depcomp ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/config/readline_check_version.m4 \ $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LIBRARIES = $(noinst_LIBRARIES) AR = ar ARFLAGS = cru AM_V_AR = $(am__v_AR_@AM_V@) am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@) am__v_AR_0 = @echo " AR " $@; am__v_AR_1 = libutil_a_AR = $(AR) $(ARFLAGS) libutil_a_LIBADD = am_libutil_a_OBJECTS = fork_util.$(OBJEXT) fs_util.$(OBJEXT) \ io.$(OBJEXT) logger.$(OBJEXT) pseudo.$(OBJEXT) \ sys_util.$(OBJEXT) terminal.$(OBJEXT) libutil_a_OBJECTS = $(am_libutil_a_OBJECTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libutil_a_SOURCES) DIST_SOURCES = $(libutil_a_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ RL_MAJOR = @RL_MAJOR@ RL_MINOR = @RL_MINOR@ RL_VERSION = @RL_VERSION@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ YACC = @YACC@ YFLAGS = @YFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_LIBRARIES = libutil.a libutil_a_SOURCES = \ fork_util.c \ fork_util.h \ fs_util.c \ fs_util.h \ io.c \ io.h \ logger.c \ logger.h \ pseudo.c \ pseudo.h \ sys_util.c \ sys_util.h \ terminal.c \ terminal.h all: all-am .SUFFIXES: .SUFFIXES: .c .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu lib/util/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu lib/util/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) libutil.a: $(libutil_a_OBJECTS) $(libutil_a_DEPENDENCIES) $(EXTRA_libutil_a_DEPENDENCIES) $(AM_V_at)-rm -f libutil.a $(AM_V_AR)$(libutil_a_AR) libutil.a $(libutil_a_OBJECTS) $(libutil_a_LIBADD) $(AM_V_at)$(RANLIB) libutil.a mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fork_util.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fs_util.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/io.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/logger.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pseudo.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sys_util.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/terminal.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LIBRARIES) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ clean-noinstLIBRARIES cscopelist-am ctags ctags-am distclean \ distclean-compile distclean-generic distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \ uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: cgdb-0.6.7/lib/util/pseudo.c000644 000765 000024 00000047515 12074441140 016607 0ustar00mmuellerstaff000000 000000 /* * libslack - http://libslack.org/ * * Copyright (C) 1999-2001 raf * * 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 of the License, 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; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * or visit http://www.gnu.org/copyleft/gpl.html * * 20011109 raf */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland * All rights reserved * Allocating a pseudo-terminal, and making it the controlling tty. * * As far as I am concerned, the code I have written for this software * can be used freely for any purpose. Any derived versions of this * software must be clearly marked as such, and if the derived work is * incompatible with the protocol description in the RFC file, it must be * called by a name other than "ssh" or "Secure Shell". */ #include "config.h" #define _GNU_SOURCE /* ptsname_r() under Linux */ #include #include #include /* With out this, cgdb will crash on gentoo when built with a 64 bit machine */ #ifdef HAVE_STDINT_H #include #endif #ifdef HAVE_PTY_H #include #endif #ifdef HAVE_UTIL_H #include #endif #ifdef HAVE_LIBUTIL_H #include #endif #include #include #include #include #include #include #include #include #include #include "pseudo.h" /* Pty allocated with _getpty gets broken if we do I_PUSH:es to it */ #if defined(HAVE__GETPTY) || defined(HAVE_OPENPTY) #undef HAVE_DEV_PTMX #endif #ifdef HAVE_PTY_H #include #endif #if defined(HAVE_DEV_PTMX) && defined(HAVE_SYS_STROPTS_H) #include #endif #if defined(HAVE_VHANGUP) && !defined(HAVE_DEV_PTMX) #define USE_VHANGUP #endif #ifndef O_NOCTTY #define O_NOCTTY 0 #endif #ifndef PATH_TTY #define PATH_TTY "/dev/tty" #endif #define set_errno(errnum) (errno = (errnum), -1) /* strlcpy_local: Used instead of strcpy. Copies src into dst size bytes long. * * dst: destination * src: source * size: amount to copy from source to dest. * * NOTE: dst will be no longer than size - 1 bytes and will be nul * terminated (unless size is zero). This is similar to strncpy() * except that it always terminates the string with a nul byte * (so it's safer) and it doesn't fill the remainder of the buffer * with nul bytes (so it's faster). Returns the length of src * (If this is >= size, truncation occurred). */ static size_t strlcpy_local(char *dst, const char *src, size_t size) { const char *s = src; char *d = dst; size_t n = size; if (n) while (--n && (*d++ = *s++)) { } if (n == 0) { if (size) *d = '\0'; while (*s++) { } } return s - src - 1; } static int groupname2gid(const char *groupname) { FILE *group = fopen("/etc/group", "r"); char line[BUFSIZ], *gid; int ret = -1; while (fgets(line, BUFSIZ, group)) { if (!strncmp(line, "tty:", 4)) { if ((gid = strchr(line + 4, ':'))) ret = atoi(gid + 1); break; } } fclose(group); return ret; } static int uid2gid(uid_t uid) { FILE *passwd = fopen("/etc/passwd", "r"); char line[BUFSIZ], *ptr; int ret = -1; while (fgets(line, BUFSIZ, passwd)) { if ((ptr = strchr(line, ':')) && (ptr = strchr(ptr + 1, ':')) && atoi(ptr + 1) == (int) uid && (ptr = strchr(ptr + 1, ':'))) { ret = atoi(ptr + 1); break; } } fclose(passwd); return ret; } /* pty_open: A safe version of openpty. * Allocates and opens a pseudo terminal. The new descriptor for the * master side of the pseudo terminal is stored in masterfd. The new * descriptor for the slave side of the pseudo terminal is stored in slavefd. * The device name of the slave side of the pseudo terminal is stored in the * buffer pointed to by slavename which must be able to hold at least 64 * characters. slavenamesize is the size of the buffer pointed to by * slavename. No more than slavenamesize bytes will be written into the * buffer pointed to by slavename, including the terminating nul byte. * If slave_termios is not null, it is passed to tcsetattr with the * command TCSANOW to set the terminal attributes of the slave device. * If slave_winsize is not null, it is passed to ioctl with the command * TIOCSWINSZ to set the window size of the slave device. On success, * returns 0. On error, returns -1 with errno set appropriately. */ int pty_open(int *masterfd, int *slavefd, char *slavename, size_t slavenamesize, const struct termios *slave_termios, const struct winsize *slave_winsize) { #if defined(HAVE_OPENPTY) || defined(BSD4_4) /* openpty(3) exists in OSF/1 and some other os'es */ #ifdef HAVE_TTYNAME_R char buf[64], *name = buf; int err; #else char *name; #endif if (!masterfd || !slavefd || !slavename || slavenamesize < 64) return set_errno(EINVAL); /* Open the master and slave descriptors, set ownership and permissions */ if (openpty(masterfd, slavefd, NULL, NULL, NULL) == -1) return -1; /* Retrieve the device name of the slave */ #ifdef HAVE_TTYNAME_R if ((err = ttyname_r(*slavefd, buf, 64))) { close(*masterfd); close(*slavefd); return set_errno(err); } #else if (!(name = ttyname(*slavefd))) { close(*masterfd); close(*slavefd); return set_errno(ENOTTY); } #endif /* Return it to the caller */ if (strlcpy_local(slavename, name, slavenamesize) >= slavenamesize) { close(*masterfd); close(*slavefd); return set_errno(ENOSPC); } #else /* HAVE_OPENPTY */ #ifdef HAVE__GETPTY /* * _getpty(3) exists in SGI Irix 4.x, 5.x & 6.x -- it generates more * pty's automagically when needed */ char *slave; if (!masterfd || !slavefd || !slavename || slavenamesize < 64) return set_errno(EINVAL); /* Open the master descriptor and get the slave's device name */ if (!(slave = _getpty(masterfd, O_RDWR, 0622, 0))) return -1; /* Return it to the caller */ if (strlcpy_local(slavename, name, slavenamesize) >= slavenamesize) { close(*masterfd); return set_errno(ENOSPC); } /* Open the slave descriptor */ if ((*slavefd = open(slavename, O_RDWR | O_NOCTTY)) == -1) { close(*masterfd); return -1; } #else /* HAVE__GETPTY */ #if defined(HAVE_DEV_PTMX) /* * This code is used e.g. on Solaris 2.x. (Note that Solaris 2.3 * also has bsd-style ptys, but they simply do not work.) */ #ifdef HAVE_PTSNAME_R char buf[64], *name = buf; int err; #else char *name; #endif if (!masterfd || !slavefd || !slavename || slavenamesize < 64) return set_errno(EINVAL); /* Open the master descriptor */ if ((*masterfd = open("/dev/ptmx", O_RDWR | O_NOCTTY)) == -1) return -1; /* Set slave ownership and permissions to real uid of process */ if (grantpt(*masterfd) == -1) { close(*masterfd); return -1; } /* Unlock the slave so it can be opened */ if (unlockpt(*masterfd) == -1) { close(*masterfd); return -1; } /* Retrieve the device name of the slave */ #ifdef HAVE_PTSNAME_R if ((err = ptsname_r(*masterfd, buf, 64))) { close(*masterfd); return set_errno(err); } #else if (!(name = ptsname(*masterfd))) { close(*masterfd); return set_errno(ENOTTY); } #endif /* Return it to the caller */ if (strlcpy_local(slavename, name, slavenamesize) >= slavenamesize) { close(*masterfd); return set_errno(ENOSPC); } /* Open the slave descriptor */ if ((*slavefd = open(slavename, O_RDWR | O_NOCTTY)) == -1) { close(*masterfd); return -1; } /* Turn the slave into a terminal */ #ifndef HAVE_CYGWIN #ifndef HAVE_LINUX /* linux does not use the streams module */ /* * Push the appropriate streams modules, as described in Solaris pts(7). * HP-UX pts(7) doesn't have ttcompat module. */ if (ioctl(*slavefd, I_PUSH, "ptem") == -1) { close(*masterfd); close(*slavefd); return -1; } if (ioctl(*slavefd, I_PUSH, "ldterm") == -1) { close(*masterfd); close(*slavefd); return -1; } #ifndef __hpux if (ioctl(*slavefd, I_PUSH, "ttcompat") == -1) { close(*masterfd); close(*slavefd); return -1; } #endif #endif #endif #else /* HAVE_DEV_PTMX */ #ifdef HAVE_DEV_PTS_AND_PTC /* AIX-style pty code */ #ifdef HAVE_TTYNAME_R char buf[64], *name = buf; int err; #else char *name; #endif if (!masterfd || !slavefd || !slavename || slavenamesize < 64) return set_errno(EINVAL); /* Open the master descriptor */ if ((*masterfd = open("/dev/ptc", O_RDWR | O_NOCTTY)) == -1) return -1; /* Retrieve the device name of the slave */ #ifdef HAVE_TTYNAME_R if ((err = ttyname_r(*masterfd, buf, 64))) { close(*masterfd); return set_errno(err); } #else if (!(name = ttyname(*masterfd))) { close(*masterfd); return set_errno(ENOTTY); } #endif /* Return it to the caller */ if (strlcpy_local(slavename, name, slavenamesize) >= slavenamesize) { close(*masterfd); return set_errno(ENOSPC); } /* Open the slave descriptor */ if ((*slavefd = open(name, O_RDWR | O_NOCTTY)) == -1) { close(*masterfd); return -1; } #else /* HAVE_DEV_PTS_AND_PTC */ /* BSD-style pty code */ const char *const ptymajors = "pqrstuvwxyzabcdefghijklmnoABCDEFGHIJKLMNOPQRSTUVWXYZ"; const char *const ptyminors = "0123456789abcdef"; int num_minors = strlen(ptyminors); int num_ptys = strlen(ptymajors) * num_minors; char buf[64]; int found = 0; int i; /* Identify the first available pty master device */ for (i = 0; !found && i < num_ptys; i++) { snprintf(buf, sizeof buf, "/dev/pty%c%c", ptymajors[i / num_minors], ptyminors[i % num_minors]); snprintf(slavename, slavenamesize, "/dev/tty%c%c", ptymajors[i / num_minors], ptyminors[i % num_minors]); /* Open the master descriptor */ if ((*masterfd = open(buf, O_RDWR | O_NOCTTY)) == -1) { /* Try SCO style naming */ snprintf(buf, sizeof buf, "/dev/ptyp%d", i); snprintf(slavename, slavenamesize, "/dev/ttyp%d", i); if ((*masterfd = open(buf, O_RDWR | O_NOCTTY)) == -1) continue; } /* Set slave ownership and permissions to real uid of process */ pty_set_owner(slavename, getuid()); /* Open the slave descriptor */ if ((*slavefd = open(slavename, O_RDWR | O_NOCTTY)) == -1) { close(*masterfd); return -1; } found = 1; } if (!found) return set_errno(ENOENT); #endif /* HAVE_DEV_PTS_AND_PTC */ #endif /* HAVE_DEV_PTMX */ #endif /* HAVE__GETPTY */ #endif /* HAVE_OPENPTY */ /* Set the slave's terminal attributes if requested */ if (slave_termios && tcsetattr(*slavefd, TCSANOW, slave_termios) == -1) { close(*masterfd); close(*slavefd); return -1; } /* Set the slave's window size if required */ if (slave_winsize && ioctl(*slavefd, TIOCSWINSZ, slave_winsize) == -1) { close(*masterfd); close(*slavefd); return -1; } return 0; } /* pty_release: Releases the slave tty device whose name is in slavename. * * slavename: the device name of the slave side of the pseudo terminal * Returns : 0 on success or -1 on error. * * Note: Its ownership is returned to root, and its permissions set to * rw-rw-rw-. Note that only root can execute this function successfully * on most systems. */ int pty_release(const char *slavename) { if (!slavename) return set_errno(EINVAL); if (chown(slavename, (uid_t) 0, (gid_t) 0) == -1) return -1; if (chmod(slavename, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH) == -1) return -1; return 0; } /* pty_set_owner: Changes the ownership of the slave pty device referred to by * slavename to the user id uid. * * slavename: the device name of the slave side of the pseudo terminal * uid : The new desired user id. * Returns : 0 on success or -1 on error. * * NOTE: Group ownership of the slave pty device will be changed * to the tty group if it exists. Otherwise, it will be changed to the given * user's primary group. The slave pty device's permissions are set to * rw--w----. Note that only root can execute this function successfully on * most systems. Also note that the ownership of the device is automatically * set to the real uid of the process by pty_open() and pty_fork(). The * permissions are also set automatically by these functions. So * pty_set_owner() is only needed when the device needs to be owned by some * user other than the real user. */ int pty_set_owner(const char *slavename, uid_t uid) { mode_t mode = S_IRUSR | S_IWUSR | S_IWGRP; struct stat status[1]; int gid; if (stat(slavename, status) == -1) return -1; if ((gid = groupname2gid("tty")) == -1) { gid = uid2gid(uid); mode |= S_IWOTH; } if (status->st_uid != uid || status->st_gid != (unsigned int) gid) if (chown(slavename, uid, gid) == -1) if (errno != EROFS || status->st_uid != uid) return -1; if ((status->st_mode & (S_IRWXU | S_IRWXG | S_IRWXO)) != mode) if (chmod(slavename, mode) == -1) if (errno != EROFS || (status->st_mode & (S_IRGRP | S_IROTH))) return -1; return 0; } /* pty_make_controlling_tty: Makes the slave pty the controlling terminal. * * slavefd contains the descriptor for the slave side of a pseudo terminal. * slavename: the device name of the slave side of the pseudo terminal * Returns : 0 on success or -1 on error. * * NOTE: The descriptor of the resulting controlling terminal will be stored * in slavefd. */ int pty_make_controlling_tty(int *slavefd, const char *slavename) { int fd; #ifdef USE_VHANGUP void (*old) (int); #endif /* USE_VHANGUP */ if (!slavefd || *slavefd < 0 || !slavename) return set_errno(EINVAL); /* First disconnect from the old controlling tty */ #ifdef TIOCNOTTY if ((fd = open(PATH_TTY, O_RDWR | O_NOCTTY)) >= 0) { ioctl(fd, TIOCNOTTY, NULL); close(fd); } #endif /* TIOCNOTTY */ setsid(); /* * Verify that we are successfully disconnected from the controlling * tty. */ #if 0 if ((fd = open(PATH_TTY, O_RDWR | O_NOCTTY)) >= 0) { close(fd); return set_errno(ENXIO); } #endif /* Make it our controlling tty */ #ifdef TIOCSCTTY if (ioctl(*slavefd, TIOCSCTTY, NULL) == -1) return -1; #endif /* TIOCSCTTY */ #ifdef HAVE_NEWS4 setpgrp(0, 0); #endif /* HAVE_NEWS4 */ #ifdef USE_VHANGUP old = signal(SIGHUP, SIG_IGN); vhangup(); signal(SIGHUP, old); #endif /* USE_VHANGUP */ /* Why do this? */ if ((fd = open(slavename, O_RDWR)) >= 0) { #ifdef USE_VHANGUP close(*slavefd); *slavefd = fd; #else /* USE_VHANGUP */ close(fd); #endif /* USE_VHANGUP */ } /* Verify that we now have a controlling tty */ if ((fd = open(PATH_TTY, O_RDWR)) == -1) return -1; close(fd); return 0; } /* pty_change_window_size: Changes the window size of the pseudo terminal * * masterfd: The pseudo terminal to change * row: The new number of rows. * col: The new number of cols. * xpixel: Number of pixels in x dir * ypixel: Number of pixels in y dir * Returns : 0 on success or -1 on error. * */ int pty_change_window_size(int masterfd, int row, int col, int xpixel, int ypixel) { struct winsize win; if (masterfd < 0 || row < 0 || col < 0 || xpixel < 0 || ypixel < 0) return set_errno(EINVAL); win.ws_row = row; win.ws_col = col; win.ws_xpixel = xpixel; win.ws_ypixel = ypixel; return ioctl(masterfd, TIOCSWINSZ, &win); } /* pty_fork: Creates a pseudo terminal and then calls fork. In the parent * process, the slave side of the pseudo terminal is closed. In the child * process, the master side of the pseudo terminal is closed and the slave * side is made the controlling terminal. It is duplicated onto standard * input, output and error and then closed. The master side of the pseudo * terminal is stored in masterfd for the parent process. The device name * of the slave side of the pseudo terminal is stored in the buffer pointed * to by slavename which must be able to hold at least 64 bytes. * slavenamesize is the size of the buffer pointed to by slavename. No * more than slavenamesize bytes will be written to slavename, including * the terminating nul byte. If slave_termios is not null, it is passed to * tcsetattr with the command TCSANOW to set the terminal attributes of the * slave device. If slave_winsize is not null, it is passed to ioctl with * the command TIOCSWINSZ to set the window size of the slave device. * On success, returns 0 to the child process and returns the process * id of the child process to the parent process. On error, returns -1 with * errno set appropriately. */ pid_t pty_fork(int *masterfd, char *slavename, size_t slavenamesize, const struct termios * slave_termios, const struct winsize * slave_winsize) { int slavefd = 0; pid_t pid = 0; /* ** Note: we don't use forkpty() because it closes the master in the ** child process before making the slave the controlling terminal of the ** child proces and this can prevent the slave from becoming the ** controlling terminal (but I have no idea why). */ if (pty_open(masterfd, &slavefd, slavename, slavenamesize, slave_termios, slave_winsize) == -1) return -1; switch (pid = fork()) { case -1: pty_release(slavename); close(slavefd); close(*masterfd); return -1; case 0: { /* Make the slave our controlling tty */ if (pty_make_controlling_tty(&slavefd, slavename) == -1) _exit(EXIT_FAILURE); /* Redirect stdin, stdout and stderr from the pseudo tty */ if (slavefd != STDIN_FILENO && dup2(slavefd, STDIN_FILENO) == -1) _exit(EXIT_FAILURE); if (slavefd != STDOUT_FILENO && dup2(slavefd, STDOUT_FILENO) == -1) _exit(EXIT_FAILURE); if (slavefd != STDERR_FILENO && dup2(slavefd, STDERR_FILENO) == -1) _exit(EXIT_FAILURE); /* Close the extra descriptor for the pseudo tty */ if (slavefd != STDIN_FILENO && slavefd != STDOUT_FILENO && slavefd != STDERR_FILENO) close(slavefd); /* Close the master side of the pseudo tty in the child */ close(*masterfd); return 0; } default: { /* Close the slave side of the pseudo tty in the parent */ close(slavefd); return pid; } } } cgdb-0.6.7/lib/util/pseudo.h000644 000765 000024 00000004213 12074441140 016600 0ustar00mmuellerstaff000000 000000 /* * libslack - http://libslack.org/ * * Copyright (C) 1999-2001 raf * * 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 of the License, 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; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * or visit http://www.gnu.org/copyleft/gpl.html * * 20011109 raf */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland * All rights reserved * Functions for allocating a pseudo-terminal and making it the controlling * tty. * * As far as I am concerned, the code I have written for this software * can be used freely for any purpose. Any derived versions of this * software must be clearly marked as such, and if the derived work is * incompatible with the protocol description in the RFC file, it must be * called by a name other than "ssh" or "Secure Shell". */ #ifndef LIBSLACK_PSEUDO_H #define LIBSLACK_PSEUDO_H #include #include #include #define SLAVE_SIZE 64 int pty_open(int *masterfd, int *slavefd, char *slavename, size_t slavenamesize, const struct termios *slave_termios, const struct winsize *slave_winsize); int pty_release(const char *slavename); int pty_set_owner(const char *slavename, uid_t uid); int pty_make_controlling_tty(int *slavefd, const char *slavename); int pty_change_window_size(int masterfd, int row, int col, int xpixel, int ypixel); pid_t pty_fork(int *masterfd, char *slavename, size_t slavenamesize, const struct termios *slave_termios, const struct winsize *slave_winsize); #endif cgdb-0.6.7/lib/util/sys_util.c000644 000765 000024 00000001676 12074441140 017161 0ustar00mmuellerstaff000000 000000 #if HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #if HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #if HAVE_ERRNO_H #include #endif /* HAVE_ERRNO_H */ #include "sys_util.h" void *cgdb_calloc(size_t nmemb, size_t size) { void *t = calloc(nmemb, size); if (t) return t; exit(-1); } void *cgdb_malloc(size_t size) { void *t = malloc(size); if (t) return t; exit(-1); } void *cgdb_realloc(void *ptr, size_t size) { void *t = realloc(ptr, size); if (t) return t; exit(-1); } char *cgdb_strdup(const char *s) { char *t = strdup(s); if (t) return t; exit(-1); } int cgdb_close(int fd) { int ret; cgdb_close_start: if ((ret = close(fd)) == -1 && errno == EINTR) goto cgdb_close_start; else if (ret == -1) exit(-1); return 0; } cgdb-0.6.7/lib/util/sys_util.h000644 000765 000024 00000001006 12074441140 017151 0ustar00mmuellerstaff000000 000000 #ifndef __SYS_UTIL_H__ #define __SYS_UTIL_H__ #if HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ /* These are wrappers for the memory management functions * If a memory allocation fails cgdb will exit * They act identical to the POSIX calls */ void *cgdb_calloc(size_t nmemb, size_t size); void *cgdb_malloc(size_t size); void *cgdb_realloc(void *ptr, size_t size); char *cgdb_strdup(const char *s); int cgdb_close(int fd); #endif cgdb-0.6.7/lib/util/terminal.c000644 000765 000024 00000003524 12074441140 017113 0ustar00mmuellerstaff000000 000000 #include "terminal.h" #if HAVE_SYS_IOCTL_H #include #endif /* HAVE_SYS_IOCTL_H */ int tty_cbreak(int fd, struct termios *orig) { struct termios buf; if (tcgetattr(fd, &buf) < 0) return -1; /* Save the original state, for resetting later */ *orig = buf; buf.c_lflag &= ~(ECHO | ICANON); buf.c_iflag &= ~(ICRNL | INLCR); buf.c_cc[VMIN] = 1; buf.c_cc[VTIME] = 0; #if defined (VLNEXT) && defined (_POSIX_VDISABLE) buf.c_cc[VLNEXT] = _POSIX_VDISABLE; #endif #if defined (VDSUSP) && defined (_POSIX_VDISABLE) buf.c_cc[VDSUSP] = _POSIX_VDISABLE; #endif if (tcsetattr(fd, TCSAFLUSH, &buf) < 0) return -1; return 0; } int tty_output_nl(int fd) { struct termios buf; /* get attributes */ if (tcgetattr(fd, &buf) < 0) return -1; buf.c_oflag &= ~ONLCR; /* turn off NL -> CR NL mapping */ if (tcsetattr(fd, TCSAFLUSH, &buf) < 0) return -1; return 0; } int tty_off_xon_xoff(int fd) { struct termios buf; if (tcgetattr(fd, &buf) < 0) return -1; /* disable flow control; let ^S and ^Q through to pty */ buf.c_iflag &= ~(IXON | IXOFF); #ifdef IXANY buf.c_iflag &= ~IXANY; #endif if (tcsetattr(fd, TCSAFLUSH, &buf) < 0) return -1; return 0; } int tty_set_echo(int fd, int echo_on) { struct termios buf; if (tcgetattr(fd, &buf) < 0) return -1; if (echo_on == 1) buf.c_lflag |= ECHO; else if (echo_on == 0) buf.c_lflag &= ~ECHO; if (tcsetattr(fd, TCSAFLUSH, &buf) < 0) return -1; return 0; } int tty_get_attributes(int fd, struct termios *buf) { if (tcgetattr(fd, buf) < 0) return -1; return 0; } int tty_set_attributes(int fd, struct termios *buf) { if (tcsetattr(fd, TCSAFLUSH, buf) < 0) return -1; return 0; } cgdb-0.6.7/lib/util/terminal.h000644 000765 000024 00000004475 12074441140 017126 0ustar00mmuellerstaff000000 000000 #ifndef __TERMINAL_H__ #define __TERMINAL_H__ #ifdef __cplusplus extern "C" { #endif #if HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #if HAVE_TERMIOS_H #include #endif /* HAVE_TERMIOS_H */ #if HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ /** * Sets terminal to cbreak mode. Also known as noncanonical mode. * 1. Signal handling is still turned on, so the user can still type those. * 2. echo is off * 3. Read in one char at a time. * * \param fd * The file descriptor of the terminal * * \param orig * Output parameter, pass in the address of a termios structure and it will * be populated with the current (aka original) state of the terminal. Use * this to reset the state with tty_set_attributes later. * * \return * 0 on success, -1 on error */ int tty_cbreak(int fd, struct termios *orig); /** * set the pseudo - terminal to not map NL to CR NL. * * \param fd * The descriptor to the pseudo-terminal. * * \return * 0 on success, -1 on error */ int tty_output_nl(int fd); /** * Turn off control flow on the terminal descriptor. * * \param fd * The terminal descriptor to turn the control flow off on. * * \return * 0 on success, -1 on error */ int tty_off_xon_xoff(int fd); /** * Either turn echo on or off for the PTY. * * \param fd * The terminal descriptor to turn the echo on or off. * * \param echo_on * If 1, the echo will be turned on, if 0 echo will be turned off. * * \return * 0 on success, -1 on error */ int tty_set_echo(int fd, int echo_on); /** * This will get the terminal attributes and store them into the buffer buf. * * \param fd * The terminal to query * * \param buf * Make sure this data item is allocated for on the way in. * This will return with the terminal attributes of the terminal. * * \return * 0 on success, -1 on error */ int tty_get_attributes(int fd, struct termios *buf); /** * Sets the terminal attributes back to their previous state. * * \param fd * The file descrioptor of the terminal to reset. * * \param buf * The attributes to set the terminal to. * * \return * 0 on success, -1 on error */ int tty_set_attributes(int fd, struct termios *buf); #ifdef __cplusplus } #endif #endif cgdb-0.6.7/lib/tokenizer/adalexer.c000644 000765 000024 00000162102 12074441140 020120 0ustar00mmuellerstaff000000 000000 #define yy_create_buffer ada__create_buffer #define yy_delete_buffer ada__delete_buffer #define yy_scan_buffer ada__scan_buffer #define yy_scan_string ada__scan_string #define yy_scan_bytes ada__scan_bytes #define yy_flex_debug ada__flex_debug #define yy_init_buffer ada__init_buffer #define yy_flush_buffer ada__flush_buffer #define yy_load_buffer_state ada__load_buffer_state #define yy_switch_to_buffer ada__switch_to_buffer #define yyin ada_in #define yyleng ada_leng #define yylex ada_lex #define yyout ada_out #define yyrestart ada_restart #define yytext ada_text #define yywrap ada_wrap #line 20 "adalexer.c" /* A lexical scanner generated by flex */ /* Scanner skeleton version: * $Header$ */ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 #include #include /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ #ifdef c_plusplus #ifndef __cplusplus #define __cplusplus #endif #endif #ifdef __cplusplus #include #ifndef _WIN32 #include #else #ifndef YY_ALWAYS_INTERACTIVE #ifndef YY_NEVER_INTERACTIVE extern int isatty YY_PROTO(( int )); #endif #endif #endif /* Use prototypes in function declarations. */ #define YY_USE_PROTOS /* The "const" storage-class-modifier is valid. */ #define YY_USE_CONST #else /* ! __cplusplus */ #if __STDC__ #define YY_USE_PROTOS #define YY_USE_CONST #endif /* __STDC__ */ #endif /* ! __cplusplus */ #ifdef __TURBOC__ #pragma warn -rch #pragma warn -use #include #include #define YY_USE_CONST #define YY_USE_PROTOS #endif #ifdef YY_USE_CONST #define yyconst const #else #define yyconst #endif #ifdef YY_USE_PROTOS #define YY_PROTO(proto) proto #else #define YY_PROTO(proto) () #endif /* Returned upon end-of-file. */ #define YY_NULL 0 /* Promotes a possibly negative, possibly signed char to an unsigned * integer for use as an array index. If the signed char is negative, * we want to instead treat it as an 8-bit unsigned char, hence the * double cast. */ #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) /* Enter a start condition. This macro really ought to take a parameter, * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ #define BEGIN yy_start = 1 + 2 * /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ #define YY_START ((yy_start - 1) / 2) #define YYSTATE YY_START /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) /* Special action meaning "start processing a new file". */ #define YY_NEW_FILE yyrestart( yyin ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ #define YY_BUF_SIZE 16384 typedef struct yy_buffer_state *YY_BUFFER_STATE; extern int yyleng; extern FILE *yyin, *yyout; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 /* The funky do-while in the following #define is used to turn the definition * int a single C statement (which needs a semi-colon terminator). This * avoids problems with code like: * * if ( condition_holds ) * yyless( 5 ); * else * do_something_else(); * * Prior to using the do-while the compiler would get upset at the * "else" because it interpreted the "if" statement as being all * done when it reached the ';' after the yyless() call. */ /* Return all but the first 'n' matched characters back to the input stream. */ #define yyless(n) \ do \ { \ /* Undo effects of setting up yytext. */ \ *yy_cp = yy_hold_char; \ YY_RESTORE_YY_MORE_OFFSET \ yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ YY_DO_BEFORE_ACTION; /* set up yytext again */ \ } \ while ( 0 ) #define unput(c) yyunput( c, yytext_ptr ) /* The following is because we cannot portably get our hands on size_t * (without autoconf's help, which isn't available because we want * flex-generated scanners to compile on their own). */ typedef unsigned int yy_size_t; struct yy_buffer_state { FILE *yy_input_file; char *yy_ch_buf; /* input buffer */ char *yy_buf_pos; /* current position in input buffer */ /* Size of input buffer in bytes, not including room for EOB * characters. */ yy_size_t yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. */ int yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to * delete it. */ int yy_is_our_buffer; /* Whether this is an "interactive" input source; if so, and * if we're using stdio for input, then we want to use getc() * instead of fread(), to make sure we stop fetching input after * each newline. */ int yy_is_interactive; /* Whether we're considered to be at the beginning of a line. * If so, '^' rules will be active on the next match, otherwise * not. */ int yy_at_bol; /* Whether to try to fill the input buffer when we reach the * end of it. */ int yy_fill_buffer; int yy_buffer_status; #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 /* When an EOF's been seen but there's still some text to process * then we mark the buffer as YY_EOF_PENDING, to indicate that we * shouldn't try reading from the input source any more. We might * still have a bunch of tokens to match, though, because of * possible backing-up. * * When we actually see the EOF, we change the status to "new" * (via yyrestart()), so that the user can continue scanning by * just pointing yyin at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 }; static YY_BUFFER_STATE yy_current_buffer = 0; /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general * "scanner state". */ #define YY_CURRENT_BUFFER yy_current_buffer /* yy_hold_char holds the character lost when yytext is formed. */ static char yy_hold_char; static int yy_n_chars; /* number of characters read into yy_ch_buf */ int yyleng; /* Points to current character in buffer. */ static char *yy_c_buf_p = (char *) 0; static int yy_init = 1; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ /* Flag which is used to allow yywrap()'s to do buffer switches * instead of setting up a fresh yyin. A bit of a hack ... */ static int yy_did_buffer_switch_on_eof; void yyrestart YY_PROTO(( FILE *input_file )); void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); void yy_load_buffer_state YY_PROTO(( void )); YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str )); YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); static void *yy_flex_alloc YY_PROTO(( yy_size_t )); static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); static void yy_flex_free YY_PROTO(( void * )); #define yy_new_buffer yy_create_buffer #define yy_set_interactive(is_interactive) \ { \ if ( ! yy_current_buffer ) \ yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ yy_current_buffer->yy_is_interactive = is_interactive; \ } #define yy_set_bol(at_bol) \ { \ if ( ! yy_current_buffer ) \ yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ yy_current_buffer->yy_at_bol = at_bol; \ } #define YY_AT_BOL() (yy_current_buffer->yy_at_bol) typedef unsigned char YY_CHAR; FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; typedef int yy_state_type; extern char *yytext; #define yytext_ptr yytext static yy_state_type yy_get_previous_state YY_PROTO(( void )); static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); static int yy_get_next_buffer YY_PROTO(( void )); static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); /* Done after the current pattern has been matched and before the * corresponding action - sets up yytext. */ #define YY_DO_BEFORE_ACTION \ yytext_ptr = yy_bp; \ yyleng = (int) (yy_cp - yy_bp); \ yy_hold_char = *yy_cp; \ *yy_cp = '\0'; \ yy_c_buf_p = yy_cp; #define YY_NUM_RULES 95 #define YY_END_OF_BUFFER 96 static yyconst short int yy_accept[400] = { 0, 0, 0, 96, 94, 92, 89, 91, 94, 94, 94, 87, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 90, 0, 86, 0, 85, 87, 93, 93, 93, 93, 93, 93, 26, 93, 93, 93, 93, 93, 93, 93, 34, 93, 93, 93, 93, 93, 93, 93, 93, 93, 45, 46, 47, 93, 93, 93, 93, 93, 93, 93, 54, 55, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 0, 86, 88, 85, 93, 19, 93, 93, 24, 25, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 37, 93, 93, 93, 93, 93, 41, 93, 93, 93, 93, 93, 93, 93, 50, 93, 51, 52, 93, 93, 57, 93, 93, 93, 93, 93, 93, 93, 93, 66, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 80, 93, 93, 93, 84, 93, 93, 93, 93, 93, 93, 28, 93, 29, 93, 93, 93, 93, 93, 93, 35, 93, 93, 93, 40, 93, 93, 93, 93, 44, 93, 93, 93, 49, 93, 53, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 75, 93, 77, 78, 93, 81, 93, 83, 18, 93, 93, 93, 93, 1, 27, 93, 93, 93, 93, 31, 32, 93, 36, 38, 93, 5, 6, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 63, 64, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 79, 82, 93, 21, 22, 93, 93, 93, 93, 93, 33, 93, 93, 93, 93, 93, 93, 93, 93, 93, 56, 93, 93, 59, 93, 93, 93, 93, 93, 93, 69, 93, 71, 93, 93, 17, 93, 74, 93, 93, 23, 2, 93, 93, 30, 93, 93, 43, 7, 48, 93, 93, 93, 12, 58, 93, 60, 93, 93, 65, 67, 68, 70, 93, 93, 93, 93, 73, 93, 20, 93, 4, 93, 42, 93, 93, 93, 13, 93, 93, 72, 93, 93, 93, 93, 3, 39, 93, 93, 93, 61, 62, 93, 93, 93, 76, 8, 93, 93, 93, 93, 93, 93, 93, 93, 14, 93, 93, 10, 93, 93, 93, 93, 93, 93, 15, 93, 93, 93, 93, 9, 93, 93, 93, 93, 11, 93, 93, 16, 0 } ; static yyconst int yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 4, 4, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 6, 1, 1, 1, 1, 7, 1, 1, 1, 1, 8, 9, 1, 1, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 1, 1, 1, 1, 1, 1, 1, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 21, 1, 1, 1, 1, 11, 1, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 21, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } ; static yyconst int yy_meta[37] = { 0, 1, 1, 2, 3, 3, 1, 1, 1, 1, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 } ; static yyconst short int yy_base[405] = { 0, 0, 0, 415, 416, 416, 416, 411, 407, 0, 403, 401, 0, 24, 24, 32, 26, 31, 37, 45, 42, 19, 384, 52, 45, 53, 69, 64, 74, 18, 68, 383, 416, 402, 401, 399, 0, 395, 0, 68, 390, 50, 388, 373, 0, 383, 74, 370, 387, 373, 78, 379, 0, 366, 60, 83, 360, 368, 364, 367, 366, 359, 0, 358, 0, 364, 79, 372, 355, 351, 353, 360, 0, 0, 363, 350, 366, 349, 87, 86, 100, 85, 352, 348, 363, 91, 346, 358, 346, 341, 355, 99, 339, 340, 362, 361, 416, 0, 337, 334, 348, 351, 0, 0, 350, 341, 324, 336, 342, 328, 326, 332, 104, 334, 102, 0, 324, 336, 320, 334, 337, 0, 334, 331, 320, 329, 324, 325, 315, 0, 309, 0, 0, 317, 323, 0, 316, 317, 318, 302, 103, 304, 315, 306, 0, 319, 298, 297, 312, 311, 314, 296, 304, 292, 304, 299, 296, 294, 302, 297, 0, 291, 292, 295, 0, 282, 283, 93, 281, 274, 284, 0, 292, 0, 295, 275, 293, 268, 291, 271, 0, 284, 264, 272, 0, 283, 266, 265, 266, 0, 276, 262, 281, 0, 262, 0, 261, 277, 257, 263, 274, 269, 268, 267, 266, 252, 256, 263, 249, 248, 262, 246, 243, 248, 236, 255, 0, 250, 0, 0, 246, 0, 252, 0, 0, 255, 235, 235, 248, 0, 0, 251, 248, 249, 231, 0, 0, 229, 0, 0, 227, 0, 0, 237, 236, 239, 238, 109, 241, 222, 233, 230, 237, 217, 232, 232, 0, 0, 230, 228, 211, 217, 211, 209, 227, 227, 219, 209, 220, 209, 0, 0, 219, 0, 0, 217, 206, 199, 204, 212, 0, 207, 200, 211, 195, 208, 199, 196, 194, 196, 0, 202, 184, 0, 200, 183, 183, 205, 182, 195, 0, 194, 0, 178, 110, 0, 192, 0, 195, 175, 0, 0, 189, 173, 0, 177, 177, 0, 0, 0, 175, 169, 174, 0, 0, 182, 0, 168, 180, 416, 0, 0, 0, 179, 171, 168, 173, 0, 160, 0, 161, 0, 164, 0, 176, 171, 168, 0, 169, 169, 0, 157, 151, 155, 164, 0, 0, 148, 160, 166, 0, 0, 164, 159, 145, 0, 0, 157, 119, 141, 153, 139, 140, 145, 142, 0, 150, 154, 0, 138, 132, 133, 141, 148, 143, 0, 133, 126, 137, 123, 0, 134, 130, 113, 120, 0, 121, 73, 0, 416, 140, 144, 37, 148, 152 } ; static yyconst short int yy_def[405] = { 0, 399, 1, 399, 399, 399, 399, 399, 400, 401, 399, 399, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 399, 400, 403, 399, 404, 399, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 400, 403, 399, 404, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 399, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 0, 399, 399, 399, 399, 399 } ; static yyconst short int yy_nxt[453] = { 0, 4, 5, 6, 5, 7, 8, 9, 4, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 12, 20, 12, 12, 21, 22, 23, 24, 25, 12, 26, 27, 28, 29, 12, 30, 31, 12, 39, 40, 65, 45, 38, 50, 89, 47, 66, 51, 41, 90, 42, 46, 48, 52, 43, 53, 44, 54, 56, 49, 62, 57, 60, 72, 58, 68, 76, 55, 63, 69, 59, 101, 61, 64, 102, 73, 115, 74, 75, 70, 77, 81, 79, 78, 82, 71, 80, 85, 91, 92, 106, 86, 116, 111, 87, 98, 83, 84, 117, 99, 138, 107, 112, 398, 118, 127, 128, 141, 139, 149, 154, 88, 142, 150, 140, 143, 161, 177, 201, 180, 162, 226, 155, 181, 227, 144, 145, 286, 334, 146, 287, 335, 147, 288, 148, 202, 178, 373, 397, 396, 374, 336, 33, 395, 33, 33, 35, 394, 35, 35, 94, 393, 94, 94, 97, 392, 391, 97, 390, 389, 388, 387, 386, 385, 384, 383, 382, 381, 380, 379, 378, 377, 376, 375, 372, 371, 370, 369, 368, 367, 366, 365, 364, 363, 362, 361, 360, 359, 358, 357, 356, 355, 354, 353, 352, 351, 350, 349, 348, 347, 346, 345, 344, 343, 342, 341, 340, 339, 338, 337, 333, 332, 331, 330, 329, 328, 327, 326, 325, 324, 323, 322, 321, 320, 319, 318, 317, 316, 315, 314, 313, 312, 311, 310, 309, 308, 307, 306, 305, 304, 303, 302, 301, 300, 299, 298, 297, 296, 295, 294, 293, 292, 291, 290, 289, 285, 284, 283, 282, 281, 280, 279, 278, 277, 276, 275, 274, 273, 272, 271, 270, 269, 268, 267, 266, 265, 264, 263, 262, 261, 260, 259, 258, 257, 256, 255, 254, 253, 252, 251, 250, 249, 248, 247, 246, 245, 244, 243, 242, 241, 240, 239, 238, 237, 236, 235, 234, 233, 232, 231, 230, 229, 228, 225, 224, 223, 222, 221, 220, 219, 218, 217, 216, 215, 214, 213, 212, 211, 210, 209, 208, 207, 206, 205, 204, 203, 200, 199, 198, 197, 196, 195, 194, 193, 192, 191, 190, 189, 188, 187, 186, 185, 184, 183, 182, 179, 176, 175, 174, 173, 172, 171, 170, 169, 168, 167, 166, 165, 95, 34, 164, 163, 160, 159, 158, 157, 156, 153, 152, 151, 137, 136, 135, 134, 133, 132, 131, 130, 129, 126, 125, 124, 123, 122, 121, 120, 119, 114, 113, 110, 109, 108, 105, 104, 103, 100, 37, 96, 95, 34, 93, 67, 37, 36, 34, 32, 399, 3, 399, 399, 399, 399, 399, 399, 399, 399, 399, 399, 399, 399, 399, 399, 399, 399, 399, 399, 399, 399, 399, 399, 399, 399, 399, 399, 399, 399, 399, 399, 399, 399, 399, 399, 399, 399 } ; static yyconst short int yy_chk[453] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 13, 13, 21, 14, 402, 16, 29, 15, 21, 16, 13, 29, 13, 14, 15, 16, 13, 17, 13, 17, 18, 15, 20, 18, 19, 24, 18, 23, 25, 17, 20, 23, 18, 41, 19, 20, 41, 24, 54, 24, 24, 23, 25, 27, 26, 25, 27, 23, 26, 28, 30, 30, 46, 28, 54, 50, 28, 39, 27, 27, 55, 39, 78, 46, 50, 397, 55, 66, 66, 79, 78, 81, 85, 28, 79, 81, 78, 80, 91, 112, 140, 114, 91, 167, 85, 114, 167, 80, 80, 247, 304, 80, 247, 304, 80, 247, 80, 140, 112, 368, 396, 394, 368, 304, 400, 393, 400, 400, 401, 392, 401, 401, 403, 391, 403, 403, 404, 389, 388, 404, 387, 386, 384, 383, 382, 381, 380, 379, 377, 376, 374, 373, 372, 371, 370, 369, 367, 364, 363, 362, 359, 358, 357, 354, 353, 352, 351, 349, 348, 346, 345, 344, 342, 340, 338, 336, 335, 334, 333, 328, 327, 325, 322, 321, 320, 316, 315, 313, 312, 309, 308, 306, 303, 301, 299, 298, 297, 296, 295, 294, 292, 291, 289, 288, 287, 286, 285, 284, 283, 282, 281, 279, 278, 277, 276, 275, 272, 269, 268, 267, 266, 265, 264, 263, 262, 261, 260, 259, 258, 255, 254, 253, 252, 251, 250, 249, 248, 246, 245, 244, 243, 240, 237, 234, 233, 232, 231, 228, 227, 226, 225, 222, 220, 217, 215, 214, 213, 212, 211, 210, 209, 208, 207, 206, 205, 204, 203, 202, 201, 200, 199, 198, 197, 196, 194, 192, 191, 190, 188, 187, 186, 185, 183, 182, 181, 179, 178, 177, 176, 175, 174, 172, 170, 169, 168, 166, 165, 163, 162, 161, 159, 158, 157, 156, 155, 154, 153, 152, 151, 150, 149, 148, 147, 146, 145, 143, 142, 141, 139, 138, 137, 136, 134, 133, 130, 128, 127, 126, 125, 124, 123, 122, 120, 119, 118, 117, 116, 113, 111, 110, 109, 108, 107, 106, 105, 104, 101, 100, 99, 98, 95, 94, 93, 92, 90, 89, 88, 87, 86, 84, 83, 82, 77, 76, 75, 74, 71, 70, 69, 68, 67, 65, 63, 61, 60, 59, 58, 57, 56, 53, 51, 49, 48, 47, 45, 43, 42, 40, 37, 35, 34, 33, 31, 22, 11, 10, 8, 7, 3, 399, 399, 399, 399, 399, 399, 399, 399, 399, 399, 399, 399, 399, 399, 399, 399, 399, 399, 399, 399, 399, 399, 399, 399, 399, 399, 399, 399, 399, 399, 399, 399, 399, 399, 399, 399, 399 } ; static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. */ #define REJECT reject_used_but_not_detected #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *yytext; #line 1 "adalexer.l" #define INITIAL 0 #line 9 "adalexer.l" /* System Includes */ #include #include "tokenizer.h" #line 628 "adalexer.c" /* Macros after this point can all be overridden by user definitions in * section 1. */ #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus extern "C" int yywrap YY_PROTO(( void )); #else extern int yywrap YY_PROTO(( void )); #endif #endif #ifndef YY_NO_UNPUT static void yyunput YY_PROTO(( int c, char *buf_ptr )); #endif #ifndef yytext_ptr static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen YY_PROTO(( yyconst char * )); #endif #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput YY_PROTO(( void )); #else static int input YY_PROTO(( void )); #endif #endif #if YY_STACK_USED static int yy_start_stack_ptr = 0; static int yy_start_stack_depth = 0; static int *yy_start_stack = 0; #ifndef YY_NO_PUSH_STATE static void yy_push_state YY_PROTO(( int new_state )); #endif #ifndef YY_NO_POP_STATE static void yy_pop_state YY_PROTO(( void )); #endif #ifndef YY_NO_TOP_STATE static int yy_top_state YY_PROTO(( void )); #endif #else #define YY_NO_PUSH_STATE 1 #define YY_NO_POP_STATE 1 #define YY_NO_TOP_STATE 1 #endif #ifdef YY_MALLOC_DECL YY_MALLOC_DECL #else #if __STDC__ #ifndef __cplusplus #include #endif #else /* Just try to get by without declaring the routines. This will fail * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) * or sizeof(void*) != sizeof(int). */ #endif #endif /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE #define YY_READ_BUF_SIZE 8192 #endif /* Copy whatever the last rule matched to the standard output. */ #ifndef ECHO /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ #define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, * is returned in "result". */ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ if ( yy_current_buffer->yy_is_interactive ) \ { \ int c = '*', n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ if ( c == '\n' ) \ buf[n++] = (char) c; \ if ( c == EOF && ferror( yyin ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ else \ { \ errno=0; \ while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ { \ if( errno != EINTR) \ { \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ break; \ } \ errno=0; \ clearerr(yyin); \ } \ } #endif /* No semi-colon after return; correct usage is to write "yyterminate();" - * we don't want an extra ';' after the "return" because that will cause * some compilers to complain about unreachable statements. */ #ifndef yyterminate #define yyterminate() return YY_NULL #endif /* Number of entries by which start-condition stack grows. */ #ifndef YY_START_STACK_INCR #define YY_START_STACK_INCR 25 #endif /* Report a fatal error. */ #ifndef YY_FATAL_ERROR #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) #endif /* Default declaration of generated scanner - a define so the user can * easily add parameters. */ #ifndef YY_DECL #define YY_DECL int yylex YY_PROTO(( void )) #endif /* Code executed at the beginning of each rule, after yytext and yyleng * have been set up. */ #ifndef YY_USER_ACTION #define YY_USER_ACTION #endif /* Code executed at the end of each rule. */ #ifndef YY_BREAK #define YY_BREAK break; #endif #define YY_RULE_SETUP \ YY_USER_ACTION YY_DECL { register yy_state_type yy_current_state; register char *yy_cp, *yy_bp; register int yy_act; #line 16 "adalexer.l" #line 792 "adalexer.c" if ( yy_init ) { yy_init = 0; #ifdef YY_USER_INIT YY_USER_INIT; #endif if ( ! yy_start ) yy_start = 1; /* first start state */ if ( ! yyin ) yyin = stdin; if ( ! yyout ) yyout = stdout; if ( ! yy_current_buffer ) yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); yy_load_buffer_state(); } while ( 1 ) /* loops until end-of-file is reached */ { yy_cp = yy_c_buf_p; /* Support of yytext. */ *yy_cp = yy_hold_char; /* yy_bp points to the position in yy_ch_buf of the start of * the current run. */ yy_bp = yy_cp; yy_current_state = yy_start; yy_match: do { register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; if ( yy_accept[yy_current_state] ) { yy_last_accepting_state = yy_current_state; yy_last_accepting_cpos = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 400 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } while ( yy_base[yy_current_state] != 416 ); yy_find_action: yy_act = yy_accept[yy_current_state]; if ( yy_act == 0 ) { /* have to back up */ yy_cp = yy_last_accepting_cpos; yy_current_state = yy_last_accepting_state; yy_act = yy_accept[yy_current_state]; } YY_DO_BEFORE_ACTION; do_action: /* This label is used only to access EOF actions. */ switch ( yy_act ) { /* beginning of action switch */ case 0: /* must back up */ /* undo the effects of YY_DO_BEFORE_ACTION */ *yy_cp = yy_hold_char; yy_cp = yy_last_accepting_cpos; yy_current_state = yy_last_accepting_state; goto yy_find_action; case 1: YY_RULE_SETUP #line 17 "adalexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 2: YY_RULE_SETUP #line 18 "adalexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 3: YY_RULE_SETUP #line 19 "adalexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 4: YY_RULE_SETUP #line 20 "adalexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 5: YY_RULE_SETUP #line 21 "adalexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 6: YY_RULE_SETUP #line 22 "adalexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 7: YY_RULE_SETUP #line 23 "adalexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 8: YY_RULE_SETUP #line 24 "adalexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 9: YY_RULE_SETUP #line 25 "adalexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 10: YY_RULE_SETUP #line 26 "adalexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 11: YY_RULE_SETUP #line 27 "adalexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 12: YY_RULE_SETUP #line 28 "adalexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 13: YY_RULE_SETUP #line 29 "adalexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 14: YY_RULE_SETUP #line 30 "adalexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 15: YY_RULE_SETUP #line 31 "adalexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 16: YY_RULE_SETUP #line 32 "adalexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 17: YY_RULE_SETUP #line 33 "adalexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 18: YY_RULE_SETUP #line 35 "adalexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 19: YY_RULE_SETUP #line 36 "adalexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 20: YY_RULE_SETUP #line 37 "adalexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 21: YY_RULE_SETUP #line 38 "adalexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 22: YY_RULE_SETUP #line 39 "adalexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 23: YY_RULE_SETUP #line 40 "adalexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 24: YY_RULE_SETUP #line 41 "adalexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 25: YY_RULE_SETUP #line 42 "adalexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 26: YY_RULE_SETUP #line 43 "adalexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 27: YY_RULE_SETUP #line 44 "adalexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 28: YY_RULE_SETUP #line 45 "adalexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 29: YY_RULE_SETUP #line 46 "adalexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 30: YY_RULE_SETUP #line 47 "adalexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 31: YY_RULE_SETUP #line 48 "adalexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 32: YY_RULE_SETUP #line 49 "adalexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 33: YY_RULE_SETUP #line 50 "adalexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 34: YY_RULE_SETUP #line 51 "adalexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 35: YY_RULE_SETUP #line 52 "adalexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 36: YY_RULE_SETUP #line 53 "adalexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 37: YY_RULE_SETUP #line 54 "adalexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 38: YY_RULE_SETUP #line 55 "adalexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 39: YY_RULE_SETUP #line 56 "adalexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 40: YY_RULE_SETUP #line 57 "adalexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 41: YY_RULE_SETUP #line 58 "adalexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 42: YY_RULE_SETUP #line 59 "adalexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 43: YY_RULE_SETUP #line 60 "adalexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 44: YY_RULE_SETUP #line 61 "adalexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 45: YY_RULE_SETUP #line 62 "adalexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 46: YY_RULE_SETUP #line 63 "adalexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 47: YY_RULE_SETUP #line 64 "adalexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 48: YY_RULE_SETUP #line 65 "adalexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 49: YY_RULE_SETUP #line 66 "adalexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 50: YY_RULE_SETUP #line 67 "adalexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 51: YY_RULE_SETUP #line 68 "adalexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 52: YY_RULE_SETUP #line 69 "adalexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 53: YY_RULE_SETUP #line 70 "adalexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 54: YY_RULE_SETUP #line 71 "adalexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 55: YY_RULE_SETUP #line 72 "adalexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 56: YY_RULE_SETUP #line 73 "adalexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 57: YY_RULE_SETUP #line 74 "adalexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 58: YY_RULE_SETUP #line 75 "adalexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 59: YY_RULE_SETUP #line 76 "adalexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 60: YY_RULE_SETUP #line 77 "adalexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 61: YY_RULE_SETUP #line 78 "adalexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 62: YY_RULE_SETUP #line 79 "adalexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 63: YY_RULE_SETUP #line 80 "adalexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 64: YY_RULE_SETUP #line 81 "adalexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 65: YY_RULE_SETUP #line 82 "adalexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 66: YY_RULE_SETUP #line 83 "adalexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 67: YY_RULE_SETUP #line 84 "adalexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 68: YY_RULE_SETUP #line 85 "adalexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 69: YY_RULE_SETUP #line 86 "adalexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 70: YY_RULE_SETUP #line 87 "adalexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 71: YY_RULE_SETUP #line 88 "adalexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 72: YY_RULE_SETUP #line 89 "adalexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 73: YY_RULE_SETUP #line 90 "adalexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 74: YY_RULE_SETUP #line 91 "adalexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 75: YY_RULE_SETUP #line 92 "adalexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 76: YY_RULE_SETUP #line 93 "adalexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 77: YY_RULE_SETUP #line 94 "adalexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 78: YY_RULE_SETUP #line 95 "adalexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 79: YY_RULE_SETUP #line 96 "adalexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 80: YY_RULE_SETUP #line 97 "adalexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 81: YY_RULE_SETUP #line 98 "adalexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 82: YY_RULE_SETUP #line 99 "adalexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 83: YY_RULE_SETUP #line 100 "adalexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 84: YY_RULE_SETUP #line 101 "adalexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 85: YY_RULE_SETUP #line 103 "adalexer.l" { return(TOKENIZER_COMMENT); } YY_BREAK case 86: YY_RULE_SETUP #line 104 "adalexer.l" { return(TOKENIZER_LITERAL); } YY_BREAK case 87: YY_RULE_SETUP #line 105 "adalexer.l" { return(TOKENIZER_LITERAL); } YY_BREAK case 88: YY_RULE_SETUP #line 106 "adalexer.l" { return(TOKENIZER_LITERAL); } YY_BREAK case 89: YY_RULE_SETUP #line 108 "adalexer.l" { return(TOKENIZER_NEWLINE); } YY_BREAK case 90: YY_RULE_SETUP #line 109 "adalexer.l" { return(TOKENIZER_NEWLINE); } YY_BREAK case 91: YY_RULE_SETUP #line 110 "adalexer.l" { return(TOKENIZER_NEWLINE); } YY_BREAK case 92: YY_RULE_SETUP #line 111 "adalexer.l" { return(TOKENIZER_TEXT); } YY_BREAK case 93: YY_RULE_SETUP #line 112 "adalexer.l" { return(TOKENIZER_TEXT); } YY_BREAK case 94: YY_RULE_SETUP #line 113 "adalexer.l" { return(TOKENIZER_TEXT); } YY_BREAK case 95: YY_RULE_SETUP #line 114 "adalexer.l" ECHO; YY_BREAK #line 1350 "adalexer.c" case YY_STATE_EOF(INITIAL): yyterminate(); case YY_END_OF_BUFFER: { /* Amount of text matched not including the EOB char. */ int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; /* Undo the effects of YY_DO_BEFORE_ACTION. */ *yy_cp = yy_hold_char; YY_RESTORE_YY_MORE_OFFSET if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) { /* We're scanning a new file or input source. It's * possible that this happened because the user * just pointed yyin at a new source and called * yylex(). If so, then we have to assure * consistency between yy_current_buffer and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ yy_n_chars = yy_current_buffer->yy_n_chars; yy_current_buffer->yy_input_file = yyin; yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; } /* Note that here we test for yy_c_buf_p "<=" to the position * of the first EOB in the buffer, since yy_c_buf_p will * already have been incremented past the NUL character * (since all states make transitions on EOB to the * end-of-buffer state). Contrast this with the test * in input(). */ if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) { /* This was really a NUL. */ yy_state_type yy_next_state; yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state(); /* Okay, we're now positioned to make the NUL * transition. We couldn't have * yy_get_previous_state() go ahead and do it * for us because it doesn't know how to deal * with the possibility of jamming (and we don't * want to build jamming into it because then it * will run more slowly). */ yy_next_state = yy_try_NUL_trans( yy_current_state ); yy_bp = yytext_ptr + YY_MORE_ADJ; if ( yy_next_state ) { /* Consume the NUL. */ yy_cp = ++yy_c_buf_p; yy_current_state = yy_next_state; goto yy_match; } else { yy_cp = yy_c_buf_p; goto yy_find_action; } } else switch ( yy_get_next_buffer() ) { case EOB_ACT_END_OF_FILE: { yy_did_buffer_switch_on_eof = 0; if ( yywrap() ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up * yytext, we can now set up * yy_c_buf_p so that if some total * hoser (like flex itself) wants to * call the scanner after we return the * YY_NULL, it'll still work - another * YY_NULL will get returned. */ yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; yy_act = YY_STATE_EOF(YY_START); goto do_action; } else { if ( ! yy_did_buffer_switch_on_eof ) YY_NEW_FILE; } break; } case EOB_ACT_CONTINUE_SCAN: yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state(); yy_cp = yy_c_buf_p; yy_bp = yytext_ptr + YY_MORE_ADJ; goto yy_match; case EOB_ACT_LAST_MATCH: yy_c_buf_p = &yy_current_buffer->yy_ch_buf[yy_n_chars]; yy_current_state = yy_get_previous_state(); yy_cp = yy_c_buf_p; yy_bp = yytext_ptr + YY_MORE_ADJ; goto yy_find_action; } break; } default: YY_FATAL_ERROR( "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ } /* end of yylex */ /* yy_get_next_buffer - try to read in a new buffer * * Returns a code representing an action: * EOB_ACT_LAST_MATCH - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */ static int yy_get_next_buffer() { register char *dest = yy_current_buffer->yy_ch_buf; register char *source = yytext_ptr; register int number_to_move, i; int ret_val; if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) YY_FATAL_ERROR( "fatal flex scanner internal error--end of buffer missed" ); if ( yy_current_buffer->yy_fill_buffer == 0 ) { /* Don't try to fill the buffer, so this is an EOF. */ if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) { /* We matched a single character, the EOB, so * treat this as a final EOF. */ return EOB_ACT_END_OF_FILE; } else { /* We matched some text prior to the EOB, first * process it. */ return EOB_ACT_LAST_MATCH; } } /* Try to read more data. */ /* First move last chars to start of buffer. */ number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) /* don't do the read, it's not guaranteed to return an EOF, * just force an EOF */ yy_current_buffer->yy_n_chars = yy_n_chars = 0; else { int num_to_read = yy_current_buffer->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ #ifdef YY_USES_REJECT YY_FATAL_ERROR( "input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); #else /* just a shorter name for the current buffer */ YY_BUFFER_STATE b = yy_current_buffer; int yy_c_buf_p_offset = (int) (yy_c_buf_p - b->yy_ch_buf); if ( b->yy_is_our_buffer ) { int new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; else b->yy_buf_size *= 2; b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ yy_flex_realloc( (void *) b->yy_ch_buf, b->yy_buf_size + 2 ); } else /* Can't grow it, we don't own it. */ b->yy_ch_buf = 0; if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; num_to_read = yy_current_buffer->yy_buf_size - number_to_move - 1; #endif } if ( num_to_read > YY_READ_BUF_SIZE ) num_to_read = YY_READ_BUF_SIZE; /* Read in more data. */ YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), yy_n_chars, num_to_read ); yy_current_buffer->yy_n_chars = yy_n_chars; } if ( yy_n_chars == 0 ) { if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; yyrestart( yyin ); } else { ret_val = EOB_ACT_LAST_MATCH; yy_current_buffer->yy_buffer_status = YY_BUFFER_EOF_PENDING; } } else ret_val = EOB_ACT_CONTINUE_SCAN; yy_n_chars += number_to_move; yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; return ret_val; } /* yy_get_previous_state - get the state just before the EOB char was reached */ static yy_state_type yy_get_previous_state() { register yy_state_type yy_current_state; register char *yy_cp; yy_current_state = yy_start; for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) { register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { yy_last_accepting_state = yy_current_state; yy_last_accepting_cpos = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 400 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; } return yy_current_state; } /* yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis * next_state = yy_try_NUL_trans( current_state ); */ #ifdef YY_USE_PROTOS static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) #else static yy_state_type yy_try_NUL_trans( yy_current_state ) yy_state_type yy_current_state; #endif { register int yy_is_jam; register char *yy_cp = yy_c_buf_p; register YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { yy_last_accepting_state = yy_current_state; yy_last_accepting_cpos = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 400 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; yy_is_jam = (yy_current_state == 399); return yy_is_jam ? 0 : yy_current_state; } #ifndef YY_NO_UNPUT #ifdef YY_USE_PROTOS static void yyunput( int c, register char *yy_bp ) #else static void yyunput( c, yy_bp ) int c; register char *yy_bp; #endif { register char *yy_cp = yy_c_buf_p; /* undo effects of setting up yytext */ *yy_cp = yy_hold_char; if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) { /* need to shift things up to make room */ /* +2 for EOB chars. */ register int number_to_move = yy_n_chars + 2; register char *dest = &yy_current_buffer->yy_ch_buf[ yy_current_buffer->yy_buf_size + 2]; register char *source = &yy_current_buffer->yy_ch_buf[number_to_move]; while ( source > yy_current_buffer->yy_ch_buf ) *--dest = *--source; yy_cp += (int) (dest - source); yy_bp += (int) (dest - source); yy_current_buffer->yy_n_chars = yy_n_chars = yy_current_buffer->yy_buf_size; if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) YY_FATAL_ERROR( "flex scanner push-back overflow" ); } *--yy_cp = (char) c; yytext_ptr = yy_bp; yy_hold_char = *yy_cp; yy_c_buf_p = yy_cp; } #endif /* ifndef YY_NO_UNPUT */ #ifdef __cplusplus static int yyinput() #else static int input() #endif { int c; *yy_c_buf_p = yy_hold_char; if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) { /* yy_c_buf_p now points to the character we want to return. * If this occurs *before* the EOB characters, then it's a * valid NUL; if not, then we've hit the end of the buffer. */ if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) /* This was really a NUL. */ *yy_c_buf_p = '\0'; else { /* need more input */ int offset = yy_c_buf_p - yytext_ptr; ++yy_c_buf_p; switch ( yy_get_next_buffer() ) { case EOB_ACT_LAST_MATCH: /* This happens because yy_g_n_b() * sees that we've accumulated a * token and flags that we need to * try matching the token before * proceeding. But for input(), * there's no matching to consider. * So convert the EOB_ACT_LAST_MATCH * to EOB_ACT_END_OF_FILE. */ /* Reset buffer status. */ yyrestart( yyin ); /* fall through */ case EOB_ACT_END_OF_FILE: { if ( yywrap() ) return EOF; if ( ! yy_did_buffer_switch_on_eof ) YY_NEW_FILE; #ifdef __cplusplus return yyinput(); #else return input(); #endif } case EOB_ACT_CONTINUE_SCAN: yy_c_buf_p = yytext_ptr + offset; break; } } } c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ *yy_c_buf_p = '\0'; /* preserve yytext */ yy_hold_char = *++yy_c_buf_p; return c; } #ifdef YY_USE_PROTOS void yyrestart( FILE *input_file ) #else void yyrestart( input_file ) FILE *input_file; #endif { if ( ! yy_current_buffer ) yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); yy_init_buffer( yy_current_buffer, input_file ); yy_load_buffer_state(); } #ifdef YY_USE_PROTOS void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) #else void yy_switch_to_buffer( new_buffer ) YY_BUFFER_STATE new_buffer; #endif { if ( yy_current_buffer == new_buffer ) return; if ( yy_current_buffer ) { /* Flush out information for old buffer. */ *yy_c_buf_p = yy_hold_char; yy_current_buffer->yy_buf_pos = yy_c_buf_p; yy_current_buffer->yy_n_chars = yy_n_chars; } yy_current_buffer = new_buffer; yy_load_buffer_state(); /* We don't actually know whether we did this switch during * EOF (yywrap()) processing, but the only time this flag * is looked at is after yywrap() is called, so it's safe * to go ahead and always set it. */ yy_did_buffer_switch_on_eof = 1; } #ifdef YY_USE_PROTOS void yy_load_buffer_state( void ) #else void yy_load_buffer_state() #endif { yy_n_chars = yy_current_buffer->yy_n_chars; yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; yyin = yy_current_buffer->yy_input_file; yy_hold_char = *yy_c_buf_p; } #ifdef YY_USE_PROTOS YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) #else YY_BUFFER_STATE yy_create_buffer( file, size ) FILE *file; int size; #endif { YY_BUFFER_STATE b; b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_buf_size = size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_is_our_buffer = 1; yy_init_buffer( b, file ); return b; } #ifdef YY_USE_PROTOS void yy_delete_buffer( YY_BUFFER_STATE b ) #else void yy_delete_buffer( b ) YY_BUFFER_STATE b; #endif { if ( ! b ) return; if ( b == yy_current_buffer ) yy_current_buffer = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) yy_flex_free( (void *) b->yy_ch_buf ); yy_flex_free( (void *) b ); } #ifndef _WIN32 #include #else #ifndef YY_ALWAYS_INTERACTIVE #ifndef YY_NEVER_INTERACTIVE extern int isatty YY_PROTO(( int )); #endif #endif #endif #ifdef YY_USE_PROTOS void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) #else void yy_init_buffer( b, file ) YY_BUFFER_STATE b; FILE *file; #endif { yy_flush_buffer( b ); b->yy_input_file = file; b->yy_fill_buffer = 1; #if YY_ALWAYS_INTERACTIVE b->yy_is_interactive = 1; #else #if YY_NEVER_INTERACTIVE b->yy_is_interactive = 0; #else b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; #endif #endif } #ifdef YY_USE_PROTOS void yy_flush_buffer( YY_BUFFER_STATE b ) #else void yy_flush_buffer( b ) YY_BUFFER_STATE b; #endif { if ( ! b ) return; b->yy_n_chars = 0; /* We always need two end-of-buffer characters. The first causes * a transition to the end-of-buffer state. The second causes * a jam in that state. */ b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; b->yy_buf_pos = &b->yy_ch_buf[0]; b->yy_at_bol = 1; b->yy_buffer_status = YY_BUFFER_NEW; if ( b == yy_current_buffer ) yy_load_buffer_state(); } #ifndef YY_NO_SCAN_BUFFER #ifdef YY_USE_PROTOS YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) #else YY_BUFFER_STATE yy_scan_buffer( base, size ) char *base; yy_size_t size; #endif { YY_BUFFER_STATE b; if ( size < 2 || base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ return 0; b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; b->yy_is_our_buffer = 0; b->yy_input_file = 0; b->yy_n_chars = b->yy_buf_size; b->yy_is_interactive = 0; b->yy_at_bol = 1; b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; yy_switch_to_buffer( b ); return b; } #endif #ifndef YY_NO_SCAN_STRING #ifdef YY_USE_PROTOS YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str ) #else YY_BUFFER_STATE yy_scan_string( yy_str ) yyconst char *yy_str; #endif { int len; for ( len = 0; yy_str[len]; ++len ) ; return yy_scan_bytes( yy_str, len ); } #endif #ifndef YY_NO_SCAN_BYTES #ifdef YY_USE_PROTOS YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len ) #else YY_BUFFER_STATE yy_scan_bytes( bytes, len ) yyconst char *bytes; int len; #endif { YY_BUFFER_STATE b; char *buf; yy_size_t n; int i; /* Get memory for full buffer, including space for trailing EOB's. */ n = len + 2; buf = (char *) yy_flex_alloc( n ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); for ( i = 0; i < len; ++i ) buf[i] = bytes[i]; buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; b = yy_scan_buffer( buf, n ); if ( ! b ) YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); /* It's okay to grow etc. this buffer, and we should throw it * away when we're done. */ b->yy_is_our_buffer = 1; return b; } #endif #ifndef YY_NO_PUSH_STATE #ifdef YY_USE_PROTOS static void yy_push_state( int new_state ) #else static void yy_push_state( new_state ) int new_state; #endif { if ( yy_start_stack_ptr >= yy_start_stack_depth ) { yy_size_t new_size; yy_start_stack_depth += YY_START_STACK_INCR; new_size = yy_start_stack_depth * sizeof( int ); if ( ! yy_start_stack ) yy_start_stack = (int *) yy_flex_alloc( new_size ); else yy_start_stack = (int *) yy_flex_realloc( (void *) yy_start_stack, new_size ); if ( ! yy_start_stack ) YY_FATAL_ERROR( "out of memory expanding start-condition stack" ); } yy_start_stack[yy_start_stack_ptr++] = YY_START; BEGIN(new_state); } #endif #ifndef YY_NO_POP_STATE static void yy_pop_state() { if ( --yy_start_stack_ptr < 0 ) YY_FATAL_ERROR( "start-condition stack underflow" ); BEGIN(yy_start_stack[yy_start_stack_ptr]); } #endif #ifndef YY_NO_TOP_STATE static int yy_top_state() { return yy_start_stack[yy_start_stack_ptr - 1]; } #endif #ifndef YY_EXIT_FAILURE #define YY_EXIT_FAILURE 2 #endif #ifdef YY_USE_PROTOS static void yy_fatal_error( yyconst char msg[] ) #else static void yy_fatal_error( msg ) char msg[]; #endif { (void) fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } /* Redefine yyless() so it works in section 3 code. */ #undef yyless #define yyless(n) \ do \ { \ /* Undo effects of setting up yytext. */ \ yytext[yyleng] = yy_hold_char; \ yy_c_buf_p = yytext + n; \ yy_hold_char = *yy_c_buf_p; \ *yy_c_buf_p = '\0'; \ yyleng = n; \ } \ while ( 0 ) /* Internal utility routines. */ #ifndef yytext_ptr #ifdef YY_USE_PROTOS static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) #else static void yy_flex_strncpy( s1, s2, n ) char *s1; yyconst char *s2; int n; #endif { register int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } #endif #ifdef YY_NEED_STRLEN #ifdef YY_USE_PROTOS static int yy_flex_strlen( yyconst char *s ) #else static int yy_flex_strlen( s ) yyconst char *s; #endif { register int n; for ( n = 0; s[n]; ++n ) ; return n; } #endif #ifdef YY_USE_PROTOS static void *yy_flex_alloc( yy_size_t size ) #else static void *yy_flex_alloc( size ) yy_size_t size; #endif { return (void *) malloc( size ); } #ifdef YY_USE_PROTOS static void *yy_flex_realloc( void *ptr, yy_size_t size ) #else static void *yy_flex_realloc( ptr, size ) void *ptr; yy_size_t size; #endif { /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter * because both ANSI C and C++ allow castless assignment from * any pointer type to void*, and deal with argument conversions * as though doing an assignment. */ return (void *) realloc( (char *) ptr, size ); } #ifdef YY_USE_PROTOS static void yy_flex_free( void *ptr ) #else static void yy_flex_free( ptr ) void *ptr; #endif { free( ptr ); } #if YY_MAIN int main() { yylex(); return 0; } #endif #line 114 "adalexer.l" int ada_wrap ( void ) { { /* Silly impossible function call to stop warning of unused functions */ if ( 0 ) { yyunput(0, ""); } } return 1; } cgdb-0.6.7/lib/tokenizer/adalexer.l000644 000765 000024 00000012477 12074441140 020142 0ustar00mmuellerstaff000000 000000 %option prefix="ada_" %option outfile="lex.yy.c" %option case-insensitive D [0-9] L [a-zA-Z_] %{ /* System Includes */ #include #include "tokenizer.h" %} %% "array" { return(TOKENIZER_TYPE); } "boolean" { return(TOKENIZER_TYPE); } "character" { return(TOKENIZER_TYPE); } "constant" { return(TOKENIZER_TYPE); } "fixed" { return(TOKENIZER_TYPE); } "float" { return(TOKENIZER_TYPE); } "integer" { return(TOKENIZER_TYPE); } "long_float" { return(TOKENIZER_TYPE); } "long_long_float" { return(TOKENIZER_TYPE); } "long_integer" { return(TOKENIZER_TYPE); } "long_long_integer" { return(TOKENIZER_TYPE); } "natural" { return(TOKENIZER_TYPE); } "positive" { return(TOKENIZER_TYPE); } "short_float" { return(TOKENIZER_TYPE); } "short_integer" { return(TOKENIZER_TYPE); } "short_short_integer" { return(TOKENIZER_TYPE); } "string" { return(TOKENIZER_TYPE); } "abort" { return(TOKENIZER_KEYWORD); } "abs" { return(TOKENIZER_KEYWORD); } "abstract" { return(TOKENIZER_KEYWORD); } "accept" { return(TOKENIZER_KEYWORD); } "access" { return(TOKENIZER_KEYWORD); } "aliased" { return(TOKENIZER_KEYWORD); } "all" { return(TOKENIZER_KEYWORD); } "and" { return(TOKENIZER_KEYWORD); } "at" { return(TOKENIZER_KEYWORD); } "begin" { return(TOKENIZER_KEYWORD); } "body" { return(TOKENIZER_KEYWORD); } "case" { return(TOKENIZER_KEYWORD); } "declare" { return(TOKENIZER_KEYWORD); } "delay" { return(TOKENIZER_KEYWORD); } "delta" { return(TOKENIZER_KEYWORD); } "digits" { return(TOKENIZER_KEYWORD); } "do" { return(TOKENIZER_KEYWORD); } "else" { return(TOKENIZER_KEYWORD); } "elsif" { return(TOKENIZER_KEYWORD); } "end" { return(TOKENIZER_KEYWORD); } "entry" { return(TOKENIZER_KEYWORD); } "exception" { return(TOKENIZER_KEYWORD); } "exit" { return(TOKENIZER_KEYWORD); } "for" { return(TOKENIZER_KEYWORD); } "function" { return(TOKENIZER_KEYWORD); } "generic" { return(TOKENIZER_KEYWORD); } "goto" { return(TOKENIZER_KEYWORD); } "if" { return(TOKENIZER_KEYWORD); } "in" { return(TOKENIZER_KEYWORD); } "is" { return(TOKENIZER_KEYWORD); } "limited" { return(TOKENIZER_KEYWORD); } "loop" { return(TOKENIZER_KEYWORD); } "mod" { return(TOKENIZER_KEYWORD); } "new" { return(TOKENIZER_KEYWORD); } "not" { return(TOKENIZER_KEYWORD); } "null" { return(TOKENIZER_KEYWORD); } "of" { return(TOKENIZER_KEYWORD); } "or" { return(TOKENIZER_KEYWORD); } "others" { return(TOKENIZER_KEYWORD); } "out" { return(TOKENIZER_KEYWORD); } "package" { return(TOKENIZER_KEYWORD); } "pragma" { return(TOKENIZER_KEYWORD); } "private" { return(TOKENIZER_KEYWORD); } "procedure" { return(TOKENIZER_KEYWORD); } "protected" { return(TOKENIZER_KEYWORD); } "raise" { return(TOKENIZER_KEYWORD); } "range" { return(TOKENIZER_KEYWORD); } "record", { return(TOKENIZER_KEYWORD); } "rem" { return(TOKENIZER_KEYWORD); } "renames" { return(TOKENIZER_KEYWORD); } "requeue" { return(TOKENIZER_KEYWORD); } "return" { return(TOKENIZER_KEYWORD); } "reverse" { return(TOKENIZER_KEYWORD); } "select" { return(TOKENIZER_KEYWORD); } "separate" { return(TOKENIZER_KEYWORD); } "subtype" { return(TOKENIZER_KEYWORD); } "tagged" { return(TOKENIZER_KEYWORD); } "task" { return(TOKENIZER_KEYWORD); } "terminate" { return(TOKENIZER_KEYWORD); } "then" { return(TOKENIZER_KEYWORD); } "type" { return(TOKENIZER_KEYWORD); } "until" { return(TOKENIZER_KEYWORD); } "use" { return(TOKENIZER_KEYWORD); } "when" { return(TOKENIZER_KEYWORD); } "while" { return(TOKENIZER_KEYWORD); } "with" { return(TOKENIZER_KEYWORD); } "xor" { return(TOKENIZER_KEYWORD); } --([^\r\n\f\v])* { return(TOKENIZER_COMMENT); } \"(\".|.)*\" { return(TOKENIZER_LITERAL); } {D}+ { return(TOKENIZER_LITERAL); } '.' { return(TOKENIZER_LITERAL); } \n { return(TOKENIZER_NEWLINE); } \r\n { return(TOKENIZER_NEWLINE); } \r { return(TOKENIZER_NEWLINE); } [ \t\v\f] { return(TOKENIZER_TEXT); } {L}+ { return(TOKENIZER_TEXT); } . { return(TOKENIZER_TEXT); } %% int ada_wrap ( void ) { { /* Silly impossible function call to stop warning of unused functions */ if ( 0 ) { yyunput(0, ""); } } return 1; } cgdb-0.6.7/lib/tokenizer/clexer.c000644 000765 000024 00000171775 12074441140 017635 0ustar00mmuellerstaff000000 000000 #define yy_create_buffer c__create_buffer #define yy_delete_buffer c__delete_buffer #define yy_scan_buffer c__scan_buffer #define yy_scan_string c__scan_string #define yy_scan_bytes c__scan_bytes #define yy_flex_debug c__flex_debug #define yy_init_buffer c__init_buffer #define yy_flush_buffer c__flush_buffer #define yy_load_buffer_state c__load_buffer_state #define yy_switch_to_buffer c__switch_to_buffer #define yyin c_in #define yyleng c_leng #define yylex c_lex #define yyout c_out #define yyrestart c_restart #define yytext c_text #define yywrap c_wrap #line 20 "clexer.c" /* A lexical scanner generated by flex */ /* Scanner skeleton version: * $Header$ */ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 #include #include /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ #ifdef c_plusplus #ifndef __cplusplus #define __cplusplus #endif #endif #ifdef __cplusplus #include /* Use prototypes in function declarations. */ #define YY_USE_PROTOS /* The "const" storage-class-modifier is valid. */ #define YY_USE_CONST #else /* ! __cplusplus */ #if __STDC__ #define YY_USE_PROTOS #define YY_USE_CONST #endif /* __STDC__ */ #endif /* ! __cplusplus */ #ifdef __TURBOC__ #pragma warn -rch #pragma warn -use #include #include #define YY_USE_CONST #define YY_USE_PROTOS #endif #ifdef YY_USE_CONST #define yyconst const #else #define yyconst #endif #ifdef YY_USE_PROTOS #define YY_PROTO(proto) proto #else #define YY_PROTO(proto) () #endif /* Returned upon end-of-file. */ #define YY_NULL 0 /* Promotes a possibly negative, possibly signed char to an unsigned * integer for use as an array index. If the signed char is negative, * we want to instead treat it as an 8-bit unsigned char, hence the * double cast. */ #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) /* Enter a start condition. This macro really ought to take a parameter, * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ #define BEGIN yy_start = 1 + 2 * /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ #define YY_START ((yy_start - 1) / 2) #define YYSTATE YY_START /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) /* Special action meaning "start processing a new file". */ #define YY_NEW_FILE yyrestart( yyin ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ #define YY_BUF_SIZE 16384 typedef struct yy_buffer_state *YY_BUFFER_STATE; extern int yyleng; extern FILE *yyin, *yyout; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 /* The funky do-while in the following #define is used to turn the definition * int a single C statement (which needs a semi-colon terminator). This * avoids problems with code like: * * if ( condition_holds ) * yyless( 5 ); * else * do_something_else(); * * Prior to using the do-while the compiler would get upset at the * "else" because it interpreted the "if" statement as being all * done when it reached the ';' after the yyless() call. */ /* Return all but the first 'n' matched characters back to the input stream. */ #define yyless(n) \ do \ { \ /* Undo effects of setting up yytext. */ \ *yy_cp = yy_hold_char; \ YY_RESTORE_YY_MORE_OFFSET \ yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ YY_DO_BEFORE_ACTION; /* set up yytext again */ \ } \ while ( 0 ) #define unput(c) yyunput( c, yytext_ptr ) /* The following is because we cannot portably get our hands on size_t * (without autoconf's help, which isn't available because we want * flex-generated scanners to compile on their own). */ typedef unsigned int yy_size_t; struct yy_buffer_state { FILE *yy_input_file; char *yy_ch_buf; /* input buffer */ char *yy_buf_pos; /* current position in input buffer */ /* Size of input buffer in bytes, not including room for EOB * characters. */ yy_size_t yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. */ int yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to * delete it. */ int yy_is_our_buffer; /* Whether this is an "interactive" input source; if so, and * if we're using stdio for input, then we want to use getc() * instead of fread(), to make sure we stop fetching input after * each newline. */ int yy_is_interactive; /* Whether we're considered to be at the beginning of a line. * If so, '^' rules will be active on the next match, otherwise * not. */ int yy_at_bol; /* Whether to try to fill the input buffer when we reach the * end of it. */ int yy_fill_buffer; int yy_buffer_status; #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 /* When an EOF's been seen but there's still some text to process * then we mark the buffer as YY_EOF_PENDING, to indicate that we * shouldn't try reading from the input source any more. We might * still have a bunch of tokens to match, though, because of * possible backing-up. * * When we actually see the EOF, we change the status to "new" * (via yyrestart()), so that the user can continue scanning by * just pointing yyin at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 }; static YY_BUFFER_STATE yy_current_buffer = 0; /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general * "scanner state". */ #define YY_CURRENT_BUFFER yy_current_buffer /* yy_hold_char holds the character lost when yytext is formed. */ static char yy_hold_char; static int yy_n_chars; /* number of characters read into yy_ch_buf */ int yyleng; /* Points to current character in buffer. */ static char *yy_c_buf_p = (char *) 0; static int yy_init = 1; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ /* Flag which is used to allow yywrap()'s to do buffer switches * instead of setting up a fresh yyin. A bit of a hack ... */ static int yy_did_buffer_switch_on_eof; void yyrestart YY_PROTO(( FILE *input_file )); void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); void yy_load_buffer_state YY_PROTO(( void )); YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str )); YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); static void *yy_flex_alloc YY_PROTO(( yy_size_t )); static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); static void yy_flex_free YY_PROTO(( void * )); #define yy_new_buffer yy_create_buffer #define yy_set_interactive(is_interactive) \ { \ if ( ! yy_current_buffer ) \ yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ yy_current_buffer->yy_is_interactive = is_interactive; \ } #define yy_set_bol(at_bol) \ { \ if ( ! yy_current_buffer ) \ yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ yy_current_buffer->yy_at_bol = at_bol; \ } #define YY_AT_BOL() (yy_current_buffer->yy_at_bol) typedef unsigned char YY_CHAR; FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; typedef int yy_state_type; extern char *yytext; #define yytext_ptr yytext static yy_state_type yy_get_previous_state YY_PROTO(( void )); static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); static int yy_get_next_buffer YY_PROTO(( void )); static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); /* Done after the current pattern has been matched and before the * corresponding action - sets up yytext. */ #define YY_DO_BEFORE_ACTION \ yytext_ptr = yy_bp; \ yyleng = (int) (yy_cp - yy_bp); \ yy_hold_char = *yy_cp; \ *yy_cp = '\0'; \ yy_c_buf_p = yy_cp; #define YY_NUM_RULES 99 #define YY_END_OF_BUFFER 100 static yyconst short int yy_accept[378] = { 0, 0, 0, 76, 76, 85, 85, 100, 98, 96, 93, 95, 84, 98, 98, 98, 90, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 76, 78, 79, 77, 85, 86, 87, 89, 99, 94, 83, 0, 0, 75, 82, 90, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 41, 97, 97, 97, 97, 97, 97, 97, 97, 97, 48, 97, 97, 97, 97, 97, 97, 97, 53, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 76, 80, 77, 77, 81, 85, 0, 88, 91, 0, 91, 82, 28, 30, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 46, 97, 97, 97, 13, 97, 97, 97, 49, 50, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 67, 97, 97, 97, 97, 97, 97, 97, 97, 97, 73, 92, 97, 1, 97, 97, 2, 97, 34, 97, 3, 97, 97, 97, 97, 97, 97, 97, 97, 43, 7, 97, 97, 97, 97, 97, 97, 47, 97, 14, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 64, 97, 66, 97, 97, 97, 97, 97, 25, 97, 97, 97, 97, 97, 97, 32, 33, 35, 4, 36, 5, 97, 97, 97, 97, 97, 97, 97, 97, 45, 10, 97, 97, 97, 97, 97, 97, 54, 97, 97, 97, 97, 97, 97, 18, 97, 97, 97, 97, 97, 97, 65, 97, 97, 97, 22, 97, 71, 97, 97, 97, 72, 97, 29, 31, 97, 97, 97, 40, 6, 97, 97, 44, 8, 11, 12, 97, 97, 51, 97, 97, 97, 57, 97, 97, 59, 19, 60, 20, 21, 62, 97, 97, 69, 97, 97, 97, 97, 97, 74, 97, 97, 39, 97, 97, 15, 97, 97, 55, 97, 97, 97, 97, 97, 68, 97, 97, 24, 97, 27, 97, 38, 97, 9, 97, 52, 97, 17, 97, 97, 63, 70, 23, 26, 97, 97, 16, 56, 97, 97, 37, 97, 97, 97, 97, 97, 61, 42, 97, 97, 97, 97, 58, 0 } ; static yyconst int yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 2, 2, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 5, 6, 1, 1, 1, 7, 1, 1, 8, 1, 1, 1, 1, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 1, 1, 1, 1, 1, 1, 1, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 1, 12, 1, 1, 13, 1, 14, 15, 16, 17, 18, 19, 20, 21, 22, 11, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } ; static yyconst int yy_meta[39] = { 0, 1, 1, 2, 3, 4, 1, 1, 5, 1, 6, 7, 1, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7 } ; static yyconst short int yy_base[389] = { 0, 0, 0, 36, 38, 44, 47, 762, 763, 763, 763, 758, 763, 0, 748, 45, 749, 748, 35, 33, 48, 47, 54, 67, 60, 57, 61, 63, 75, 76, 82, 85, 88, 95, 91, 97, 117, 72, 0, 763, 754, 120, 744, 763, 752, 763, 749, 763, 0, 746, 745, 763, 0, 741, 0, 740, 101, 111, 98, 116, 104, 124, 125, 127, 129, 134, 130, 135, 136, 69, 137, 141, 140, 145, 148, 143, 142, 739, 151, 153, 156, 157, 161, 166, 167, 171, 170, 176, 179, 177, 180, 192, 183, 184, 185, 193, 200, 198, 202, 203, 213, 204, 209, 206, 0, 763, 230, 232, 763, 736, 742, 763, 763, 739, 738, 0, 232, 734, 207, 233, 222, 234, 239, 211, 240, 241, 243, 242, 244, 245, 246, 252, 249, 254, 258, 259, 255, 266, 733, 265, 268, 271, 732, 274, 277, 278, 731, 279, 280, 287, 288, 289, 290, 291, 292, 293, 294, 297, 298, 296, 299, 301, 302, 305, 307, 309, 730, 319, 315, 321, 325, 328, 329, 330, 331, 337, 339, 763, 338, 729, 340, 343, 728, 344, 727, 347, 726, 345, 348, 349, 352, 353, 355, 354, 359, 725, 724, 360, 361, 365, 367, 369, 370, 723, 373, 722, 378, 379, 380, 390, 382, 392, 387, 393, 397, 384, 399, 398, 402, 404, 403, 407, 408, 409, 721, 411, 720, 417, 412, 416, 422, 425, 719, 427, 430, 431, 434, 435, 437, 718, 717, 716, 715, 714, 438, 440, 443, 445, 447, 446, 459, 451, 452, 713, 712, 460, 461, 462, 463, 464, 466, 711, 470, 471, 472, 474, 479, 475, 710, 482, 484, 480, 485, 490, 494, 709, 495, 497, 502, 708, 499, 707, 505, 500, 508, 706, 510, 705, 704, 513, 514, 516, 703, 702, 517, 518, 701, 700, 699, 698, 520, 521, 697, 522, 524, 526, 696, 527, 531, 695, 688, 687, 533, 680, 675, 534, 540, 674, 542, 544, 541, 545, 543, 673, 546, 553, 667, 560, 547, 666, 558, 554, 662, 562, 566, 567, 571, 568, 660, 572, 575, 659, 573, 650, 578, 633, 583, 632, 579, 631, 584, 629, 588, 590, 628, 627, 626, 625, 592, 593, 621, 620, 595, 596, 618, 598, 600, 601, 602, 604, 616, 615, 605, 606, 609, 612, 613, 763, 644, 651, 313, 658, 660, 667, 674, 681, 688, 695, 697 } ; static yyconst short int yy_def[389] = { 0, 377, 1, 378, 378, 379, 379, 377, 377, 377, 377, 377, 377, 380, 381, 377, 377, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 383, 377, 377, 384, 385, 377, 377, 377, 385, 377, 380, 377, 386, 377, 387, 377, 388, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 383, 377, 384, 384, 377, 385, 385, 377, 377, 377, 377, 387, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 377, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 0, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377 } ; static yyconst short int yy_nxt[802] = { 0, 8, 9, 10, 11, 12, 13, 14, 8, 15, 16, 17, 8, 17, 18, 19, 20, 21, 22, 23, 24, 17, 25, 17, 26, 27, 28, 29, 30, 17, 31, 32, 33, 34, 35, 36, 37, 17, 17, 39, 40, 39, 40, 54, 41, 54, 41, 43, 44, 45, 43, 44, 45, 51, 52, 59, 46, 54, 54, 46, 60, 56, 62, 61, 54, 66, 57, 54, 58, 63, 54, 54, 64, 54, 67, 65, 77, 54, 69, 54, 70, 72, 54, 78, 68, 54, 54, 76, 79, 81, 71, 73, 54, 82, 74, 54, 80, 75, 54, 103, 132, 54, 83, 88, 84, 54, 85, 54, 54, 89, 90, 54, 86, 93, 54, 87, 94, 97, 116, 99, 91, 54, 98, 92, 100, 95, 54, 54, 107, 108, 118, 120, 96, 101, 54, 54, 117, 54, 102, 54, 54, 124, 121, 125, 54, 54, 54, 54, 119, 128, 54, 54, 54, 54, 129, 54, 122, 123, 54, 126, 127, 54, 131, 54, 136, 139, 54, 54, 130, 134, 133, 54, 137, 135, 140, 141, 54, 54, 138, 143, 54, 54, 145, 142, 149, 148, 54, 54, 144, 54, 54, 152, 150, 54, 54, 54, 146, 151, 147, 153, 157, 154, 54, 54, 156, 161, 159, 163, 54, 162, 54, 155, 54, 54, 54, 164, 54, 54, 158, 54, 168, 54, 160, 54, 170, 174, 165, 185, 167, 169, 166, 175, 54, 171, 179, 172, 176, 173, 377, 377, 107, 108, 54, 54, 54, 178, 182, 180, 183, 54, 54, 54, 54, 54, 54, 54, 54, 184, 191, 54, 181, 193, 54, 192, 54, 54, 194, 195, 54, 54, 186, 188, 187, 189, 190, 54, 54, 199, 54, 196, 201, 54, 197, 202, 54, 198, 200, 54, 54, 54, 54, 206, 208, 204, 205, 203, 207, 54, 54, 54, 54, 54, 54, 54, 54, 210, 54, 54, 54, 54, 209, 54, 54, 214, 213, 54, 219, 54, 215, 54, 48, 212, 211, 218, 217, 54, 216, 226, 220, 54, 223, 54, 221, 222, 225, 54, 224, 227, 54, 54, 54, 54, 228, 229, 233, 234, 232, 54, 54, 54, 54, 230, 236, 54, 54, 54, 237, 54, 54, 54, 231, 235, 54, 54, 54, 54, 238, 240, 241, 54, 54, 54, 243, 239, 245, 54, 242, 54, 248, 54, 54, 244, 250, 54, 249, 253, 246, 247, 54, 54, 54, 251, 54, 257, 54, 252, 255, 54, 259, 256, 54, 254, 54, 54, 260, 263, 262, 54, 54, 54, 258, 261, 54, 54, 54, 264, 266, 54, 54, 54, 269, 54, 54, 272, 273, 271, 54, 54, 265, 267, 268, 270, 54, 274, 276, 54, 280, 54, 279, 277, 54, 54, 281, 278, 54, 54, 275, 54, 54, 285, 54, 289, 286, 54, 288, 54, 54, 54, 282, 283, 284, 54, 54, 292, 287, 293, 290, 291, 294, 54, 54, 54, 54, 54, 54, 295, 54, 298, 297, 299, 54, 54, 54, 296, 54, 54, 300, 305, 306, 54, 54, 301, 54, 302, 54, 54, 312, 308, 303, 310, 54, 309, 304, 311, 54, 54, 307, 54, 315, 54, 54, 314, 54, 316, 317, 54, 318, 313, 54, 320, 54, 322, 321, 54, 54, 319, 54, 54, 54, 324, 54, 54, 54, 327, 54, 330, 54, 54, 329, 323, 328, 54, 332, 54, 54, 334, 336, 325, 326, 331, 54, 54, 54, 54, 54, 54, 54, 54, 333, 338, 344, 335, 340, 54, 54, 341, 337, 339, 54, 342, 54, 345, 54, 346, 348, 343, 54, 54, 54, 347, 350, 54, 54, 54, 349, 54, 354, 353, 54, 54, 355, 357, 356, 54, 54, 352, 351, 360, 54, 359, 54, 361, 54, 54, 363, 54, 54, 365, 54, 358, 54, 54, 54, 366, 54, 54, 54, 372, 362, 54, 374, 373, 54, 54, 364, 54, 54, 367, 54, 368, 54, 54, 369, 370, 371, 54, 54, 54, 54, 54, 375, 54, 54, 54, 376, 38, 38, 38, 38, 38, 38, 38, 42, 42, 42, 42, 42, 42, 42, 49, 54, 49, 49, 49, 49, 49, 55, 55, 104, 54, 54, 104, 54, 104, 104, 106, 54, 54, 106, 106, 106, 106, 109, 54, 54, 54, 109, 109, 109, 113, 54, 113, 113, 113, 113, 113, 115, 54, 54, 115, 115, 115, 115, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 177, 177, 109, 110, 54, 54, 53, 114, 112, 109, 111, 110, 105, 54, 53, 50, 47, 377, 7, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377 } ; static yyconst short int yy_chk[802] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 4, 4, 19, 3, 18, 4, 5, 5, 5, 6, 6, 6, 15, 15, 19, 5, 21, 20, 6, 19, 18, 20, 19, 22, 21, 18, 25, 18, 20, 24, 26, 20, 27, 21, 20, 25, 23, 22, 69, 22, 23, 37, 25, 21, 28, 29, 24, 26, 28, 22, 23, 30, 28, 23, 31, 27, 23, 32, 37, 69, 34, 28, 31, 29, 33, 29, 35, 58, 32, 32, 56, 30, 33, 60, 30, 33, 34, 56, 35, 32, 57, 34, 32, 35, 33, 59, 36, 41, 41, 58, 60, 33, 36, 61, 62, 57, 63, 36, 64, 66, 63, 61, 64, 65, 67, 68, 70, 59, 66, 72, 71, 76, 75, 66, 73, 62, 62, 74, 65, 65, 78, 68, 79, 72, 75, 80, 81, 67, 71, 70, 82, 73, 71, 76, 78, 83, 84, 74, 79, 86, 85, 81, 78, 85, 84, 87, 89, 80, 88, 90, 87, 86, 92, 93, 94, 82, 86, 83, 88, 90, 88, 91, 95, 89, 92, 91, 94, 97, 93, 96, 88, 98, 99, 101, 94, 103, 118, 90, 102, 97, 123, 91, 100, 98, 101, 95, 123, 96, 97, 95, 102, 120, 99, 118, 100, 103, 100, 106, 106, 107, 107, 116, 119, 121, 116, 120, 119, 121, 122, 124, 125, 127, 126, 128, 129, 130, 122, 128, 132, 119, 130, 131, 129, 133, 136, 131, 132, 134, 135, 124, 126, 125, 127, 127, 139, 137, 135, 140, 133, 137, 141, 134, 139, 143, 134, 136, 144, 145, 147, 148, 144, 147, 141, 143, 140, 145, 149, 150, 151, 152, 153, 154, 155, 156, 149, 159, 157, 158, 160, 148, 161, 162, 153, 152, 163, 158, 164, 154, 165, 380, 151, 150, 157, 156, 168, 155, 165, 159, 167, 162, 169, 160, 161, 164, 170, 163, 167, 171, 172, 173, 174, 168, 169, 173, 174, 172, 175, 178, 176, 180, 170, 176, 181, 183, 187, 178, 185, 188, 189, 171, 175, 190, 191, 193, 192, 180, 183, 185, 194, 197, 198, 188, 181, 190, 199, 187, 200, 193, 201, 202, 189, 197, 204, 194, 200, 191, 192, 206, 207, 208, 198, 210, 206, 215, 199, 202, 212, 208, 204, 209, 201, 211, 213, 209, 212, 211, 214, 217, 216, 207, 210, 218, 220, 219, 213, 215, 221, 222, 223, 218, 225, 228, 221, 222, 220, 229, 227, 214, 216, 217, 219, 230, 223, 227, 231, 229, 233, 228, 227, 234, 235, 230, 227, 236, 237, 225, 238, 244, 235, 245, 244, 236, 246, 238, 247, 249, 248, 231, 233, 234, 251, 252, 247, 237, 248, 245, 246, 249, 250, 255, 256, 257, 258, 259, 250, 260, 255, 252, 256, 262, 263, 264, 251, 265, 267, 257, 263, 264, 266, 271, 258, 269, 259, 270, 272, 271, 266, 260, 269, 273, 267, 262, 270, 274, 276, 265, 277, 274, 280, 283, 273, 278, 276, 277, 282, 278, 272, 284, 282, 286, 284, 283, 289, 290, 280, 291, 294, 295, 289, 300, 301, 303, 294, 304, 301, 305, 307, 300, 286, 295, 308, 304, 312, 315, 307, 312, 290, 291, 303, 316, 320, 318, 322, 319, 321, 324, 328, 305, 316, 324, 308, 319, 325, 331, 320, 315, 318, 330, 321, 327, 325, 333, 327, 330, 322, 334, 335, 337, 328, 333, 336, 339, 342, 331, 340, 337, 336, 344, 348, 339, 342, 340, 346, 350, 335, 334, 348, 352, 346, 353, 350, 358, 359, 353, 362, 363, 359, 365, 344, 366, 367, 368, 362, 369, 372, 373, 369, 352, 374, 373, 372, 375, 376, 358, 371, 370, 363, 364, 365, 361, 360, 366, 367, 368, 357, 356, 355, 354, 351, 374, 349, 347, 345, 375, 378, 378, 378, 378, 378, 378, 378, 379, 379, 379, 379, 379, 379, 379, 381, 343, 381, 381, 381, 381, 381, 382, 382, 383, 341, 338, 383, 332, 383, 383, 384, 329, 326, 384, 384, 384, 384, 385, 323, 317, 314, 385, 385, 385, 386, 313, 386, 386, 386, 386, 386, 387, 311, 310, 387, 387, 387, 387, 388, 388, 309, 306, 302, 299, 298, 297, 296, 293, 292, 288, 287, 285, 281, 279, 275, 268, 261, 254, 253, 243, 242, 241, 240, 239, 232, 226, 224, 205, 203, 196, 195, 186, 184, 182, 179, 166, 146, 142, 138, 117, 114, 113, 110, 109, 77, 55, 53, 50, 49, 46, 44, 42, 40, 17, 16, 14, 11, 7, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377 } ; static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. */ #define REJECT reject_used_but_not_detected #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *yytext; #line 1 "clexer.l" #define INITIAL 0 #line 10 "clexer.l" #include #include "tokenizer.h" #define comment 1 #define string_literal 2 #line 691 "clexer.c" /* Macros after this point can all be overridden by user definitions in * section 1. */ #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus extern "C" int yywrap YY_PROTO(( void )); #else extern int yywrap YY_PROTO(( void )); #endif #endif #ifndef YY_NO_UNPUT static void yyunput YY_PROTO(( int c, char *buf_ptr )); #endif #ifndef yytext_ptr static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen YY_PROTO(( yyconst char * )); #endif #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput YY_PROTO(( void )); #else static int input YY_PROTO(( void )); #endif #endif #if YY_STACK_USED static int yy_start_stack_ptr = 0; static int yy_start_stack_depth = 0; static int *yy_start_stack = 0; #ifndef YY_NO_PUSH_STATE static void yy_push_state YY_PROTO(( int new_state )); #endif #ifndef YY_NO_POP_STATE static void yy_pop_state YY_PROTO(( void )); #endif #ifndef YY_NO_TOP_STATE static int yy_top_state YY_PROTO(( void )); #endif #else #define YY_NO_PUSH_STATE 1 #define YY_NO_POP_STATE 1 #define YY_NO_TOP_STATE 1 #endif #ifdef YY_MALLOC_DECL YY_MALLOC_DECL #else #if __STDC__ #ifndef __cplusplus #include #endif #else /* Just try to get by without declaring the routines. This will fail * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) * or sizeof(void*) != sizeof(int). */ #endif #endif /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE #define YY_READ_BUF_SIZE 8192 #endif /* Copy whatever the last rule matched to the standard output. */ #ifndef ECHO /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ #define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, * is returned in "result". */ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ if ( yy_current_buffer->yy_is_interactive ) \ { \ int c = '*', n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ if ( c == '\n' ) \ buf[n++] = (char) c; \ if ( c == EOF && ferror( yyin ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \ && ferror( yyin ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); #endif /* No semi-colon after return; correct usage is to write "yyterminate();" - * we don't want an extra ';' after the "return" because that will cause * some compilers to complain about unreachable statements. */ #ifndef yyterminate #define yyterminate() return YY_NULL #endif /* Number of entries by which start-condition stack grows. */ #ifndef YY_START_STACK_INCR #define YY_START_STACK_INCR 25 #endif /* Report a fatal error. */ #ifndef YY_FATAL_ERROR #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) #endif /* Default declaration of generated scanner - a define so the user can * easily add parameters. */ #ifndef YY_DECL #define YY_DECL int yylex YY_PROTO(( void )) #endif /* Code executed at the beginning of each rule, after yytext and yyleng * have been set up. */ #ifndef YY_USER_ACTION #define YY_USER_ACTION #endif /* Code executed at the end of each rule. */ #ifndef YY_BREAK #define YY_BREAK break; #endif #define YY_RULE_SETUP \ YY_USER_ACTION YY_DECL { register yy_state_type yy_current_state; register char *yy_cp = NULL, *yy_bp = NULL; register int yy_act; #line 18 "clexer.l" #line 844 "clexer.c" if ( yy_init ) { yy_init = 0; #ifdef YY_USER_INIT YY_USER_INIT; #endif if ( ! yy_start ) yy_start = 1; /* first start state */ if ( ! yyin ) yyin = stdin; if ( ! yyout ) yyout = stdout; if ( ! yy_current_buffer ) yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); yy_load_buffer_state(); } while ( 1 ) /* loops until end-of-file is reached */ { yy_cp = yy_c_buf_p; /* Support of yytext. */ *yy_cp = yy_hold_char; /* yy_bp points to the position in yy_ch_buf of the start of * the current run. */ yy_bp = yy_cp; yy_current_state = yy_start; yy_match: do { register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; if ( yy_accept[yy_current_state] ) { yy_last_accepting_state = yy_current_state; yy_last_accepting_cpos = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 378 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } while ( yy_base[yy_current_state] != 763 ); yy_find_action: yy_act = yy_accept[yy_current_state]; if ( yy_act == 0 ) { /* have to back up */ yy_cp = yy_last_accepting_cpos; yy_current_state = yy_last_accepting_state; yy_act = yy_accept[yy_current_state]; } YY_DO_BEFORE_ACTION; do_action: /* This label is used only to access EOF actions. */ switch ( yy_act ) { /* beginning of action switch */ case 0: /* must back up */ /* undo the effects of YY_DO_BEFORE_ACTION */ *yy_cp = yy_hold_char; yy_cp = yy_last_accepting_cpos; yy_current_state = yy_last_accepting_state; goto yy_find_action; case 1: YY_RULE_SETUP #line 19 "clexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 2: YY_RULE_SETUP #line 20 "clexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 3: YY_RULE_SETUP #line 21 "clexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 4: YY_RULE_SETUP #line 22 "clexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 5: YY_RULE_SETUP #line 23 "clexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 6: YY_RULE_SETUP #line 24 "clexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 7: YY_RULE_SETUP #line 25 "clexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 8: YY_RULE_SETUP #line 26 "clexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 9: YY_RULE_SETUP #line 27 "clexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 10: YY_RULE_SETUP #line 28 "clexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 11: YY_RULE_SETUP #line 29 "clexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 12: YY_RULE_SETUP #line 30 "clexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 13: YY_RULE_SETUP #line 31 "clexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 14: YY_RULE_SETUP #line 32 "clexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 15: YY_RULE_SETUP #line 33 "clexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 16: YY_RULE_SETUP #line 34 "clexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 17: YY_RULE_SETUP #line 35 "clexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 18: YY_RULE_SETUP #line 36 "clexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 19: YY_RULE_SETUP #line 37 "clexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 20: YY_RULE_SETUP #line 38 "clexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 21: YY_RULE_SETUP #line 39 "clexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 22: YY_RULE_SETUP #line 40 "clexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 23: YY_RULE_SETUP #line 41 "clexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 24: YY_RULE_SETUP #line 42 "clexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 25: YY_RULE_SETUP #line 43 "clexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 26: YY_RULE_SETUP #line 44 "clexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 27: YY_RULE_SETUP #line 45 "clexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 28: YY_RULE_SETUP #line 47 "clexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 29: YY_RULE_SETUP #line 48 "clexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 30: YY_RULE_SETUP #line 49 "clexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 31: YY_RULE_SETUP #line 50 "clexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 32: YY_RULE_SETUP #line 51 "clexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 33: YY_RULE_SETUP #line 52 "clexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 34: YY_RULE_SETUP #line 53 "clexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 35: YY_RULE_SETUP #line 54 "clexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 36: YY_RULE_SETUP #line 55 "clexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 37: YY_RULE_SETUP #line 56 "clexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 38: YY_RULE_SETUP #line 57 "clexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 39: YY_RULE_SETUP #line 58 "clexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 40: YY_RULE_SETUP #line 59 "clexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 41: YY_RULE_SETUP #line 60 "clexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 42: YY_RULE_SETUP #line 61 "clexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 43: YY_RULE_SETUP #line 62 "clexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 44: YY_RULE_SETUP #line 63 "clexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 45: YY_RULE_SETUP #line 64 "clexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 46: YY_RULE_SETUP #line 65 "clexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 47: YY_RULE_SETUP #line 66 "clexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 48: YY_RULE_SETUP #line 67 "clexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 49: YY_RULE_SETUP #line 68 "clexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 50: YY_RULE_SETUP #line 69 "clexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 51: YY_RULE_SETUP #line 70 "clexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 52: YY_RULE_SETUP #line 71 "clexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 53: YY_RULE_SETUP #line 72 "clexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 54: YY_RULE_SETUP #line 73 "clexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 55: YY_RULE_SETUP #line 74 "clexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 56: YY_RULE_SETUP #line 75 "clexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 57: YY_RULE_SETUP #line 76 "clexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 58: YY_RULE_SETUP #line 77 "clexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 59: YY_RULE_SETUP #line 78 "clexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 60: YY_RULE_SETUP #line 79 "clexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 61: YY_RULE_SETUP #line 80 "clexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 62: YY_RULE_SETUP #line 81 "clexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 63: YY_RULE_SETUP #line 82 "clexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 64: YY_RULE_SETUP #line 83 "clexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 65: YY_RULE_SETUP #line 84 "clexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 66: YY_RULE_SETUP #line 85 "clexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 67: YY_RULE_SETUP #line 86 "clexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 68: YY_RULE_SETUP #line 87 "clexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 69: YY_RULE_SETUP #line 88 "clexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 70: YY_RULE_SETUP #line 89 "clexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 71: YY_RULE_SETUP #line 90 "clexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 72: YY_RULE_SETUP #line 91 "clexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 73: YY_RULE_SETUP #line 92 "clexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 74: YY_RULE_SETUP #line 93 "clexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 75: YY_RULE_SETUP #line 95 "clexer.l" { BEGIN(comment); return(TOKENIZER_COMMENT); } YY_BREAK case 76: YY_RULE_SETUP #line 96 "clexer.l" { return(TOKENIZER_COMMENT); } YY_BREAK case 77: YY_RULE_SETUP #line 97 "clexer.l" { return(TOKENIZER_COMMENT); } YY_BREAK case 78: YY_RULE_SETUP #line 98 "clexer.l" { return(TOKENIZER_NEWLINE); } YY_BREAK case 79: YY_RULE_SETUP #line 99 "clexer.l" { return(TOKENIZER_NEWLINE); } YY_BREAK case 80: YY_RULE_SETUP #line 100 "clexer.l" { return(TOKENIZER_NEWLINE); } YY_BREAK case 81: YY_RULE_SETUP #line 101 "clexer.l" { BEGIN(INITIAL); return(TOKENIZER_COMMENT); } YY_BREAK case 82: YY_RULE_SETUP #line 103 "clexer.l" { return(TOKENIZER_COMMENT); } YY_BREAK case 83: YY_RULE_SETUP #line 105 "clexer.l" { return(TOKENIZER_DIRECTIVE); } YY_BREAK case 84: YY_RULE_SETUP #line 107 "clexer.l" { BEGIN(string_literal); return(TOKENIZER_LITERAL); } YY_BREAK case 85: YY_RULE_SETUP #line 108 "clexer.l" { return(TOKENIZER_LITERAL); } YY_BREAK case 86: YY_RULE_SETUP #line 109 "clexer.l" { return(TOKENIZER_NEWLINE); } YY_BREAK case 87: YY_RULE_SETUP #line 110 "clexer.l" { return(TOKENIZER_NEWLINE); } YY_BREAK case 88: YY_RULE_SETUP #line 111 "clexer.l" { return(TOKENIZER_NEWLINE); } YY_BREAK case 89: YY_RULE_SETUP #line 112 "clexer.l" { BEGIN(INITIAL); return(TOKENIZER_LITERAL); } YY_BREAK case 90: YY_RULE_SETUP #line 115 "clexer.l" { return(TOKENIZER_LITERAL); } YY_BREAK case 91: YY_RULE_SETUP #line 116 "clexer.l" { return(TOKENIZER_LITERAL); } YY_BREAK case 92: YY_RULE_SETUP #line 117 "clexer.l" { return(TOKENIZER_LITERAL); } YY_BREAK case 93: YY_RULE_SETUP #line 119 "clexer.l" { return(TOKENIZER_NEWLINE); } YY_BREAK case 94: YY_RULE_SETUP #line 120 "clexer.l" { return(TOKENIZER_NEWLINE); } YY_BREAK case 95: YY_RULE_SETUP #line 121 "clexer.l" { return(TOKENIZER_NEWLINE); } YY_BREAK case 96: YY_RULE_SETUP #line 122 "clexer.l" { return(TOKENIZER_TEXT); } YY_BREAK case 97: YY_RULE_SETUP #line 123 "clexer.l" { return(TOKENIZER_TEXT); } YY_BREAK case 98: YY_RULE_SETUP #line 124 "clexer.l" { return(TOKENIZER_TEXT); } YY_BREAK case 99: YY_RULE_SETUP #line 126 "clexer.l" ECHO; YY_BREAK #line 1422 "clexer.c" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(comment): case YY_STATE_EOF(string_literal): yyterminate(); case YY_END_OF_BUFFER: { /* Amount of text matched not including the EOB char. */ int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; /* Undo the effects of YY_DO_BEFORE_ACTION. */ *yy_cp = yy_hold_char; YY_RESTORE_YY_MORE_OFFSET if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) { /* We're scanning a new file or input source. It's * possible that this happened because the user * just pointed yyin at a new source and called * yylex(). If so, then we have to assure * consistency between yy_current_buffer and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ yy_n_chars = yy_current_buffer->yy_n_chars; yy_current_buffer->yy_input_file = yyin; yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; } /* Note that here we test for yy_c_buf_p "<=" to the position * of the first EOB in the buffer, since yy_c_buf_p will * already have been incremented past the NUL character * (since all states make transitions on EOB to the * end-of-buffer state). Contrast this with the test * in input(). */ if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) { /* This was really a NUL. */ yy_state_type yy_next_state; yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state(); /* Okay, we're now positioned to make the NUL * transition. We couldn't have * yy_get_previous_state() go ahead and do it * for us because it doesn't know how to deal * with the possibility of jamming (and we don't * want to build jamming into it because then it * will run more slowly). */ yy_next_state = yy_try_NUL_trans( yy_current_state ); yy_bp = yytext_ptr + YY_MORE_ADJ; if ( yy_next_state ) { /* Consume the NUL. */ yy_cp = ++yy_c_buf_p; yy_current_state = yy_next_state; goto yy_match; } else { yy_cp = yy_c_buf_p; goto yy_find_action; } } else switch ( yy_get_next_buffer() ) { case EOB_ACT_END_OF_FILE: { yy_did_buffer_switch_on_eof = 0; if ( yywrap() ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up * yytext, we can now set up * yy_c_buf_p so that if some total * hoser (like flex itself) wants to * call the scanner after we return the * YY_NULL, it'll still work - another * YY_NULL will get returned. */ yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; yy_act = YY_STATE_EOF(YY_START); goto do_action; } else { if ( ! yy_did_buffer_switch_on_eof ) YY_NEW_FILE; } break; } case EOB_ACT_CONTINUE_SCAN: yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state(); yy_cp = yy_c_buf_p; yy_bp = yytext_ptr + YY_MORE_ADJ; goto yy_match; case EOB_ACT_LAST_MATCH: yy_c_buf_p = &yy_current_buffer->yy_ch_buf[yy_n_chars]; yy_current_state = yy_get_previous_state(); yy_cp = yy_c_buf_p; yy_bp = yytext_ptr + YY_MORE_ADJ; goto yy_find_action; } break; } default: YY_FATAL_ERROR( "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ } /* end of yylex */ /* yy_get_next_buffer - try to read in a new buffer * * Returns a code representing an action: * EOB_ACT_LAST_MATCH - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */ static int yy_get_next_buffer() { register char *dest = yy_current_buffer->yy_ch_buf; register char *source = yytext_ptr; register int number_to_move, i; int ret_val; if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) YY_FATAL_ERROR( "fatal flex scanner internal error--end of buffer missed" ); if ( yy_current_buffer->yy_fill_buffer == 0 ) { /* Don't try to fill the buffer, so this is an EOF. */ if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) { /* We matched a single character, the EOB, so * treat this as a final EOF. */ return EOB_ACT_END_OF_FILE; } else { /* We matched some text prior to the EOB, first * process it. */ return EOB_ACT_LAST_MATCH; } } /* Try to read more data. */ /* First move last chars to start of buffer. */ number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) /* don't do the read, it's not guaranteed to return an EOF, * just force an EOF */ yy_current_buffer->yy_n_chars = yy_n_chars = 0; else { int num_to_read = yy_current_buffer->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ #ifdef YY_USES_REJECT YY_FATAL_ERROR( "input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); #else /* just a shorter name for the current buffer */ YY_BUFFER_STATE b = yy_current_buffer; int yy_c_buf_p_offset = (int) (yy_c_buf_p - b->yy_ch_buf); if ( b->yy_is_our_buffer ) { int new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; else b->yy_buf_size *= 2; b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ yy_flex_realloc( (void *) b->yy_ch_buf, b->yy_buf_size + 2 ); } else /* Can't grow it, we don't own it. */ b->yy_ch_buf = 0; if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; num_to_read = yy_current_buffer->yy_buf_size - number_to_move - 1; #endif } if ( num_to_read > YY_READ_BUF_SIZE ) num_to_read = YY_READ_BUF_SIZE; /* Read in more data. */ YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), yy_n_chars, num_to_read ); yy_current_buffer->yy_n_chars = yy_n_chars; } if ( yy_n_chars == 0 ) { if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; yyrestart( yyin ); } else { ret_val = EOB_ACT_LAST_MATCH; yy_current_buffer->yy_buffer_status = YY_BUFFER_EOF_PENDING; } } else ret_val = EOB_ACT_CONTINUE_SCAN; yy_n_chars += number_to_move; yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; return ret_val; } /* yy_get_previous_state - get the state just before the EOB char was reached */ static yy_state_type yy_get_previous_state() { register yy_state_type yy_current_state; register char *yy_cp; yy_current_state = yy_start; for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) { register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { yy_last_accepting_state = yy_current_state; yy_last_accepting_cpos = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 378 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; } return yy_current_state; } /* yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis * next_state = yy_try_NUL_trans( current_state ); */ #ifdef YY_USE_PROTOS static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) #else static yy_state_type yy_try_NUL_trans( yy_current_state ) yy_state_type yy_current_state; #endif { register int yy_is_jam; register char *yy_cp = yy_c_buf_p; register YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { yy_last_accepting_state = yy_current_state; yy_last_accepting_cpos = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 378 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; yy_is_jam = (yy_current_state == 377); return yy_is_jam ? 0 : yy_current_state; } #ifndef YY_NO_UNPUT #ifdef YY_USE_PROTOS static void yyunput( int c, register char *yy_bp ) #else static void yyunput( c, yy_bp ) int c; register char *yy_bp; #endif { register char *yy_cp = yy_c_buf_p; /* undo effects of setting up yytext */ *yy_cp = yy_hold_char; if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) { /* need to shift things up to make room */ /* +2 for EOB chars. */ register int number_to_move = yy_n_chars + 2; register char *dest = &yy_current_buffer->yy_ch_buf[ yy_current_buffer->yy_buf_size + 2]; register char *source = &yy_current_buffer->yy_ch_buf[number_to_move]; while ( source > yy_current_buffer->yy_ch_buf ) *--dest = *--source; yy_cp += (int) (dest - source); yy_bp += (int) (dest - source); yy_current_buffer->yy_n_chars = yy_n_chars = yy_current_buffer->yy_buf_size; if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) YY_FATAL_ERROR( "flex scanner push-back overflow" ); } *--yy_cp = (char) c; yytext_ptr = yy_bp; yy_hold_char = *yy_cp; yy_c_buf_p = yy_cp; } #endif /* ifndef YY_NO_UNPUT */ #ifdef __cplusplus static int yyinput() #else static int input() #endif { int c; *yy_c_buf_p = yy_hold_char; if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) { /* yy_c_buf_p now points to the character we want to return. * If this occurs *before* the EOB characters, then it's a * valid NUL; if not, then we've hit the end of the buffer. */ if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) /* This was really a NUL. */ *yy_c_buf_p = '\0'; else { /* need more input */ int offset = yy_c_buf_p - yytext_ptr; ++yy_c_buf_p; switch ( yy_get_next_buffer() ) { case EOB_ACT_LAST_MATCH: /* This happens because yy_g_n_b() * sees that we've accumulated a * token and flags that we need to * try matching the token before * proceeding. But for input(), * there's no matching to consider. * So convert the EOB_ACT_LAST_MATCH * to EOB_ACT_END_OF_FILE. */ /* Reset buffer status. */ yyrestart( yyin ); /* fall through */ case EOB_ACT_END_OF_FILE: { if ( yywrap() ) return EOF; if ( ! yy_did_buffer_switch_on_eof ) YY_NEW_FILE; #ifdef __cplusplus return yyinput(); #else return input(); #endif } case EOB_ACT_CONTINUE_SCAN: yy_c_buf_p = yytext_ptr + offset; break; } } } c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ *yy_c_buf_p = '\0'; /* preserve yytext */ yy_hold_char = *++yy_c_buf_p; return c; } #ifdef YY_USE_PROTOS void yyrestart( FILE *input_file ) #else void yyrestart( input_file ) FILE *input_file; #endif { if ( ! yy_current_buffer ) yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); yy_init_buffer( yy_current_buffer, input_file ); yy_load_buffer_state(); } #ifdef YY_USE_PROTOS void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) #else void yy_switch_to_buffer( new_buffer ) YY_BUFFER_STATE new_buffer; #endif { if ( yy_current_buffer == new_buffer ) return; if ( yy_current_buffer ) { /* Flush out information for old buffer. */ *yy_c_buf_p = yy_hold_char; yy_current_buffer->yy_buf_pos = yy_c_buf_p; yy_current_buffer->yy_n_chars = yy_n_chars; } yy_current_buffer = new_buffer; yy_load_buffer_state(); /* We don't actually know whether we did this switch during * EOF (yywrap()) processing, but the only time this flag * is looked at is after yywrap() is called, so it's safe * to go ahead and always set it. */ yy_did_buffer_switch_on_eof = 1; } #ifdef YY_USE_PROTOS void yy_load_buffer_state( void ) #else void yy_load_buffer_state() #endif { yy_n_chars = yy_current_buffer->yy_n_chars; yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; yyin = yy_current_buffer->yy_input_file; yy_hold_char = *yy_c_buf_p; } #ifdef YY_USE_PROTOS YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) #else YY_BUFFER_STATE yy_create_buffer( file, size ) FILE *file; int size; #endif { YY_BUFFER_STATE b; b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_buf_size = size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_is_our_buffer = 1; yy_init_buffer( b, file ); return b; } #ifdef YY_USE_PROTOS void yy_delete_buffer( YY_BUFFER_STATE b ) #else void yy_delete_buffer( b ) YY_BUFFER_STATE b; #endif { if ( ! b ) return; if ( b == yy_current_buffer ) yy_current_buffer = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) yy_flex_free( (void *) b->yy_ch_buf ); yy_flex_free( (void *) b ); } #ifdef YY_USE_PROTOS void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) #else void yy_init_buffer( b, file ) YY_BUFFER_STATE b; FILE *file; #endif { yy_flush_buffer( b ); b->yy_input_file = file; b->yy_fill_buffer = 1; #if YY_ALWAYS_INTERACTIVE b->yy_is_interactive = 1; #else #if YY_NEVER_INTERACTIVE b->yy_is_interactive = 0; #else b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; #endif #endif } #ifdef YY_USE_PROTOS void yy_flush_buffer( YY_BUFFER_STATE b ) #else void yy_flush_buffer( b ) YY_BUFFER_STATE b; #endif { if ( ! b ) return; b->yy_n_chars = 0; /* We always need two end-of-buffer characters. The first causes * a transition to the end-of-buffer state. The second causes * a jam in that state. */ b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; b->yy_buf_pos = &b->yy_ch_buf[0]; b->yy_at_bol = 1; b->yy_buffer_status = YY_BUFFER_NEW; if ( b == yy_current_buffer ) yy_load_buffer_state(); } #ifndef YY_NO_SCAN_BUFFER #ifdef YY_USE_PROTOS YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) #else YY_BUFFER_STATE yy_scan_buffer( base, size ) char *base; yy_size_t size; #endif { YY_BUFFER_STATE b; if ( size < 2 || base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ return 0; b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; b->yy_is_our_buffer = 0; b->yy_input_file = 0; b->yy_n_chars = b->yy_buf_size; b->yy_is_interactive = 0; b->yy_at_bol = 1; b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; yy_switch_to_buffer( b ); return b; } #endif #ifndef YY_NO_SCAN_STRING #ifdef YY_USE_PROTOS YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str ) #else YY_BUFFER_STATE yy_scan_string( yy_str ) yyconst char *yy_str; #endif { int len; for ( len = 0; yy_str[len]; ++len ) ; return yy_scan_bytes( yy_str, len ); } #endif #ifndef YY_NO_SCAN_BYTES #ifdef YY_USE_PROTOS YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len ) #else YY_BUFFER_STATE yy_scan_bytes( bytes, len ) yyconst char *bytes; int len; #endif { YY_BUFFER_STATE b; char *buf; yy_size_t n; int i; /* Get memory for full buffer, including space for trailing EOB's. */ n = len + 2; buf = (char *) yy_flex_alloc( n ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); for ( i = 0; i < len; ++i ) buf[i] = bytes[i]; buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; b = yy_scan_buffer( buf, n ); if ( ! b ) YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); /* It's okay to grow etc. this buffer, and we should throw it * away when we're done. */ b->yy_is_our_buffer = 1; return b; } #endif #ifndef YY_NO_PUSH_STATE #ifdef YY_USE_PROTOS static void yy_push_state( int new_state ) #else static void yy_push_state( new_state ) int new_state; #endif { if ( yy_start_stack_ptr >= yy_start_stack_depth ) { yy_size_t new_size; yy_start_stack_depth += YY_START_STACK_INCR; new_size = yy_start_stack_depth * sizeof( int ); if ( ! yy_start_stack ) yy_start_stack = (int *) yy_flex_alloc( new_size ); else yy_start_stack = (int *) yy_flex_realloc( (void *) yy_start_stack, new_size ); if ( ! yy_start_stack ) YY_FATAL_ERROR( "out of memory expanding start-condition stack" ); } yy_start_stack[yy_start_stack_ptr++] = YY_START; BEGIN(new_state); } #endif #ifndef YY_NO_POP_STATE static void yy_pop_state() { if ( --yy_start_stack_ptr < 0 ) YY_FATAL_ERROR( "start-condition stack underflow" ); BEGIN(yy_start_stack[yy_start_stack_ptr]); } #endif #ifndef YY_NO_TOP_STATE static int yy_top_state() { return yy_start_stack[yy_start_stack_ptr - 1]; } #endif #ifndef YY_EXIT_FAILURE #define YY_EXIT_FAILURE 2 #endif #ifdef YY_USE_PROTOS static void yy_fatal_error( yyconst char msg[] ) #else static void yy_fatal_error( msg ) char msg[]; #endif { (void) fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } /* Redefine yyless() so it works in section 3 code. */ #undef yyless #define yyless(n) \ do \ { \ /* Undo effects of setting up yytext. */ \ yytext[yyleng] = yy_hold_char; \ yy_c_buf_p = yytext + n; \ yy_hold_char = *yy_c_buf_p; \ *yy_c_buf_p = '\0'; \ yyleng = n; \ } \ while ( 0 ) /* Internal utility routines. */ #ifndef yytext_ptr #ifdef YY_USE_PROTOS static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) #else static void yy_flex_strncpy( s1, s2, n ) char *s1; yyconst char *s2; int n; #endif { register int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } #endif #ifdef YY_NEED_STRLEN #ifdef YY_USE_PROTOS static int yy_flex_strlen( yyconst char *s ) #else static int yy_flex_strlen( s ) yyconst char *s; #endif { register int n; for ( n = 0; s[n]; ++n ) ; return n; } #endif #ifdef YY_USE_PROTOS static void *yy_flex_alloc( yy_size_t size ) #else static void *yy_flex_alloc( size ) yy_size_t size; #endif { return (void *) malloc( size ); } #ifdef YY_USE_PROTOS static void *yy_flex_realloc( void *ptr, yy_size_t size ) #else static void *yy_flex_realloc( ptr, size ) void *ptr; yy_size_t size; #endif { /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter * because both ANSI C and C++ allow castless assignment from * any pointer type to void*, and deal with argument conversions * as though doing an assignment. */ return (void *) realloc( (char *) ptr, size ); } #ifdef YY_USE_PROTOS static void yy_flex_free( void *ptr ) #else static void yy_flex_free( ptr ) void *ptr; #endif { free( ptr ); } #if YY_MAIN int main() { yylex(); return 0; } #endif #line 126 "clexer.l" int c_wrap ( void ) { { /* Silly impossible function call to stop warning of unused functions */ if ( 0 ) { yyunput(0, ""); } } return 1; } cgdb-0.6.7/lib/tokenizer/clexer.l000644 000765 000024 00000013403 12074441140 017625 0ustar00mmuellerstaff000000 000000 %option prefix="c_" %option outfile="lex.yy.c" D [0-9] L [a-zA-Z_] T [0-9a-zA-Z_] IDENTIFIER {L}+{T}* %{ #include #include "tokenizer.h" %} %x comment %x string_literal %% "auto" { return(TOKENIZER_TYPE); } "bool" { return(TOKENIZER_TYPE); } "char" { return(TOKENIZER_TYPE); } "class" { return(TOKENIZER_TYPE); } "const" { return(TOKENIZER_TYPE); } "double" { return(TOKENIZER_TYPE); } "enum" { return(TOKENIZER_TYPE); } "extern" { return(TOKENIZER_TYPE); } "explicit" { return(TOKENIZER_TYPE); } "float" { return(TOKENIZER_TYPE); } "friend" { return(TOKENIZER_TYPE); } "inline" { return(TOKENIZER_TYPE); } "int" { return(TOKENIZER_TYPE); } "long" { return(TOKENIZER_TYPE); } "mutable" { return(TOKENIZER_TYPE); } "namespace" { return(TOKENIZER_TYPE); } "register" { return(TOKENIZER_TYPE); } "short" { return(TOKENIZER_TYPE); } "signed" { return(TOKENIZER_TYPE); } "static" { return(TOKENIZER_TYPE); } "struct" { return(TOKENIZER_TYPE); } "union" { return(TOKENIZER_TYPE); } "unsigned" { return(TOKENIZER_TYPE); } "virtual" { return(TOKENIZER_TYPE); } "void" { return(TOKENIZER_TYPE); } "volatile" { return(TOKENIZER_TYPE); } "wchar_t" { return(TOKENIZER_TYPE); } "and" { return(TOKENIZER_KEYWORD); } "and_eq" { return(TOKENIZER_KEYWORD); } "asm" { return(TOKENIZER_KEYWORD); } "bitand" { return(TOKENIZER_KEYWORD); } "bitor" { return(TOKENIZER_KEYWORD); } "break" { return(TOKENIZER_KEYWORD); } "case" { return(TOKENIZER_KEYWORD); } "catch" { return(TOKENIZER_KEYWORD); } "compl" { return(TOKENIZER_KEYWORD); } "const_cast" { return(TOKENIZER_KEYWORD); } "continue" { return(TOKENIZER_KEYWORD); } "default" { return(TOKENIZER_KEYWORD); } "delete" { return(TOKENIZER_KEYWORD); } "do" { return(TOKENIZER_KEYWORD); } "dynamic_cast" { return(TOKENIZER_KEYWORD); } "else" { return(TOKENIZER_KEYWORD); } "export" { return(TOKENIZER_KEYWORD); } "false" { return(TOKENIZER_KEYWORD); } "for" { return(TOKENIZER_KEYWORD); } "goto" { return(TOKENIZER_KEYWORD); } "if" { return(TOKENIZER_KEYWORD); } "new" { return(TOKENIZER_KEYWORD); } "not" { return(TOKENIZER_KEYWORD); } "not_eq" { return(TOKENIZER_KEYWORD); } "operator" { return(TOKENIZER_KEYWORD); } "or" { return(TOKENIZER_KEYWORD); } "or_eq" { return(TOKENIZER_KEYWORD); } "private" { return(TOKENIZER_KEYWORD); } "protected" { return(TOKENIZER_KEYWORD); } "public" { return(TOKENIZER_KEYWORD); } "reinterpret_cast" { return(TOKENIZER_KEYWORD); } "return" { return(TOKENIZER_KEYWORD); } "sizeof" { return(TOKENIZER_KEYWORD); } "static_cast" { return(TOKENIZER_KEYWORD); } "switch" { return(TOKENIZER_KEYWORD); } "template" { return(TOKENIZER_KEYWORD); } "this" { return(TOKENIZER_KEYWORD); } "throw" { return(TOKENIZER_KEYWORD); } "true" { return(TOKENIZER_KEYWORD); } "try" { return(TOKENIZER_KEYWORD); } "typedef" { return(TOKENIZER_KEYWORD); } "typeid" { return(TOKENIZER_KEYWORD); } "typename" { return(TOKENIZER_KEYWORD); } "using" { return(TOKENIZER_KEYWORD); } "while" { return(TOKENIZER_KEYWORD); } "xor" { return(TOKENIZER_KEYWORD); } "xor_eq" { return(TOKENIZER_KEYWORD); } "/*" { BEGIN(comment); return(TOKENIZER_COMMENT); } [^*\r\n]* { return(TOKENIZER_COMMENT); } "*"+[^*/\r\n]* { return(TOKENIZER_COMMENT); } \n { return(TOKENIZER_NEWLINE); } \r { return(TOKENIZER_NEWLINE); } \r\n { return(TOKENIZER_NEWLINE); } "*"+"/" { BEGIN(INITIAL); return(TOKENIZER_COMMENT); } \/\/[^\r\n]* { return(TOKENIZER_COMMENT); } #{L}+ { return(TOKENIZER_DIRECTIVE); } \" { BEGIN(string_literal); return(TOKENIZER_LITERAL); } (\\[^\r\n]|[^\\"\r\n])* { return(TOKENIZER_LITERAL); } \n { return(TOKENIZER_NEWLINE); } \r { return(TOKENIZER_NEWLINE); } \r\n { return(TOKENIZER_NEWLINE); } \" { BEGIN(INITIAL); return(TOKENIZER_LITERAL); } {D}+ { return(TOKENIZER_LITERAL); } '.' { return(TOKENIZER_LITERAL); } '\\.' { return(TOKENIZER_LITERAL); } \n { return(TOKENIZER_NEWLINE); } \r\n { return(TOKENIZER_NEWLINE); } \r { return(TOKENIZER_NEWLINE); } [ \t\v\f] { return(TOKENIZER_TEXT); } {IDENTIFIER} { return(TOKENIZER_TEXT); } . { return(TOKENIZER_TEXT); } %% int c_wrap ( void ) { { /* Silly impossible function call to stop warning of unused functions */ if ( 0 ) { yyunput(0, ""); } } return 1; } cgdb-0.6.7/lib/tokenizer/dlexer.c000644 000765 000024 00000306006 12074441140 017621 0ustar00mmuellerstaff000000 000000 #line 2 "dlexer.c" #line 4 "dlexer.c" #define YY_INT_ALIGNED short int /* A lexical scanner generated by flex */ #define yy_create_buffer d__create_buffer #define yy_delete_buffer d__delete_buffer #define yy_flex_debug d__flex_debug #define yy_init_buffer d__init_buffer #define yy_flush_buffer d__flush_buffer #define yy_load_buffer_state d__load_buffer_state #define yy_switch_to_buffer d__switch_to_buffer #define yyin d_in #define yyleng d_leng #define yylex d_lex #define yylineno d_lineno #define yyout d_out #define yyrestart d_restart #define yytext d_text #define yywrap d_wrap #define yyalloc d_alloc #define yyrealloc d_realloc #define yyfree d_free #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 #define YY_FLEX_SUBMINOR_VERSION 35 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif /* First, we deal with platform-specific or compiler-specific issues. */ /* begin standard C headers. */ #include #include #include #include /* end standard C headers. */ /* flex integer type definitions */ #ifndef FLEXINT_H #define FLEXINT_H /* C99 systems have . Non-C99 systems may or may not. */ #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, * if you want the limit (max/min) macros for int types. */ #ifndef __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS 1 #endif #include typedef int8_t flex_int8_t; typedef uint8_t flex_uint8_t; typedef int16_t flex_int16_t; typedef uint16_t flex_uint16_t; typedef int32_t flex_int32_t; typedef uint32_t flex_uint32_t; #else typedef signed char flex_int8_t; typedef short int flex_int16_t; typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; /* Limits of integral types. */ #ifndef INT8_MIN #define INT8_MIN (-128) #endif #ifndef INT16_MIN #define INT16_MIN (-32767-1) #endif #ifndef INT32_MIN #define INT32_MIN (-2147483647-1) #endif #ifndef INT8_MAX #define INT8_MAX (127) #endif #ifndef INT16_MAX #define INT16_MAX (32767) #endif #ifndef INT32_MAX #define INT32_MAX (2147483647) #endif #ifndef UINT8_MAX #define UINT8_MAX (255U) #endif #ifndef UINT16_MAX #define UINT16_MAX (65535U) #endif #ifndef UINT32_MAX #define UINT32_MAX (4294967295U) #endif #endif /* ! C99 */ #endif /* ! FLEXINT_H */ #ifdef __cplusplus /* The "const" storage-class-modifier is valid. */ #define YY_USE_CONST #else /* ! __cplusplus */ /* C99 requires __STDC__ to be defined as 1. */ #if defined (__STDC__) #define YY_USE_CONST #endif /* defined (__STDC__) */ #endif /* ! __cplusplus */ #ifdef YY_USE_CONST #define yyconst const #else #define yyconst #endif /* Returned upon end-of-file. */ #define YY_NULL 0 /* Promotes a possibly negative, possibly signed char to an unsigned * integer for use as an array index. If the signed char is negative, * we want to instead treat it as an 8-bit unsigned char, hence the * double cast. */ #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) /* Enter a start condition. This macro really ought to take a parameter, * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ #define BEGIN (yy_start) = 1 + 2 * /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ #define YY_START (((yy_start) - 1) / 2) #define YYSTATE YY_START /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) /* Special action meaning "start processing a new file". */ #define YY_NEW_FILE d_restart(d_in ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ #ifndef YY_BUF_SIZE #ifdef __ia64__ /* On IA-64, the buffer size is 16k, not 8k. * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. * Ditto for the __ia64__ case accordingly. */ #define YY_BUF_SIZE 32768 #else #define YY_BUF_SIZE 16384 #endif /* __ia64__ */ #endif /* The state buf must be large enough to hold one state per character in the main buffer. */ #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) #ifndef YY_TYPEDEF_YY_BUFFER_STATE #define YY_TYPEDEF_YY_BUFFER_STATE typedef struct yy_buffer_state *YY_BUFFER_STATE; #endif extern int d_leng; extern FILE *d_in, *d_out; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 #define YY_LESS_LINENO(n) /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ do \ { \ /* Undo effects of setting up d_text. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ *yy_cp = (yy_hold_char); \ YY_RESTORE_YY_MORE_OFFSET \ (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ YY_DO_BEFORE_ACTION; /* set up d_text again */ \ } \ while ( 0 ) #define unput(c) yyunput( c, (yytext_ptr) ) #ifndef YY_TYPEDEF_YY_SIZE_T #define YY_TYPEDEF_YY_SIZE_T typedef size_t yy_size_t; #endif #ifndef YY_STRUCT_YY_BUFFER_STATE #define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state { FILE *yy_input_file; char *yy_ch_buf; /* input buffer */ char *yy_buf_pos; /* current position in input buffer */ /* Size of input buffer in bytes, not including room for EOB * characters. */ yy_size_t yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. */ int yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to * delete it. */ int yy_is_our_buffer; /* Whether this is an "interactive" input source; if so, and * if we're using stdio for input, then we want to use getc() * instead of fread(), to make sure we stop fetching input after * each newline. */ int yy_is_interactive; /* Whether we're considered to be at the beginning of a line. * If so, '^' rules will be active on the next match, otherwise * not. */ int yy_at_bol; int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ /* Whether to try to fill the input buffer when we reach the * end of it. */ int yy_fill_buffer; int yy_buffer_status; #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 /* When an EOF's been seen but there's still some text to process * then we mark the buffer as YY_EOF_PENDING, to indicate that we * shouldn't try reading from the input source any more. We might * still have a bunch of tokens to match, though, because of * possible backing-up. * * When we actually see the EOF, we change the status to "new" * (via d_restart()), so that the user can continue scanning by * just pointing d_in at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 }; #endif /* !YY_STRUCT_YY_BUFFER_STATE */ /* Stack of input buffers. */ static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general * "scanner state". * * Returns the top of the stack, or NULL. */ #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ : NULL) /* Same as previous macro, but useful when we know that the buffer stack is not * NULL or when we need an lvalue. For internal use only. */ #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] /* yy_hold_char holds the character lost when d_text is formed. */ static char yy_hold_char; static int yy_n_chars; /* number of characters read into yy_ch_buf */ int d_leng; /* Points to current character in buffer. */ static char *yy_c_buf_p = (char *) 0; static int yy_init = 0; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ /* Flag which is used to allow d_wrap()'s to do buffer switches * instead of setting up a fresh d_in. A bit of a hack ... */ static int yy_did_buffer_switch_on_eof; void d_restart (FILE *input_file ); void d__switch_to_buffer (YY_BUFFER_STATE new_buffer ); YY_BUFFER_STATE d__create_buffer (FILE *file,int size ); void d__delete_buffer (YY_BUFFER_STATE b ); void d__flush_buffer (YY_BUFFER_STATE b ); void d_push_buffer_state (YY_BUFFER_STATE new_buffer ); void d_pop_buffer_state (void ); static void d_ensure_buffer_stack (void ); static void d__load_buffer_state (void ); static void d__init_buffer (YY_BUFFER_STATE b,FILE *file ); #define YY_FLUSH_BUFFER d__flush_buffer(YY_CURRENT_BUFFER ) YY_BUFFER_STATE d__scan_buffer (char *base,yy_size_t size ); YY_BUFFER_STATE d__scan_string (yyconst char *yy_str ); YY_BUFFER_STATE d__scan_bytes (yyconst char *bytes,int len ); void *d_alloc (yy_size_t ); void *d_realloc (void *,yy_size_t ); void d_free (void * ); #define yy_new_buffer d__create_buffer #define yy_set_interactive(is_interactive) \ { \ if ( ! YY_CURRENT_BUFFER ){ \ d_ensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ d__create_buffer(d_in,YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } #define yy_set_bol(at_bol) \ { \ if ( ! YY_CURRENT_BUFFER ){\ d_ensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ d__create_buffer(d_in,YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ } #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) /* Begin user sect3 */ typedef unsigned char YY_CHAR; FILE *d_in = (FILE *) 0, *d_out = (FILE *) 0; typedef int yy_state_type; extern int d_lineno; int d_lineno = 1; extern char *d_text; #define yytext_ptr d_text static yy_state_type yy_get_previous_state (void ); static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); static int yy_get_next_buffer (void ); static void yy_fatal_error (yyconst char msg[] ); /* Done after the current pattern has been matched and before the * corresponding action - sets up d_text. */ #define YY_DO_BEFORE_ACTION \ (yytext_ptr) = yy_bp; \ d_leng = (size_t) (yy_cp - yy_bp); \ (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; #define YY_NUM_RULES 173 #define YY_END_OF_BUFFER 174 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info { flex_int32_t yy_verify; flex_int32_t yy_nxt; }; static yyconst flex_int16_t yy_accept[660] = { 0, 0, 0, 111, 111, 118, 118, 145, 145, 151, 151, 174, 172, 170, 167, 169, 144, 172, 172, 172, 156, 156, 172, 171, 156, 150, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 111, 113, 114, 112, 118, 122, 123, 119, 120, 145, 146, 147, 149, 173, 151, 152, 153, 155, 168, 127, 0, 0, 110, 117, 126, 156, 158, 159, 157, 0, 0, 0, 0, 0, 171, 171, 156, 158, 159, 156, 171, 171, 171, 157, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 77, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 85, 171, 86, 171, 88, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 111, 115, 112, 112, 116, 118, 124, 119, 119, 125, 120, 121, 120, 145, 0, 148, 151, 154, 162, 0, 162, 126, 160, 161, 0, 0, 0, 0, 0, 158, 159, 157, 160, 156, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 65, 171, 171, 8, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 80, 171, 171, 171, 171, 171, 171, 171, 171, 6, 171, 171, 171, 171, 171, 171, 90, 171, 171, 91, 171, 171, 171, 171, 171, 171, 171, 171, 171, 41, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 102, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 163, 0, 0, 0, 0, 0, 160, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 5, 67, 9, 171, 7, 69, 71, 171, 171, 12, 171, 10, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 78, 18, 171, 171, 171, 171, 171, 171, 171, 171, 84, 171, 171, 171, 171, 171, 171, 171, 171, 171, 34, 35, 171, 171, 171, 165, 171, 171, 171, 171, 171, 171, 171, 39, 40, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 99, 171, 166, 171, 171, 171, 53, 171, 171, 171, 171, 171, 57, 171, 171, 171, 109, 171, 0, 0, 139, 0, 0, 171, 171, 171, 171, 171, 171, 171, 171, 171, 137, 138, 171, 63, 64, 171, 68, 70, 171, 171, 14, 15, 171, 16, 21, 74, 171, 171, 171, 171, 171, 171, 171, 171, 171, 164, 27, 28, 171, 171, 171, 171, 171, 171, 171, 31, 171, 171, 33, 89, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, 42, 171, 44, 171, 171, 171, 171, 171, 171, 100, 171, 171, 171, 101, 171, 171, 171, 51, 52, 54, 55, 171, 171, 171, 171, 59, 108, 171, 0, 0, 0, 0, 136, 171, 171, 171, 171, 171, 134, 171, 171, 171, 66, 171, 13, 171, 171, 171, 76, 171, 23, 171, 171, 19, 20, 171, 171, 171, 25, 171, 29, 171, 128, 171, 171, 129, 171, 171, 171, 131, 171, 171, 171, 94, 95, 43, 45, 171, 96, 47, 48, 49, 97, 171, 171, 171, 104, 105, 171, 56, 171, 171, 171, 171, 0, 0, 141, 0, 171, 171, 171, 171, 171, 133, 171, 171, 11, 171, 73, 171, 171, 22, 171, 79, 81, 171, 26, 171, 171, 171, 36, 171, 130, 92, 171, 171, 171, 171, 171, 103, 171, 107, 171, 60, 61, 143, 0, 140, 171, 171, 2, 62, 3, 171, 4, 72, 75, 171, 24, 171, 83, 171, 171, 171, 37, 171, 171, 171, 171, 98, 106, 58, 142, 1, 135, 171, 171, 171, 30, 32, 87, 93, 38, 171, 171, 132, 17, 171, 46, 171, 171, 171, 171, 50, 171, 171, 82, 0 } ; static yyconst flex_int32_t yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 2, 2, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 5, 6, 1, 1, 1, 7, 1, 1, 8, 9, 1, 1, 1, 10, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 1, 1, 1, 1, 1, 1, 13, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 16, 15, 15, 15, 15, 15, 15, 15, 15, 17, 15, 15, 15, 15, 15, 1, 18, 1, 1, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 15, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } ; static yyconst flex_int32_t yy_meta[46] = { 0, 1, 1, 2, 3, 4, 1, 1, 5, 6, 6, 7, 7, 1, 8, 9, 9, 9, 1, 8, 10, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9 } ; static yyconst flex_int16_t yy_base[678] = { 0, 0, 0, 43, 45, 51, 53, 61, 64, 55, 67, 443, 2118, 2118, 2118, 426, 2118, 0, 404, 64, 77, 88, 71, 65, 110, 2118, 101, 106, 140, 135, 145, 178, 74, 69, 208, 90, 133, 168, 142, 174, 72, 236, 205, 270, 210, 239, 0, 2118, 406, 42, 0, 2118, 400, 82, 106, 378, 2118, 385, 2118, 372, 0, 2118, 370, 2118, 2118, 0, 359, 348, 2118, 2118, 0, 212, 2118, 333, 2118, 0, 318, 295, 98, 293, 0, 126, 244, 137, 180, 290, 189, 186, 246, 192, 241, 225, 262, 276, 279, 272, 308, 286, 312, 293, 194, 323, 325, 327, 329, 331, 333, 341, 346, 348, 353, 357, 359, 363, 369, 371, 367, 373, 378, 381, 383, 394, 396, 401, 403, 405, 260, 407, 412, 414, 423, 420, 427, 429, 437, 439, 442, 456, 444, 447, 461, 459, 467, 463, 483, 480, 485, 491, 487, 494, 498, 500, 505, 514, 510, 516, 518, 525, 521, 533, 529, 540, 543, 548, 0, 2118, 120, 162, 2118, 0, 2118, 556, 558, 2118, 561, 2118, 563, 310, 321, 2118, 0, 2118, 2118, 314, 309, 0, 2118, 0, 274, 276, 281, 264, 255, 0, 273, 0, 563, 557, 572, 574, 579, 577, 581, 583, 585, 587, 589, 596, 591, 613, 615, 618, 620, 622, 624, 629, 631, 635, 639, 648, 650, 654, 656, 660, 662, 664, 666, 669, 677, 681, 685, 689, 692, 697, 699, 701, 703, 710, 712, 719, 725, 730, 727, 732, 734, 743, 740, 745, 747, 751, 754, 757, 759, 761, 770, 772, 774, 778, 780, 782, 784, 786, 790, 793, 796, 798, 802, 807, 812, 814, 816, 818, 825, 827, 829, 833, 836, 838, 840, 846, 848, 855, 862, 859, 866, 869, 874, 876, 878, 886, 888, 880, 890, 892, 894, 899, 912, 914, 896, 2118, 265, 234, 241, 204, 201, 0, 918, 920, 923, 925, 928, 934, 939, 941, 943, 947, 949, 952, 954, 956, 958, 960, 962, 971, 977, 980, 983, 985, 987, 991, 993, 995, 999, 1004, 1006, 1008, 1010, 1013, 1015, 1017, 1020, 1022, 1030, 1037, 1039, 1046, 1049, 1051, 1053, 1056, 1058, 1060, 1062, 1064, 1071, 1073, 1068, 1080, 1087, 1082, 1091, 1093, 1095, 1097, 1099, 1101, 1104, 1106, 1111, 1120, 1125, 1127, 1129, 1133, 1136, 1140, 1142, 1144, 1149, 1151, 1155, 1159, 1163, 1161, 1166, 1172, 1177, 1180, 1182, 1189, 1193, 1195, 1197, 1200, 1205, 1207, 1210, 1214, 1216, 1220, 1224, 1227, 1231, 1233, 1236, 1239, 1241, 1246, 193, 185, 2118, 169, 148, 1243, 1255, 1251, 1258, 1266, 1270, 1273, 1275, 1279, 1277, 1281, 1285, 1287, 1289, 1291, 1293, 1296, 1301, 1304, 1306, 1308, 1311, 1313, 1315, 1317, 1322, 1324, 1326, 1329, 1335, 1337, 1343, 1345, 1347, 1350, 1352, 1354, 1356, 1360, 1362, 1364, 1366, 1375, 1379, 1381, 1386, 1388, 1391, 1395, 1397, 1399, 1402, 1408, 1404, 1412, 1415, 1417, 1425, 1428, 1430, 1433, 1435, 1438, 1441, 1443, 1448, 1451, 1453, 1455, 1461, 1463, 1469, 1471, 1473, 1475, 1482, 1484, 1490, 1492, 1494, 1498, 1500, 1502, 1504, 1506, 1508, 1510, 153, 138, 131, 134, 1515, 1517, 1519, 1523, 1526, 1529, 1534, 1536, 1539, 1544, 1541, 1549, 1557, 1559, 1564, 1566, 1568, 1570, 1572, 1574, 1576, 1578, 1581, 1585, 1595, 1597, 1599, 1601, 1603, 1605, 1607, 1609, 1613, 1621, 1624, 1626, 1628, 1630, 1632, 1634, 1636, 1640, 1643, 1647, 1649, 1652, 1656, 1658, 1660, 1663, 1665, 1668, 1670, 1672, 1674, 1676, 1678, 1680, 1682, 1688, 1684, 1693, 130, 86, 2118, 74, 1696, 1699, 1701, 1706, 1715, 1717, 1720, 1723, 1725, 1729, 1727, 1731, 1734, 1736, 1738, 1746, 1748, 1752, 1754, 1757, 1759, 1763, 1767, 1769, 1772, 1775, 1778, 1780, 1786, 1789, 1793, 1795, 1797, 1799, 1802, 1804, 1808, 2118, 34, 2118, 1813, 1817, 1819, 1821, 1823, 1827, 1829, 1831, 1833, 1835, 1837, 1839, 1841, 1844, 1846, 1850, 1852, 1856, 1861, 1863, 1866, 1872, 1874, 1876, 2118, 1879, 1881, 1885, 1887, 1890, 1892, 1894, 1896, 1898, 1901, 1905, 1907, 1909, 1913, 1915, 1917, 1920, 1922, 1924, 1926, 1928, 1930, 1939, 1942, 2118, 1968, 1978, 1988, 1998, 2001, 2010, 2014, 2023, 2033, 2043, 2053, 2063, 2073, 2083, 2092, 2102, 2106, 2108 } ; static yyconst flex_int16_t yy_def[678] = { 0, 659, 1, 660, 660, 661, 661, 662, 662, 663, 663, 659, 659, 659, 659, 659, 659, 664, 665, 659, 659, 659, 659, 666, 666, 659, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 667, 659, 659, 668, 669, 659, 659, 670, 671, 672, 659, 659, 659, 672, 673, 659, 659, 659, 659, 664, 659, 674, 659, 659, 675, 659, 659, 659, 659, 676, 659, 659, 659, 659, 677, 666, 677, 666, 666, 24, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 667, 659, 668, 668, 659, 669, 659, 670, 670, 659, 671, 659, 671, 672, 672, 659, 673, 659, 659, 659, 659, 675, 659, 676, 659, 659, 659, 659, 659, 677, 677, 677, 666, 24, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 659, 659, 659, 659, 659, 659, 677, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 659, 659, 659, 659, 659, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 659, 659, 659, 659, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 659, 659, 659, 659, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 659, 659, 659, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 659, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, 0, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659 } ; static yyconst flex_int16_t yy_nxt[2164] = { 0, 12, 13, 14, 15, 16, 17, 18, 12, 12, 19, 20, 21, 22, 23, 23, 23, 23, 12, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 23, 35, 36, 37, 38, 39, 23, 40, 41, 42, 43, 44, 45, 23, 23, 23, 47, 48, 47, 48, 167, 49, 168, 49, 51, 52, 51, 52, 61, 62, 53, 54, 53, 54, 56, 57, 58, 56, 57, 58, 61, 62, 68, 69, 70, 63, 80, 80, 634, 59, 80, 80, 59, 80, 80, 80, 80, 63, 71, 71, 120, 172, 173, 72, 73, 76, 71, 140, 609, 71, 71, 80, 80, 74, 72, 73, 77, 71, 119, 78, 79, 127, 80, 80, 74, 175, 176, 80, 80, 190, 75, 82, 82, 90, 128, 608, 83, 84, 659, 85, 659, 86, 91, 87, 88, 94, 89, 80, 80, 92, 95, 93, 191, 96, 80, 80, 80, 80, 80, 80, 97, 80, 80, 80, 80, 607, 80, 80, 106, 569, 107, 98, 129, 568, 99, 100, 101, 130, 102, 108, 167, 103, 168, 109, 104, 567, 110, 105, 111, 80, 80, 112, 134, 135, 566, 80, 80, 503, 113, 80, 80, 80, 80, 131, 502, 136, 196, 80, 80, 114, 80, 80, 132, 80, 80, 80, 80, 115, 133, 116, 501, 137, 117, 138, 139, 500, 80, 80, 118, 80, 80, 80, 80, 71, 71, 204, 203, 219, 72, 73, 148, 71, 121, 149, 122, 158, 80, 80, 74, 412, 123, 124, 150, 411, 159, 125, 126, 80, 80, 151, 80, 80, 80, 80, 207, 82, 82, 80, 80, 141, 193, 194, 160, 82, 142, 143, 410, 161, 162, 409, 195, 80, 80, 80, 80, 144, 145, 163, 146, 206, 147, 80, 80, 80, 80, 205, 408, 80, 80, 305, 80, 80, 152, 153, 208, 304, 212, 80, 80, 154, 209, 155, 303, 156, 80, 80, 213, 302, 157, 197, 301, 81, 300, 198, 81, 210, 299, 199, 211, 80, 80, 299, 200, 80, 80, 215, 177, 218, 178, 201, 192, 202, 189, 214, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 221, 188, 222, 186, 216, 217, 80, 80, 220, 184, 224, 80, 80, 80, 80, 225, 223, 226, 80, 80, 182, 227, 80, 80, 80, 80, 228, 181, 80, 80, 229, 177, 80, 80, 80, 80, 80, 80, 80, 80, 230, 231, 179, 80, 80, 232, 80, 80, 80, 80, 178, 233, 235, 234, 237, 239, 236, 170, 238, 80, 80, 80, 80, 165, 240, 241, 80, 80, 80, 80, 80, 80, 80, 80, 242, 243, 67, 80, 80, 80, 80, 245, 244, 64, 251, 80, 80, 246, 80, 80, 247, 248, 80, 80, 80, 80, 249, 659, 250, 253, 659, 255, 80, 80, 80, 80, 252, 80, 80, 80, 80, 254, 80, 80, 258, 659, 256, 659, 260, 261, 257, 80, 80, 266, 80, 80, 80, 80, 80, 80, 259, 262, 80, 80, 659, 265, 268, 659, 267, 263, 659, 269, 272, 659, 264, 80, 80, 271, 80, 80, 80, 80, 80, 80, 270, 273, 80, 80, 275, 80, 80, 659, 274, 80, 80, 80, 80, 659, 278, 277, 80, 80, 659, 280, 276, 80, 80, 281, 279, 80, 80, 80, 80, 80, 80, 282, 80, 80, 659, 285, 80, 80, 283, 287, 80, 80, 284, 288, 80, 80, 659, 290, 659, 286, 289, 80, 80, 291, 80, 80, 659, 295, 292, 80, 80, 659, 293, 659, 294, 659, 659, 172, 173, 296, 659, 659, 659, 176, 80, 80, 197, 659, 81, 659, 81, 81, 297, 80, 80, 80, 80, 298, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 659, 309, 311, 80, 80, 659, 313, 306, 307, 308, 310, 659, 312, 317, 659, 314, 659, 315, 659, 318, 80, 80, 80, 80, 316, 80, 80, 80, 80, 80, 80, 80, 80, 659, 319, 659, 80, 80, 80, 80, 659, 323, 80, 80, 659, 320, 80, 80, 659, 322, 324, 659, 325, 659, 327, 80, 80, 80, 80, 659, 321, 80, 80, 80, 80, 659, 326, 80, 80, 80, 80, 80, 80, 80, 80, 328, 80, 80, 659, 335, 330, 336, 659, 329, 80, 80, 338, 331, 80, 80, 332, 659, 80, 80, 333, 334, 80, 80, 339, 80, 80, 659, 337, 341, 80, 80, 80, 80, 80, 80, 80, 80, 659, 343, 340, 659, 345, 80, 80, 80, 80, 659, 342, 659, 347, 344, 80, 80, 659, 349, 659, 346, 80, 80, 80, 80, 350, 80, 80, 80, 80, 80, 80, 659, 348, 659, 351, 80, 80, 352, 80, 80, 80, 80, 80, 80, 354, 353, 80, 80, 659, 80, 80, 659, 80, 80, 80, 80, 80, 80, 355, 361, 360, 356, 362, 358, 357, 80, 80, 80, 80, 80, 80, 359, 364, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 365, 659, 80, 80, 363, 80, 80, 367, 80, 80, 80, 80, 368, 366, 80, 80, 659, 370, 371, 80, 80, 659, 369, 374, 80, 80, 80, 80, 80, 80, 80, 80, 659, 376, 375, 372, 373, 80, 80, 80, 80, 80, 80, 659, 377, 80, 80, 659, 80, 80, 80, 80, 80, 80, 379, 382, 659, 378, 80, 80, 80, 80, 659, 380, 386, 381, 384, 80, 80, 659, 388, 80, 80, 383, 80, 80, 659, 385, 80, 80, 387, 80, 80, 659, 389, 392, 80, 80, 80, 80, 80, 80, 80, 80, 390, 393, 659, 391, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 395, 80, 80, 659, 394, 400, 403, 402, 396, 659, 397, 404, 659, 398, 80, 80, 80, 80, 399, 401, 80, 80, 80, 80, 407, 80, 80, 80, 80, 659, 80, 80, 659, 406, 405, 413, 80, 80, 659, 414, 417, 80, 80, 80, 80, 80, 80, 415, 418, 80, 80, 80, 80, 416, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 659, 420, 659, 419, 659, 422, 421, 80, 80, 423, 659, 424, 426, 80, 80, 425, 80, 80, 427, 80, 80, 80, 80, 80, 80, 659, 428, 80, 80, 80, 80, 80, 80, 659, 430, 80, 80, 659, 429, 431, 80, 80, 80, 80, 80, 80, 80, 80, 659, 80, 80, 80, 80, 80, 80, 659, 80, 80, 80, 80, 434, 659, 432, 659, 435, 437, 80, 80, 433, 439, 441, 659, 436, 80, 80, 80, 80, 659, 442, 659, 438, 440, 80, 80, 443, 80, 80, 80, 80, 80, 80, 659, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 444, 447, 80, 80, 450, 80, 80, 80, 80, 445, 448, 446, 454, 452, 80, 80, 80, 80, 453, 659, 449, 80, 80, 659, 451, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 659, 80, 80, 80, 80, 455, 659, 457, 80, 80, 456, 659, 460, 659, 458, 659, 459, 80, 80, 659, 461, 462, 80, 80, 80, 80, 80, 80, 659, 463, 80, 80, 465, 80, 80, 659, 467, 80, 80, 80, 80, 80, 80, 464, 468, 466, 80, 80, 80, 80, 659, 469, 80, 80, 659, 470, 80, 80, 80, 80, 80, 80, 472, 80, 80, 659, 473, 659, 475, 80, 80, 659, 471, 476, 80, 80, 478, 80, 80, 80, 80, 480, 659, 477, 474, 479, 80, 80, 659, 482, 80, 80, 80, 80, 80, 80, 483, 80, 80, 659, 481, 659, 80, 80, 80, 80, 484, 80, 80, 659, 486, 80, 80, 80, 80, 487, 489, 80, 80, 659, 488, 80, 80, 485, 80, 80, 659, 491, 80, 80, 80, 80, 490, 80, 80, 492, 80, 80, 80, 80, 80, 80, 495, 80, 80, 493, 659, 494, 80, 80, 498, 659, 80, 80, 504, 80, 80, 659, 496, 497, 659, 499, 505, 80, 80, 659, 506, 80, 80, 507, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 659, 508, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 513, 80, 80, 509, 510, 512, 80, 80, 511, 80, 80, 80, 80, 80, 80, 659, 80, 80, 80, 80, 80, 80, 80, 80, 514, 659, 515, 80, 80, 80, 80, 80, 80, 659, 80, 80, 659, 516, 517, 519, 80, 80, 80, 80, 659, 520, 521, 518, 80, 80, 80, 80, 80, 80, 522, 80, 80, 80, 80, 80, 80, 80, 80, 659, 523, 80, 80, 80, 80, 80, 80, 80, 80, 528, 526, 524, 659, 527, 525, 659, 80, 80, 659, 529, 80, 80, 80, 80, 659, 531, 533, 80, 80, 80, 80, 530, 80, 80, 659, 532, 80, 80, 80, 80, 80, 80, 535, 80, 80, 80, 80, 536, 534, 80, 80, 659, 537, 80, 80, 541, 80, 80, 80, 80, 659, 539, 659, 538, 659, 540, 80, 80, 543, 80, 80, 80, 80, 544, 80, 80, 80, 80, 545, 80, 80, 542, 80, 80, 80, 80, 659, 547, 659, 80, 80, 546, 80, 80, 80, 80, 80, 80, 659, 550, 549, 551, 80, 80, 80, 80, 659, 548, 552, 659, 80, 80, 80, 80, 80, 80, 80, 80, 659, 554, 556, 659, 553, 80, 80, 80, 80, 659, 557, 558, 555, 80, 80, 80, 80, 80, 80, 659, 559, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 560, 659, 564, 80, 80, 80, 80, 80, 80, 659, 563, 80, 80, 562, 80, 80, 561, 80, 80, 659, 565, 572, 80, 80, 80, 80, 659, 80, 80, 80, 80, 570, 80, 80, 659, 571, 659, 80, 80, 659, 574, 576, 573, 659, 577, 80, 80, 80, 80, 659, 575, 578, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 582, 80, 80, 659, 584, 80, 80, 659, 579, 659, 583, 659, 580, 659, 581, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 659, 586, 80, 80, 588, 589, 659, 585, 590, 587, 80, 80, 591, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 659, 593, 80, 80, 594, 80, 80, 659, 595, 80, 80, 80, 80, 597, 80, 80, 659, 592, 80, 80, 80, 80, 80, 80, 596, 80, 80, 80, 80, 598, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 659, 601, 80, 80, 659, 599, 659, 80, 80, 659, 80, 80, 600, 80, 80, 80, 80, 659, 603, 602, 80, 80, 604, 606, 610, 659, 605, 659, 612, 80, 80, 80, 80, 659, 80, 80, 611, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 613, 80, 80, 80, 80, 80, 80, 659, 614, 615, 617, 659, 618, 80, 80, 80, 80, 659, 616, 80, 80, 80, 80, 621, 80, 80, 80, 80, 659, 619, 80, 80, 659, 620, 80, 80, 80, 80, 624, 80, 80, 622, 80, 80, 623, 80, 80, 80, 80, 659, 626, 659, 625, 80, 80, 628, 80, 80, 659, 627, 80, 80, 80, 80, 80, 80, 80, 80, 629, 80, 80, 80, 80, 659, 631, 80, 80, 659, 630, 659, 80, 80, 659, 633, 80, 80, 80, 80, 80, 80, 80, 80, 632, 635, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 636, 80, 80, 80, 80, 659, 638, 80, 80, 80, 80, 659, 637, 80, 80, 640, 659, 641, 80, 80, 80, 80, 639, 80, 80, 659, 643, 659, 645, 80, 80, 80, 80, 80, 80, 642, 80, 80, 80, 80, 659, 646, 80, 80, 80, 80, 644, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 648, 80, 80, 659, 649, 80, 80, 80, 80, 80, 80, 659, 647, 80, 80, 80, 80, 80, 80, 659, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 659, 650, 653, 659, 654, 655, 659, 80, 80, 651, 80, 80, 659, 652, 659, 659, 659, 659, 659, 659, 656, 658, 659, 659, 659, 657, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 65, 65, 66, 659, 66, 66, 66, 66, 66, 66, 66, 66, 81, 81, 81, 164, 659, 659, 164, 659, 164, 164, 164, 164, 164, 166, 659, 659, 166, 166, 166, 166, 166, 166, 166, 169, 659, 659, 169, 169, 659, 169, 169, 169, 169, 171, 659, 659, 171, 171, 171, 171, 171, 171, 171, 174, 659, 659, 174, 174, 174, 174, 174, 174, 174, 177, 659, 659, 659, 177, 177, 177, 177, 177, 177, 180, 659, 659, 180, 180, 180, 180, 180, 180, 183, 659, 183, 183, 183, 183, 183, 183, 183, 183, 185, 659, 659, 185, 185, 185, 185, 185, 185, 185, 187, 187, 80, 80, 80, 11, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659 } ; static yyconst flex_int16_t yy_chk[2164] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 4, 4, 49, 3, 49, 4, 5, 5, 6, 6, 9, 9, 5, 5, 6, 6, 7, 7, 7, 8, 8, 8, 10, 10, 19, 19, 19, 9, 23, 23, 608, 7, 33, 33, 8, 40, 40, 32, 32, 10, 20, 20, 33, 53, 53, 20, 20, 22, 20, 40, 569, 21, 21, 35, 35, 20, 21, 21, 22, 21, 32, 22, 22, 35, 26, 26, 21, 54, 54, 27, 27, 78, 20, 24, 24, 26, 35, 567, 24, 24, 166, 24, 166, 24, 26, 24, 24, 27, 24, 81, 81, 26, 27, 26, 78, 27, 36, 36, 29, 29, 83, 83, 27, 28, 28, 38, 38, 566, 30, 30, 29, 503, 29, 28, 36, 502, 28, 28, 28, 36, 28, 29, 167, 28, 167, 29, 28, 501, 30, 28, 30, 37, 37, 30, 38, 38, 500, 39, 39, 412, 30, 31, 31, 84, 84, 37, 411, 39, 84, 87, 87, 31, 86, 86, 37, 89, 89, 100, 100, 31, 37, 31, 409, 39, 31, 39, 39, 408, 42, 42, 31, 34, 34, 44, 44, 71, 71, 87, 86, 100, 71, 71, 42, 71, 34, 42, 34, 44, 91, 91, 71, 304, 34, 34, 42, 303, 44, 34, 34, 41, 41, 42, 45, 45, 90, 90, 91, 82, 82, 88, 88, 41, 82, 82, 45, 82, 41, 41, 302, 45, 45, 301, 82, 126, 126, 92, 92, 41, 41, 45, 41, 90, 41, 43, 43, 95, 95, 88, 300, 93, 93, 194, 94, 94, 43, 43, 92, 192, 95, 97, 97, 43, 92, 43, 191, 43, 99, 99, 95, 190, 43, 85, 189, 85, 188, 85, 85, 93, 184, 85, 94, 96, 96, 183, 85, 98, 98, 97, 178, 99, 177, 85, 79, 85, 77, 96, 101, 101, 102, 102, 103, 103, 104, 104, 105, 105, 106, 106, 102, 76, 103, 73, 98, 98, 107, 107, 101, 67, 105, 108, 108, 109, 109, 106, 104, 107, 110, 110, 66, 107, 111, 111, 112, 112, 107, 62, 113, 113, 107, 59, 116, 116, 114, 114, 115, 115, 117, 117, 108, 109, 57, 118, 118, 110, 119, 119, 120, 120, 55, 111, 113, 112, 114, 116, 113, 52, 115, 121, 121, 122, 122, 48, 117, 118, 123, 123, 124, 124, 125, 125, 127, 127, 119, 120, 18, 128, 128, 129, 129, 122, 121, 15, 125, 131, 131, 123, 130, 130, 123, 124, 132, 132, 133, 133, 124, 11, 124, 128, 0, 130, 134, 134, 135, 135, 127, 136, 136, 138, 138, 129, 139, 139, 133, 0, 131, 0, 135, 136, 132, 137, 137, 139, 141, 141, 140, 140, 143, 143, 134, 137, 142, 142, 0, 138, 140, 0, 139, 137, 0, 140, 142, 0, 137, 145, 145, 141, 144, 144, 146, 146, 148, 148, 140, 142, 147, 147, 144, 149, 149, 0, 143, 150, 150, 151, 151, 0, 146, 145, 152, 152, 0, 148, 144, 154, 154, 149, 147, 153, 153, 155, 155, 156, 156, 149, 158, 158, 0, 151, 157, 157, 150, 153, 160, 160, 150, 154, 159, 159, 0, 156, 0, 152, 155, 161, 161, 157, 162, 162, 0, 160, 158, 163, 163, 0, 159, 0, 159, 171, 171, 172, 172, 161, 174, 174, 176, 176, 196, 196, 197, 0, 197, 0, 197, 197, 162, 198, 198, 199, 199, 163, 201, 201, 200, 200, 202, 202, 203, 203, 204, 204, 205, 205, 206, 206, 208, 208, 0, 201, 202, 207, 207, 0, 203, 198, 199, 200, 201, 0, 202, 207, 0, 204, 0, 205, 0, 207, 209, 209, 210, 210, 206, 211, 211, 212, 212, 213, 213, 214, 214, 0, 209, 0, 215, 215, 216, 216, 0, 214, 217, 217, 0, 210, 218, 218, 0, 213, 215, 0, 216, 0, 217, 219, 219, 220, 220, 0, 212, 221, 221, 222, 222, 0, 216, 223, 223, 224, 224, 225, 225, 226, 226, 218, 227, 227, 0, 224, 220, 225, 0, 219, 228, 228, 227, 221, 229, 229, 222, 0, 230, 230, 223, 223, 231, 231, 228, 232, 232, 0, 226, 230, 233, 233, 234, 234, 235, 235, 236, 236, 0, 232, 229, 0, 234, 237, 237, 238, 238, 0, 231, 0, 236, 233, 239, 239, 0, 238, 0, 235, 240, 240, 242, 242, 239, 241, 241, 243, 243, 244, 244, 0, 237, 0, 240, 246, 246, 241, 245, 245, 247, 247, 248, 248, 243, 242, 249, 249, 0, 250, 250, 0, 251, 251, 252, 252, 253, 253, 244, 250, 249, 245, 251, 247, 246, 254, 254, 255, 255, 256, 256, 248, 253, 257, 257, 258, 258, 259, 259, 260, 260, 261, 261, 254, 0, 262, 262, 252, 263, 263, 257, 264, 264, 265, 265, 258, 255, 266, 266, 0, 261, 262, 267, 267, 0, 260, 265, 268, 268, 269, 269, 270, 270, 271, 271, 0, 267, 266, 263, 264, 272, 272, 273, 273, 274, 274, 0, 268, 275, 275, 0, 276, 276, 277, 277, 278, 278, 271, 274, 0, 270, 279, 279, 280, 280, 0, 272, 277, 273, 276, 281, 281, 0, 279, 283, 283, 275, 282, 282, 0, 276, 284, 284, 278, 285, 285, 0, 280, 283, 286, 286, 287, 287, 288, 288, 291, 291, 281, 285, 0, 282, 289, 289, 290, 290, 292, 292, 293, 293, 294, 294, 298, 298, 287, 295, 295, 0, 286, 291, 294, 293, 288, 0, 289, 295, 0, 290, 296, 296, 297, 297, 290, 292, 306, 306, 307, 307, 298, 308, 308, 309, 309, 0, 310, 310, 0, 297, 296, 306, 311, 311, 0, 307, 310, 312, 312, 313, 313, 314, 314, 308, 311, 315, 315, 316, 316, 309, 317, 317, 318, 318, 319, 319, 320, 320, 321, 321, 322, 322, 0, 313, 0, 312, 0, 314, 313, 323, 323, 315, 0, 316, 318, 324, 324, 317, 325, 325, 319, 326, 326, 327, 327, 328, 328, 0, 323, 329, 329, 330, 330, 331, 331, 0, 328, 332, 332, 0, 327, 330, 333, 333, 334, 334, 335, 335, 336, 336, 0, 337, 337, 338, 338, 339, 339, 0, 340, 340, 341, 341, 334, 0, 332, 0, 335, 337, 342, 342, 333, 339, 340, 0, 336, 343, 343, 344, 344, 0, 341, 0, 338, 339, 345, 345, 342, 346, 346, 347, 347, 348, 348, 0, 349, 349, 350, 350, 351, 351, 352, 352, 353, 353, 345, 348, 356, 356, 351, 354, 354, 355, 355, 346, 349, 347, 356, 354, 357, 357, 359, 359, 355, 0, 350, 358, 358, 0, 352, 360, 360, 361, 361, 362, 362, 363, 363, 364, 364, 365, 365, 0, 366, 366, 367, 367, 357, 0, 359, 368, 368, 358, 0, 362, 0, 360, 0, 361, 369, 369, 0, 365, 366, 370, 370, 371, 371, 372, 372, 0, 367, 373, 373, 370, 374, 374, 0, 372, 375, 375, 376, 376, 377, 377, 369, 373, 371, 378, 378, 379, 379, 0, 374, 380, 380, 0, 375, 381, 381, 383, 383, 382, 382, 379, 384, 384, 0, 380, 0, 382, 385, 385, 0, 378, 382, 386, 386, 383, 387, 387, 388, 388, 385, 0, 382, 381, 384, 389, 389, 0, 387, 390, 390, 391, 391, 392, 392, 388, 393, 393, 0, 386, 0, 394, 394, 395, 395, 389, 396, 396, 0, 393, 397, 397, 398, 398, 393, 394, 399, 399, 0, 393, 400, 400, 391, 401, 401, 0, 397, 402, 402, 403, 403, 395, 404, 404, 398, 405, 405, 406, 406, 413, 413, 401, 407, 407, 399, 0, 400, 415, 415, 405, 0, 414, 414, 413, 416, 416, 0, 403, 404, 0, 407, 414, 417, 417, 0, 415, 418, 418, 416, 419, 419, 420, 420, 422, 422, 421, 421, 423, 423, 0, 417, 424, 424, 425, 425, 426, 426, 427, 427, 428, 428, 424, 429, 429, 418, 419, 421, 430, 430, 420, 431, 431, 432, 432, 433, 433, 0, 434, 434, 435, 435, 436, 436, 437, 437, 427, 0, 430, 438, 438, 439, 439, 440, 440, 0, 441, 441, 0, 431, 434, 439, 442, 442, 443, 443, 0, 440, 441, 438, 444, 444, 445, 445, 446, 446, 442, 447, 447, 448, 448, 449, 449, 450, 450, 0, 443, 451, 451, 452, 452, 453, 453, 454, 454, 450, 446, 444, 0, 448, 445, 0, 455, 455, 0, 451, 456, 456, 457, 457, 0, 453, 455, 458, 458, 459, 459, 452, 460, 460, 0, 454, 461, 461, 462, 462, 463, 463, 458, 464, 464, 466, 466, 459, 456, 465, 465, 0, 462, 467, 467, 466, 468, 468, 469, 469, 0, 464, 0, 463, 0, 465, 470, 470, 468, 471, 471, 472, 472, 469, 473, 473, 474, 474, 470, 475, 475, 467, 476, 476, 477, 477, 0, 473, 0, 478, 478, 471, 479, 479, 480, 480, 481, 481, 0, 477, 476, 478, 482, 482, 483, 483, 0, 475, 479, 0, 484, 484, 485, 485, 486, 486, 487, 487, 0, 482, 484, 0, 480, 488, 488, 489, 489, 0, 486, 487, 483, 490, 490, 491, 491, 492, 492, 0, 488, 493, 493, 494, 494, 495, 495, 496, 496, 497, 497, 498, 498, 499, 499, 493, 0, 497, 504, 504, 505, 505, 506, 506, 0, 496, 507, 507, 495, 508, 508, 494, 509, 509, 0, 499, 507, 510, 510, 511, 511, 0, 512, 512, 514, 514, 505, 513, 513, 0, 506, 0, 515, 515, 0, 509, 512, 508, 0, 513, 516, 516, 517, 517, 0, 511, 515, 518, 518, 519, 519, 520, 520, 521, 521, 522, 522, 523, 523, 524, 524, 525, 525, 521, 526, 526, 0, 524, 527, 527, 0, 517, 0, 523, 0, 518, 0, 519, 528, 528, 529, 529, 530, 530, 531, 531, 532, 532, 533, 533, 534, 534, 535, 535, 0, 528, 536, 536, 531, 533, 0, 527, 535, 529, 537, 537, 536, 538, 538, 539, 539, 540, 540, 541, 541, 542, 542, 543, 543, 544, 544, 0, 539, 545, 545, 540, 546, 546, 0, 542, 547, 547, 548, 548, 544, 549, 549, 0, 538, 550, 550, 551, 551, 552, 552, 543, 553, 553, 554, 554, 549, 555, 555, 556, 556, 557, 557, 558, 558, 559, 559, 560, 560, 561, 561, 562, 562, 564, 564, 0, 557, 563, 563, 0, 555, 0, 565, 565, 0, 570, 570, 556, 571, 571, 572, 572, 0, 562, 560, 573, 573, 563, 565, 570, 0, 564, 0, 572, 574, 574, 575, 575, 0, 576, 576, 571, 577, 577, 578, 578, 580, 580, 579, 579, 581, 581, 573, 582, 582, 583, 583, 584, 584, 0, 574, 576, 579, 0, 581, 585, 585, 586, 586, 0, 577, 587, 587, 588, 588, 586, 589, 589, 590, 590, 0, 582, 591, 591, 0, 584, 592, 592, 593, 593, 590, 594, 594, 587, 595, 595, 589, 596, 596, 597, 597, 0, 593, 0, 591, 598, 598, 597, 599, 599, 0, 596, 600, 600, 601, 601, 602, 602, 603, 603, 598, 604, 604, 605, 605, 0, 600, 606, 606, 0, 599, 0, 610, 610, 0, 604, 611, 611, 612, 612, 613, 613, 614, 614, 602, 610, 615, 615, 616, 616, 617, 617, 618, 618, 619, 619, 620, 620, 621, 621, 622, 622, 611, 623, 623, 624, 624, 0, 619, 625, 625, 626, 626, 0, 615, 627, 627, 623, 0, 624, 628, 628, 629, 629, 621, 630, 630, 0, 627, 0, 629, 631, 631, 632, 632, 633, 633, 625, 635, 635, 636, 636, 0, 630, 637, 637, 638, 638, 628, 639, 639, 640, 640, 641, 641, 642, 642, 643, 643, 638, 644, 644, 0, 639, 645, 645, 646, 646, 647, 647, 0, 637, 648, 648, 649, 649, 650, 650, 0, 651, 651, 652, 652, 653, 653, 654, 654, 655, 655, 656, 656, 0, 645, 651, 0, 652, 653, 0, 657, 657, 646, 658, 658, 0, 649, 0, 0, 0, 0, 0, 0, 654, 657, 0, 0, 0, 656, 660, 660, 660, 660, 660, 660, 660, 660, 660, 660, 661, 661, 661, 661, 661, 661, 661, 661, 661, 661, 662, 662, 662, 662, 662, 662, 662, 662, 662, 662, 663, 663, 663, 663, 663, 663, 663, 663, 663, 663, 664, 664, 665, 0, 665, 665, 665, 665, 665, 665, 665, 665, 666, 666, 666, 667, 0, 0, 667, 0, 667, 667, 667, 667, 667, 668, 0, 0, 668, 668, 668, 668, 668, 668, 668, 669, 0, 0, 669, 669, 0, 669, 669, 669, 669, 670, 0, 0, 670, 670, 670, 670, 670, 670, 670, 671, 0, 0, 671, 671, 671, 671, 671, 671, 671, 672, 0, 0, 0, 672, 672, 672, 672, 672, 672, 673, 0, 0, 673, 673, 673, 673, 673, 673, 674, 0, 674, 674, 674, 674, 674, 674, 674, 674, 675, 0, 0, 675, 675, 675, 675, 675, 675, 675, 676, 676, 677, 677, 677, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, 659 } ; static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; extern int d__flex_debug; int d__flex_debug = 0; /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. */ #define REJECT reject_used_but_not_detected #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *d_text; #line 1 "dlexer.l" #line 11 "dlexer.l" #include #include "tokenizer.h" int nesting_level; #line 1183 "dlexer.c" #define INITIAL 0 #define comment 1 #define nesting_comment 2 #define string_literal 3 #define wysiwyg_literal 4 #ifndef YY_NO_UNISTD_H /* Special case for "unistd.h", since it is non-ANSI. We include it way * down here because we want the user's section 1 to have been scanned first. * The user has a chance to override it with an option. */ #include #endif #ifndef YY_EXTRA_TYPE #define YY_EXTRA_TYPE void * #endif static int yy_init_globals (void ); /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ int d_lex_destroy (void ); int d_get_debug (void ); void d_set_debug (int debug_flag ); YY_EXTRA_TYPE d_get_extra (void ); void d_set_extra (YY_EXTRA_TYPE user_defined ); FILE *d_get_in (void ); void d_set_in (FILE * in_str ); FILE *d_get_out (void ); void d_set_out (FILE * out_str ); int d_get_leng (void ); char *d_get_text (void ); int d_get_lineno (void ); void d_set_lineno (int line_number ); /* Macros after this point can all be overridden by user definitions in * section 1. */ #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus extern "C" int d_wrap (void ); #else extern int d_wrap (void ); #endif #endif static void yyunput (int c,char *buf_ptr ); #ifndef yytext_ptr static void yy_flex_strncpy (char *,yyconst char *,int ); #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen (yyconst char * ); #endif #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (void ); #else static int input (void ); #endif #endif /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE #ifdef __ia64__ /* On IA-64, the buffer size is 16k, not 8k */ #define YY_READ_BUF_SIZE 16384 #else #define YY_READ_BUF_SIZE 8192 #endif /* __ia64__ */ #endif /* Copy whatever the last rule matched to the standard output. */ #ifndef ECHO /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ #define ECHO do { if (fwrite( d_text, d_leng, 1, d_out )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, * is returned in "result". */ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ size_t n; \ for ( n = 0; n < max_size && \ (c = getc( d_in )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ if ( c == '\n' ) \ buf[n++] = (char) c; \ if ( c == EOF && ferror( d_in ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ else \ { \ errno=0; \ while ( (result = fread(buf, 1, max_size, d_in))==0 && ferror(d_in)) \ { \ if( errno != EINTR) \ { \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ break; \ } \ errno=0; \ clearerr(d_in); \ } \ }\ \ #endif /* No semi-colon after return; correct usage is to write "yyterminate();" - * we don't want an extra ';' after the "return" because that will cause * some compilers to complain about unreachable statements. */ #ifndef yyterminate #define yyterminate() return YY_NULL #endif /* Number of entries by which start-condition stack grows. */ #ifndef YY_START_STACK_INCR #define YY_START_STACK_INCR 25 #endif /* Report a fatal error. */ #ifndef YY_FATAL_ERROR #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) #endif /* end tables serialization structures and prototypes */ /* Default declaration of generated scanner - a define so the user can * easily add parameters. */ #ifndef YY_DECL #define YY_DECL_IS_OURS 1 extern int d_lex (void); #define YY_DECL int d_lex (void) #endif /* !YY_DECL */ /* Code executed at the beginning of each rule, after d_text and d_leng * have been set up. */ #ifndef YY_USER_ACTION #define YY_USER_ACTION #endif /* Code executed at the end of each rule. */ #ifndef YY_BREAK #define YY_BREAK break; #endif #define YY_RULE_SETUP \ YY_USER_ACTION /** The main scanner function which does all the work. */ YY_DECL { register yy_state_type yy_current_state; register char *yy_cp, *yy_bp; register int yy_act; #line 23 "dlexer.l" #line 1376 "dlexer.c" if ( !(yy_init) ) { (yy_init) = 1; #ifdef YY_USER_INIT YY_USER_INIT; #endif if ( ! (yy_start) ) (yy_start) = 1; /* first start state */ if ( ! d_in ) d_in = stdin; if ( ! d_out ) d_out = stdout; if ( ! YY_CURRENT_BUFFER ) { d_ensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = d__create_buffer(d_in,YY_BUF_SIZE ); } d__load_buffer_state( ); } while ( 1 ) /* loops until end-of-file is reached */ { yy_cp = (yy_c_buf_p); /* Support of d_text. */ *yy_cp = (yy_hold_char); /* yy_bp points to the position in yy_ch_buf of the start of * the current run. */ yy_bp = yy_cp; yy_current_state = (yy_start); yy_match: do { register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 660 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } while ( yy_base[yy_current_state] != 2118 ); yy_find_action: yy_act = yy_accept[yy_current_state]; if ( yy_act == 0 ) { /* have to back up */ yy_cp = (yy_last_accepting_cpos); yy_current_state = (yy_last_accepting_state); yy_act = yy_accept[yy_current_state]; } YY_DO_BEFORE_ACTION; do_action: /* This label is used only to access EOF actions. */ switch ( yy_act ) { /* beginning of action switch */ case 0: /* must back up */ /* undo the effects of YY_DO_BEFORE_ACTION */ *yy_cp = (yy_hold_char); yy_cp = (yy_last_accepting_cpos); yy_current_state = (yy_last_accepting_state); goto yy_find_action; case 1: YY_RULE_SETUP #line 24 "dlexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 2: YY_RULE_SETUP #line 25 "dlexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 3: YY_RULE_SETUP #line 26 "dlexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 4: YY_RULE_SETUP #line 27 "dlexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 5: YY_RULE_SETUP #line 28 "dlexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 6: YY_RULE_SETUP #line 29 "dlexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 7: YY_RULE_SETUP #line 30 "dlexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 8: YY_RULE_SETUP #line 31 "dlexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 9: YY_RULE_SETUP #line 32 "dlexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 10: YY_RULE_SETUP #line 33 "dlexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 11: YY_RULE_SETUP #line 34 "dlexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 12: YY_RULE_SETUP #line 35 "dlexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 13: YY_RULE_SETUP #line 36 "dlexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 14: YY_RULE_SETUP #line 37 "dlexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 15: YY_RULE_SETUP #line 38 "dlexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 16: YY_RULE_SETUP #line 39 "dlexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 17: YY_RULE_SETUP #line 40 "dlexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 18: YY_RULE_SETUP #line 41 "dlexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 19: YY_RULE_SETUP #line 42 "dlexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 20: YY_RULE_SETUP #line 43 "dlexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 21: YY_RULE_SETUP #line 44 "dlexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 22: YY_RULE_SETUP #line 45 "dlexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 23: YY_RULE_SETUP #line 46 "dlexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 24: YY_RULE_SETUP #line 47 "dlexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 25: YY_RULE_SETUP #line 48 "dlexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 26: YY_RULE_SETUP #line 49 "dlexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 27: YY_RULE_SETUP #line 50 "dlexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 28: YY_RULE_SETUP #line 51 "dlexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 29: YY_RULE_SETUP #line 52 "dlexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 30: YY_RULE_SETUP #line 53 "dlexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 31: YY_RULE_SETUP #line 54 "dlexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 32: YY_RULE_SETUP #line 55 "dlexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 33: YY_RULE_SETUP #line 56 "dlexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 34: YY_RULE_SETUP #line 57 "dlexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 35: YY_RULE_SETUP #line 58 "dlexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 36: YY_RULE_SETUP #line 59 "dlexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 37: YY_RULE_SETUP #line 60 "dlexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 38: YY_RULE_SETUP #line 61 "dlexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 39: YY_RULE_SETUP #line 62 "dlexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 40: YY_RULE_SETUP #line 63 "dlexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 41: YY_RULE_SETUP #line 64 "dlexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 42: YY_RULE_SETUP #line 65 "dlexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 43: YY_RULE_SETUP #line 66 "dlexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 44: YY_RULE_SETUP #line 67 "dlexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 45: YY_RULE_SETUP #line 68 "dlexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 46: YY_RULE_SETUP #line 69 "dlexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 47: YY_RULE_SETUP #line 70 "dlexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 48: YY_RULE_SETUP #line 71 "dlexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 49: YY_RULE_SETUP #line 72 "dlexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 50: YY_RULE_SETUP #line 73 "dlexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 51: YY_RULE_SETUP #line 74 "dlexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 52: YY_RULE_SETUP #line 75 "dlexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 53: YY_RULE_SETUP #line 76 "dlexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 54: YY_RULE_SETUP #line 77 "dlexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 55: YY_RULE_SETUP #line 78 "dlexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 56: YY_RULE_SETUP #line 79 "dlexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 57: YY_RULE_SETUP #line 80 "dlexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 58: YY_RULE_SETUP #line 81 "dlexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 59: YY_RULE_SETUP #line 82 "dlexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 60: YY_RULE_SETUP #line 83 "dlexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 61: YY_RULE_SETUP #line 84 "dlexer.l" { return(TOKENIZER_TYPE); } YY_BREAK case 62: YY_RULE_SETUP #line 86 "dlexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 63: YY_RULE_SETUP #line 87 "dlexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 64: YY_RULE_SETUP #line 88 "dlexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 65: YY_RULE_SETUP #line 89 "dlexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 66: YY_RULE_SETUP #line 90 "dlexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 67: YY_RULE_SETUP #line 91 "dlexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 68: YY_RULE_SETUP #line 92 "dlexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 69: YY_RULE_SETUP #line 93 "dlexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 70: YY_RULE_SETUP #line 94 "dlexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 71: YY_RULE_SETUP #line 95 "dlexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 72: YY_RULE_SETUP #line 96 "dlexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 73: YY_RULE_SETUP #line 97 "dlexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 74: YY_RULE_SETUP #line 98 "dlexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 75: YY_RULE_SETUP #line 99 "dlexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 76: YY_RULE_SETUP #line 100 "dlexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 77: YY_RULE_SETUP #line 101 "dlexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 78: YY_RULE_SETUP #line 102 "dlexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 79: YY_RULE_SETUP #line 103 "dlexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 80: YY_RULE_SETUP #line 104 "dlexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 81: YY_RULE_SETUP #line 105 "dlexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 82: YY_RULE_SETUP #line 106 "dlexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 83: YY_RULE_SETUP #line 107 "dlexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 84: YY_RULE_SETUP #line 108 "dlexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 85: YY_RULE_SETUP #line 109 "dlexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 86: YY_RULE_SETUP #line 110 "dlexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 87: YY_RULE_SETUP #line 111 "dlexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 88: YY_RULE_SETUP #line 112 "dlexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 89: YY_RULE_SETUP #line 113 "dlexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 90: YY_RULE_SETUP #line 114 "dlexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 91: YY_RULE_SETUP #line 115 "dlexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 92: YY_RULE_SETUP #line 116 "dlexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 93: YY_RULE_SETUP #line 117 "dlexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 94: YY_RULE_SETUP #line 118 "dlexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 95: YY_RULE_SETUP #line 119 "dlexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 96: YY_RULE_SETUP #line 120 "dlexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 97: YY_RULE_SETUP #line 121 "dlexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 98: YY_RULE_SETUP #line 122 "dlexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 99: YY_RULE_SETUP #line 123 "dlexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 100: YY_RULE_SETUP #line 124 "dlexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 101: YY_RULE_SETUP #line 125 "dlexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 102: YY_RULE_SETUP #line 126 "dlexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 103: YY_RULE_SETUP #line 127 "dlexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 104: YY_RULE_SETUP #line 128 "dlexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 105: YY_RULE_SETUP #line 129 "dlexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 106: YY_RULE_SETUP #line 130 "dlexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 107: YY_RULE_SETUP #line 131 "dlexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 108: YY_RULE_SETUP #line 132 "dlexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 109: YY_RULE_SETUP #line 133 "dlexer.l" { return(TOKENIZER_KEYWORD); } YY_BREAK case 110: YY_RULE_SETUP #line 135 "dlexer.l" { BEGIN(comment); return(TOKENIZER_COMMENT); } YY_BREAK case 111: YY_RULE_SETUP #line 136 "dlexer.l" { return(TOKENIZER_COMMENT); } YY_BREAK case 112: YY_RULE_SETUP #line 137 "dlexer.l" { return(TOKENIZER_COMMENT); } YY_BREAK case 113: /* rule 113 can match eol */ YY_RULE_SETUP #line 138 "dlexer.l" { return(TOKENIZER_NEWLINE); } YY_BREAK case 114: YY_RULE_SETUP #line 139 "dlexer.l" { return(TOKENIZER_NEWLINE); } YY_BREAK case 115: /* rule 115 can match eol */ YY_RULE_SETUP #line 140 "dlexer.l" { return(TOKENIZER_NEWLINE); } YY_BREAK case 116: YY_RULE_SETUP #line 141 "dlexer.l" { BEGIN(INITIAL); return(TOKENIZER_COMMENT); } YY_BREAK case 117: YY_RULE_SETUP #line 143 "dlexer.l" { BEGIN(nesting_comment); nesting_level = (0); return(TOKENIZER_COMMENT); } YY_BREAK case 118: YY_RULE_SETUP #line 144 "dlexer.l" { return(TOKENIZER_COMMENT); } YY_BREAK case 119: YY_RULE_SETUP #line 145 "dlexer.l" { return(TOKENIZER_COMMENT); } YY_BREAK case 120: YY_RULE_SETUP #line 146 "dlexer.l" { return(TOKENIZER_COMMENT); } YY_BREAK case 121: YY_RULE_SETUP #line 147 "dlexer.l" { nesting_level++; return(TOKENIZER_COMMENT); } YY_BREAK case 122: /* rule 122 can match eol */ YY_RULE_SETUP #line 148 "dlexer.l" { return(TOKENIZER_NEWLINE); } YY_BREAK case 123: YY_RULE_SETUP #line 149 "dlexer.l" { return(TOKENIZER_NEWLINE); } YY_BREAK case 124: /* rule 124 can match eol */ YY_RULE_SETUP #line 150 "dlexer.l" { return(TOKENIZER_NEWLINE); } YY_BREAK case 125: YY_RULE_SETUP #line 151 "dlexer.l" { if (nesting_level-- == 0) BEGIN(INITIAL); return(TOKENIZER_COMMENT); } YY_BREAK case 126: YY_RULE_SETUP #line 153 "dlexer.l" { return(TOKENIZER_COMMENT); } YY_BREAK case 127: YY_RULE_SETUP #line 155 "dlexer.l" { return(TOKENIZER_DIRECTIVE); } YY_BREAK case 128: YY_RULE_SETUP #line 156 "dlexer.l" { return(TOKENIZER_DIRECTIVE); } YY_BREAK case 129: YY_RULE_SETUP #line 157 "dlexer.l" { return(TOKENIZER_DIRECTIVE); } YY_BREAK case 130: YY_RULE_SETUP #line 158 "dlexer.l" { return(TOKENIZER_DIRECTIVE); } YY_BREAK case 131: YY_RULE_SETUP #line 159 "dlexer.l" { return(TOKENIZER_DIRECTIVE); } YY_BREAK case 132: YY_RULE_SETUP #line 160 "dlexer.l" { return(TOKENIZER_DIRECTIVE); } YY_BREAK case 133: YY_RULE_SETUP #line 161 "dlexer.l" { return(TOKENIZER_DIRECTIVE); } YY_BREAK case 134: YY_RULE_SETUP #line 162 "dlexer.l" { return(TOKENIZER_DIRECTIVE); } YY_BREAK case 135: YY_RULE_SETUP #line 163 "dlexer.l" { return(TOKENIZER_DIRECTIVE); } YY_BREAK case 136: YY_RULE_SETUP #line 164 "dlexer.l" { return(TOKENIZER_DIRECTIVE); } YY_BREAK case 137: YY_RULE_SETUP #line 165 "dlexer.l" { return(TOKENIZER_DIRECTIVE); } YY_BREAK case 138: YY_RULE_SETUP #line 166 "dlexer.l" { return(TOKENIZER_DIRECTIVE); } YY_BREAK case 139: YY_RULE_SETUP #line 167 "dlexer.l" { return(TOKENIZER_DIRECTIVE); } YY_BREAK case 140: YY_RULE_SETUP #line 168 "dlexer.l" { return(TOKENIZER_DIRECTIVE); } YY_BREAK case 141: YY_RULE_SETUP #line 169 "dlexer.l" { return(TOKENIZER_DIRECTIVE); } YY_BREAK case 142: YY_RULE_SETUP #line 170 "dlexer.l" { return(TOKENIZER_DIRECTIVE); } YY_BREAK case 143: YY_RULE_SETUP #line 171 "dlexer.l" { return(TOKENIZER_DIRECTIVE); } YY_BREAK case 144: YY_RULE_SETUP #line 174 "dlexer.l" { BEGIN(string_literal); return(TOKENIZER_LITERAL); } YY_BREAK case 145: YY_RULE_SETUP #line 175 "dlexer.l" { return(TOKENIZER_LITERAL); } YY_BREAK case 146: /* rule 146 can match eol */ YY_RULE_SETUP #line 176 "dlexer.l" { return(TOKENIZER_NEWLINE); } YY_BREAK case 147: YY_RULE_SETUP #line 177 "dlexer.l" { return(TOKENIZER_NEWLINE); } YY_BREAK case 148: /* rule 148 can match eol */ YY_RULE_SETUP #line 178 "dlexer.l" { return(TOKENIZER_NEWLINE); } YY_BREAK case 149: YY_RULE_SETUP #line 179 "dlexer.l" { BEGIN(INITIAL); return(TOKENIZER_LITERAL); } YY_BREAK case 150: YY_RULE_SETUP #line 181 "dlexer.l" { BEGIN(wysiwyg_literal); return(TOKENIZER_LITERAL); } YY_BREAK case 151: YY_RULE_SETUP #line 182 "dlexer.l" { return(TOKENIZER_LITERAL); } YY_BREAK case 152: /* rule 152 can match eol */ YY_RULE_SETUP #line 183 "dlexer.l" { return(TOKENIZER_NEWLINE); } YY_BREAK case 153: YY_RULE_SETUP #line 184 "dlexer.l" { return(TOKENIZER_NEWLINE); } YY_BREAK case 154: /* rule 154 can match eol */ YY_RULE_SETUP #line 185 "dlexer.l" { return(TOKENIZER_NEWLINE); } YY_BREAK case 155: YY_RULE_SETUP #line 186 "dlexer.l" { BEGIN(INITIAL); return(TOKENIZER_LITERAL); } YY_BREAK case 156: YY_RULE_SETUP #line 189 "dlexer.l" { return(TOKENIZER_LITERAL); } YY_BREAK case 157: YY_RULE_SETUP #line 190 "dlexer.l" { return(TOKENIZER_LITERAL); } YY_BREAK case 158: YY_RULE_SETUP #line 191 "dlexer.l" { return(TOKENIZER_LITERAL); } YY_BREAK case 159: YY_RULE_SETUP #line 192 "dlexer.l" { return(TOKENIZER_LITERAL); } YY_BREAK case 160: YY_RULE_SETUP #line 193 "dlexer.l" { return(TOKENIZER_LITERAL); } YY_BREAK case 161: YY_RULE_SETUP #line 194 "dlexer.l" { return(TOKENIZER_LITERAL); } YY_BREAK case 162: YY_RULE_SETUP #line 195 "dlexer.l" { return(TOKENIZER_LITERAL); } YY_BREAK case 163: YY_RULE_SETUP #line 196 "dlexer.l" { return(TOKENIZER_LITERAL); } YY_BREAK case 164: YY_RULE_SETUP #line 197 "dlexer.l" { return(TOKENIZER_LITERAL); } YY_BREAK case 165: YY_RULE_SETUP #line 198 "dlexer.l" { return(TOKENIZER_LITERAL); } YY_BREAK case 166: YY_RULE_SETUP #line 199 "dlexer.l" { return(TOKENIZER_LITERAL); } YY_BREAK case 167: /* rule 167 can match eol */ YY_RULE_SETUP #line 201 "dlexer.l" { return(TOKENIZER_NEWLINE); } YY_BREAK case 168: /* rule 168 can match eol */ YY_RULE_SETUP #line 202 "dlexer.l" { return(TOKENIZER_NEWLINE); } YY_BREAK case 169: YY_RULE_SETUP #line 203 "dlexer.l" { return(TOKENIZER_NEWLINE); } YY_BREAK case 170: YY_RULE_SETUP #line 204 "dlexer.l" { return(TOKENIZER_TEXT); } YY_BREAK case 171: YY_RULE_SETUP #line 205 "dlexer.l" { return(TOKENIZER_TEXT); } YY_BREAK case 172: YY_RULE_SETUP #line 206 "dlexer.l" { return(TOKENIZER_TEXT); } YY_BREAK case 173: YY_RULE_SETUP #line 208 "dlexer.l" ECHO; YY_BREAK #line 2334 "dlexer.c" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(comment): case YY_STATE_EOF(nesting_comment): case YY_STATE_EOF(string_literal): case YY_STATE_EOF(wysiwyg_literal): yyterminate(); case YY_END_OF_BUFFER: { /* Amount of text matched not including the EOB char. */ int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; /* Undo the effects of YY_DO_BEFORE_ACTION. */ *yy_cp = (yy_hold_char); YY_RESTORE_YY_MORE_OFFSET if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) { /* We're scanning a new file or input source. It's * possible that this happened because the user * just pointed d_in at a new source and called * d_lex(). If so, then we have to assure * consistency between YY_CURRENT_BUFFER and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; YY_CURRENT_BUFFER_LVALUE->yy_input_file = d_in; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; } /* Note that here we test for yy_c_buf_p "<=" to the position * of the first EOB in the buffer, since yy_c_buf_p will * already have been incremented past the NUL character * (since all states make transitions on EOB to the * end-of-buffer state). Contrast this with the test * in input(). */ if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) { /* This was really a NUL. */ yy_state_type yy_next_state; (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state( ); /* Okay, we're now positioned to make the NUL * transition. We couldn't have * yy_get_previous_state() go ahead and do it * for us because it doesn't know how to deal * with the possibility of jamming (and we don't * want to build jamming into it because then it * will run more slowly). */ yy_next_state = yy_try_NUL_trans( yy_current_state ); yy_bp = (yytext_ptr) + YY_MORE_ADJ; if ( yy_next_state ) { /* Consume the NUL. */ yy_cp = ++(yy_c_buf_p); yy_current_state = yy_next_state; goto yy_match; } else { yy_cp = (yy_c_buf_p); goto yy_find_action; } } else switch ( yy_get_next_buffer( ) ) { case EOB_ACT_END_OF_FILE: { (yy_did_buffer_switch_on_eof) = 0; if ( d_wrap( ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up * d_text, we can now set up * yy_c_buf_p so that if some total * hoser (like flex itself) wants to * call the scanner after we return the * YY_NULL, it'll still work - another * YY_NULL will get returned. */ (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; yy_act = YY_STATE_EOF(YY_START); goto do_action; } else { if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; } break; } case EOB_ACT_CONTINUE_SCAN: (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state( ); yy_cp = (yy_c_buf_p); yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_match; case EOB_ACT_LAST_MATCH: (yy_c_buf_p) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; yy_current_state = yy_get_previous_state( ); yy_cp = (yy_c_buf_p); yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_find_action; } break; } default: YY_FATAL_ERROR( "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ } /* end of d_lex */ /* yy_get_next_buffer - try to read in a new buffer * * Returns a code representing an action: * EOB_ACT_LAST_MATCH - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */ static int yy_get_next_buffer (void) { register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; register char *source = (yytext_ptr); register int number_to_move, i; int ret_val; if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) YY_FATAL_ERROR( "fatal flex scanner internal error--end of buffer missed" ); if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) { /* Don't try to fill the buffer, so this is an EOF. */ if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) { /* We matched a single character, the EOB, so * treat this as a final EOF. */ return EOB_ACT_END_OF_FILE; } else { /* We matched some text prior to the EOB, first * process it. */ return EOB_ACT_LAST_MATCH; } } /* Try to read more data. */ /* First move last chars to start of buffer. */ number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) /* don't do the read, it's not guaranteed to return an EOF, * just force an EOF */ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; else { int num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ /* just a shorter name for the current buffer */ YY_BUFFER_STATE b = YY_CURRENT_BUFFER; int yy_c_buf_p_offset = (int) ((yy_c_buf_p) - b->yy_ch_buf); if ( b->yy_is_our_buffer ) { int new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; else b->yy_buf_size *= 2; b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ d_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); } else /* Can't grow it, we don't own it. */ b->yy_ch_buf = 0; if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; } if ( num_to_read > YY_READ_BUF_SIZE ) num_to_read = YY_READ_BUF_SIZE; /* Read in more data. */ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), (yy_n_chars), (size_t) num_to_read ); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } if ( (yy_n_chars) == 0 ) { if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; d_restart(d_in ); } else { ret_val = EOB_ACT_LAST_MATCH; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_EOF_PENDING; } } else ret_val = EOB_ACT_CONTINUE_SCAN; if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) d_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); } (yy_n_chars) += number_to_move; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; return ret_val; } /* yy_get_previous_state - get the state just before the EOB char was reached */ static yy_state_type yy_get_previous_state (void) { register yy_state_type yy_current_state; register char *yy_cp; yy_current_state = (yy_start); for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) { register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 660 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; } return yy_current_state; } /* yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis * next_state = yy_try_NUL_trans( current_state ); */ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) { register int yy_is_jam; register char *yy_cp = (yy_c_buf_p); register YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 660 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; yy_is_jam = (yy_current_state == 659); return yy_is_jam ? 0 : yy_current_state; } static void yyunput (int c, register char * yy_bp ) { register char *yy_cp; yy_cp = (yy_c_buf_p); /* undo effects of setting up d_text */ *yy_cp = (yy_hold_char); if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) { /* need to shift things up to make room */ /* +2 for EOB chars. */ register int number_to_move = (yy_n_chars) + 2; register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; register char *source = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) *--dest = *--source; yy_cp += (int) (dest - source); yy_bp += (int) (dest - source); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) YY_FATAL_ERROR( "flex scanner push-back overflow" ); } *--yy_cp = (char) c; (yytext_ptr) = yy_bp; (yy_hold_char) = *yy_cp; (yy_c_buf_p) = yy_cp; } #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (void) #else static int input (void) #endif { int c; *(yy_c_buf_p) = (yy_hold_char); if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) { /* yy_c_buf_p now points to the character we want to return. * If this occurs *before* the EOB characters, then it's a * valid NUL; if not, then we've hit the end of the buffer. */ if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) /* This was really a NUL. */ *(yy_c_buf_p) = '\0'; else { /* need more input */ int offset = (yy_c_buf_p) - (yytext_ptr); ++(yy_c_buf_p); switch ( yy_get_next_buffer( ) ) { case EOB_ACT_LAST_MATCH: /* This happens because yy_g_n_b() * sees that we've accumulated a * token and flags that we need to * try matching the token before * proceeding. But for input(), * there's no matching to consider. * So convert the EOB_ACT_LAST_MATCH * to EOB_ACT_END_OF_FILE. */ /* Reset buffer status. */ d_restart(d_in ); /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { if ( d_wrap( ) ) return EOF; if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; #ifdef __cplusplus return yyinput(); #else return input(); #endif } case EOB_ACT_CONTINUE_SCAN: (yy_c_buf_p) = (yytext_ptr) + offset; break; } } } c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ *(yy_c_buf_p) = '\0'; /* preserve d_text */ (yy_hold_char) = *++(yy_c_buf_p); return c; } #endif /* ifndef YY_NO_INPUT */ /** Immediately switch to a different input stream. * @param input_file A readable stream. * * @note This function does not reset the start condition to @c INITIAL . */ void d_restart (FILE * input_file ) { if ( ! YY_CURRENT_BUFFER ){ d_ensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = d__create_buffer(d_in,YY_BUF_SIZE ); } d__init_buffer(YY_CURRENT_BUFFER,input_file ); d__load_buffer_state( ); } /** Switch to a different input buffer. * @param new_buffer The new input buffer. * */ void d__switch_to_buffer (YY_BUFFER_STATE new_buffer ) { /* TODO. We should be able to replace this entire function body * with * d_pop_buffer_state(); * d_push_buffer_state(new_buffer); */ d_ensure_buffer_stack (); if ( YY_CURRENT_BUFFER == new_buffer ) return; if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ *(yy_c_buf_p) = (yy_hold_char); YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } YY_CURRENT_BUFFER_LVALUE = new_buffer; d__load_buffer_state( ); /* We don't actually know whether we did this switch during * EOF (d_wrap()) processing, but the only time this flag * is looked at is after d_wrap() is called, so it's safe * to go ahead and always set it. */ (yy_did_buffer_switch_on_eof) = 1; } static void d__load_buffer_state (void) { (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; d_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file; (yy_hold_char) = *(yy_c_buf_p); } /** Allocate and initialize an input buffer state. * @param file A readable stream. * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. * * @return the allocated buffer state. */ YY_BUFFER_STATE d__create_buffer (FILE * file, int size ) { YY_BUFFER_STATE b; b = (YY_BUFFER_STATE) d_alloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in d__create_buffer()" ); b->yy_buf_size = size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ b->yy_ch_buf = (char *) d_alloc(b->yy_buf_size + 2 ); if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in d__create_buffer()" ); b->yy_is_our_buffer = 1; d__init_buffer(b,file ); return b; } /** Destroy the buffer. * @param b a buffer created with d__create_buffer() * */ void d__delete_buffer (YY_BUFFER_STATE b ) { if ( ! b ) return; if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) d_free((void *) b->yy_ch_buf ); d_free((void *) b ); } #ifndef __cplusplus extern int isatty (int ); #endif /* __cplusplus */ /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, * such as during a d_restart() or at EOF. */ static void d__init_buffer (YY_BUFFER_STATE b, FILE * file ) { int oerrno = errno; d__flush_buffer(b ); b->yy_input_file = file; b->yy_fill_buffer = 1; /* If b is the current buffer, then d__init_buffer was _probably_ * called from d_restart() or through yy_get_next_buffer. * In that case, we don't want to reset the lineno or column. */ if (b != YY_CURRENT_BUFFER){ b->yy_bs_lineno = 1; b->yy_bs_column = 0; } b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; errno = oerrno; } /** Discard all buffered characters. On the next scan, YY_INPUT will be called. * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. * */ void d__flush_buffer (YY_BUFFER_STATE b ) { if ( ! b ) return; b->yy_n_chars = 0; /* We always need two end-of-buffer characters. The first causes * a transition to the end-of-buffer state. The second causes * a jam in that state. */ b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; b->yy_buf_pos = &b->yy_ch_buf[0]; b->yy_at_bol = 1; b->yy_buffer_status = YY_BUFFER_NEW; if ( b == YY_CURRENT_BUFFER ) d__load_buffer_state( ); } /** Pushes the new state onto the stack. The new state becomes * the current state. This function will allocate the stack * if necessary. * @param new_buffer The new state. * */ void d_push_buffer_state (YY_BUFFER_STATE new_buffer ) { if (new_buffer == NULL) return; d_ensure_buffer_stack(); /* This block is copied from d__switch_to_buffer. */ if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ *(yy_c_buf_p) = (yy_hold_char); YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } /* Only push if top exists. Otherwise, replace top. */ if (YY_CURRENT_BUFFER) (yy_buffer_stack_top)++; YY_CURRENT_BUFFER_LVALUE = new_buffer; /* copied from d__switch_to_buffer. */ d__load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } /** Removes and deletes the top of the stack, if present. * The next element becomes the new top. * */ void d_pop_buffer_state (void) { if (!YY_CURRENT_BUFFER) return; d__delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; if ((yy_buffer_stack_top) > 0) --(yy_buffer_stack_top); if (YY_CURRENT_BUFFER) { d__load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } } /* Allocates the stack if it does not exist. * Guarantees space for at least one push. */ static void d_ensure_buffer_stack (void) { int num_to_alloc; if (!(yy_buffer_stack)) { /* First allocation is just for 2 elements, since we don't know if this * scanner will even need a stack. We use 2 instead of 1 to avoid an * immediate realloc on the next call. */ num_to_alloc = 1; (yy_buffer_stack) = (struct yy_buffer_state**)d_alloc (num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in d_ensure_buffer_stack()" ); memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); (yy_buffer_stack_max) = num_to_alloc; (yy_buffer_stack_top) = 0; return; } if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ /* Increase the buffer to prepare for a possible push. */ int grow_size = 8 /* arbitrary grow size */; num_to_alloc = (yy_buffer_stack_max) + grow_size; (yy_buffer_stack) = (struct yy_buffer_state**)d_realloc ((yy_buffer_stack), num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in d_ensure_buffer_stack()" ); /* zero only the new slots.*/ memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); (yy_buffer_stack_max) = num_to_alloc; } } /** Setup the input buffer state to scan directly from a user-specified character buffer. * @param base the character buffer * @param size the size in bytes of the character buffer * * @return the newly allocated buffer state object. */ YY_BUFFER_STATE d__scan_buffer (char * base, yy_size_t size ) { YY_BUFFER_STATE b; if ( size < 2 || base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ return 0; b = (YY_BUFFER_STATE) d_alloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in d__scan_buffer()" ); b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; b->yy_is_our_buffer = 0; b->yy_input_file = 0; b->yy_n_chars = b->yy_buf_size; b->yy_is_interactive = 0; b->yy_at_bol = 1; b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; d__switch_to_buffer(b ); return b; } /** Setup the input buffer state to scan a string. The next call to d_lex() will * scan from a @e copy of @a str. * @param yystr a NUL-terminated string to scan * * @return the newly allocated buffer state object. * @note If you want to scan bytes that may contain NUL values, then use * d__scan_bytes() instead. */ YY_BUFFER_STATE d__scan_string (yyconst char * yystr ) { return d__scan_bytes(yystr,strlen(yystr) ); } /** Setup the input buffer state to scan the given bytes. The next call to d_lex() will * scan from a @e copy of @a bytes. * @param yybytes the byte buffer to scan * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. * * @return the newly allocated buffer state object. */ YY_BUFFER_STATE d__scan_bytes (yyconst char * yybytes, int _yybytes_len ) { YY_BUFFER_STATE b; char *buf; yy_size_t n; int i; /* Get memory for full buffer, including space for trailing EOB's. */ n = _yybytes_len + 2; buf = (char *) d_alloc(n ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in d__scan_bytes()" ); for ( i = 0; i < _yybytes_len; ++i ) buf[i] = yybytes[i]; buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; b = d__scan_buffer(buf,n ); if ( ! b ) YY_FATAL_ERROR( "bad buffer in d__scan_bytes()" ); /* It's okay to grow etc. this buffer, and we should throw it * away when we're done. */ b->yy_is_our_buffer = 1; return b; } #ifndef YY_EXIT_FAILURE #define YY_EXIT_FAILURE 2 #endif static void yy_fatal_error (yyconst char* msg ) { (void) fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } /* Redefine yyless() so it works in section 3 code. */ #undef yyless #define yyless(n) \ do \ { \ /* Undo effects of setting up d_text. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ d_text[d_leng] = (yy_hold_char); \ (yy_c_buf_p) = d_text + yyless_macro_arg; \ (yy_hold_char) = *(yy_c_buf_p); \ *(yy_c_buf_p) = '\0'; \ d_leng = yyless_macro_arg; \ } \ while ( 0 ) /* Accessor methods (get/set functions) to struct members. */ /** Get the current line number. * */ int d_get_lineno (void) { return d_lineno; } /** Get the input stream. * */ FILE *d_get_in (void) { return d_in; } /** Get the output stream. * */ FILE *d_get_out (void) { return d_out; } /** Get the length of the current token. * */ int d_get_leng (void) { return d_leng; } /** Get the current token. * */ char *d_get_text (void) { return d_text; } /** Set the current line number. * @param line_number * */ void d_set_lineno (int line_number ) { d_lineno = line_number; } /** Set the input stream. This does not discard the current * input buffer. * @param in_str A readable stream. * * @see d__switch_to_buffer */ void d_set_in (FILE * in_str ) { d_in = in_str ; } void d_set_out (FILE * out_str ) { d_out = out_str ; } int d_get_debug (void) { return d__flex_debug; } void d_set_debug (int bdebug ) { d__flex_debug = bdebug ; } static int yy_init_globals (void) { /* Initialization is the same as for the non-reentrant scanner. * This function is called from d_lex_destroy(), so don't allocate here. */ (yy_buffer_stack) = 0; (yy_buffer_stack_top) = 0; (yy_buffer_stack_max) = 0; (yy_c_buf_p) = (char *) 0; (yy_init) = 0; (yy_start) = 0; /* Defined in main.c */ #ifdef YY_STDINIT d_in = stdin; d_out = stdout; #else d_in = (FILE *) 0; d_out = (FILE *) 0; #endif /* For future reference: Set errno on error, since we are called by * d_lex_init() */ return 0; } /* d_lex_destroy is for both reentrant and non-reentrant scanners. */ int d_lex_destroy (void) { /* Pop the buffer stack, destroying each element. */ while(YY_CURRENT_BUFFER){ d__delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; d_pop_buffer_state(); } /* Destroy the stack itself. */ d_free((yy_buffer_stack) ); (yy_buffer_stack) = NULL; /* Reset the globals. This is important in a non-reentrant scanner so the next time * d_lex() is called, initialization will occur. */ yy_init_globals( ); return 0; } /* * Internal utility routines. */ #ifndef yytext_ptr static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) { register int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen (yyconst char * s ) { register int n; for ( n = 0; s[n]; ++n ) ; return n; } #endif void *d_alloc (yy_size_t size ) { return (void *) malloc( size ); } void *d_realloc (void * ptr, yy_size_t size ) { /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter * because both ANSI C and C++ allow castless assignment from * any pointer type to void*, and deal with argument conversions * as though doing an assignment. */ return (void *) realloc( (char *) ptr, size ); } void d_free (void * ptr ) { free( (char *) ptr ); /* see d_realloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" #line 208 "dlexer.l" int d_wrap ( void ) { { /* Silly impossible function call to stop warning of unused functions */ if ( 0 ) { yyunput(0, ""); } } return 1; } cgdb-0.6.7/lib/tokenizer/dlexer.l000644 000765 000024 00000024306 12074441140 017632 0ustar00mmuellerstaff000000 000000 %option prefix="d_" %option outfile="lex.yy.c" D [0-9_] H [0-9a-fA-F_] L [a-zA-Z_] T [0-9a-zA-Z_] IDENTIFIER {L}+{T}* %{ #include #include "tokenizer.h" int nesting_level; %} %x comment %x nesting_comment %x string_literal %x wysiwyg_literal %% "__gshared" { return(TOKENIZER_TYPE); } "__thread" { return(TOKENIZER_TYPE); } "__vector" { return(TOKENIZER_TYPE); } "abstract" { return(TOKENIZER_TYPE); } "auto" { return(TOKENIZER_TYPE); } "int" { return(TOKENIZER_TYPE); } "byte" { return(TOKENIZER_TYPE); } "bit" { return(TOKENIZER_TYPE); } "bool" { return(TOKENIZER_TYPE); } "char" { return(TOKENIZER_TYPE); } "cdouble" { return(TOKENIZER_TYPE); } "cent" { return(TOKENIZER_TYPE); } "cfloat" { return(TOKENIZER_TYPE); } "class" { return(TOKENIZER_TYPE); } "const" { return(TOKENIZER_TYPE); } "creal" { return(TOKENIZER_TYPE); } "deprecated" { return(TOKENIZER_TYPE); } "enum" { return(TOKENIZER_TYPE); } "export" { return(TOKENIZER_TYPE); } "extern" { return(TOKENIZER_TYPE); } "dchar" { return(TOKENIZER_TYPE); } "dstring" { return(TOKENIZER_TYPE); } "double" { return(TOKENIZER_TYPE); } "equals_t" { return(TOKENIZER_TYPE); } "hash_t" { return(TOKENIZER_TYPE); } "idouble" { return(TOKENIZER_TYPE); } "final" { return(TOKENIZER_TYPE); } "float" { return(TOKENIZER_TYPE); } "ifloat" { return(TOKENIZER_TYPE); } "immutable" { return(TOKENIZER_TYPE); } "inout" { return(TOKENIZER_TYPE); } "interface" { return(TOKENIZER_TYPE); } "ireal" { return(TOKENIZER_TYPE); } "lazy" { return(TOKENIZER_TYPE); } "long" { return(TOKENIZER_TYPE); } "nothrow" { return(TOKENIZER_TYPE); } "override" { return(TOKENIZER_TYPE); } "ptrdiff_t" { return(TOKENIZER_TYPE); } "pure" { return(TOKENIZER_TYPE); } "real" { return(TOKENIZER_TYPE); } "ref" { return(TOKENIZER_TYPE); } "scope" { return(TOKENIZER_TYPE); } "shared" { return(TOKENIZER_TYPE); } "short" { return(TOKENIZER_TYPE); } "size_t" { return(TOKENIZER_TYPE); } "sizediff_t" { return(TOKENIZER_TYPE); } "static" { return(TOKENIZER_TYPE); } "string" { return(TOKENIZER_TYPE); } "struct" { return(TOKENIZER_TYPE); } "synchronized" { return(TOKENIZER_TYPE); } "ubyte" { return(TOKENIZER_TYPE); } "ucent" { return(TOKENIZER_TYPE); } "uint" { return(TOKENIZER_TYPE); } "ulong" { return(TOKENIZER_TYPE); } "union" { return(TOKENIZER_TYPE); } "ushort" { return(TOKENIZER_TYPE); } "void" { return(TOKENIZER_TYPE); } "volatile" { return(TOKENIZER_TYPE); } "wchar" { return(TOKENIZER_TYPE); } "wchar_t" { return(TOKENIZER_TYPE); } "wstring" { return(TOKENIZER_TYPE); } "__traits" { return(TOKENIZER_KEYWORD); } "alias" { return(TOKENIZER_KEYWORD); } "align" { return(TOKENIZER_KEYWORD); } "asm" { return(TOKENIZER_KEYWORD); } "assert" { return(TOKENIZER_KEYWORD); } "body" { return(TOKENIZER_KEYWORD); } "break" { return(TOKENIZER_KEYWORD); } "case" { return(TOKENIZER_KEYWORD); } "catch" { return(TOKENIZER_KEYWORD); } "cast" { return(TOKENIZER_KEYWORD); } "continue" { return(TOKENIZER_KEYWORD); } "default" { return(TOKENIZER_KEYWORD); } "debug" { return(TOKENIZER_KEYWORD); } "delegate" { return(TOKENIZER_KEYWORD); } "delete" { return(TOKENIZER_KEYWORD); } "do" { return(TOKENIZER_KEYWORD); } "else" { return(TOKENIZER_KEYWORD); } "finally" { return(TOKENIZER_KEYWORD); } "for" { return(TOKENIZER_KEYWORD); } "foreach" { return(TOKENIZER_KEYWORD); } "foreach_reverse" { return(TOKENIZER_KEYWORD); } "function" { return(TOKENIZER_KEYWORD); } "goto" { return(TOKENIZER_KEYWORD); } "if" { return(TOKENIZER_KEYWORD); } "in" { return(TOKENIZER_KEYWORD); } "invariant" { return(TOKENIZER_KEYWORD); } "is" { return(TOKENIZER_KEYWORD); } "mixin" { return(TOKENIZER_KEYWORD); } "new" { return(TOKENIZER_KEYWORD); } "out" { return(TOKENIZER_KEYWORD); } "private" { return(TOKENIZER_KEYWORD); } "protected" { return(TOKENIZER_KEYWORD); } "public" { return(TOKENIZER_KEYWORD); } "return" { return(TOKENIZER_KEYWORD); } "sizeof" { return(TOKENIZER_KEYWORD); } "switch" { return(TOKENIZER_KEYWORD); } "template" { return(TOKENIZER_KEYWORD); } "this" { return(TOKENIZER_KEYWORD); } "super" { return(TOKENIZER_KEYWORD); } "throw" { return(TOKENIZER_KEYWORD); } "try" { return(TOKENIZER_KEYWORD); } "typedef" { return(TOKENIZER_KEYWORD); } "typeid" { return(TOKENIZER_KEYWORD); } "typeof" { return(TOKENIZER_KEYWORD); } "unittest" { return(TOKENIZER_KEYWORD); } "version" { return(TOKENIZER_KEYWORD); } "while" { return(TOKENIZER_KEYWORD); } "with" { return(TOKENIZER_KEYWORD); } "/*" { BEGIN(comment); return(TOKENIZER_COMMENT); } [^*\r\n]* { return(TOKENIZER_COMMENT); } "*"+[^*/\r\n]* { return(TOKENIZER_COMMENT); } \n { return(TOKENIZER_NEWLINE); } \r { return(TOKENIZER_NEWLINE); } \r\n { return(TOKENIZER_NEWLINE); } "*"+"/" { BEGIN(INITIAL); return(TOKENIZER_COMMENT); } "/+" { BEGIN(nesting_comment); nesting_level = (0); return(TOKENIZER_COMMENT); } [^+/\r\n]* { return(TOKENIZER_COMMENT); } "+"+[^+/\r\n]* { return(TOKENIZER_COMMENT); } "/"+[^+/\r\n]* { return(TOKENIZER_COMMENT); } "/+" { nesting_level++; return(TOKENIZER_COMMENT); } \n { return(TOKENIZER_NEWLINE); } \r { return(TOKENIZER_NEWLINE); } \r\n { return(TOKENIZER_NEWLINE); } "+"+"/" { if (nesting_level-- == 0) BEGIN(INITIAL); return(TOKENIZER_COMMENT); } \/\/[^\r\n]* { return(TOKENIZER_COMMENT); } #{L}+ { return(TOKENIZER_DIRECTIVE); } "import" { return(TOKENIZER_DIRECTIVE); } "module" { return(TOKENIZER_DIRECTIVE); } "package" { return(TOKENIZER_DIRECTIVE); } "pragma" { return(TOKENIZER_DIRECTIVE); } "_arguments" { return(TOKENIZER_DIRECTIVE); } "_argptr" { return(TOKENIZER_DIRECTIVE); } "__vptr" { return(TOKENIZER_DIRECTIVE); } "__monitor" { return(TOKENIZER_DIRECTIVE); } "__ctfe" { return(TOKENIZER_DIRECTIVE); } "_ctor" { return(TOKENIZER_DIRECTIVE); } "_dtor" { return(TOKENIZER_DIRECTIVE); } "@safe" { return(TOKENIZER_DIRECTIVE); } "@trusted" { return(TOKENIZER_DIRECTIVE); } "@system" { return(TOKENIZER_DIRECTIVE); } "@property" { return(TOKENIZER_DIRECTIVE); } "@disable" { return(TOKENIZER_DIRECTIVE); } \" { BEGIN(string_literal); return(TOKENIZER_LITERAL); } (\\[^\r\n]|[^\\"\r\n])* { return(TOKENIZER_LITERAL); } \n { return(TOKENIZER_NEWLINE); } \r { return(TOKENIZER_NEWLINE); } \r\n { return(TOKENIZER_NEWLINE); } \" { BEGIN(INITIAL); return(TOKENIZER_LITERAL); } "`" { BEGIN(wysiwyg_literal); return(TOKENIZER_LITERAL); } ([^`\r\n])* { return(TOKENIZER_LITERAL); } \n { return(TOKENIZER_NEWLINE); } \r { return(TOKENIZER_NEWLINE); } \r\n { return(TOKENIZER_NEWLINE); } "`" { BEGIN(INITIAL); return(TOKENIZER_LITERAL); } {D}+ { return(TOKENIZER_LITERAL); } {D}+f { return(TOKENIZER_LITERAL); } {D}+L { return(TOKENIZER_LITERAL); } {D}+U { return(TOKENIZER_LITERAL); } {D}+UL { return(TOKENIZER_LITERAL); } 0x{H}+ { return(TOKENIZER_LITERAL); } '.' { return(TOKENIZER_LITERAL); } '\\.' { return(TOKENIZER_LITERAL); } "false" { return(TOKENIZER_LITERAL); } "null" { return(TOKENIZER_LITERAL); } "true" { return(TOKENIZER_LITERAL); } \n { return(TOKENIZER_NEWLINE); } \r\n { return(TOKENIZER_NEWLINE); } \r { return(TOKENIZER_NEWLINE); } [ \t\v\f] { return(TOKENIZER_TEXT); } {IDENTIFIER} { return(TOKENIZER_TEXT); } . { return(TOKENIZER_TEXT); } %% int d_wrap ( void ) { { /* Silly impossible function call to stop warning of unused functions */ if ( 0 ) { yyunput(0, ""); } } return 1; } cgdb-0.6.7/lib/tokenizer/Makefile.am000644 000765 000024 00000001247 12074441140 020225 0ustar00mmuellerstaff000000 000000 AM_CFLAGS = \ -I$(top_srcdir)/lib/adt \ -I$(top_srcdir)/lib/util #AM_LFLAGS = -Pxx -olex.yy.c # create the input library noinst_LIBRARIES = libtokenizer.a libtokenizer_a_SOURCES = \ adalexer.l \ clexer.l \ dlexer.l \ tokenizer.c \ tokenizer.h # Installs the driver programs into progs directory noinst_PROGRAMS = tokenizer_driver # This is the input driver tokenizer_driver_LDFLAGS = -L. \ -L$(top_builddir)/lib/adt \ -L$(top_builddir)/lib/util tokenizer_driver_LDADD = ./libtokenizer.a \ $(top_builddir)/lib/adt/libadt.a \ $(top_builddir)/lib/util/libutil.a tokenizer_driver_SOURCES = tokenizer_driver.c input_driver_CFLAGS = $(AM_CFLAGS) cgdb-0.6.7/lib/tokenizer/Makefile.in000644 000765 000024 00000041307 12074766253 020256 0ustar00mmuellerstaff000000 000000 # Makefile.in generated by automake 1.13.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ noinst_PROGRAMS = tokenizer_driver$(EXEEXT) subdir = lib/tokenizer DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am adalexer.c \ clexer.c dlexer.c $(top_srcdir)/config/depcomp \ $(top_srcdir)/config/ylwrap ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/config/readline_check_version.m4 \ $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LIBRARIES = $(noinst_LIBRARIES) AR = ar ARFLAGS = cru AM_V_AR = $(am__v_AR_@AM_V@) am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@) am__v_AR_0 = @echo " AR " $@; am__v_AR_1 = libtokenizer_a_AR = $(AR) $(ARFLAGS) libtokenizer_a_LIBADD = am_libtokenizer_a_OBJECTS = adalexer.$(OBJEXT) clexer.$(OBJEXT) \ dlexer.$(OBJEXT) tokenizer.$(OBJEXT) libtokenizer_a_OBJECTS = $(am_libtokenizer_a_OBJECTS) PROGRAMS = $(noinst_PROGRAMS) am_tokenizer_driver_OBJECTS = tokenizer_driver.$(OBJEXT) tokenizer_driver_OBJECTS = $(am_tokenizer_driver_OBJECTS) tokenizer_driver_DEPENDENCIES = ./libtokenizer.a \ $(top_builddir)/lib/adt/libadt.a \ $(top_builddir)/lib/util/libutil.a tokenizer_driver_LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(tokenizer_driver_LDFLAGS) $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = LEXCOMPILE = $(LEX) $(AM_LFLAGS) $(LFLAGS) AM_V_LEX = $(am__v_LEX_@AM_V@) am__v_LEX_ = $(am__v_LEX_@AM_DEFAULT_V@) am__v_LEX_0 = @echo " LEX " $@; am__v_LEX_1 = YLWRAP = $(top_srcdir)/config/ylwrap SOURCES = $(libtokenizer_a_SOURCES) $(tokenizer_driver_SOURCES) DIST_SOURCES = $(libtokenizer_a_SOURCES) $(tokenizer_driver_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ RL_MAJOR = @RL_MAJOR@ RL_MINOR = @RL_MINOR@ RL_VERSION = @RL_VERSION@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ YACC = @YACC@ YFLAGS = @YFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CFLAGS = \ -I$(top_srcdir)/lib/adt \ -I$(top_srcdir)/lib/util #AM_LFLAGS = -Pxx -olex.yy.c # create the input library noinst_LIBRARIES = libtokenizer.a libtokenizer_a_SOURCES = \ adalexer.l \ clexer.l \ dlexer.l \ tokenizer.c \ tokenizer.h # This is the input driver tokenizer_driver_LDFLAGS = -L. \ -L$(top_builddir)/lib/adt \ -L$(top_builddir)/lib/util tokenizer_driver_LDADD = ./libtokenizer.a \ $(top_builddir)/lib/adt/libadt.a \ $(top_builddir)/lib/util/libutil.a tokenizer_driver_SOURCES = tokenizer_driver.c input_driver_CFLAGS = $(AM_CFLAGS) all: all-am .SUFFIXES: .SUFFIXES: .c .l .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu lib/tokenizer/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu lib/tokenizer/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) libtokenizer.a: $(libtokenizer_a_OBJECTS) $(libtokenizer_a_DEPENDENCIES) $(EXTRA_libtokenizer_a_DEPENDENCIES) $(AM_V_at)-rm -f libtokenizer.a $(AM_V_AR)$(libtokenizer_a_AR) libtokenizer.a $(libtokenizer_a_OBJECTS) $(libtokenizer_a_LIBADD) $(AM_V_at)$(RANLIB) libtokenizer.a clean-noinstPROGRAMS: -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) tokenizer_driver$(EXEEXT): $(tokenizer_driver_OBJECTS) $(tokenizer_driver_DEPENDENCIES) $(EXTRA_tokenizer_driver_DEPENDENCIES) @rm -f tokenizer_driver$(EXEEXT) $(AM_V_CCLD)$(tokenizer_driver_LINK) $(tokenizer_driver_OBJECTS) $(tokenizer_driver_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/adalexer.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/clexer.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dlexer.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tokenizer.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tokenizer_driver.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .l.c: $(AM_V_LEX)$(am__skiplex) $(SHELL) $(YLWRAP) $< $(LEX_OUTPUT_ROOT).c $@ -- $(LEXCOMPILE) ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LIBRARIES) $(PROGRAMS) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -rm -f adalexer.c -rm -f clexer.c -rm -f dlexer.c clean: clean-am clean-am: clean-generic clean-noinstLIBRARIES clean-noinstPROGRAMS \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ clean-noinstLIBRARIES clean-noinstPROGRAMS cscopelist-am ctags \ ctags-am distclean distclean-compile distclean-generic \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: cgdb-0.6.7/lib/tokenizer/tokenizer.c000644 000765 000024 00000007241 12074441140 020347 0ustar00mmuellerstaff000000 000000 #include "tokenizer.h" #include "sys_util.h" #include #include /* Some default file extensions */ char *c_extensions[] = { ".c", ".C", ".cc", ".cpp", ".cxx", ".c++", ".h", ".hpp", ".hxx", ".hh", ".ipp", ".inl", ".moc" }; char *d_extensions[] = { ".d", ".di" }; char *ada_extensions[] = { ".adb", ".ads", ".ada", ".ADB", ".ADS", ".ADA" }; extern int c_lex(void); extern FILE *c_in; extern char *c_text; extern int d_lex(void); extern FILE *d_in; extern char *d_text; extern int ada_lex(void); extern FILE *ada_in; extern char *ada_text; struct tokenizer { enum tokenizer_language_support lang; int (*tokenizer_lex) (void); FILE **tokenizer_in; char **tokenizer_text; enum tokenizer_type tpacket; struct ibuf *i; }; struct tokenizer *tokenizer_init(void) { struct tokenizer *n = (struct tokenizer *) cgdb_malloc(sizeof (struct tokenizer)); n->i = ibuf_init(); n->lang = TOKENIZER_LANGUAGE_UNKNOWN; n->tokenizer_lex = NULL; n->tokenizer_in = NULL; n->tokenizer_text = NULL; return n; } int tokenizer_set_file(struct tokenizer *t, const char *file, enum tokenizer_language_support l) { if (l < TOKENIZER_ENUM_START_POS || l >= TOKENIZER_LANGUAGE_UNKNOWN) return 0; t->lang = l; if (l == TOKENIZER_LANGUAGE_C) { t->tokenizer_lex = c_lex; t->tokenizer_in = &c_in; t->tokenizer_text = &c_text; } else if (l == TOKENIZER_LANGUAGE_D) { t->tokenizer_lex = d_lex; t->tokenizer_in = &d_in; t->tokenizer_text = &d_text; } else { t->tokenizer_lex = ada_lex; t->tokenizer_in = &ada_in; t->tokenizer_text = &ada_text; } *(t->tokenizer_in) = fopen(file, "r"); if (!(*(t->tokenizer_in))) { fprintf(stderr, "%s:%d tokizer_set_file error", __FILE__, __LINE__); return -1; } return 0; } int tokenizer_get_token(struct tokenizer *t) { if (t == NULL || t->tokenizer_lex == NULL) return 0; t->tpacket = (t->tokenizer_lex) (); ibuf_clear(t->i); ibuf_add(t->i, (const char *) *(t->tokenizer_text)); if (!(t->tpacket)) { fclose(*(t->tokenizer_in)); return 0; } return 1; } enum tokenizer_type tokenizer_get_packet_type(struct tokenizer *t) { return t->tpacket; } const char *tokenizer_get_printable_enum(enum tokenizer_type e) { const char *enum_array[] = { "TOKENIZER_KEYWORD", "TOKENIZER_TYPE", "TOKENIZER_LITERAL", "TOKENIZER_NUMBER", "TOKENIZER_COMMENT", "TOKENIZER_DIRECTIVE", "TOKENIZER_TEXT", "TOKENIZER_NEWLINE" }; if (e >= TOKENIZER_KEYWORD && e < TOKENIZER_ERROR) return enum_array[e - TOKENIZER_ENUM_START_POS]; else if (e == TOKENIZER_ERROR) return "TOKEN ERROR!"; return NULL; } char *tokenizer_get_data(struct tokenizer *t) { char *string = ibuf_get(t->i); return string; } enum tokenizer_language_support tokenizer_get_default_file_type(const char *file_extension) { enum tokenizer_language_support l = TOKENIZER_LANGUAGE_UNKNOWN; int i; if (!file_extension) return TOKENIZER_LANGUAGE_UNKNOWN; for (i = 0; i < sizeof (c_extensions) / sizeof (char *); i++) if (strcmp(file_extension, c_extensions[i]) == 0) l = TOKENIZER_LANGUAGE_C; for (i = 0; i < sizeof (d_extensions) / sizeof (char *); i++) if (strcmp(file_extension, d_extensions[i]) == 0) l = TOKENIZER_LANGUAGE_D; for (i = 0; i < sizeof (ada_extensions) / sizeof (char *); i++) if (strcmp(file_extension, ada_extensions[i]) == 0) l = TOKENIZER_LANGUAGE_ADA; return l; } cgdb-0.6.7/lib/tokenizer/tokenizer.h000644 000765 000024 00000005241 12074441140 020352 0ustar00mmuellerstaff000000 000000 #ifndef __TOKENIZER_H__ #define __TOKENIZER_H__ #include "ibuf.h" struct tokenizer; #define TOKENIZER_ENUM_START_POS 255 enum tokenizer_type { TOKENIZER_KEYWORD = TOKENIZER_ENUM_START_POS, TOKENIZER_TYPE, TOKENIZER_LITERAL, TOKENIZER_NUMBER, TOKENIZER_COMMENT, TOKENIZER_DIRECTIVE, TOKENIZER_TEXT, TOKENIZER_NEWLINE, TOKENIZER_ERROR }; enum tokenizer_language_support { TOKENIZER_LANGUAGE_C = TOKENIZER_ENUM_START_POS, TOKENIZER_LANGUAGE_D, TOKENIZER_LANGUAGE_ADA, TOKENIZER_LANGUAGE_UNKNOWN }; /* tokenizer_init * -------------- * * This initializers a new tokenizer. * * t: The tokenizer object to work on * * Return: It will never fail. */ struct tokenizer *tokenizer_init(void); /* tokenizer_destroy * ----------------- * * This destroy's a tokenizer * * t: The tokenizer object to work on */ void tokenizer_destroy(struct tokenizer *t); /* tokenizer_set_file * ------------------ * * This functions will prepare the tokenizer to parse a particular file. * * t: The tokenizer object to work on * file: The absolute path to the file to tokenize. * * Return: -1 on error. 0 on success */ int tokenizer_set_file(struct tokenizer *t, const char *file, enum tokenizer_language_support l); /* tokenizer_get_token * ------------------- * * This function will get the next token packet from the file. * * t: The tokenizer object to work on * * Return: -1 on error, 0 on end of file, 1 on success */ int tokenizer_get_token(struct tokenizer *t); /* tokenizer_type * -------------- * * This will return the type of token a tokenizer is. * * t: The tokenizer object to work on * * Returns: the token type */ enum tokenizer_type tokenizer_get_packet_type(struct tokenizer *t); /* tokenizer_print_enum * -------------------- * * Returns the string representation of the enum * * e: The enum * * Returns: NULL on error, or the enum on success. */ const char *tokenizer_get_printable_enum(enum tokenizer_type e); /* tokenizer_get_data * ------------------ * * This gets the actual token. * * t: The tokenizer object to work on * * Returns: The token data. This is from the heap. The user must free it. */ char *tokenizer_get_data(struct tokenizer *t); /* tokenizer_get_default_file_type * * This will return the type of file the tokenizer thinks the * extension FILE_EXTENSION belongs too. * * t: The tokenizer object to work on * e: The file extension the tokenizer will use to determine filetype. */ enum tokenizer_language_support tokenizer_get_default_file_type(const char *file_extension); #endif /* __TOKENIZER_H__ */ cgdb-0.6.7/lib/tokenizer/tokenizer_driver.c000644 000765 000024 00000002227 12074441140 021721 0ustar00mmuellerstaff000000 000000 #include #include #include "tokenizer.h" static void usage(void) { printf("tokenizer_driver \n"); exit(-1); } int main(int argc, char **argv) { struct tokenizer *t = tokenizer_init(); int ret; enum tokenizer_language_support l = TOKENIZER_LANGUAGE_UNKNOWN; if (argc != 3) usage(); if (strcmp(argv[2], "c") == 0) l = TOKENIZER_LANGUAGE_C; else if (strcmp(argv[2], "d") == 0) l = TOKENIZER_LANGUAGE_D; else if (strcmp(argv[2], "ada") == 0) l = TOKENIZER_LANGUAGE_ADA; else usage(); if (tokenizer_set_file(t, argv[1], l) == -1) { printf("%s:%d tokenizer_set_file error\n", __FILE__, __LINE__); return -1; } while ((ret = tokenizer_get_token(t)) > 0) { enum tokenizer_type e = tokenizer_get_packet_type(t); printf("Token:\n"); printf("\tNumber: %d\n", e); printf("\tType: %s\n", tokenizer_get_printable_enum(e)); printf("\tData: %s\n", tokenizer_get_data(t)); } if (ret == 0) printf("finished!\n"); else if (ret == -1) printf("Error!\n"); return 0; } cgdb-0.6.7/lib/tgdb/annotate-two/000755 000765 000024 00000000000 12074766277 017540 5ustar00mmuellerstaff000000 000000 cgdb-0.6.7/lib/tgdb/gdbmi/000755 000765 000024 00000000000 12074766277 016202 5ustar00mmuellerstaff000000 000000 cgdb-0.6.7/lib/tgdb/Makefile.am000644 000765 000024 00000000076 12074441140 017132 0ustar00mmuellerstaff000000 000000 SUBDIRS = annotate-two gdbmi tgdb-base EXTRA_DIST = testsuite cgdb-0.6.7/lib/tgdb/Makefile.in000644 000765 000024 00000040463 12074766253 017166 0ustar00mmuellerstaff000000 000000 # Makefile.in generated by automake 1.13.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = lib/tgdb DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am TODO ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/config/readline_check_version.m4 \ $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ RL_MAJOR = @RL_MAJOR@ RL_MINOR = @RL_MINOR@ RL_VERSION = @RL_VERSION@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ YACC = @YACC@ YFLAGS = @YFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = annotate-two gdbmi tgdb-base EXTRA_DIST = testsuite all: all-recursive .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu lib/tgdb/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu lib/tgdb/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. # To change the values of 'make' variables: instead of editing Makefiles, # (1) if the variable is set in 'config.status', edit 'config.status' # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. $(am__recursive_targets): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: .MAKE: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ check-am clean clean-generic cscopelist-am ctags ctags-am \ distclean distclean-generic distclean-tags distdir dvi dvi-am \ html html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ pdf-am ps ps-am tags tags-am uninstall uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: cgdb-0.6.7/lib/tgdb/testsuite/000755 000765 000024 00000000000 12074441140 017124 5ustar00mmuellerstaff000000 000000 cgdb-0.6.7/lib/tgdb/tgdb-base/000755 000765 000024 00000000000 12074766277 016750 5ustar00mmuellerstaff000000 000000 cgdb-0.6.7/lib/tgdb/TODO000644 000765 000024 00000010374 12074441140 015570 0ustar00mmuellerstaff000000 000000 -- Get bison/yacc autoconf not be found to be an error 1.0 Proposal * stack window tgdb 0.6.0 ---------- * Modify the readline library to be context driven. * Make all dependencies of TGDB be context driven. ( util library ... ) tgdb 0.5.0 ---------- * Change CGDB/TGDB to return to the user the appropriate error codes. For instance, a user had "read-only" permission of a2_gdb_init instead of saying why TGDB couldn't open the file, or showing the error stack trace, CGDB/TGDB just died silently. * Integrate gdbmi stubs into libtgdb and get gdbmi integrated into tgdb * Get assembly language working. * Get tab completion to work through readline ? This is *very* difficult to do. I don't know if it is possible. * Add new structures to types.h that are intended to work with MI * Write internal documentation * standardize the way TGDB returns paths to the front end. As of know, it returns the full path with the relative path. Then it returns a relative path for breakpoints and source files. The front end then needs to look up the full path from the relative path. * Fix bug in TGDB annotate 2 subsystem where it is returning TGDB_ABSOLUTE_SOURCE_DENIED 3 times when it is started with out a program to debug. Should it even return this command at all? tgdb 0.5.0 issues raised by developers --------------------------------------- [ ] Robert Lemmen asked me to remove the config.* files from the releases. They are inappropriate to distribute to the user since they are machine dependent. [x] I received a patch from Santiago Vila that made CGDB work on GNU/HURD. I have to remove all occurrences of PATH_MAX. I can apply the patch for know, or come up with a better all around approach. I removed all occurences of PATH_MAX and replaced them with FSUTIL_PATH_MAX. Ideally, CGDB/TGDB could dynamically create the strings like Santiago pointed out. This should be done eventually. tgdb-0.4.0 and before * Get in touch with 'Ronald Landheer-Cieslak' about Makefile.am patch to build CVS out of the source tree. * Work on webpage for cgdb/tgdb * Make sure mueller's wrap searching feature gets documented. * Standardize tgdb_interface. Maybe change its name. The clients should be able to generate and add commands to the command queue here. The commands should be made cleaner. * Change use of 'struct queue' for tgdb_get_command. * Change all use's of 'struct string' to the proper 'struct ibuf'. * Remove #define MAXLINE in tgdb_types.h, there should be no hard coded constants in TGDB. * Comment all tgdb-base headers to be compliant with doxygen * Get testsuite to install with automake * Add the return value of gdb when returning with TGDB_QUIT_NORMAL * Make 1 quit command. Returning a structure defining how GDB was killed. * Fix tgdb to call the lower level subsystems in an independent way. * Modify the structures, to only contain things like 'const char *' * rename type tgdb_command to tgdb_command_type. * rename type Command to tgdb_command * Add tgdb_get_command() function to the tgdb functions. * Implemented new tgdb_list ADT * Make tgdb use this instead of a queue of items ( breakpoints, frames ... ). * Return new list type to the user to traverse the stuff. * Have a tgdb function that can traverse the commands, printing either all of them. * Have a tgdb function that will free all of the memory returned. * Fix interface to have all functions return an 'int' * Rework tgdb to be able to support multiple types of debugging (annotate,mi). This involves making a better interface to running commands through the debbuger and through readline. * Make annotate-two use the new architecture. This way, gdbmi will integrate easier. This is done, however, there is still no clear interface between annotate and tgdb-base. This needs to be clearly defined before going trying to add gdbmi. * Get configure to only build cgdb, and build the driver programs on request. * Reorganize tgdb to have a separate low level lib for ADT's and for util calls like xmalloc. This is so all programs can use it without linking to libtgdb. * Move rlctx_prog to another directory * Figure out how to make rlctx not require another program to use. * Add a dejagnu testsuite to the annotate_driver and gdbmi_driver This needs to include many more tests. cgdb-0.6.7/lib/tgdb/tgdb-base/driver.c000644 000765 000024 00000031216 12074441140 020365 0ustar00mmuellerstaff000000 000000 #if HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #if HAVE_STDIO_H #include #endif /* HAVE_STDIO_H */ #ifdef HAVE_SYS_TIME_H #include #endif /* Library includes */ #ifdef HAVE_SYS_SELECT_H #include #endif #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #if HAVE_ERRNO_H #include #endif /* HAVE_ERRNO_H */ #if HAVE_SIGNAL_H #include #endif #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ /* Local includes */ #include "tgdb.h" #include "logger.h" #include "io.h" #include "terminal.h" #include "rline.h" #include "queue.h" #include "fork_util.h" #define MAXLINE 4096 struct tgdb *tgdb; /** Master/Slave PTY used to keep readline off of stdin/stdout. */ static pty_pair_ptr pty_pair; /* Readline interface */ static struct rline *rline; static int is_tab_completing = 0; /* Original terminal attributes */ static struct termios term_attributes; /* Run or queue a TGDB command */ static int handle_request(struct tgdb *tgdb, struct tgdb_request *request) { int val, is_busy; if (!tgdb || !request) return -1; val = tgdb_is_busy(tgdb, &is_busy); if (val == -1) return -1; if (is_busy) tgdb_queue_append(tgdb, request); else tgdb_process_command(tgdb, request); return 0; } static void change_prompt(char *prompt) { rline_set_prompt(rline, prompt); } static void rlctx_send_user_command(char *line) { tgdb_request_ptr request_ptr; /* This happens when rl_callback_read_char gets EOF */ if (line == NULL) return; /* Don't add the enter command */ if (line && *line != '\0') rline_add_history(rline, line); /* Send this command to TGDB */ request_ptr = tgdb_request_run_console_command(tgdb, line); if (!request_ptr) logger_write_pos(logger, __FILE__, __LINE__, "rlctx_send_user_command\n"); handle_request(tgdb, request_ptr); } static int tab_completion(int a, int b) { char *cur_line; int ret; tgdb_request_ptr request_ptr; is_tab_completing = 1; ret = rline_get_current_line(rline, &cur_line); if (ret == -1) logger_write_pos(logger, __FILE__, __LINE__, "rline_get_current_line error\n"); request_ptr = tgdb_request_complete(tgdb, cur_line); if (!request_ptr) logger_write_pos(logger, __FILE__, __LINE__, "tgdb_request_complete error\n"); handle_request(tgdb, request_ptr); return 0; } /** * This is the function responsible for display the readline completions when there * is more than 1 item to complete. Currently it prints 1 per line. */ static void readline_completion_display_func(char **matches, int num_matches, int max_length) { int i; printf("\n"); for (i = 1; i <= num_matches; ++i) { printf("%s", matches[i]); printf("\n"); } } int do_tab_completion(struct tgdb_list *list) { if (rline_rl_complete(rline, list, &readline_completion_display_func) == -1) { logger_write_pos(logger, __FILE__, __LINE__, "rline_rl_complete error\n"); return -1; } is_tab_completing = 0; return 0; } static void signal_handler(int signo) { if (signo == SIGINT) rline_clear(rline); if (signo == SIGINT || signo == SIGTERM || signo == SIGQUIT) tgdb_signal_notification(tgdb, signo); is_tab_completing = 0; } /* Sets up the signal handler for SIGWINCH * Returns -1 on error. Or 0 on success */ static int set_up_signal(void) { struct sigaction action; action.sa_handler = signal_handler; sigemptyset(&action.sa_mask); action.sa_flags = 0; if (sigaction(SIGINT, &action, NULL) < 0) { logger_write_pos(logger, __FILE__, __LINE__, "sigaction failed "); return -1; } if (sigaction(SIGTERM, &action, NULL) < 0) { logger_write_pos(logger, __FILE__, __LINE__, "sigaction failed "); return -1; } if (sigaction(SIGQUIT, &action, NULL) < 0) { logger_write_pos(logger, __FILE__, __LINE__, "sigaction failed "); return -1; } return 0; } static void driver_prompt_change(const char *new_prompt) { char *nprompt = (char *) new_prompt; change_prompt(nprompt); } static int gdb_input(void) { char buf[MAXLINE]; size_t size; size_t i; struct tgdb_response *item; int is_finished; if ((size = tgdb_process(tgdb, buf, MAXLINE, &is_finished)) == -1) { logger_write_pos(logger, __FILE__, __LINE__, "file descriptor closed"); return -1; } /* end if */ for (i = 0; i < size; ++i) { if (write(STDOUT_FILENO, &(buf[i]), 1) != 1) { logger_write_pos(logger, __FILE__, __LINE__, "could not write byte"); return -1; } } /*tgdb_traverse_responses ( tgdb ); */ while ((item = tgdb_get_response(tgdb)) != NULL) { if (item->header == TGDB_UPDATE_COMPLETIONS) { struct tgdb_list *list = item->choice.update_completions.completion_list; do_tab_completion(list); } if (item->header == TGDB_UPDATE_CONSOLE_PROMPT_VALUE) driver_prompt_change(item->choice.update_console_prompt_value. prompt_value); if (item->header == TGDB_QUIT) { fprintf(stderr, "%s:%d TGDB_QUIT\n", __FILE__, __LINE__); return -1; } } if (is_finished) { int size; tgdb_queue_size(tgdb, &size); if (size > 0) { struct tgdb_request *request = tgdb_queue_pop(tgdb); char *prompt; rline_get_prompt(rline, &prompt); printf("%s", prompt); if (request->header == TGDB_REQUEST_CONSOLE_COMMAND) { printf("%s", request->choice.console_command.command); printf("\n"); } tgdb_process_command(tgdb, request); } else rline_rl_forced_update_display(rline); } return 0; } static void tty_input(void) { char buf[MAXLINE]; size_t size; size_t i; if ((size = tgdb_recv_inferior_data(tgdb, buf, MAXLINE)) == -1) { logger_write_pos(logger, __FILE__, __LINE__, "file descriptor closed"); return; } /* end if */ for (i = 0; i < size; ++i) if (write(STDOUT_FILENO, &(buf[i]), 1) != 1) { logger_write_pos(logger, __FILE__, __LINE__, "could not write byte"); return; } } static int readline_input() { char buf[MAXLINE]; size_t size; size_t i; int masterfd = pty_pair_get_masterfd(pty_pair); if (masterfd == -1) { logger_write_pos(logger, __FILE__, __LINE__, "pty_pair_get_masterfd error"); return -1; } size = read(masterfd, buf, MAXLINE - 1); if (size == -1) { logger_write_pos(logger, __FILE__, __LINE__, "read error"); return -1; } buf[size] = 0; /* Display GDB output * The strlen check is here so that if_print does not get called * when displaying the filedlg. If it does get called, then the * gdb window gets displayed when the filedlg is up */ for (i = 0; i < size; ++i) if (write(STDOUT_FILENO, &(buf[i]), 1) != 1) { logger_write_pos(logger, __FILE__, __LINE__, "could not write byte"); return -1; } return 0; } static int stdin_input() { char buf[MAXLINE]; size_t size; size_t i; int masterfd = pty_pair_get_masterfd(pty_pair); if (masterfd == -1) { logger_write_pos(logger, __FILE__, __LINE__, "pty_pair_get_masterfd error"); return -1; } size = read(STDIN_FILENO, buf, MAXLINE - 1); if (size == -1) { logger_write_pos(logger, __FILE__, __LINE__, "read error"); return -1; } buf[size] = 0; /* Display GDB output * The strlen check is here so that if_print does not get called * when displaying the filedlg. If it does get called, then the * gdb window gets displayed when the filedlg is up */ for (i = 0; i < size; ++i) if (write(masterfd, &(buf[i]), 1) != 1) { logger_write_pos(logger, __FILE__, __LINE__, "could not write byte"); return -1; } return 0; return 0; } int main_loop(int gdbfd, int childfd) { int max; fd_set rfds; int result; int masterfd, slavefd; masterfd = pty_pair_get_masterfd(pty_pair); if (masterfd == -1) { logger_write_pos(logger, __FILE__, __LINE__, "pty_pair_get_masterfd error"); return -1; } slavefd = pty_pair_get_slavefd(pty_pair); if (slavefd == -1) { logger_write_pos(logger, __FILE__, __LINE__, "pty_pair_get_slavefd error"); return -1; } /* When TGDB is ready, we read from STDIN, otherwise, leave the data buffered. */ /* get max fd for select loop */ max = (gdbfd > STDIN_FILENO) ? gdbfd : STDIN_FILENO; max = (max > childfd) ? max : childfd; max = (max > slavefd) ? max : slavefd; max = (max > masterfd) ? max : masterfd; while (1) { /* Clear the set and * * READ FROM: * stdin (user or gui) * master (gdb's stdout) * gui_stdout (gui's stdout sending new info) * */ FD_ZERO(&rfds); /* Let the terminal emulate the char's when TGDB is busy */ FD_SET(STDIN_FILENO, &rfds); FD_SET(gdbfd, &rfds); FD_SET(slavefd, &rfds); FD_SET(masterfd, &rfds); if (childfd != -1) FD_SET(childfd, &rfds); result = select(max + 1, &rfds, NULL, NULL, NULL); /* if the signal interuppted system call keep going */ if (result == -1 && errno == EINTR) continue; else if (result == -1) /* on error ... must die -> stupid OS */ logger_write_pos(logger, __FILE__, __LINE__, "select failed"); /* Input received through the pty: Handle it * Readline read from slavefd, and it wrote to the masterfd. */ if (FD_ISSET(masterfd, &rfds)) if (readline_input() == -1) return -1; if (FD_ISSET(slavefd, &rfds)) rline_rl_callback_read_char(rline); /* stdin -> readline input */ if (FD_ISSET(STDIN_FILENO, &rfds)) { stdin_input(); } /* child's output -> stdout */ if (childfd != -1 && FD_ISSET(childfd, &rfds)) { tty_input(); continue; } /* gdb's output -> stdout */ if (FD_ISSET(gdbfd, &rfds)) if (gdb_input() == -1) return -1; } return 0; } int main(int argc, char **argv) { int gdb_fd, child_fd, slavefd, masterfd; #if 0 int c; read(0, &c, 1); #endif if (tty_cbreak(STDIN_FILENO, &term_attributes) == -1) logger_write_pos(logger, __FILE__, __LINE__, "tty_cbreak error"); pty_pair = pty_pair_create(); if (!pty_pair) { fprintf(stderr, "%s:%d Unable to create PTY pair", __FILE__, __LINE__); exit(-1); } slavefd = pty_pair_get_slavefd(pty_pair); if (slavefd == -1) { fprintf(stderr, "%s:%d Unable to get slavefd", __FILE__, __LINE__); exit(-1); } masterfd = pty_pair_get_masterfd(pty_pair); if (masterfd == -1) { fprintf(stderr, "%s:%d Unable to get masterfd", __FILE__, __LINE__); exit(-1); } if (tty_off_xon_xoff(masterfd) == -1) exit(-1); rline = rline_initialize(slavefd, rlctx_send_user_command, tab_completion, getenv("TERM")); if ((tgdb = tgdb_initialize(NULL, argc - 1, argv + 1, &gdb_fd, &child_fd)) == NULL) { logger_write_pos(logger, __FILE__, __LINE__, "tgdb_start error"); goto driver_end; } if (tgdb_set_verbose_error_handling(tgdb, 1) != 1) { logger_write_pos(logger, __FILE__, __LINE__, "driver error"); goto driver_end; } /* Ask TGDB to print error messages */ if (tgdb_set_verbose_gui_command_output(tgdb, 1) != 1) { logger_write_pos(logger, __FILE__, __LINE__, "driver error"); goto driver_end; } set_up_signal(); main_loop(gdb_fd, child_fd); if (tgdb_shutdown(tgdb) == -1) logger_write_pos(logger, __FILE__, __LINE__, "could not shutdown"); driver_end: if (tty_set_attributes(STDIN_FILENO, &term_attributes) == -1) logger_write_pos(logger, __FILE__, __LINE__, "tty_reset error"); return 0; } cgdb-0.6.7/lib/tgdb/tgdb-base/Makefile.am000644 000765 000024 00000002000 12074441140 020747 0ustar00mmuellerstaff000000 000000 AM_CFLAGS = \ -I$(top_srcdir)/lib/adt \ -I$(top_srcdir)/lib/rline \ -I$(top_srcdir)/lib/util \ -I$(top_srcdir)/lib/tgdb/annotate-two \ -I$(top_srcdir)/lib/tgdb/gdbmi \ -I$(top_srcdir)/lib/tgdb/tgdb-base noinst_LIBRARIES = libtgdb.a libtgdb_a_SOURCES = \ tgdb.c \ tgdb.h \ tgdb_client_interface.c \ tgdb_client_interface.h \ tgdb_command.c \ tgdb_command.h \ tgdb_types.c \ tgdb_types.h noinst_PROGRAMS = tgdb_driver tgdb_driver_LDFLAGS = \ -L$(top_builddir)/lib/adt \ -L$(top_builddir)/lib/rline \ -L$(top_builddir)/lib/util \ -L$(top_builddir)/lib/tgdb/annotate-two \ -L$(top_builddir)/lib/tgdb/gdbmi \ -L$(top_builddir)/lib/tgdb/tgdb-base tgdb_driver_LDADD = \ libtgdb.a \ $(top_builddir)/lib/tgdb/annotate-two/libtgdb_a2.a \ $(top_builddir)/lib/tgdb/gdbmi/libtgdb_mi.a \ $(top_builddir)/lib/rline/librline.a \ $(top_builddir)/lib/adt/libadt.a \ $(top_builddir)/lib/util/libutil.a tgdb_driver_SOURCES = driver.c cgdb-0.6.7/lib/tgdb/tgdb-base/Makefile.in000644 000765 000024 00000041256 12074766253 021017 0ustar00mmuellerstaff000000 000000 # Makefile.in generated by automake 1.13.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ noinst_PROGRAMS = tgdb_driver$(EXEEXT) subdir = lib/tgdb/tgdb-base DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/config/depcomp ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/config/readline_check_version.m4 \ $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LIBRARIES = $(noinst_LIBRARIES) AR = ar ARFLAGS = cru AM_V_AR = $(am__v_AR_@AM_V@) am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@) am__v_AR_0 = @echo " AR " $@; am__v_AR_1 = libtgdb_a_AR = $(AR) $(ARFLAGS) libtgdb_a_LIBADD = am_libtgdb_a_OBJECTS = tgdb.$(OBJEXT) tgdb_client_interface.$(OBJEXT) \ tgdb_command.$(OBJEXT) tgdb_types.$(OBJEXT) libtgdb_a_OBJECTS = $(am_libtgdb_a_OBJECTS) PROGRAMS = $(noinst_PROGRAMS) am_tgdb_driver_OBJECTS = driver.$(OBJEXT) tgdb_driver_OBJECTS = $(am_tgdb_driver_OBJECTS) tgdb_driver_DEPENDENCIES = libtgdb.a \ $(top_builddir)/lib/tgdb/annotate-two/libtgdb_a2.a \ $(top_builddir)/lib/tgdb/gdbmi/libtgdb_mi.a \ $(top_builddir)/lib/rline/librline.a \ $(top_builddir)/lib/adt/libadt.a \ $(top_builddir)/lib/util/libutil.a tgdb_driver_LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(tgdb_driver_LDFLAGS) $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libtgdb_a_SOURCES) $(tgdb_driver_SOURCES) DIST_SOURCES = $(libtgdb_a_SOURCES) $(tgdb_driver_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ RL_MAJOR = @RL_MAJOR@ RL_MINOR = @RL_MINOR@ RL_VERSION = @RL_VERSION@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ YACC = @YACC@ YFLAGS = @YFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CFLAGS = \ -I$(top_srcdir)/lib/adt \ -I$(top_srcdir)/lib/rline \ -I$(top_srcdir)/lib/util \ -I$(top_srcdir)/lib/tgdb/annotate-two \ -I$(top_srcdir)/lib/tgdb/gdbmi \ -I$(top_srcdir)/lib/tgdb/tgdb-base noinst_LIBRARIES = libtgdb.a libtgdb_a_SOURCES = \ tgdb.c \ tgdb.h \ tgdb_client_interface.c \ tgdb_client_interface.h \ tgdb_command.c \ tgdb_command.h \ tgdb_types.c \ tgdb_types.h tgdb_driver_LDFLAGS = \ -L$(top_builddir)/lib/adt \ -L$(top_builddir)/lib/rline \ -L$(top_builddir)/lib/util \ -L$(top_builddir)/lib/tgdb/annotate-two \ -L$(top_builddir)/lib/tgdb/gdbmi \ -L$(top_builddir)/lib/tgdb/tgdb-base tgdb_driver_LDADD = \ libtgdb.a \ $(top_builddir)/lib/tgdb/annotate-two/libtgdb_a2.a \ $(top_builddir)/lib/tgdb/gdbmi/libtgdb_mi.a \ $(top_builddir)/lib/rline/librline.a \ $(top_builddir)/lib/adt/libadt.a \ $(top_builddir)/lib/util/libutil.a tgdb_driver_SOURCES = driver.c all: all-am .SUFFIXES: .SUFFIXES: .c .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu lib/tgdb/tgdb-base/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu lib/tgdb/tgdb-base/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) libtgdb.a: $(libtgdb_a_OBJECTS) $(libtgdb_a_DEPENDENCIES) $(EXTRA_libtgdb_a_DEPENDENCIES) $(AM_V_at)-rm -f libtgdb.a $(AM_V_AR)$(libtgdb_a_AR) libtgdb.a $(libtgdb_a_OBJECTS) $(libtgdb_a_LIBADD) $(AM_V_at)$(RANLIB) libtgdb.a clean-noinstPROGRAMS: -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) tgdb_driver$(EXEEXT): $(tgdb_driver_OBJECTS) $(tgdb_driver_DEPENDENCIES) $(EXTRA_tgdb_driver_DEPENDENCIES) @rm -f tgdb_driver$(EXEEXT) $(AM_V_CCLD)$(tgdb_driver_LINK) $(tgdb_driver_OBJECTS) $(tgdb_driver_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/driver.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tgdb.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tgdb_client_interface.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tgdb_command.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tgdb_types.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LIBRARIES) $(PROGRAMS) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-noinstLIBRARIES clean-noinstPROGRAMS \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ clean-noinstLIBRARIES clean-noinstPROGRAMS cscopelist-am ctags \ ctags-am distclean distclean-compile distclean-generic \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: cgdb-0.6.7/lib/tgdb/tgdb-base/tgdb.c000644 000765 000024 00000114231 12074711270 020015 0ustar00mmuellerstaff000000 000000 /* Includes {{{ */ #if HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_SIGNAL_H #include /* sig_atomic_t */ #endif /* HAVE_SIGNAL_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #if HAVE_SYS_TYPES_H #include #endif #if HAVE_SYS_WAIT_H #include #endif #include "tgdb.h" #include "tgdb_command.h" #include "tgdb_client_interface.h" #include "fs_util.h" #include "ibuf.h" #include "io.h" #include "queue.h" #include "pseudo.h" /* SLAVE_SIZE constant */ #include "fork_util.h" #include "sys_util.h" #include "tgdb_list.h" #include "logger.h" /* }}} */ static int num_loggers = 0; /* struct tgdb {{{ */ /** * The TGDB context data structure. */ struct tgdb { /** A client context to abstract the debugger. */ struct tgdb_client_context *tcc; /** Reading from this will read from the debugger's output */ int debugger_stdout; /** Writing to this will write to the debugger's stdin */ int debugger_stdin; /** Reading from this will read the stdout from the program being debugged */ int inferior_stdout; /** Writing to this will write to the stdin of the program being debugged */ int inferior_stdin; /*************************************************************************** * All the queue's the clients can run commands through * The different queue's can be slightly confusing. **************************************************************************/ /** * The commands that need to be run through GDB. * * This is a buffered queue that represents all of the commands that TGDB * needs to execute. These commands will be executed one at a time. That is, * 1 command will be issued, and TGDB will wait for the entire response before * issuing any more commands. It is even possible that while this command is * executing, that the client context will add commands to the * oob_command_queue. If this happens TGDB will execute all of the commands * in the oob_command_queue before executing the next command in this queue. */ struct queue *gdb_input_queue; /** * The commands that the client has requested to run. * * TGDB buffers all of the commands that the FE wants to run. That is, * if the FE is sending commands faster than TGDB can pass the command to * GDB and get a response, then the commands are buffered until it is there * turn to run. These commands are run in the order that they are recieved. * * This is here as a convience to the FE. TGDB currently does not access * these commands. It provides the push/pop functionality and it erases the * queue when a control_c is received. */ struct queue *gdb_client_request_queue; /** * The out of band input queue. * * These commands are used by the client context. When a single client context * command is run, sometimes it will discover that it needs to run other commands * in order to satisfy the functionality requested by the GUI. For instance, a * single GUI function request could take N client context commands to generate * a response. Also, to make things worse, sometimes the client context doesn't * know if it will take 1 or N commands to satisfy the request until after it has * sent and recieved the information from the first command. Thus, while the * client context is processing the first command, it may add more commands to * this queue to specify that these commands need to be run before any other * commands are sent to GDB. * * These commands should *always* be run first. */ struct queue *oob_input_queue; /** These are 2 very important state variables. */ /** * If set to 1, libtgdb thinks the lower level subsystem is capable of * recieving another command. It needs this so that it doesn't send 2 * commands to the lower level before it can say it can't recieve a command. * At some point, maybe this can be removed? * When its set to 0, libtgdb thinks it can not send the lower level another * command. */ int IS_SUBSYSTEM_READY_FOR_NEXT_COMMAND; /** If ^c was hit by user */ sig_atomic_t control_c; /** * This is the last GUI command that has been run. * It is used to display to the client the GUI commands. * * It will either be NULL when it is not set or it should be * the last GUI command run. If it is non-NULL it should be from the heap. * As anyone is allowed to call free on it. */ char *last_gui_command; /** * This is a TGDB option. * It determines if the user wants to see the commands the GUI is running. * * If it is 0, the user does not want to see the commands the GUI is * running. Otherwise, if it is 1, it does. */ int show_gui_commands; /** * This is the queue of commands TGDB has currently made to give to the * front end. */ struct tgdb_list *command_list; /** An iterator into command_list. */ tgdb_list_iterator *command_list_iterator; /** * When GDB dies (purposely or not), the SIGCHLD is sent to the application controlling TGDB. * This data structure represents the fact that SIGCHLD has been sent. * * This currently does not need to track if more than 1 SIGCHLD has been received. So * no matter how many are receieved, this will only be 1. Otherwise if none have been * received this will be 0. */ int has_sigchld_recv; }; /* }}} */ /* Temporary prototypes {{{ */ static int tgdb_deliver_command(struct tgdb *tgdb, struct tgdb_command *command); static int tgdb_unqueue_and_deliver_command(struct tgdb *tgdb); static int tgdb_run_or_queue_command(struct tgdb *tgdb, struct tgdb_command *com); /* }}} */ /** * Process the commands that were created by the client * * \param tgdb * The TGDB context * * \return * -1 on error, 0 on success */ static int tgdb_process_client_commands(struct tgdb *tgdb) { struct tgdb_list *client_command_list; tgdb_list_iterator *iterator; struct tgdb_command *command; client_command_list = tgdb_client_get_client_commands(tgdb->tcc); iterator = tgdb_list_get_first(client_command_list); while (iterator) { command = (struct tgdb_command *) tgdb_list_get_item(iterator); if (tgdb_run_or_queue_command(tgdb, command) == -1) { logger_write_pos(logger, __FILE__, __LINE__, "tgdb_run_or_queue_command failed"); return -1; } iterator = tgdb_list_next(iterator); } /* free the list of client commands */ tgdb_list_clear(client_command_list); return 0; } static struct tgdb *initialize_tgdb_context(void) { struct tgdb *tgdb = (struct tgdb *) cgdb_malloc(sizeof (struct tgdb)); tgdb->tcc = NULL; tgdb->control_c = 0; tgdb->debugger_stdout = -1; tgdb->debugger_stdin = -1; tgdb->inferior_stdout = -1; tgdb->inferior_stdin = -1; tgdb->gdb_client_request_queue = NULL; tgdb->gdb_input_queue = NULL; tgdb->oob_input_queue = NULL; tgdb->IS_SUBSYSTEM_READY_FOR_NEXT_COMMAND = 1; tgdb->last_gui_command = NULL; tgdb->show_gui_commands = 0; tgdb->command_list = tgdb_list_init(); tgdb->has_sigchld_recv = 0; logger = NULL; return tgdb; } /******************************************************************************* * This is the basic initialization ******************************************************************************/ /* * Gets the users home dir and creates the config directory. * * \param tgdb * The tgdb context. * * \param config_dir * Should be FSUTIL_PATH_MAX in size on way in. * On way out, it will be the path to the config dir * * \return * -1 on error, or 0 on success */ static int tgdb_initialize_config_dir(struct tgdb *tgdb, char *config_dir) { /* Get the home directory */ char *home_dir = getenv("HOME"); const char *tgdb_dir = ".tgdb"; /* Create the config directory */ if (!fs_util_create_dir_in_base(home_dir, tgdb_dir)) { logger_write_pos(logger, __FILE__, __LINE__, "fs_util_create_dir_in_base error"); return -1; } fs_util_get_path(home_dir, tgdb_dir, config_dir); return 0; } /** * Knowing the user's home directory, TGDB can initialize the logger interface * * \param tgdb * The tgdb context. * * \param config_dir * The path to the user's config directory * * \return * -1 on error, or 0 on success */ static int tgdb_initialize_logger_interface(struct tgdb *tgdb, char *config_dir) { /* Get the home directory */ const char *tgdb_log_file = "tgdb_log.txt"; char tgdb_log_path[FSUTIL_PATH_MAX]; fs_util_get_path(config_dir, tgdb_log_file, tgdb_log_path); /* Initialize the logger */ if (num_loggers == 0) { logger = logger_create(); if (!logger) { printf("Error: Could not create log file\n"); return -1; } } ++num_loggers; if (logger_set_file(logger, tgdb_log_path) == -1) { printf("Error: Could not open log file\n"); return -1; } return 0; } /* Createing and Destroying a libtgdb context. {{{*/ struct tgdb *tgdb_initialize(const char *debugger, int argc, char **argv, int *debugger_fd, int *inferior_fd) { /* Initialize the libtgdb context */ struct tgdb *tgdb = initialize_tgdb_context(); char config_dir[FSUTIL_PATH_MAX]; /* Create config directory */ if (tgdb_initialize_config_dir(tgdb, config_dir) == -1) { logger_write_pos(logger, __FILE__, __LINE__, "tgdb_initialize error"); return NULL; } if (tgdb_initialize_logger_interface(tgdb, config_dir) == -1) { printf("Could not initialize logger interface\n"); return NULL; } tgdb->gdb_client_request_queue = queue_init(); tgdb->gdb_input_queue = queue_init(); tgdb->oob_input_queue = queue_init(); tgdb->tcc = tgdb_client_create_context(debugger, argc, argv, config_dir, TGDB_CLIENT_DEBUGGER_GNU_GDB, TGDB_CLIENT_PROTOCOL_GNU_GDB_ANNOTATE_TWO, logger); /* create an instance and initialize a tgdb_client_context */ if (tgdb->tcc == NULL) { logger_write_pos(logger, __FILE__, __LINE__, "tgdb_client_create_context failed"); return NULL; } if (tgdb_client_initialize_context(tgdb->tcc, &(tgdb->debugger_stdin), &(tgdb->debugger_stdout), &(tgdb->inferior_stdin), &(tgdb->inferior_stdout)) == -1) { logger_write_pos(logger, __FILE__, __LINE__, "tgdb_client_initialize failed"); return NULL; } tgdb_process_client_commands(tgdb); *debugger_fd = tgdb->debugger_stdout; *inferior_fd = tgdb->inferior_stdout; return tgdb; } int tgdb_shutdown(struct tgdb *tgdb) { /* Free the logger */ if (num_loggers == 1) { if (logger_destroy(logger) == -1) { printf("Could not destroy logger interface\n"); return -1; } } --num_loggers; return tgdb_client_destroy_context(tgdb->tcc); } /* }}}*/ char *tgdb_err_msg(struct tgdb *tgdb) { return NULL; } void command_completion_callback(struct tgdb *tgdb) { tgdb->IS_SUBSYSTEM_READY_FOR_NEXT_COMMAND = 1; } static char *tgdb_get_client_command(struct tgdb *tgdb, enum tgdb_command_type c) { return tgdb_client_return_command(tgdb->tcc, c); } static char *tgdb_client_modify_breakpoint_call(struct tgdb *tgdb, const char *file, int line, enum tgdb_breakpoint_action b) { return tgdb_client_modify_breakpoint(tgdb->tcc, file, line, b); } /* These functions are used to determine the state of libtgdb */ /** * Determines if tgdb should send data to gdb or put it in a buffer. This * is when the debugger is ready and there are no commands to run. * * \return * 1 if can issue directly to gdb. Otherwise 0. */ static int tgdb_can_issue_command(struct tgdb *tgdb) { if (tgdb->IS_SUBSYSTEM_READY_FOR_NEXT_COMMAND && tgdb_client_is_client_ready(tgdb->tcc) && (queue_size(tgdb->gdb_input_queue) == 0)) return 1; return 0; } /** * Determines if tgdb has commands it needs to run. * * \return * 1 if can issue directly to gdb. Otherwise 0. */ static int tgdb_has_command_to_run(struct tgdb *tgdb) { if (tgdb_client_is_client_ready(tgdb->tcc) && ((queue_size(tgdb->gdb_input_queue) > 0) || (queue_size(tgdb->oob_input_queue) > 0))) return 1; return 0; } int tgdb_is_busy(struct tgdb *tgdb, int *is_busy) { /* Validate parameters */ if (!tgdb || !is_busy) { logger_write_pos(logger, __FILE__, __LINE__, "tgdb_is_busy failed"); return -1; } if (tgdb_can_issue_command(tgdb) == 1) *is_busy = 0; else *is_busy = 1; return 0; } static void tgdb_request_destroy(void *item) { tgdb_request_ptr request_ptr = (tgdb_request_ptr) item; switch (request_ptr->header) { case TGDB_REQUEST_CONSOLE_COMMAND: free((char *) request_ptr->choice.console_command.command); request_ptr->choice.console_command.command = NULL; break; case TGDB_REQUEST_INFO_SOURCES: break; case TGDB_REQUEST_FILENAME_PAIR: free((char *) request_ptr->choice.filename_pair.file); request_ptr->choice.filename_pair.file = NULL; break; case TGDB_REQUEST_DEBUGGER_COMMAND: break; case TGDB_REQUEST_MODIFY_BREAKPOINT: free((char *) request_ptr->choice.modify_breakpoint.file); request_ptr->choice.modify_breakpoint.file = NULL; break; case TGDB_REQUEST_COMPLETE: free((char *) request_ptr->choice.complete.line); request_ptr->choice.complete.line = NULL; break; default: break; } free(request_ptr); request_ptr = NULL; } /* tgdb_handle_signals */ static int tgdb_handle_signals(struct tgdb *tgdb) { if (tgdb->control_c) { queue_free_list(tgdb->gdb_input_queue, tgdb_command_destroy); queue_free_list(tgdb->gdb_client_request_queue, tgdb_request_destroy); tgdb->control_c = 0; } return 0; } /******************************************************************************* * This is the main_loop stuff for tgdb-base ******************************************************************************/ /* * Sends a command to the debugger. This function gets called when the GUI * wants to run a command. * * \param tgdb * An instance of the tgdb library to operate on. * * \param command * This is the command that should be sent to the debugger. * * \param command_choice * This tells tgdb_send who is sending the command. * * \return * 0 on success, or -1 on error. */ static int tgdb_send(struct tgdb *tgdb, char *command, enum tgdb_command_choice command_choice) { struct tgdb_command *tc; struct ibuf *temp_command = ibuf_init(); int length = strlen(command); /* Add a newline to the end of the command if it doesn't exist */ ibuf_add(temp_command, command); if (command[length - 1] != '\n') ibuf_addchar(temp_command, '\n'); /* Create the client command */ tc = tgdb_command_create(ibuf_get(temp_command), command_choice, NULL); ibuf_free(temp_command); temp_command = NULL; if (tgdb_run_or_queue_command(tgdb, tc) == -1) { logger_write_pos(logger, __FILE__, __LINE__, "tgdb_run_or_queue_command failed"); return -1; } if (tgdb_client_tgdb_ran_command(tgdb->tcc) == -1) { logger_write_pos(logger, __FILE__, __LINE__, "tgdb_client_tgdb_ran_command failed"); return -1; } tgdb_process_client_commands(tgdb); return 0; } /** * If TGDB is ready to process another command, then this command will be * sent to the debugger. However, if TGDB is not ready to process another command, * then the command will be queued and run when TGDB is ready. * * \param tgdb * The TGDB context to use. * * \param command * The command to run or queue. * * \return * 0 on success or -1 on error */ static int tgdb_run_or_queue_command(struct tgdb *tgdb, struct tgdb_command *command) { int can_issue; can_issue = tgdb_can_issue_command(tgdb); if (can_issue) { if (tgdb_deliver_command(tgdb, command) == -1) return -1; } else { /* Make sure to put the command into the correct queue. */ switch (command->command_choice) { case TGDB_COMMAND_FRONT_END: case TGDB_COMMAND_TGDB_CLIENT: queue_append(tgdb->gdb_input_queue, command); break; case TGDB_COMMAND_TGDB_CLIENT_PRIORITY: queue_append(tgdb->oob_input_queue, command); break; case TGDB_COMMAND_CONSOLE: logger_write_pos(logger, __FILE__, __LINE__, "unimplemented command"); return -1; break; default: logger_write_pos(logger, __FILE__, __LINE__, "unimplemented command"); return -1; } } return 0; } /** * Will send a command to the debugger immediatly. No queueing will be done * at this point. * * \param tgdb * The TGDB context to use. * * \param command * The command to run. * * NOTE: This function assummes valid commands are being sent to it. * Error checking should be done before inserting into queue. */ static int tgdb_deliver_command(struct tgdb *tgdb, struct tgdb_command *command) { tgdb->IS_SUBSYSTEM_READY_FOR_NEXT_COMMAND = 0; /* Here is where the command is actually given to the debugger. * Before this is done, if the command is a GUI command, we save it, * so that later, it can be printed to the client. Its for debugging * purposes only, or for people who want to know the commands there * debugger is being given. */ if (command->command_choice == TGDB_COMMAND_FRONT_END) tgdb->last_gui_command = cgdb_strdup(command->tgdb_command_data); /* A command for the debugger */ if (tgdb_client_prepare_for_command(tgdb->tcc, command) == -1) return -1; /* A regular command from the client */ io_debug_write_fmt("<%s>", command->tgdb_command_data); io_writen(tgdb->debugger_stdin, command->tgdb_command_data, strlen(command->tgdb_command_data)); /* Uncomment this if you wish to see all of the commands, that are * passed to GDB. */ #if 0 { char *s = strdup(client_command->tgdb_client_command_data); int length = strlen(s); s[length - 1] = '\0'; fprintf(stderr, "[%s]\n", s); s[length - 1] = ' '; free(s); s = NULL; } #endif return 0; } /** * TGDB will search it's command queue's and determine what the next command * to deliever to GDB should be. * * \return * 0 on success, -1 on error */ static int tgdb_unqueue_and_deliver_command(struct tgdb *tgdb) { tgdb_unqueue_and_deliver_command_tag: /* This will redisplay the prompt when a command is run * through the gui with data on the console. */ /* The out of band commands should always be run first */ if (queue_size(tgdb->oob_input_queue) > 0) { /* These commands are always run. * However, if an assumption is made that a misc * prompt can never be set while in this spot. */ struct tgdb_command *item = NULL; item = queue_pop(tgdb->oob_input_queue); tgdb_deliver_command(tgdb, item); tgdb_command_destroy(item); } /* If the queue is not empty, run a command */ else if (queue_size(tgdb->gdb_input_queue) > 0) { struct tgdb_command *item = NULL; item = queue_pop(tgdb->gdb_input_queue); /* If at the misc prompt, don't run the internal tgdb commands, * In fact throw them out for now, since they are only * 'info breakpoints' */ if (tgdb_client_can_tgdb_run_commands(tgdb->tcc) == 1) { if (item->command_choice != TGDB_COMMAND_CONSOLE) { tgdb_command_destroy(item); goto tgdb_unqueue_and_deliver_command_tag; } } /* This happens when a command was skipped because the client no longer * needs the command to be run */ if (tgdb_deliver_command(tgdb, item) == -1) goto tgdb_unqueue_and_deliver_command_tag; tgdb_command_destroy(item); } return 0; } /* These functions are used to communicate with the inferior */ int tgdb_send_inferior_char(struct tgdb *tgdb, char c) { if (io_write_byte(tgdb->inferior_stdout, c) == -1) { logger_write_pos(logger, __FILE__, __LINE__, "io_write_byte failed"); return -1; } return 0; } /* returns to the caller data from the child */ size_t tgdb_recv_inferior_data(struct tgdb * tgdb, char *buf, size_t n) { char local_buf[n + 1]; ssize_t size; /* read all the data possible from the child that is ready. */ if ((size = io_read(tgdb->inferior_stdin, local_buf, n)) < 0) { logger_write_pos(logger, __FILE__, __LINE__, "inferior_fd read failed"); return -1; } strncpy(buf, local_buf, size); buf[size] = '\0'; return size; } /** * TGDB is going to quit. * * \param tgdb * The tgdb context * * \return * 0 on success or -1 on error */ static int tgdb_add_quit_command(struct tgdb *tgdb) { struct tgdb_debugger_exit_status *tstatus; struct tgdb_response *response; tstatus = (struct tgdb_debugger_exit_status *) cgdb_malloc(sizeof (struct tgdb_debugger_exit_status)); /* Child did not exit normally */ tstatus->exit_status = -1; tstatus->return_value = 0; response = (struct tgdb_response *) cgdb_malloc(sizeof (struct tgdb_response)); response->header = TGDB_QUIT; response->choice.quit.exit_status = tstatus; tgdb_types_append_command(tgdb->command_list, response); return 0; } /** * This is called when GDB has finished. * Its job is to add the type of QUIT command that is appropriate. * * \param tgdb * The tgdb context * * \param tgdb_will_quit * This will return as 1 if tgdb sent the TGDB_QUIT command. Otherwise 0. * * \return * 0 on success or -1 on error */ static int tgdb_get_quit_command(struct tgdb *tgdb, int *tgdb_will_quit) { pid_t pid = tgdb_client_get_debugger_pid(tgdb->tcc); int status = 0; pid_t ret; struct tgdb_debugger_exit_status *tstatus; struct tgdb_response *response = (struct tgdb_response *) cgdb_malloc(sizeof (struct tgdb_response)); if (!tgdb_will_quit) return -1; *tgdb_will_quit = 0; tstatus = (struct tgdb_debugger_exit_status *) cgdb_malloc(sizeof (struct tgdb_debugger_exit_status)); ret = waitpid(pid, &status, WNOHANG); if (ret == -1) { logger_write_pos(logger, __FILE__, __LINE__, "waitpid error"); return -1; } else if (ret == 0) { /* This SIGCHLD wasn't for GDB */ return 0; } if ((WIFEXITED(status)) == 0) { /* Child did not exit normally */ tstatus->exit_status = -1; tstatus->return_value = 0; } else { tstatus->exit_status = 0; tstatus->return_value = WEXITSTATUS(status); } response->header = TGDB_QUIT; response->choice.quit.exit_status = tstatus; tgdb_types_append_command(tgdb->command_list, response); *tgdb_will_quit = 1; return 0; } size_t tgdb_process(struct tgdb * tgdb, char *buf, size_t n, int *is_finished) { char local_buf[10 * n]; ssize_t size; size_t buf_size = 0; int is_busy; /* make the queue empty */ tgdb_delete_responses(tgdb); /* TODO: This is kind of a hack. * Since I know that I didn't do a read yet, the next select loop will * get me back here. This probably shouldn't return, however, I have to * re-write a lot of this function. Also, I think this function should * return a malloc'd string, not a static buffer. * * Currently, I see it as a bigger hack to try to just append this to the * beggining of buf. */ if (tgdb->last_gui_command != NULL) { int ret; if (tgdb_is_busy(tgdb, &is_busy) == -1) { logger_write_pos(logger, __FILE__, __LINE__, "tgdb_is_busy failed"); return -1; } *is_finished = !is_busy; if (tgdb->show_gui_commands) { strcpy(buf, tgdb->last_gui_command); ret = strlen(tgdb->last_gui_command); } else { strcpy(buf, "\n"); ret = 1; } free(tgdb->last_gui_command); tgdb->last_gui_command = NULL; return ret; } if (tgdb->has_sigchld_recv) { int tgdb_will_quit; /* tgdb_get_quit_command will return right away, it's asynchrounous. * We call it to determine if it was GDB that died. * If GDB didn't die, things will work like normal. ignore this. * If GDB did die, this get's the quit command and add's it to the list. It's * OK that the rest of this function get's executed, since the read will simply * return EOF. */ int val = tgdb_get_quit_command(tgdb, &tgdb_will_quit); if (val == -1) { logger_write_pos(logger, __FILE__, __LINE__, "tgdb_get_quit_command error"); return -1; } tgdb->has_sigchld_recv = 0; if (tgdb_will_quit) goto tgdb_finish; } /* set buf to null for debug reasons */ memset(buf, '\0', n); /* 1. read all the data possible from gdb that is ready. */ if ((size = io_read(tgdb->debugger_stdout, local_buf, n)) < 0) { logger_write_pos(logger, __FILE__, __LINE__, "could not read from masterfd"); buf_size = -1; tgdb_add_quit_command(tgdb); goto tgdb_finish; } else if (size == 0) { /* EOF */ tgdb_add_quit_command(tgdb); goto tgdb_finish; } local_buf[size] = '\0'; /* 2. At this point local_buf has everything new from this read. * Basically this function is responsible for seperating the annotations * that gdb writes from the data. * * buf and buf_size are the data to be returned from the user. */ { /* unused for now */ char *infbuf = NULL; size_t infbuf_size; int result; result = tgdb_client_parse_io(tgdb->tcc, local_buf, size, buf, &buf_size, infbuf, &infbuf_size, tgdb->command_list); tgdb_process_client_commands(tgdb); if (result == 0) { /* success, and more to parse, ss isn't done */ } else if (result == 1) { /* success, and finished command */ command_completion_callback(tgdb); } else if (result == -1) { logger_write_pos(logger, __FILE__, __LINE__, "tgdb_client_parse_io failed"); } } /* 3. if ^c has been sent, clear the buffers. * If a signal has been recieved, clear the queue and return */ if (tgdb_handle_signals(tgdb) == -1) { logger_write_pos(logger, __FILE__, __LINE__, "tgdb_handle_signals failed"); return -1; } /* 4. runs the users buffered command if any exists */ if (tgdb_has_command_to_run(tgdb)) tgdb_unqueue_and_deliver_command(tgdb); tgdb_finish: /* Set the iterator to the beggining. So when the user * calls tgdb_get_command it, it will be in the right spot. */ tgdb->command_list_iterator = tgdb_list_get_first(tgdb->command_list); if (tgdb_is_busy(tgdb, &is_busy) == -1) { logger_write_pos(logger, __FILE__, __LINE__, "tgdb_is_busy failed"); return -1; } *is_finished = !is_busy; return buf_size; } /* Getting Data out of TGDB {{{*/ struct tgdb_response *tgdb_get_response(struct tgdb *tgdb) { struct tgdb_response *command; if (tgdb->command_list_iterator == NULL) return NULL; command = (struct tgdb_response *) tgdb_list_get_item(tgdb-> command_list_iterator); tgdb->command_list_iterator = tgdb_list_next(tgdb->command_list_iterator); return command; } void tgdb_traverse_responses(struct tgdb *tgdb) { tgdb_list_foreach(tgdb->command_list, tgdb_types_print_command); } void tgdb_delete_responses(struct tgdb *tgdb) { tgdb_list_free(tgdb->command_list, tgdb_types_free_command); } /* }}}*/ /* Inferior tty commands {{{*/ int tgdb_tty_new(struct tgdb *tgdb) { int ret = tgdb_client_open_new_tty(tgdb->tcc, &tgdb->inferior_stdin, &tgdb->inferior_stdout); tgdb_process_client_commands(tgdb); return ret; } const char *tgdb_tty_name(struct tgdb *tgdb) { return tgdb_client_get_tty_name(tgdb->tcc); } /* }}}*/ /* Functional commands {{{ */ /* Request {{{*/ tgdb_request_ptr tgdb_request_run_console_command(struct tgdb * tgdb, const char *command) { tgdb_request_ptr request_ptr; if (!tgdb || !command) return NULL; request_ptr = (tgdb_request_ptr) cgdb_malloc(sizeof (struct tgdb_request)); if (!request_ptr) return NULL; request_ptr->header = TGDB_REQUEST_CONSOLE_COMMAND; request_ptr->choice.console_command.command = (const char *) cgdb_strdup(command); return request_ptr; } tgdb_request_ptr tgdb_request_inferiors_source_files(struct tgdb * tgdb) { tgdb_request_ptr request_ptr; if (!tgdb) return NULL; request_ptr = (tgdb_request_ptr) cgdb_malloc(sizeof (struct tgdb_request)); if (!request_ptr) return NULL; request_ptr->header = TGDB_REQUEST_INFO_SOURCES; return request_ptr; } tgdb_request_ptr tgdb_request_filename_pair(struct tgdb * tgdb, const char *file) { tgdb_request_ptr request_ptr; if (!tgdb) return NULL; if (!file) return NULL; request_ptr = (tgdb_request_ptr) cgdb_malloc(sizeof (struct tgdb_request)); if (!request_ptr) return NULL; request_ptr->header = TGDB_REQUEST_FILENAME_PAIR; if (file) { request_ptr->choice.filename_pair.file = (const char *) cgdb_strdup(file); } else request_ptr->choice.filename_pair.file = NULL; return request_ptr; } tgdb_request_ptr tgdb_request_current_location(struct tgdb * tgdb, int on_startup) { tgdb_request_ptr request_ptr; if (!tgdb) return NULL; request_ptr = (tgdb_request_ptr) cgdb_malloc(sizeof (struct tgdb_request)); if (!request_ptr) return NULL; request_ptr->header = TGDB_REQUEST_CURRENT_LOCATION; request_ptr->choice.current_location.on_startup = on_startup; return request_ptr; } tgdb_request_ptr tgdb_request_run_debugger_command(struct tgdb * tgdb, enum tgdb_command_type c) { tgdb_request_ptr request_ptr; if (!tgdb) return NULL; request_ptr = (tgdb_request_ptr) cgdb_malloc(sizeof (struct tgdb_request)); if (!request_ptr) return NULL; request_ptr->header = TGDB_REQUEST_DEBUGGER_COMMAND; request_ptr->choice.debugger_command.c = c; return request_ptr; } tgdb_request_ptr tgdb_request_modify_breakpoint(struct tgdb * tgdb, const char *file, int line, enum tgdb_breakpoint_action b) { tgdb_request_ptr request_ptr; if (!tgdb) return NULL; request_ptr = (tgdb_request_ptr) cgdb_malloc(sizeof (struct tgdb_request)); if (!request_ptr) return NULL; request_ptr->header = TGDB_REQUEST_MODIFY_BREAKPOINT; request_ptr->choice.modify_breakpoint.file = (const char *) cgdb_strdup(file); request_ptr->choice.modify_breakpoint.line = line; request_ptr->choice.modify_breakpoint.b = b; return request_ptr; } tgdb_request_ptr tgdb_request_complete(struct tgdb * tgdb, const char *line) { tgdb_request_ptr request_ptr; if (!tgdb) return NULL; request_ptr = (tgdb_request_ptr) cgdb_malloc(sizeof (struct tgdb_request)); if (!request_ptr) return NULL; request_ptr->header = TGDB_REQUEST_COMPLETE; request_ptr->choice.complete.line = (const char *) cgdb_strdup(line); return request_ptr; } /* }}}*/ /* Process {{{*/ static int tgdb_process_console_command(struct tgdb *tgdb, tgdb_request_ptr request) { struct ibuf *command; if (!tgdb || !request) return -1; if (!tgdb_can_issue_command(tgdb)) return -1; if (request->header != TGDB_REQUEST_CONSOLE_COMMAND) return -1; command = ibuf_init(); ibuf_add(command, request->choice.console_command.command); ibuf_addchar(command, '\n'); if (tgdb_send(tgdb, ibuf_get(command), TGDB_COMMAND_CONSOLE) == -1) { logger_write_pos(logger, __FILE__, __LINE__, "tgdb_send failed"); return -1; } ibuf_free(command); command = NULL; return 0; } static int tgdb_process_info_sources(struct tgdb *tgdb, tgdb_request_ptr request) { int ret; if (!tgdb || !request) return -1; if (request->header != TGDB_REQUEST_INFO_SOURCES) return -1; ret = tgdb_client_get_inferior_source_files(tgdb->tcc); tgdb_process_client_commands(tgdb); return ret; } static int tgdb_process_filename_pair(struct tgdb *tgdb, tgdb_request_ptr request) { int ret; if (!tgdb || !request) return -1; if (request->header != TGDB_REQUEST_FILENAME_PAIR) return -1; ret = tgdb_client_get_filename_pair(tgdb->tcc, request->choice.filename_pair.file); tgdb_process_client_commands(tgdb); return ret; } static int tgdb_process_current_location(struct tgdb *tgdb, tgdb_request_ptr request) { int ret = 0; if (!tgdb || !request) return -1; if (request->header != TGDB_REQUEST_CURRENT_LOCATION) return -1; ret = tgdb_client_get_current_location(tgdb->tcc, request->choice.current_location.on_startup); tgdb_process_client_commands(tgdb); return ret; } static int tgdb_process_debugger_command(struct tgdb *tgdb, tgdb_request_ptr request) { if (!tgdb || !request) return -1; if (request->header != TGDB_REQUEST_DEBUGGER_COMMAND) return -1; return tgdb_send(tgdb, tgdb_get_client_command(tgdb, request->choice.debugger_command.c), TGDB_COMMAND_FRONT_END); } static int tgdb_process_modify_breakpoint(struct tgdb *tgdb, tgdb_request_ptr request) { char *val; if (!tgdb || !request) return -1; if (request->header != TGDB_REQUEST_MODIFY_BREAKPOINT) return -1; val = tgdb_client_modify_breakpoint_call(tgdb, request->choice.modify_breakpoint.file, request->choice.modify_breakpoint.line, request->choice.modify_breakpoint.b); if (val == NULL) return -1; if (tgdb_send(tgdb, val, TGDB_COMMAND_FRONT_END) == -1) { logger_write_pos(logger, __FILE__, __LINE__, "tgdb_send failed"); return -1; } free(val); return 0; } static int tgdb_process_complete(struct tgdb *tgdb, tgdb_request_ptr request) { int ret; if (!tgdb || !request) return -1; if (request->header != TGDB_REQUEST_COMPLETE) return -1; ret = tgdb_client_completion_callback(tgdb->tcc, request->choice.complete.line); tgdb_process_client_commands(tgdb); return ret; } int tgdb_process_command(struct tgdb *tgdb, tgdb_request_ptr request) { if (!tgdb || !request) return -1; if (!tgdb_can_issue_command(tgdb)) return -1; if (request->header == TGDB_REQUEST_CONSOLE_COMMAND) return tgdb_process_console_command(tgdb, request); else if (request->header == TGDB_REQUEST_INFO_SOURCES) return tgdb_process_info_sources(tgdb, request); else if (request->header == TGDB_REQUEST_FILENAME_PAIR) return tgdb_process_filename_pair(tgdb, request); else if (request->header == TGDB_REQUEST_CURRENT_LOCATION) return tgdb_process_current_location(tgdb, request); else if (request->header == TGDB_REQUEST_DEBUGGER_COMMAND) return tgdb_process_debugger_command(tgdb, request); else if (request->header == TGDB_REQUEST_MODIFY_BREAKPOINT) return tgdb_process_modify_breakpoint(tgdb, request); else if (request->header == TGDB_REQUEST_COMPLETE) return tgdb_process_complete(tgdb, request); return 0; } /* }}}*/ /* }}} */ /* TGDB Queue commands {{{*/ int tgdb_queue_append(struct tgdb *tgdb, tgdb_request_ptr request) { if (!tgdb || !request) return -1; queue_append(tgdb->gdb_client_request_queue, request); return 0; } tgdb_request_ptr tgdb_queue_pop(struct tgdb * tgdb) { tgdb_request_ptr item; if (!tgdb) return NULL; item = queue_pop(tgdb->gdb_client_request_queue); return item; } int tgdb_queue_size(struct tgdb *tgdb, int *size) { if (!tgdb || !size) return -1; *size = queue_size(tgdb->gdb_client_request_queue); return 0; } /* }}}*/ /* Signal Handling Support {{{*/ int tgdb_signal_notification(struct tgdb *tgdb, int signum) { struct termios t; cc_t *sig_char = NULL; tcgetattr(tgdb->debugger_stdin, &t); if (signum == SIGINT) { /* ^c */ tgdb->control_c = 1; sig_char = &t.c_cc[VINTR]; if (write(tgdb->debugger_stdin, sig_char, 1) < 1) return -1; } else if (signum == SIGQUIT) { /* ^\ */ sig_char = &t.c_cc[VQUIT]; if (write(tgdb->debugger_stdin, sig_char, 1) < 1) return -1; } else if (signum == SIGCHLD) { tgdb->has_sigchld_recv = 1; } return 0; } int tgdb_has_sigchld_recv(struct tgdb *tgdb) { return tgdb->has_sigchld_recv; } /* }}}*/ /* Config Options {{{*/ int tgdb_set_verbose_gui_command_output(struct tgdb *tgdb, int value) { if ((value == 0) || (value == 1)) tgdb->show_gui_commands = value; if (tgdb->show_gui_commands == 1) return 1; return 0; } int tgdb_set_verbose_error_handling(struct tgdb *tgdb, int value) { if (value == -1) return logger_is_recording(logger); if (value == 1 || value == 0) logger_set_record(logger, value); if (value == 1) logger_set_fd(logger, stderr); return logger_is_recording(logger); } /* }}}*/ cgdb-0.6.7/lib/tgdb/tgdb-base/tgdb.h000644 000765 000024 00000041512 12074711270 020023 0ustar00mmuellerstaff000000 000000 #ifndef __TGDB_H__ #define __TGDB_H__ /*! * \file * tgdb.h * * \brief * This interface is intended to be the abstraction layer between a front end * and the low level debugger the front end is trying to communicate with. */ #ifdef __cplusplus extern "C" { #endif /* includes {{{*/ #if HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #if HAVE_SYS_TYPES_H #include #endif /* HAVE_SYS_TYPES_H */ #include "tgdb_types.h" /* }}}*/ /* Createing and Destroying a libtgdb context. {{{*/ /******************************************************************************/ /** * @name Createing and Destroying a libtgdb context. * These functions are for createing and destroying a tgdb context. */ /******************************************************************************/ /*@{*/ /** * This struct is a reference to a libtgdb instance. */ struct tgdb; /** * This initializes a tgdb library instance. It starts up the debugger and * returns all file descriptors the client must select on. * * The client must call this function before any other function in the * tgdb library. * * \param debugger * The path to the desired debugger to use. If this is NULL, then just * "gdb" is used. * * \param argc * The number of arguments to pass to the debugger * * \param argv * The arguments to pass to the debugger * * \param debugger_fd * The descriptor to the debugger's I/O * * \param inferior_fd * The descriptor to the I/O of the program being debugged. * * @return * NULL on error, a valid context on success. */ struct tgdb *tgdb_initialize(const char *debugger, int argc, char **argv, int *debugger_fd, int *inferior_fd); /** * This will terminate a libtgdb session. No functions should be called on * the tgdb context passed into this function after this call. * * \param tgdb * An instance of the tgdb library to operate on. * * @return * 0 on success or -1 on error */ int tgdb_shutdown(struct tgdb *tgdb); /*@}*/ /* }}}*/ /* Status Commands {{{*/ /******************************************************************************/ /** * @name Status Commands * These functions are for querying the tgdb context. */ /******************************************************************************/ /*@{*/ /** * If a function returns an error, this can be called to report more * about the type of error, or the error message itself. * * \param tgdb * An instance of the tgdb library to operate on. * * @return * Error Message or NULL on error */ char *tgdb_err_msg(struct tgdb *tgdb); /** * This will check to see if TGDB is currently capable of receiving another command. * * \param tgdb * An instance of the tgdb library to operate on. * * \param is_busy * Will return as 1 if tgdb is busy, otherwise 0. * * \return * 0 on success, or -1 on error */ int tgdb_is_busy(struct tgdb *tgdb, int *is_busy); /*@}*/ /* }}}*/ /* Input/Output commands {{{*/ /******************************************************************************/ /** * @name Input/Output commands * These functions are for communicating I/O with the tgdb context. */ /******************************************************************************/ /*@{*/ /** * Have TGDB process a command. * * \param tgdb * An instance of the tgdb library to operate on. * * \param request * The requested command to have TGDB process. * * \return * 0 on success or -1 on error */ int tgdb_process_command(struct tgdb *tgdb, tgdb_request_ptr request); /** * This function does most of the dirty work in TGDB. It is capable of * processing the output of the debugger, to either satisfy a previously * made request, or to simply get console output for the caller to have. * * The data returned from this function is the console output of the * debugger. * * \param tgdb * An instance of the tgdb library to operate on. * * \param buf * The output of the debugger will be returned in this buffer. * The buffer passed back will not exceed N in size. * * \param n * Tells libtgdb how large the buffer BUF is that the client passed in. * * \param is_finished * If this is passed in as NULL, it is not set. * * If it is non-null, it will be set to 1 if TGDB finished processing the * current request. Otherwise, it will be set to 0 if TGDB needs more input * in order to finish processing the current requested command. * * @return * The number of valid bytes in BUF on success, or -1 on error. */ size_t tgdb_process(struct tgdb *tgdb, char *buf, size_t n, int *is_finished); /** * This sends a byte of data to the program being debugged. * * \param tgdb * An instance of the tgdb library to operate on. * * \param c * The character to pass to the program being debugged. * * @return * 0 on success or -1 on error */ int tgdb_send_inferior_char(struct tgdb *tgdb, char c); /** * Gets the ouput from the program being debugged. * * \param tgdb * An instance of the tgdb library to operate on. * * \param buf * The output of the program being debugged will be returned here. * * \param n * Tells libtgdb how large the buffer BUF is. * * @return * The number of valid bytes in BUF on success, or 0 on error. */ size_t tgdb_recv_inferior_data(struct tgdb *tgdb, char *buf, size_t n); /*@}*/ /* }}}*/ /* Getting Data out of TGDB {{{*/ /******************************************************************************/ /** * @name Getting Data out of TGDB * These functions are for dealing with getting back data from TGDB */ /******************************************************************************/ /*@{*/ /** * Gets a response from TGDB. * This should be called after tgdb_recv_debugger_data * * \param tgdb * An instance of the tgdb library to operate on. * * @return * A valid response if responses still exist. * Null if no more responses exist. */ struct tgdb_response *tgdb_get_response(struct tgdb *tgdb); /** * This will traverse all of the responses that the context tgdb currently * has and will print them. It is currently used for debugging purposes. * * \param tgdb * An instance of the tgdb library to operate on. */ void tgdb_traverse_responses(struct tgdb *tgdb); /** * This will free all of the memory used by the responses that tgdb returns. * * \param tgdb * An instance of the tgdb library to operate on. */ void tgdb_delete_responses(struct tgdb *tgdb); /*@}*/ /* }}}*/ /* Inferior tty commands {{{*/ /******************************************************************************/ /** * @name Inferior tty commands * These functinos are used to alter the tty state of the inferior program. * These functions currently are not always supported. If the annotate_two * subsytem is being used, the tty commands are supported. */ /******************************************************************************/ /*@{*/ /** * This allocates a new tty and tells the debugger to use it for I/O * with the program being debugged. * * Whatever was left in the old tty is lost, the debugged program starts * with a new tty. * * \param tgdb * An instance of the tgdb library to operate on. * * NOTE * The return value only indicates whether the tty was allocated properly, * not whether the debugger accepted the tty, since this can only be determined * when the debugger responds, not when the command is given. * * @return * 0 on success or -1 on error */ int tgdb_tty_new(struct tgdb *tgdb); /** * Gets the name of file that debugger is using for I/O with the program * being debugged. * * \param tgdb * An instance of the tgdb library to operate on. * * @return * Name of tty or NULL on error. */ const char *tgdb_tty_name(struct tgdb *tgdb); /*@}*/ /* }}}*/ /* Functional commands {{{*/ /******************************************************************************/ /** * @name Functional commands * These functinos are used to ask the TGDB context to perform a task. */ /******************************************************************************/ /*@{*/ /** * This sends a console command to the debugger (GDB). * * \param tgdb * An instance of the tgdb library to operate on. * * \param command * The null terminated command to pass to GDB as a console command. * * \return * Will return as a tgdb request command on success, otherwise NULL. */ tgdb_request_ptr tgdb_request_run_console_command(struct tgdb *tgdb, const char *command); /** * Gets a list of source files that make up the program being debugged. * * This function does not actually do anything but put a command in the * queue to be run when libtgdb is ready. When the libtgdb runs the * command to get the inferior's source files, it will return 1 of 2 * things next time tgdb_recv is called. * * If the function succeeds the gui will get back TGDB_UPDATE_SOURCE_FILES * containing a list of all the source files. Otherwise the gui will get * back TGDB_SOURCES_DENIED. * * \param tgdb * An instance of the tgdb library to operate on. * * \return * Will return as a tgdb request command on success, otherwise NULL. */ tgdb_request_ptr tgdb_request_inferiors_source_files(struct tgdb *tgdb); /** * This gets the absolute path and the relative path from the given file, * FILE. The file parameter should have been returned by * tgdb_request_inferiors_source_files. It can return both relative and * absolute filenames. * * Basically, if the parameter file is a relative path OR an absolute path, * both the relative path and the absolute path will be returned in the * response. * * If this functions succeeds TGDB_ABSOLUTE_SOURCE_ACCEPTED will be returned. * Otherwise, TGDB_ABSOLUTE_SOURCE_DENIED gets returned. * * \param tgdb * An instance of the tgdb library to operate on. * * \param file * The relative filename to get the absolute path of. If this is passed in as * NULL, then this function will return NULL. * * \return * Will return as a tgdb request command on success, otherwise NULL. */ tgdb_request_ptr tgdb_request_filename_pair(struct tgdb *tgdb, const char *file); /** * This will ask the debugger for it's current file and line number. * It will return to the caller a tgdb_response with the * response->update_source_files set. This is the same response you * will get when TGDB asynchronously sends the update_file_postition. * * \param tgdb * An instance of the tgdb library to operate on. * * \param on_starup * This variable can be set to 1 if the front end wants to probe GDB * for the initial file and location of the program being debugged. * However, each initial time after that, this variable should be * set to 0. * * \return * Will return as a tgdb request command on success, otherwise NULL. */ tgdb_request_ptr tgdb_request_current_location(struct tgdb *tgdb, int on_startup); /** * This tells libtgdb to run a command through the debugger. * * \param tgdb * An instance of the tgdb library to operate on. * * \param c * This is the command that libtgdb should run through the debugger. * * @return * Will return as a tgdb request command on success, otherwise NULL. */ tgdb_request_ptr tgdb_request_run_debugger_command(struct tgdb *tgdb, enum tgdb_command_type c); /** * Modify's a breakpoint. * * \param tgdb * An instance of the tgdb library to operate on. * * \param file * The file to set the breakpoint in. * * \param line * The line in FILE to set the breakpoint in. * * \param b * Determines what the user wants to do with the breakpoint. * * @return * Will return as a tgdb request command on success, otherwise NULL. */ tgdb_request_ptr tgdb_request_modify_breakpoint(struct tgdb *tgdb, const char *file, int line, enum tgdb_breakpoint_action b); /** * Used to get all of the possible tab completion options for LINE. * * \param tgdb * An instance of the tgdb library to operate on. * * \param line * The line to tab complete. * * \return * Will return as a tgdb request command on success, otherwise NULL. */ tgdb_request_ptr tgdb_request_complete(struct tgdb *tgdb, const char *line); /*@}*/ /* }}}*/ /* TGDB Queue commands {{{*/ /******************************************************************************/ /** * @name Queuing of TGDB commands * These functinos are used to allow clients to queue multiple commands for * TGDB to be able to run. */ /******************************************************************************/ /** * Have TGDB append a command to it's list of commands it needs to run. * * \param tgdb * An instance of the tgdb library to operate on. * * \param request * The requested command to have TGDB process. * * \return * 0 on success or -1 on error */ int tgdb_queue_append(struct tgdb *tgdb, tgdb_request_ptr request); /** * Get a tgdb_request command back from TGDB. * * \param tgdb * An instance of the tgdb library to operate on. * * \return * The requested command at the top of the stack, or NULL on error. * Popping a command when the queue is empty is also considered an error, * and NULL will be returned. */ tgdb_request_ptr tgdb_queue_pop(struct tgdb *tgdb); /** * Get's the number of items that are in the queue for TGDB to run. * * \param tgdb * An instance of the tgdb library to operate on. * * \size * The number of items in the list. * * \return * 0 on success or -1 on error */ int tgdb_queue_size(struct tgdb *tgdb, int *size); /* }}}*/ /* Signal Handling Support {{{*/ /******************************************************************************/ /** * @name Signal Handling Support * These functinos are used to notify TGDB of signal recieved. */ /******************************************************************************/ /*@{*/ /** * The front end can use this function to notify libtgdb that an * asynchronous event has occurred. If signal SIGNUM is relavant * to libtgdb, the appropriate processing will be done. * Currently, TGDB only handles SIGINT,SIGTERM and SIGQUIT. * * libtgdb will remove all elements from it's queue when a SIGINT * is received. * * \param tgdb * An instance of the tgdb library to operate on. * * \param signum * The signal number SIGNUM that has occured. * * @return * 0 on success or -1 on error */ int tgdb_signal_notification(struct tgdb *tgdb, int signum); /** * Checks if SIGCHLD is received. */ int tgdb_has_sigchld_recv(struct tgdb *tgdb); /*@}*/ /* }}}*/ /* Config Options {{{*/ /******************************************************************************/ /** * @name TGDB Config Options * These functinos are used to change the state TGDB works. TGDB can currently * only be configured through this interface. */ /******************************************************************************/ /*@{*/ /** * This sets the verbosity of the GUI's commands. * If the value is set to 0, the GUI's commands will not be shown. * If the value is set to 1, the GUI's commands will be shown. * The default value for TGDB is to be off. * * \param tgdb * An instance of the tgdb library to operate on. * * \param value * 0 to not show GUI commands, 1 to show them, otherwise nothing is done. * You would use a value other than 0 or 1 just to query if the option is set. * * @return * 1 if option is set, otherwise 0 */ int tgdb_set_verbose_gui_command_output(struct tgdb *tgdb, int value); /** * This will make TGDB handle error's in a verbose mode. * The basically mean's that when TGDB find's an error, the message is * printed to stdout/stderr. Normally this is not acceptable because TGDB can * simple not print when any front end is using it. Imparticular, TGDB can * not print when a curses based front end is using it. * * \param tgdb * An instance of the tgdb library to operate on. * * \param value * if -1, query to see if the option is set. * If 0, the option will be turned off. * If 1, the option will be turned on. * * @return * 1 if option is set, otherwise 0 */ int tgdb_set_verbose_error_handling(struct tgdb *tgdb, int value); /*@}*/ /* }}}*/ #ifdef __cplusplus } #endif #endif /* __TGDB_H__ */ cgdb-0.6.7/lib/tgdb/tgdb-base/tgdb_client_interface.c000644 000765 000024 00000041232 12074441140 023367 0ustar00mmuellerstaff000000 000000 #include "tgdb_client_interface.h" #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #include "gdbmi_tgdb.h" #include "a2-tgdb.h" #include "sys_util.h" /** * This is a list of all of the client interfaces that TGDB supports. */ static struct tgdb_client_debugger_interfaces { /** * This represents the type of debugger to support. */ enum tgdb_client_supported_debuggers debugger; /** * This represents the type of protocol to support. */ enum tgdb_client_supported_protocols protocol; void *(*tgdb_client_create_context) (const char *debugger_path, int argc, char **argv, const char *config_dir, struct logger * logger); int (*tgdb_client_initialize_context) (void *ctx, int *debugger_stdin, int *debugger_stdout, int *inferior_stdin, int *inferior_stdout); int (*tgdb_client_destroy_context) (void *ctx); int (*tgdb_client_err_msg) (void *ctx); int (*tgdb_client_is_client_ready) (void *ctx); int (*tgdb_client_tgdb_ran_command) (void *ctx); int (*tgdb_client_prepare_for_command) (void *ctx, struct tgdb_command * com); int (*tgdb_client_can_tgdb_run_commands) (void *ctx); int (*tgdb_client_parse_io) (void *ctx, const char *input_data, const size_t input_data_size, char *debugger_output, size_t * debugger_output_size, char *inferior_output, size_t * inferior_output_size, struct tgdb_list * list); struct tgdb_list *(*tgdb_client_get_client_commands) (void *ctx); int (*tgdb_client_get_filename_pair) (void *ctx, const char *path); int (*tgdb_client_get_current_location) (void *ctx, int on_startup); int (*tgdb_client_get_inferior_source_files) (void *ctx); int (*tgdb_client_completion_callback) (void *ctx, const char *completion_command); char *(*tgdb_client_return_command) (void *ctx, enum tgdb_command_type c); char *(*tgdb_client_modify_breakpoint) (void *ctx, const char *file, int line, enum tgdb_breakpoint_action b); pid_t(*tgdb_client_get_debugger_pid) (void *ctx); int (*tgdb_client_open_new_tty) (void *ctx, int *inferior_stdin, int *inferior_stdout); const char *(*tgdb_client_get_tty_name) (void *ctx); } tgdb_client_debugger_interfaces[] = { { TGDB_CLIENT_DEBUGGER_GNU_GDB, TGDB_CLIENT_PROTOCOL_GNU_GDB_ANNOTATE_TWO, /* tgdb_client_create_context */ a2_create_context, /* tgdb_client_initialize_context */ a2_initialize, /* tgdb_client_destroy_context */ a2_shutdown, /* tgdb_client_err_msg */ a2_err_msg, /* tgdb_client_is_client_ready */ a2_is_client_ready, /* tgdb_client_tgdb_ran_command */ a2_user_ran_command, /* tgdb_client_prepare_for_command */ a2_prepare_for_command, /* tgdb_client_can_tgdb_run_commands */ a2_is_misc_prompt, /* tgdb_client_parse_io */ a2_parse_io, /* tgdb_client_get_client_commands */ a2_get_client_commands, /* tgdb_client_get_filename_pair */ a2_get_source_filename_pair, /* tgdb_client_get_current_location */ a2_get_current_location, /* tgdb_client_get_inferior_source_files */ a2_get_inferior_sources, /* tgdb_client_completion_callback */ a2_completion_callback, /* tgdb_client_return_command */ a2_return_client_command, /* tgdb_client_modify_breakpoint */ a2_client_modify_breakpoint, /* tgdb_client_get_debugger_pid */ a2_get_debugger_pid, /* tgdb_client_open_new_tty */ a2_open_new_tty, /* tgdb_client_get_tty_name */ a2_get_tty_name}, { TGDB_CLIENT_DEBUGGER_GNU_GDB, TGDB_CLIENT_PROTOCOL_GNU_GDB_GDBMI, /* tgdb_client_create_context */ gdbmi_create_context, /* tgdb_client_initialize_context */ gdbmi_initialize, /* tgdb_client_destroy_context */ gdbmi_shutdown, /* tgdb_client_err_msg */ NULL, /* tgdb_client_is_client_ready */ gdbmi_is_client_ready, /* tgdb_client_tgdb_ran_command */ gdbmi_user_ran_command, /* tgdb_client_prepare_for_command */ gdbmi_prepare_for_command, /* tgdb_client_can_tgdb_run_commands */ NULL, /* tgdb_client_parse_io */ gdbmi_parse_io, /* tgdb_client_get_client_commands */ gdbmi_get_client_commands, /* tgdb_client_get_filename_pair */ NULL, /* tgdb_client_get_current_location */ NULL, /* tgdb_client_get_inferior_source_files */ NULL, /* tgdb_client_completion_callback */ NULL, /* tgdb_client_return_command */ NULL, /* tgdb_client_modify_breakpoint */ NULL, /* tgdb_client_get_debugger_pid */ gdbmi_get_debugger_pid, /* tgdb_client_open_new_tty */ NULL, /* tgdb_client_get_tty_name */ NULL}, { TGDB_CLIENT_DEBUGGER_UNSUPPORTED, TGDB_CLIENT_PROTOCOL_UNSUPPORTED, /* tgdb_client_create_context */ NULL, /* tgdb_client_initialize_context */ NULL, /* tgdb_client_destroy_context */ NULL, /* tgdb_client_err_msg */ NULL, /* tgdb_client_is_client_ready */ NULL, /* tgdb_client_tgdb_ran_command */ NULL, /* tgdb_client_prepare_for_command */ NULL, /* tgdb_client_can_tgdb_run_commands */ NULL, /* tgdb_client_parse_io */ NULL, /* tgdb_client_get_filename_pair */ NULL, /* tgdb_client_get_current_location */ NULL, /* tgdb_client_get_inferior_source_files */ NULL, /* tgdb_client_completion_callback */ NULL, /* tgdb_client_return_command */ NULL, /* tgdb_client_modify_breakpoint */ NULL, /* tgdb_client_get_debugger_pid */ NULL, /* tgdb_client_open_new_tty */ NULL, /* tgdb_client_get_tty_name */ NULL} }; /** * This is a context that abstracts the lower level interface from TGDB. * By doing this, all of the lower levels can communicate here, and TGDB * just makes sure that it calls the functions in this header. */ struct tgdb_client_context { /** * The current debugger being used. */ enum tgdb_client_supported_debuggers debugger; /** * The current protocol begin used. */ enum tgdb_client_supported_protocols protocol; /** * The current client debugger being used. */ void *tgdb_debugger_context; /** * A client interface. All of the functions that implement the client. */ struct tgdb_client_debugger_interfaces *tgdb_client_interface; struct logger *logger; }; struct tgdb_client_context *tgdb_client_create_context(const char *debugger_path, int argc, char **argv, const char *config_dir, enum tgdb_client_supported_debuggers debugger, enum tgdb_client_supported_protocols protocol, struct logger *logger) { struct tgdb_client_context *tcc = NULL; /* Try to initialize the annotate 2 protocol */ if (debugger == TGDB_CLIENT_DEBUGGER_GNU_GDB && (protocol == TGDB_CLIENT_PROTOCOL_GNU_GDB_ANNOTATE_TWO || protocol == TGDB_CLIENT_PROTOCOL_GNU_GDB_GDBMI) ) { tcc = (struct tgdb_client_context *) cgdb_malloc(sizeof (struct tgdb_client_context)); tcc->debugger = debugger; tcc->protocol = protocol; tcc->logger = logger; if (protocol == TGDB_CLIENT_PROTOCOL_GNU_GDB_ANNOTATE_TWO) tcc->tgdb_client_interface = &tgdb_client_debugger_interfaces[0]; else if (protocol == TGDB_CLIENT_PROTOCOL_GNU_GDB_GDBMI) tcc->tgdb_client_interface = &tgdb_client_debugger_interfaces[1]; tcc->tgdb_debugger_context = tcc->tgdb_client_interface-> tgdb_client_create_context(debugger_path, argc, argv, config_dir, logger); if (tcc->tgdb_debugger_context == NULL) { free(tcc); logger_write_pos(tcc->logger, __FILE__, __LINE__, "a2_create_instance failed"); return NULL; } } else { logger_write_pos(tcc->logger, __FILE__, __LINE__, "tgdb_client_create_context protocol not recognized"); } return tcc; } int tgdb_client_initialize_context(struct tgdb_client_context *tcc, int *debugger_stdin, int *debugger_stdout, int *inferior_stdin, int *inferior_stdout) { if (tcc == NULL || tcc->tgdb_client_interface == NULL) { logger_write_pos(logger, __FILE__, __LINE__, "tgdb_client_initilize_context unimplemented"); return -1; } return tcc->tgdb_client_interface->tgdb_client_initialize_context(tcc-> tgdb_debugger_context, debugger_stdin, debugger_stdout, inferior_stdin, inferior_stdout); } int tgdb_client_destroy_context(struct tgdb_client_context *tcc) { if (tcc == NULL || tcc->tgdb_client_interface == NULL) { logger_write_pos(logger, __FILE__, __LINE__, "tgdb_client_destroy_context unimplemented"); return -1; } return tcc->tgdb_client_interface->tgdb_client_destroy_context(tcc-> tgdb_debugger_context); } int tgdb_client_err_msg(struct tgdb_client_context *tcc) { return -1; } int tgdb_client_is_client_ready(struct tgdb_client_context *tcc) { if (tcc == NULL || tcc->tgdb_client_interface == NULL) { logger_write_pos(logger, __FILE__, __LINE__, "tgdb_client_is_client_ready unimplemented"); return -1; } return tcc->tgdb_client_interface->tgdb_client_is_client_ready(tcc-> tgdb_debugger_context); } int tgdb_client_tgdb_ran_command(struct tgdb_client_context *tcc) { if (tcc == NULL || tcc->tgdb_client_interface == NULL) { logger_write_pos(logger, __FILE__, __LINE__, "tgdb_client_tgdb_ran_command unimplemented"); return -1; } return tcc->tgdb_client_interface->tgdb_client_tgdb_ran_command(tcc-> tgdb_debugger_context); } int tgdb_client_prepare_for_command(struct tgdb_client_context *tcc, struct tgdb_command *com) { if (tcc == NULL || tcc->tgdb_client_interface == NULL) { logger_write_pos(logger, __FILE__, __LINE__, "tgdb_client_prepare_for_command unimplemented"); return -1; } return tcc->tgdb_client_interface->tgdb_client_prepare_for_command(tcc-> tgdb_debugger_context, com); } int tgdb_client_can_tgdb_run_commands(struct tgdb_client_context *tcc) { if (tcc == NULL || tcc->tgdb_client_interface == NULL) { logger_write_pos(logger, __FILE__, __LINE__, "tgdb_client_can_tgdb_run_commands unimplemented"); return -1; } return tcc->tgdb_client_interface->tgdb_client_can_tgdb_run_commands(tcc-> tgdb_debugger_context); } int tgdb_client_parse_io(struct tgdb_client_context *tcc, const char *input_data, const size_t input_data_size, char *debugger_output, size_t * debugger_output_size, char *inferior_output, size_t * inferior_output_size, struct tgdb_list *command_list) { if (tcc == NULL || tcc->tgdb_client_interface == NULL) { logger_write_pos(logger, __FILE__, __LINE__, "tgdb_client_parse_io error"); return -1; } return tcc->tgdb_client_interface->tgdb_client_parse_io(tcc-> tgdb_debugger_context, input_data, input_data_size, debugger_output, debugger_output_size, inferior_output, inferior_output_size, command_list); } struct tgdb_list *tgdb_client_get_client_commands(struct tgdb_client_context *tcc) { if (tcc == NULL || tcc->tgdb_client_interface == NULL) { logger_write_pos(logger, __FILE__, __LINE__, "tgdb_client_get_client_commands error"); return NULL; } return tcc->tgdb_client_interface->tgdb_client_get_client_commands(tcc-> tgdb_debugger_context); } int tgdb_client_get_filename_pair(struct tgdb_client_context *tcc, const char *path) { if (tcc == NULL || tcc->tgdb_client_interface == NULL) { logger_write_pos(logger, __FILE__, __LINE__, "tgdb_client_get_absolute_path unimplemented"); return -1; } return tcc->tgdb_client_interface->tgdb_client_get_filename_pair(tcc-> tgdb_debugger_context, path); } int tgdb_client_get_current_location(struct tgdb_client_context *tcc, int on_startup) { if (tcc == NULL || tcc->tgdb_client_interface == NULL) { logger_write_pos(logger, __FILE__, __LINE__, "tgdb_client_get_current_location unimplemented"); return -1; } return tcc->tgdb_client_interface->tgdb_client_get_current_location(tcc-> tgdb_debugger_context, on_startup); } int tgdb_client_get_inferior_source_files(struct tgdb_client_context *tcc) { if (tcc == NULL || tcc->tgdb_client_interface == NULL) { logger_write_pos(logger, __FILE__, __LINE__, "tgdb_client_get_inferior_source_files unimplemented"); return -1; } return tcc->tgdb_client_interface-> tgdb_client_get_inferior_source_files(tcc->tgdb_debugger_context); } int tgdb_client_completion_callback(struct tgdb_client_context *tcc, const char *completion_command) { if (tcc == NULL || tcc->tgdb_client_interface == NULL) { logger_write_pos(logger, __FILE__, __LINE__, "tgdb_client_completion_callback unimplemented"); return -1; } return tcc->tgdb_client_interface->tgdb_client_completion_callback(tcc-> tgdb_debugger_context, completion_command); } char *tgdb_client_return_command(struct tgdb_client_context *tcc, enum tgdb_command_type c) { if (tcc == NULL || tcc->tgdb_client_interface == NULL) { logger_write_pos(logger, __FILE__, __LINE__, "tgdb_client_return_command unimplemented"); return NULL; } return tcc->tgdb_client_interface->tgdb_client_return_command(tcc-> tgdb_debugger_context, c); } char *tgdb_client_modify_breakpoint(struct tgdb_client_context *tcc, const char *file, int line, enum tgdb_breakpoint_action b) { if (tcc == NULL || tcc->tgdb_client_interface == NULL) { logger_write_pos(logger, __FILE__, __LINE__, "tgdb_client_modify_breakpoint unimplemented"); return NULL; } return tcc->tgdb_client_interface->tgdb_client_modify_breakpoint(tcc-> tgdb_debugger_context, file, line, b); } pid_t tgdb_client_get_debugger_pid(struct tgdb_client_context * tcc) { if (tcc == NULL || tcc->tgdb_client_interface == NULL) { logger_write_pos(logger, __FILE__, __LINE__, "tgdb_client_get_debugger_pid unimplemented"); return -1; } return tcc->tgdb_client_interface->tgdb_client_get_debugger_pid(tcc-> tgdb_debugger_context); } int tgdb_client_open_new_tty(struct tgdb_client_context *tcc, int *inferior_stdin, int *inferior_stdout) { if (tcc == NULL || tcc->tgdb_client_interface == NULL) { logger_write_pos(logger, __FILE__, __LINE__, "tgdb_client_open_new_tty unimplemented"); return -1; } return tcc->tgdb_client_interface->tgdb_client_open_new_tty(tcc-> tgdb_debugger_context, inferior_stdin, inferior_stdout); } const char *tgdb_client_get_tty_name(struct tgdb_client_context *tcc) { if (tcc == NULL || tcc->tgdb_client_interface == NULL) { logger_write_pos(logger, __FILE__, __LINE__, "tgdb_client_get_tty_name unimplemented"); return NULL; } return tcc->tgdb_client_interface->tgdb_client_get_tty_name(tcc-> tgdb_debugger_context); } cgdb-0.6.7/lib/tgdb/tgdb-base/tgdb_client_interface.h000644 000765 000024 00000032074 12074441140 023400 0ustar00mmuellerstaff000000 000000 #ifndef __TGDB_CLIENT_INTERFACE_H__ #define __TGDB_CLIENT_INTERFACE_H__ #if HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #if HAVE_SYS_TYPES_H #include #endif /* HAVE_SYS_TYPES_H */ #include "tgdb_command.h" #include "logger.h" /*! * \file * tgdb_client_interface.h * * \brief * This file documents the interface that a client will have to implement in * order to get TGDB to work with a particular debugger/protocol. */ /** * This type represents a client context. */ struct tgdb_client_context; /** * Commands that the client should be able to act upon or ignore. * TGDB will issue these commands to the client. */ enum tgdb_client_commands { /** * The client can currently ignore this command. */ TGDB_CLIENT_VOID = 0, /** * Get a list of breakpoints */ TGDB_CLIENT_GET_BREAKPOINTS, /** * Complete the current console line */ TGDB_CLIENT_COMPLETE_COMMAND_LINE, /** * Get a list of all the source files the inferior is made up of */ TGDB_CLIENT_GET_INFERIOR_SOURCE_FILES, /** * Set the debugger's prompt */ TGDB_CLIENT_SET_DEBUGGER_PROMPT }; /** * All of the debuggers that TGDB supports. */ enum tgdb_client_supported_debuggers { /** * An unsupported debugger. */ TGDB_CLIENT_DEBUGGER_UNSUPPORTED = 0, /** * This is of course the gnu debugger (GDB). */ TGDB_CLIENT_DEBUGGER_GNU_GDB }; /** * All of the protocols that are supported. * One debugger can work with many protocols. Basically, GDB supports * the 'annotate two' interface, the 'gdbmi' interface, and several others. */ enum tgdb_client_supported_protocols { /** * An unsupported protocol. */ TGDB_CLIENT_PROTOCOL_UNSUPPORTED = 0, /** * TGDB will try to negotiate with the debugger in order to choose the * most appropriate protocol to communicate with GDB. */ TGDB_CLIENT_PROTOCOL_AUTO, /** * This is a functional protocol to communicate with GDB. This protocol is * depricated. The annotate two protocol does not allow a lot of GDB's * functionality to be used. However, it works with really old GDB's. */ TGDB_CLIENT_PROTOCOL_GNU_GDB_ANNOTATE_TWO, /** * This is currently the best protocol to use when communicating with GDB. * It allows for the most functionality to be retrieved from GDB and * sent back to the front end. */ TGDB_CLIENT_PROTOCOL_GNU_GDB_GDBMI }; /******************************************************************************/ /** * @name Createing and Destroying a libtgdb context. * These functions are for createing and destroying client contexts. */ /******************************************************************************/ /*@{*/ /** * This creates a client context. * TGDB must call this function before any other function in the client library. * This function is responsible for determining which protocol will be used to * communicate with a particular debugger. * * \param debugger_path * The path to the desired debugger to use. *If this is NULL, then just "gdb" should be used. * * \param argc * The number of arguments to pass to the debugger * * \param argv * The arguments to pass to the debugger * * \param config_dir * The current config directory. * Files can be stored here by the client library. * * \param debugger * This is the debugger the user wishes to use. * * \param protocol * This is the protocol the user wishes to use with the particular debugger. * * \param logger * The data structure to report errors to. * * @return * NULL on error or a valid client context upon success. */ struct tgdb_client_context *tgdb_client_create_context(const char *debugger_path, int argc, char **argv, const char *config_dir, enum tgdb_client_supported_debuggers debugger, enum tgdb_client_supported_protocols protocol, struct logger *logger); /** * This will initialize a client context. * * \param tcc * The client context to initialize * * \param debugger_stdin * Writing to this descriptor, writes to the stdin of the debugger. * * \param debugger_stdout * Reading from this descriptor, reads from the debugger's stdout. * * \param inferior_stdin * Writing to this descriptor, writes to the stdin of the inferior. * * \param inferior_stdout * Reading from this descriptor, reads from the inferior's stdout. * * @return * 0 on success, otherwise -1 on error. * * \post * debugger_stdin, debugger_stdout, inferior_stdin, inferior_stdout * are all set. */ int tgdb_client_initialize_context(struct tgdb_client_context *tcc, int *debugger_stdin, int *debugger_stdout, int *inferior_stdin, int *inferior_stdout); /** * Shuts down the client context. No more calls can be made on the * current context. It will clean up after itself. * For instance, all descriptors it opened, it will close. * * \param tcc * The client context. * * @return * 0 on success, otherwise -1 on error. */ int tgdb_client_destroy_context(struct tgdb_client_context *tcc); /*@}*/ /******************************************************************************/ /** * @name Status Commands * These functions are for querying the client context. */ /******************************************************************************/ /*@{*/ /** * Returns the last error message ? * Not implemented yet. * What should it return? How should errors be handled? * * \param tcc * The client context. * * @return * 0 on success, otherwise -1 on error. */ int tgdb_client_err_msg(struct tgdb_client_context *tcc); /** * This determines if the client context is ready to allow TGDB to run * another command. * * \param tcc * The client context. * * @return * 1 if it is ready to allow TGDB to run another command, 0 if not. */ int tgdb_client_is_client_ready(struct tgdb_client_context *tcc); /** * This is currently called after TGDB has sent a command to the debugger. * Currently, the client can run commands that has to be run ( for TGDB ) * everytime the user/GUI runs a commnad. For example, this is necessary * for keeping the breakpoints current. * * In the future, it seems like this function should go away, and TGDB * should be responsible for running the commands necessary ???. * * \param tcc * The client context. * * @return * -1 on error, 0 on success * * \post * command_container is set. */ int tgdb_client_tgdb_ran_command(struct tgdb_client_context *tcc); /** * This is currently called by TGDB before TGDB runs the command. * It can prepare the client for the command COM to be run. * * \param tcc * The client context. * * \param com * The command to be run. * * @return * -1 on error, 0 on success */ int tgdb_client_prepare_for_command(struct tgdb_client_context *tcc, struct tgdb_command *com); /** * Determines if the client is capable of accepting TGDB commands. The client * may not be willing to allow TGDB to run its internal commands if the * debugger is prompting a "Yes/No" question or needs to get an answer from * the user related to the last command. * * \param tcc * The client context. * * @return * 1 if TGDB can run its internal commands, 0 if TGDB can't. */ int tgdb_client_can_tgdb_run_commands(struct tgdb_client_context *tcc); /*@}*/ /******************************************************************************/ /** * @name Input/Output commands * These functions are for communicating I/O with a client context. */ /******************************************************************************/ /*@{*/ /** * This recieves all of the output from the debugger. It is all routed * through this function. * * \param tcc * The client context. * * \param input_data * This is the stdout/stderr from the debugger. This is the data that * should parse be parsed. * * \param input_data_size * This is the size of input_data. * * \param debugger_output * Contains data that has been determined to be the output of the * debugger that the user should see. * * \param debugger_output_size * This is the size of debugger_output * * \param inferior_output * Contains data that has been determined to be the output of the * inferior that the user should see. * * \param inferior_output_size * This is the size of inferior_output * * \param list * The data generated by the client. These are any tgdb_command types the * client generated. * * @return * 1 when it has finished a command, * 0 on success but hasn't recieved enough I/O to finish the command, * otherwise -1 on error. * * \post * debugger_output, debugger_output_size, inferior_output, * inferior_output_size are all set. */ int tgdb_client_parse_io(struct tgdb_client_context *tcc, const char *input_data, const size_t input_data_size, char *debugger_output, size_t * debugger_output_size, char *inferior_output, size_t * inferior_output_size, struct tgdb_list *list); /** * Get's all of the commands that the client generated during the last call. * * \param tcc * The client context. * * @return * NULL if there are no commands. * Otherwise a list of tgdb_client_commands. * The order of these commands must be preserved. */ struct tgdb_list *tgdb_client_get_client_commands(struct tgdb_client_context *tcc); /*@}*/ /******************************************************************************/ /** * @name Functional commands * These functinos are used to ask the client context to perform a task. */ /******************************************************************************/ /*@{*/ /** * Get's the absolute and relative path that relates to the path PATH. * * \param tcc * The client context. * * \param path * The path that the debugger outputted. (relative or absolute) * * @return * 0 on success, otherwise -1 on error. */ int tgdb_client_get_filename_pair(struct tgdb_client_context *tcc, const char *path); /** * Get's the current fullname, filename and line number that the debugger is * at. * * \param tcc * The client context. * * \param on_startup * This variable can be set to 1 if the front end wants to probe GDB * for the initial file and location of the program being debugged. * However, each initial time after that, this variable should be * set to 0. * * @return * 0 on success, otherwise -1 on error. */ int tgdb_client_get_current_location(struct tgdb_client_context *tcc, int on_startup); /** * Gets all of the source files that the inferior is made of. * * \param tcc * The client context. * * @return * 0 on success, otherwise -1 on error. */ int tgdb_client_get_inferior_source_files(struct tgdb_client_context *tcc); /** * TGDB calls this function when it determines a command needs to be completed. * * \param tcc * The client context. * * \param completion_command * The command to be completed * * @return * 0 on success, otherwise -1 on error. */ int tgdb_client_completion_callback(struct tgdb_client_context *tcc, const char *completion_command); /** * This returns the command to send to gdb for the enum C. * It will return NULL on error, otherwise correct string on output. * * \param tcc * The client context. * * \param c * The command to run. * * @return * Command on success, otherwise NULL on error. */ char *tgdb_client_return_command(struct tgdb_client_context *tcc, enum tgdb_command_type c); /** * \param tcc * The client context. * * \param file * The file to set the breakpoint in. * * \param line * The line in FILE to set the breakpoint in. * * \param b * Determines what the user wants to do with the breakpoint. * * @return * -1 on error, or 0 on success */ char *tgdb_client_modify_breakpoint(struct tgdb_client_context *tcc, const char *file, int line, enum tgdb_breakpoint_action b); /** * \param tcc * The client context. * * @return * -1 on error or pid on success. */ pid_t tgdb_client_get_debugger_pid(struct tgdb_client_context *tcc); /*@}*/ /******************************************************************************/ /** * @name Inferior tty commands * These functinos are used to alter the tty state of the inferior program. * These functions currently are not always supported. If the annotate_two * subsytem is being used, the tty commands are supported. */ /******************************************************************************/ /*@{*/ /** * \param tcc * The client context. * * \param inferior_stdin * Writing to this descriptor, writes to the stdin of the inferior. * * \param inferior_stdout * Reading from this descriptor, reads from the inferior's stdout. * * @return * 0 on success, otherwise -1 on error. * * \post * inferior_stdin and inferior_stdout are set if the return value * of tgdb_client_open_new_tty is acceptable. */ int tgdb_client_open_new_tty(struct tgdb_client_context *tcc, int *inferior_stdin, int *inferior_stdout); /** * \param tcc * The client context. * * @return * tty name on success, otherwise NULL on error. */ const char *tgdb_client_get_tty_name(struct tgdb_client_context *tcc); /*@}*/ #endif cgdb-0.6.7/lib/tgdb/tgdb-base/tgdb_command.c000644 000765 000024 00000001773 12074441140 021515 0ustar00mmuellerstaff000000 000000 #if HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #if HAVE_STDIO_H #include #endif #include "tgdb_types.h" #include "tgdb_command.h" #include "sys_util.h" struct tgdb_command *tgdb_command_create(const char *tgdb_command_data, enum tgdb_command_choice command_choice, void *client_data) { struct tgdb_command *tc; tc = (struct tgdb_command *) cgdb_malloc(sizeof (struct tgdb_command)); if (tgdb_command_data) tc->tgdb_command_data = strdup(tgdb_command_data); else tc->tgdb_command_data = NULL; tc->command_choice = command_choice; tc->tgdb_client_private_data = client_data; return tc; } void tgdb_command_destroy(void *item) { struct tgdb_command *tc = (struct tgdb_command *) item; free(tc); tc = NULL; } void tgdb_command_print(void *item) { fprintf(stderr, "unimplemented\n"); } cgdb-0.6.7/lib/tgdb/tgdb-base/tgdb_command.h000644 000765 000024 00000004724 12074441140 021521 0ustar00mmuellerstaff000000 000000 #ifndef __TGDB_COMMAND_H__ #define __TGDB_COMMAND_H__ /*! * \file * tgdb_command.h * * \brief * This interface is intended to allow TGDB to represent a single command. */ #include "tgdb_types.h" /** * The current command type. TGDB is capable of having any commands of this * type in it's queue. * * I don't know what this should look like completly. */ enum tgdb_command_choice { /** * A command from the front end */ TGDB_COMMAND_FRONT_END, /** * A command from the console */ TGDB_COMMAND_CONSOLE, /** * A command from a client of TGDB */ TGDB_COMMAND_TGDB_CLIENT, /** * A priority command is a command that the client context needs * to run before it can finish getting the data necessary for a * TGDB_COMMAND_TGDB_CLIENT command. */ TGDB_COMMAND_TGDB_CLIENT_PRIORITY }; /* This is here to add new client_command/command faster */ /** * This is the main tgdb queue command. * It will be put into a queue and run. * For each TGDB command generated by a client, the client command is * with it. */ struct tgdb_command { /** * The actual command to give. */ char *tgdb_command_data; /** * The type of command this one is. */ enum tgdb_command_choice command_choice; /** * The client command associated with this command. */ struct tgdb_client_command *client_command; /** Private data the client context can use. */ void *tgdb_client_private_data; }; /** * Creates a new command and initializes it * * \param tgdb_command_data * The data needed to run the command * * \param command_choice * The type of command to run. * * \param action_choice * The type of action TGDB would like to perform. * * \param client_data * Data that the client can use when prepare_client_for_command is called * * @return * Always is successfull, will call exit on failed malloc */ struct tgdb_command *tgdb_command_create(const char *tgdb_command_data, enum tgdb_command_choice command_choice, void *client_data); /** * This will free a TGDB queue command. * These are the commands given by TGDB to the debugger. * This is a function for debugging. * * \param item * The command to free */ void tgdb_command_destroy(void *item); /** * This will print a TGDB queue command to stderr. * These are the commands given by TGDB to the debugger. * This is a function for debugging. * * \param item * The command to print */ void tgdb_command_print(void *item); #endif cgdb-0.6.7/lib/tgdb/tgdb-base/tgdb_types.c000644 000765 000024 00000020134 12074441140 021233 0ustar00mmuellerstaff000000 000000 #if HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #if HAVE_SYS_TYPES_H #include #endif /* HAVE_SYS_TYPES_H */ #if HAVE_STDIO_H #include #endif #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ /* Local includes */ #include "tgdb_types.h" #include "logger.h" #include "sys_util.h" #include "ibuf.h" #include "tgdb_list.h" #include "queue.h" static int tgdb_types_print_item(void *command) { struct tgdb_response *com = (struct tgdb_response *) command; FILE *fd = stderr; if (!com) { logger_write_pos(logger, __FILE__, __LINE__, "item is null"); return -1; } switch (com->header) { case TGDB_UPDATE_BREAKPOINTS: { struct tgdb_list *list = com->choice.update_breakpoints.breakpoint_list; tgdb_list_iterator *iterator; struct tgdb_breakpoint *tb; fprintf(fd, "Breakpoint start\n"); iterator = tgdb_list_get_first(list); while (iterator) { tb = (struct tgdb_breakpoint *) tgdb_list_get_item(iterator); if (tb == NULL) logger_write_pos(logger, __FILE__, __LINE__, "breakpoint is NULL"); fprintf(fd, "\tFILE(%s) FUNCNAME(%s) LINE(%d) ENABLED(%d)\n", tb->file, tb->funcname, tb->line, tb->enabled); iterator = tgdb_list_next(iterator); } fprintf(fd, "Breakpoint end\n"); break; } case TGDB_UPDATE_FILE_POSITION: { struct tgdb_file_position *tfp = com->choice.update_file_position.file_position; fprintf(fd, "TGDB_UPDATE_FILE_POSITION ABSOLUTE(%s)RELATIVE(%s)LINE(%d)\n", tfp->absolute_path, tfp->relative_path, tfp->line_number); break; } case TGDB_UPDATE_SOURCE_FILES: { struct tgdb_list *list = com->choice.update_source_files.source_files; tgdb_list_iterator *i; char *s; fprintf(fd, "Inferior source files start\n"); i = tgdb_list_get_first(list); while (i) { s = (char *) tgdb_list_get_item(i); fprintf(fd, "TGDB_SOURCE_FILE (%s)\n", s); i = tgdb_list_next(i); } fprintf(fd, "Inferior source files end\n"); break; } case TGDB_SOURCES_DENIED: fprintf(fd, "TGDB_SOURCES_DENIED\n"); break; case TGDB_FILENAME_PAIR: { const char *apath = com->choice.filename_pair.absolute_path; const char *rpath = com->choice.filename_pair.relative_path; fprintf(fd, "TGDB_ABSOLUTE_SOURCE_ACCEPTED ABSOLUTE(%s) RELATIVE(%s)\n", apath, rpath); break; } case TGDB_ABSOLUTE_SOURCE_DENIED: { struct tgdb_source_file *file = com->choice.absolute_source_denied.source_file; fprintf(fd, "TGDB_ABSOLUTE_SOURCE_DENIED(%s)\n", file->absolute_path); break; } case TGDB_INFERIOR_EXITED: { int *status = com->choice.inferior_exited.exit_status; fprintf(fd, "TGDB_INFERIOR_EXITED(%d)\n", *status); break; } case TGDB_UPDATE_COMPLETIONS: { struct tgdb_list *list = com->choice.update_completions.completion_list; tgdb_list_iterator *i; char *s; fprintf(fd, "completions start\n"); i = tgdb_list_get_first(list); while (i) { s = (char *) tgdb_list_get_item(i); fprintf(fd, "TGDB_UPDATE_COMPLETION (%s)\n", s); i = tgdb_list_next(i); } fprintf(fd, "completions end\n"); break; } case TGDB_UPDATE_CONSOLE_PROMPT_VALUE: { const char *value = com->choice.update_console_prompt_value.prompt_value; fprintf(fd, "TGDB_UPDATE_CONSOLE_PROMPT_VALUE(%s)\n", value); break; } case TGDB_QUIT: { struct tgdb_debugger_exit_status *status = com->choice.quit.exit_status; fprintf(fd, "TGDB_QUIT EXIT_STATUS(%d)RETURN_VALUE(%d)\n", status->exit_status, status->return_value); break; } } return 0; } static int tgdb_types_breakpoint_free(void *data) { struct tgdb_breakpoint *tb; tb = (struct tgdb_breakpoint *) data; /* Free the structure */ free((char *) tb->file); tb->file = NULL; free((char *) tb->funcname); tb->funcname = NULL; free(tb); tb = NULL; return 0; } static int tgdb_types_source_files_free(void *data) { char *s = (char *) data; free(s); s = NULL; return 0; } static int tgdb_types_delete_item(void *command) { struct tgdb_response *com = (struct tgdb_response *) command; if (!com) return -1; switch (com->header) { case TGDB_UPDATE_BREAKPOINTS: { struct tgdb_list *list = com->choice.update_breakpoints.breakpoint_list; tgdb_list_free(list, tgdb_types_breakpoint_free); break; } case TGDB_UPDATE_FILE_POSITION: { struct tgdb_file_position *tfp = com->choice.update_file_position.file_position; free(tfp->absolute_path), tfp->absolute_path = NULL; free(tfp->relative_path), tfp->relative_path = NULL; free(tfp); tfp = NULL; break; } case TGDB_UPDATE_SOURCE_FILES: { struct tgdb_list *list = com->choice.update_source_files.source_files; tgdb_list_free(list, tgdb_types_source_files_free); break; } case TGDB_SOURCES_DENIED: /* Nothing to do */ break; case TGDB_FILENAME_PAIR: { free((char *) com->choice.filename_pair.absolute_path); com->choice.filename_pair.absolute_path = NULL; free((char *) com->choice.filename_pair.relative_path); com->choice.filename_pair.relative_path = NULL; break; } case TGDB_ABSOLUTE_SOURCE_DENIED: { struct tgdb_source_file *file = com->choice.absolute_source_denied.source_file; free(file->absolute_path); file->absolute_path = NULL; free(file); file = NULL; break; } case TGDB_INFERIOR_EXITED: { int *status = com->choice.inferior_exited.exit_status; free(status); status = NULL; } break; case TGDB_UPDATE_COMPLETIONS: { struct tgdb_list *list = com->choice.update_completions.completion_list; tgdb_list_free(list, tgdb_types_source_files_free); break; } case TGDB_UPDATE_CONSOLE_PROMPT_VALUE: { const char *value = com->choice.update_console_prompt_value.prompt_value; free((char *) value); value = NULL; break; } case TGDB_QUIT: { struct tgdb_debugger_exit_status *status = com->choice.quit.exit_status; free(status); status = NULL; break; } } free(com); com = NULL; return 0; } int tgdb_types_print_command(void *command) { return tgdb_types_print_item((void *) command); } int tgdb_types_free_command(void *command) { return tgdb_types_delete_item((void *) command); } void tgdb_types_append_command(struct tgdb_list *command_list, struct tgdb_response *response) { tgdb_list_append(command_list, response); } cgdb-0.6.7/lib/tgdb/tgdb-base/tgdb_types.h000644 000765 000024 00000027436 12074441140 021254 0ustar00mmuellerstaff000000 000000 #ifndef __TGDB_TYPES_H__ #define __TGDB_TYPES_H__ /*! * \file * tgdb_types.h * * \brief * This interface is intended to declare and document the ADT's that TGDB * exports to the front ends. * * The front end can interrogate these data structures to discover what TGDB * knows about the debugger. This is currently the only way the front end gets * any information about the current debugging session. */ #ifdef __cplusplus extern "C" { #endif #include "tgdb_list.h" /* A reference to a command that has been created by TGDB */ struct tgdb_command; struct tgdb_response; /******************************************************************************/ /** * @name Utilitly commands to run on a command. * These functions take a 'struct tgdb_response' as a parameter. */ /******************************************************************************/ /*@{*/ /** * This will print a client generated command to stderr. * These are the commands that are returned to the front end. * It is currently used for debugging purposes. * * \param command * The command to print. It should be of type 'struct tgdb_response' * * @return * Will return -1 if the print command failed. Otherwise, 0. */ int tgdb_types_print_command(void *command); /** * This will free a client generated command. * These are the commands that are returned to the front end. * * \param command * The command to print. It should be of type 'struct tgdb_response' * * @return * Will return -1 if free'ing failed. Otherwise, 0. */ int tgdb_types_free_command(void *command); /** * This will append a new command into TGDB's queue. * * \param command_list * \param response */ void tgdb_types_append_command(struct tgdb_list *command_list, struct tgdb_response *response); /*@}*/ /** * The client can give any of these commands to TGDB through * tgdb_run_debugger_command. */ enum tgdb_command_type { /** This will instruct TGDB to tell the debugger to continue. */ TGDB_CONTINUE = 0, /** This will instruct TGDB to tell the debugger to finish. */ TGDB_FINISH, /** * This will instruct TGDB to tell the debugger to go to the next * source level instruction. */ TGDB_NEXT, /** * This will instruct TGDB to tell the debugger to (re-)start the program. */ TGDB_START, /** * This will instruct TGDB to tell the debugger to (re-)run the program. */ TGDB_RUN, /** * This will instruct TGDB to tell the debugger to kill the program. */ TGDB_KILL, /** This will instruct TGDB to tell the debugger to step. */ TGDB_STEP, /** This will instruct TGDB to tell the debugger to go up a frame. */ TGDB_UP, /** This will instruct TGDB to tell the debugger to go down a frame. */ TGDB_DOWN, /** * Hmmm. This is probably bad :). Actually, I can't remember why its here. */ TGDB_ERROR }; /** * This gives the client the ability to add or remove breakpoints. * Currently, enable/disable are not supported. */ enum tgdb_breakpoint_action { /** Add a breakpoint. */ TGDB_BREAKPOINT_ADD, /** Add a temporary breakpoint */ TGDB_TBREAKPOINT_ADD, /** Delete a breakpoint. */ TGDB_BREAKPOINT_DELETE, /** Disable a breakpoint. */ TGDB_BREAKPOINT_DISABLE, /** Enable a breakpoint. */ TGDB_BREAKPOINT_ENABLE }; /** * This structure represents a breakpoint. */ struct tgdb_breakpoint { /** * This is the file that the breakpoint is set in. This path name can be * relative. */ char *file; /** The name of the function the breakpoint is set at. */ char *funcname; /** The line number where the breakpoint is set. */ int line; /** 0 if it is not enabled or 1 if it is enabled. */ int enabled; }; /** * This structure currently represents a file position. */ struct tgdb_file_position { /** The absolute path to the file. */ char *absolute_path; /** The relative path to the file. */ char *relative_path; /** The line number in the file. */ int line_number; }; /** * This is used to return a path to the front end. */ struct tgdb_source_file { /** The absolute path to the file of interest. */ char *absolute_path; }; /** * This tells the front end how the debugger terminated. */ struct tgdb_debugger_exit_status { /** * If this is 0, the debugger terminated normally and return_value is valid * If this is -1, the debugger terminated abnormally and return_value is * invalid */ int exit_status; /** * This is the return value of the debugger upon normal termination. */ int return_value; }; enum INTERFACE_REQUEST_COMMANDS { /** Request for TGDB to run a console command through the debugger */ TGDB_REQUEST_CONSOLE_COMMAND, /** * Request for TGDB to get all of the source files that the debugger * currently knows about the inferior. */ TGDB_REQUEST_INFO_SOURCES, /** * Request the absolute and relative path from the debugger given a path. * This path being used to get the pair should have been returned by the * tgdb_request_inferiors_source_files command. */ TGDB_REQUEST_FILENAME_PAIR, /** * This asks TGDB to determine the current fullname, filename and line * number that the debugger is currently at, in the inferior. */ TGDB_REQUEST_CURRENT_LOCATION, /** Run a debugger command (ie next, step, finish) */ TGDB_REQUEST_DEBUGGER_COMMAND, /** Modify a breakpoint (ie delete/create/disable) */ TGDB_REQUEST_MODIFY_BREAKPOINT, /** Ask GDB to give a list of tab completions for a given string */ TGDB_REQUEST_COMPLETE }; struct tgdb_request { /** This is the type of request. */ enum INTERFACE_REQUEST_COMMANDS header; union { struct { /** The null terminated console command to pass to GDB */ const char *command; } console_command; /* info_sources; */ struct { const char *file; } filename_pair; struct { int on_startup; } current_location; struct { /** This is the command that libtgdb should run through the debugger */ enum tgdb_command_type c; } debugger_command; struct { /* The filename to set the breakpoint in */ const char *file; /* The corresponding line number */ int line; /* The action to take */ enum tgdb_breakpoint_action b; } modify_breakpoint; struct { /* The line to ask GDB for completions for */ const char *line; } complete; } choice; }; typedef struct tgdb_request *tgdb_request_ptr; /** * This is the commands interface used between the front end and TGDB. * When TGDB is responding to a request or when an event is being generated * the front end will find out about it through one of these enums. */ enum INTERFACE_RESPONSE_COMMANDS { /** All breakpoints that are set. */ TGDB_UPDATE_BREAKPOINTS, /** * This tells the gui what filename/line number the debugger is on. * It gets generated whenever it changes. * This is a 'struct tgdb_file_position *'. */ TGDB_UPDATE_FILE_POSITION, /** * This returns a list of all the source files that make up the * inferior program. */ TGDB_UPDATE_SOURCE_FILES, /** * This is a response to the tgdb_get_sources function call. * If the sources can not be recieved you will get this response. */ TGDB_SOURCES_DENIED, /** * This is a response to the function call tgdb_get_filename_pair. * It returns the absolute and relative path to the source file requested. */ TGDB_FILENAME_PAIR, /** * This is a response to the function call tgdb_get_source_absolute_filename. * It happens when gdb failed to know what the absolute path to the relative * path asked for was. * * NOTE: If this command is generated and the file is NULL, the command can * be ignored. Currently, the annotate 2 subsytem uses this when trying to * figure out the initial file. */ TGDB_ABSOLUTE_SOURCE_DENIED, /** * This happens when the program being debugged by GDB exits. * It can be used be the front end to clear any cache that it might have * obtained by debugging the last program. The data represents the exit * status. */ TGDB_INFERIOR_EXITED, /** * This returns a list of all the completions. * */ TGDB_UPDATE_COMPLETIONS, /** The prompt has changed, here is the new value. */ TGDB_UPDATE_CONSOLE_PROMPT_VALUE, /** * This happens when gdb quits. * libtgdb is done. * You will get no more responses after this one. * This is a 'struct tgdb_quit_status *' */ TGDB_QUIT }; /** * A single TGDB response for the front end. * This is the smallest unit of information that TGDB can return to the front * end. */ struct tgdb_response { /** This is the type of response. */ enum INTERFACE_RESPONSE_COMMANDS header; union { /* header == TGDB_UPDATE_BREAKPOINTS */ struct { /* This list has elements of 'struct tgdb_breakpoint *' * representing each breakpoint. */ struct tgdb_list *breakpoint_list; } update_breakpoints; /* header == TGDB_UPDATE_FILE_POSITION */ struct { struct tgdb_file_position *file_position; } update_file_position; /* header == TGDB_UPDATE_SOURCE_FILES */ struct { /* This list has elements of 'const char *' representing each * filename. The filename may be relative or absolute. */ struct tgdb_list *source_files; } update_source_files; /* header == TGDB_SOURCES_DENIED */ /* sources_denied; */ /* header == TGDB_FILENAME_PAIR */ struct { /** * If either of these are NULL, the data could not be retrieved from * the debugger. */ /** The absolute path to the file being looked for */ const char *absolute_path; /** The relative path to the file being looked for */ const char *relative_path; } filename_pair; /* header == TGDB_ABSOLUTE_SOURCE_DENIED */ struct { struct tgdb_source_file *source_file; } absolute_source_denied; /* header == TGDB_INFERIOR_EXITED */ struct { int *exit_status; } inferior_exited; /* header == TGDB_UPDATE_COMPLETIONS */ struct { /* This list has elements of 'const char *' * representing each possible completion. */ struct tgdb_list *completion_list; } update_completions; /* header == TGDB_UPDATE_CONSOLE_PROMPT_VALUE */ struct { /* The new prompt GDB has reported */ const char *prompt_value; } update_console_prompt_value; /* header == TGDB_QUIT */ struct { struct tgdb_debugger_exit_status *exit_status; } quit; } choice; }; #ifdef __cplusplus } #endif #endif /* __TGDB_TYPES_H__ */ cgdb-0.6.7/lib/tgdb/testsuite/AUTHORS000644 000765 000024 00000000000 12074441140 020162 0ustar00mmuellerstaff000000 000000 cgdb-0.6.7/lib/tgdb/testsuite/autoregen.sh000755 000765 000024 00000000100 12074441140 021443 0ustar00mmuellerstaff000000 000000 rm -rf autom4te.cache/ aclocal autoconf autoheader automake -a cgdb-0.6.7/lib/tgdb/testsuite/config/000755 000765 000024 00000000000 12074441140 020371 5ustar00mmuellerstaff000000 000000 cgdb-0.6.7/lib/tgdb/testsuite/config.h.in000644 000765 000024 00000001055 12074441140 021150 0ustar00mmuellerstaff000000 000000 /* config.h.in. Generated from configure.in by autoheader. */ /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Version number of package */ #undef VERSION cgdb-0.6.7/lib/tgdb/testsuite/configure.in000644 000765 000024 00000000452 12074441140 021436 0ustar00mmuellerstaff000000 000000 AC_PREREQ(2.5) AC_INIT(tgdb.base) AC_CONFIG_HEADER(config.h) AC_EXEEXT AM_INIT_AUTOMAKE(tgdb,.1) AM_MAINTAINER_MODE dnl always compile examples with -g CFLAGS=-g CXXFLAGS=-g dnl Checks for programs. AC_PROG_CC AC_PROG_CXX #AC_CONFIG_SUBDIRS($configdirs) AC_OUTPUT([Makefile tgdb.base/Makefile]) cgdb-0.6.7/lib/tgdb/testsuite/COPYING000644 000765 000024 00000043110 12074441140 020156 0ustar00mmuellerstaff000000 000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 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 of the License, 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; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. cgdb-0.6.7/lib/tgdb/testsuite/depcomp000755 000765 000024 00000027533 12074441140 020513 0ustar00mmuellerstaff000000 000000 #! /bin/sh # depcomp - compile a program generating dependencies as side-effects # Copyright 1999, 2000 Free Software Foundation, Inc. # 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; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # `libtool' can also be set to `yes' or `no'. if test -z "$depfile"; then base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'` dir=`echo "$object" | sed 's,/.*$,/,'` if test "$dir" = "$object"; then dir= fi # FIXME: should be _deps on DOS. depfile="$dir.deps/$base" fi tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ## The second -e expression handles DOS-style file names with drive letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the `deleted header file' problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. tr ' ' ' ' < "$tmpdepfile" | ## Some versions of gcc put a space before the `:'. On the theory ## that the space means something, we add a space to the output as ## well. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like `#:fec' to the end of the # dependency line. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ tr ' ' ' ' >> $depfile echo >> $depfile # The second pass generates a dummy entry for each header file. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> $depfile else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. This file always lives in the current directory. # Also, the AIX compiler puts `$object:' at the start of each line; # $object doesn't have directory information. stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'` tmpdepfile="$stripped.u" outname="$stripped.o" if test "$libtool" = yes; then "$@" -Wc,-M else "$@" -M fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi if test -f "$tmpdepfile"; then # Each line is of the form `foo.o: dependent.h'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in `foo.d' instead, so we check for that too. # Subdirectories are respected. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then tmpdepfile1="$dir.libs/$base.lo.d" tmpdepfile2="$dir.libs/$base.d" "$@" -Wc,-MD else tmpdepfile1="$dir$base.o.d" tmpdepfile2="$dir$base.d" "$@" -MD fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi if test -f "$tmpdepfile1"; then tmpdepfile="$tmpdepfile1" else tmpdepfile="$tmpdepfile2" fi if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a space and a tab in the []. sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the proprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # Remove `-o $object'. We will use -o /dev/null later, # however we can't do the remplacement now because # `-o $object' might simply not be used IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M "$@" -o /dev/null $dashmflag | sed 's:^[^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" tr ' ' ' ' < "$tmpdepfile" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # X makedepend shift cleared=no for arg in "$@"; do case $cleared in no) set ""; shift cleared=yes ;; esac case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; -*) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix="`echo $object | sed 's/^.*\././'`" touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" sed '1,2d' "$tmpdepfile" | tr ' ' ' ' | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the proprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E | sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the proprocessed file to stdout, regardless of -o, # because we must use -o when running libtool. "$@" || exit $? IFS=" " for arg do case "$arg" in "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" echo " " >> "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 cgdb-0.6.7/lib/tgdb/testsuite/INSTALL000644 000765 000024 00000022030 12074441140 020152 0ustar00mmuellerstaff000000 000000 Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is free documentation; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. Basic Installation ================== These are generic installation instructions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. (Caching is disabled by default to prevent problems with accidental use of stale cache files.) If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You only need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. If you're using `csh' on an old version of System V, you might need to type `sh ./configure' instead to prevent `csh' from trying to execute `configure' itself. Running `configure' takes awhile. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package. 4. Type `make install' to install the programs and any data files and documentation. 5. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you must use a version of `make' that supports the `VPATH' variable, such as GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. If you have to use a `make' that does not support the `VPATH' variable, you have to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. Installation Names ================== By default, `make install' will install the package's files in `/usr/local/bin', `/usr/local/man', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PATH'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you give `configure' the option `--exec-prefix=PATH', the package will use PATH as the prefix for installing programs and libraries. Documentation and other data files will still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=PATH' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, `configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the `--target=TYPE' option to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc will cause the specified gcc to be used as the C compiler (unless it is overridden in the site shell script). `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of the options to `configure', and exit. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. cgdb-0.6.7/lib/tgdb/testsuite/install-sh000755 000765 000024 00000012701 12074441140 021131 0ustar00mmuellerstaff000000 000000 #!/bin/sh # # install - install a program, script, or datafile # This comes from X11R5 (mit/util/scripts/install.sh). # # Copyright 1991 by the Massachusetts Institute of Technology # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting # documentation, and that the name of M.I.T. not be used in advertising or # publicity pertaining to distribution of the software without specific, # written prior permission. M.I.T. makes no representations about the # suitability of this software for any purpose. It is provided "as is" # without express or implied warranty. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. It can only install one file at a time, a restriction # shared with many OS's install programs. # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" transformbasename="" transform_arg="" instcmd="$mvprog" chmodcmd="$chmodprog 0755" chowncmd="" chgrpcmd="" stripcmd="" rmcmd="$rmprog -f" mvcmd="$mvprog" src="" dst="" dir_arg="" while [ x"$1" != x ]; do case $1 in -c) instcmd="$cpprog" shift continue;; -d) dir_arg=true shift continue;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; -s) stripcmd="$stripprog" shift continue;; -t=*) transformarg=`echo $1 | sed 's/-t=//'` shift continue;; -b=*) transformbasename=`echo $1 | sed 's/-b=//'` shift continue;; *) if [ x"$src" = x ] then src=$1 else # this colon is to work around a 386BSD /bin/sh bug : dst=$1 fi shift continue;; esac done if [ x"$src" = x ] then echo "install: no input file specified" exit 1 else : fi if [ x"$dir_arg" != x ]; then dst=$src src="" if [ -d $dst ]; then instcmd=: chmodcmd="" else instcmd=$mkdirprog fi else # Waiting for this to be detected by the "$instcmd $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if [ -f "$src" ] || [ -d "$src" ] then : else echo "install: $src does not exist" exit 1 fi if [ x"$dst" = x ] then echo "install: no destination specified" exit 1 else : fi # If destination is a directory, append the input filename; if your system # does not like double slashes in filenames, you may need to add some logic if [ -d $dst ] then dst="$dst"/`basename $src` else : fi fi ## this sed command emulates the dirname command dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Make sure that the destination directory exists. # this part is taken from Noah Friedman's mkinstalldirs script # Skip lots of stat calls in the usual case. if [ ! -d "$dstdir" ]; then defaultIFS=' ' IFS="${IFS-${defaultIFS}}" oIFS="${IFS}" # Some sh's can't handle IFS=/ for some reason. IFS='%' set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` IFS="${oIFS}" pathcomp='' while [ $# -ne 0 ] ; do pathcomp="${pathcomp}${1}" shift if [ ! -d "${pathcomp}" ] ; then $mkdirprog "${pathcomp}" else : fi pathcomp="${pathcomp}/" done fi if [ x"$dir_arg" != x ] then $doit $instcmd $dst && if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else : ; fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else : ; fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else : ; fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else : ; fi else # If we're going to rename the final executable, determine the name now. if [ x"$transformarg" = x ] then dstfile=`basename $dst` else dstfile=`basename $dst $transformbasename | sed $transformarg`$transformbasename fi # don't allow the sed command to completely eliminate the filename if [ x"$dstfile" = x ] then dstfile=`basename $dst` else : fi # Make a temp file name in the proper directory. dsttmp=$dstdir/#inst.$$# # Move or copy the file name to the temp name $doit $instcmd $src $dsttmp && trap "rm -f ${dsttmp}" 0 && # and set any options; do chmod last to preserve setuid bits # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $instcmd $src $dsttmp" command. if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else :;fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else :;fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else :;fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else :;fi && # Now rename the file to the real destination. $doit $rmcmd -f $dstdir/$dstfile && $doit $mvcmd $dsttmp $dstdir/$dstfile fi && exit 0 cgdb-0.6.7/lib/tgdb/testsuite/lib/000755 000765 000024 00000000000 12074441140 017672 5ustar00mmuellerstaff000000 000000 cgdb-0.6.7/lib/tgdb/testsuite/Makefile.am000644 000765 000024 00000000057 12074441140 021162 0ustar00mmuellerstaff000000 000000 AUTOMAKE_OPTIONS = dejagnu SUBDIRS = tgdb.base cgdb-0.6.7/lib/tgdb/testsuite/missing000755 000765 000024 00000024036 12074441140 020530 0ustar00mmuellerstaff000000 000000 #! /bin/sh # Common stub for a few missing GNU programs while installing. # Copyright (C) 1996, 1997, 1999, 2000, 2002 Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. # 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; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi run=: # In the cases where this matters, `missing' is being run in the # srcdir already. if test -f configure.ac; then configure_ac=configure.ac else configure_ac=configure.in fi case "$1" in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 ;; esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. case "$1" in -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit --run try to run the given command, and emulate it if it fails Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file tar try tar, gnutar, gtar, then tar without non-portable flags yacc create \`y.tab.[ch]', if possible, from existing .[ch]" ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing 0.4 - GNU automake" ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; aclocal*) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" touch_files= for f in $files; do case "$f" in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake*) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; autom4te) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is needed, and you do not seem to have it handy on your system. You might have modified some files without having the proper tools for further handling them. You can get \`$1Help2man' as part of \`Autoconf' from any GNU archive site." file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo "#! /bin/sh" echo "# Created by GNU Automake missing as a replacement of" echo "# $ $@" echo "exit 0" chmod +x $file exit 1 fi ;; bison|yacc) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.h fi ;; esac fi if [ ! -f y.tab.h ]; then echo >y.tab.h fi if [ ! -f y.tab.c ]; then echo 'main() { return 0; }' >y.tab.c fi ;; lex|flex) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if [ ! -f lex.yy.c ]; then echo 'main() { return 0; }' >lex.yy.c fi ;; help2man) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` fi if [ -f "$file" ]; then touch $file else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" exit 1 fi ;; makeinfo) if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then # We have makeinfo, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` fi touch $file ;; tar) shift if test -n "$run"; then echo 1>&2 "ERROR: \`tar' requires --run" exit 1 fi # We have already tried tar in the generic part. # Look for gnutar/gtar before invocation to avoid ugly error # messages. if (gnutar --version > /dev/null 2>&1); then gnutar "$@" && exit 0 fi if (gtar --version > /dev/null 2>&1); then gtar "$@" && exit 0 fi firstarg="$1" if shift; then case "$firstarg" in *o*) firstarg=`echo "$firstarg" | sed s/o//` tar "$firstarg" "$@" && exit 0 ;; esac case "$firstarg" in *h*) firstarg=`echo "$firstarg" | sed s/h//` tar "$firstarg" "$@" && exit 0 ;; esac fi echo 1>&2 "\ WARNING: I can't seem to be able to run \`tar' with the given arguments. You may want to install GNU tar or Free paxutils, or check the command line arguments." exit 1 ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and you do not seem to have it handy on your system. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequirements for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 cgdb-0.6.7/lib/tgdb/testsuite/mkinstalldirs000755 000765 000024 00000003411 12074441140 021731 0ustar00mmuellerstaff000000 000000 #! /bin/sh # mkinstalldirs --- make directory hierarchy # Author: Noah Friedman # Created: 1993-05-16 # Public domain errstatus=0 dirmode="" usage="\ Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..." # process command line arguments while test $# -gt 0 ; do case "${1}" in -h | --help | --h* ) # -h for help echo "${usage}" 1>&2; exit 0 ;; -m ) # -m PERM arg shift test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; } dirmode="${1}" shift ;; -- ) shift; break ;; # stop option processing -* ) echo "${usage}" 1>&2; exit 1 ;; # unknown option * ) break ;; # first non-opt arg esac done for file do if test -d "$file"; then shift else break fi done case $# in 0) exit 0 ;; esac case $dirmode in '') if mkdir -p -- . 2>/dev/null; then echo "mkdir -p -- $*" exec mkdir -p -- "$@" fi ;; *) if mkdir -m "$dirmode" -p -- . 2>/dev/null; then echo "mkdir -m $dirmode -p -- $*" exec mkdir -m "$dirmode" -p -- "$@" fi ;; esac for file do set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` shift pathcomp= for d do pathcomp="$pathcomp$d" case "$pathcomp" in -* ) pathcomp=./$pathcomp ;; esac if test ! -d "$pathcomp"; then echo "mkdir $pathcomp" mkdir "$pathcomp" || lasterr=$? if test ! -d "$pathcomp"; then errstatus=$lasterr else if test ! -z "$dirmode"; then echo "chmod $dirmode $pathcomp" lasterr="" chmod "$dirmode" "$pathcomp" || lasterr=$? if test ! -z "$lasterr"; then errstatus=$lasterr fi fi fi fi pathcomp="$pathcomp/" done done exit $errstatus # Local Variables: # mode: shell-script # sh-indentation: 3 # End: # mkinstalldirs ends here cgdb-0.6.7/lib/tgdb/testsuite/NEWS000644 000765 000024 00000000000 12074441140 017611 0ustar00mmuellerstaff000000 000000 cgdb-0.6.7/lib/tgdb/testsuite/README000644 000765 000024 00000000000 12074441140 017772 0ustar00mmuellerstaff000000 000000 cgdb-0.6.7/lib/tgdb/testsuite/tgdb.base/000755 000765 000024 00000000000 12074441140 020755 5ustar00mmuellerstaff000000 000000 cgdb-0.6.7/lib/tgdb/testsuite/tgdb.base/_sanity.exp000644 000765 000024 00000001354 12074441140 023144 0ustar00mmuellerstaff000000 000000 # Load the tgdb library load_lib tgdb.exp # Don't wait for more than 10 seconds set timeout 10 # Some basic constants set tgdb_dir "tgdb.base" set source_file_name "basic" set file "$tgdb_dir/$source_file_name" set source_file "$source_file_name.c" # Load the program to test into gdb set test "load file" if [gdb_file_cmd ${file}] then { fail "crap" exit 1 } # # Lists a file # set test "list" send "list\n" expect { -re ".*$tgdb_prompt" { } timeout { fail "timeout $test" } } # # Runs the 'info source' command # set test "source file" send "info source\n" expect { -re "No current source file." { fail "$test" } -re "Current source file is .*$source_file.*$tgdb_prompt$" { pass "$test" } timeout { fail "timeout $test" } } cgdb-0.6.7/lib/tgdb/testsuite/tgdb.base/basic.c000644 000765 000024 00000002310 12074441140 022176 0ustar00mmuellerstaff000000 000000 #include #include struct global_software_watchpoint { int i; char string[1000]; } software_watchpoint; int two(int a){ return a*a; } int one(int a, int b){ return two(a) + two(b); } void short_func(void){ int i = 0; sleep(1); i = 1; i = 2; } void long_func(void){ int k = 0; sleep(3); k = 1; k = 2; } #define SIZE 100000 struct test { int a; int b; int c; } a = { 1, 2, 3 }; int main(int argc, char **argv){ int i = 3; int j = 4; char temp[SIZE]; long_func(); fprintf(stderr, "ABCDEFGHI\n"); fprintf(stderr, "ABCDEFGH\n"); fprintf(stderr, "ABCDEFG\n"); fprintf(stderr, "ABCDEF\n"); fprintf(stderr, "ABCDE\n"); fprintf(stderr, "ABCD\n"); fprintf(stderr, "ABC\n"); fprintf(stderr, "AB\n"); fprintf(stderr, "A\n"); for ( i = 0; i < 100; i++) fprintf(stderr, "Yo\n"); long_func(); short_func(); short_func(); short_func(); /* A simple loop */ for(i = 0; i < 100000; ++i) j++; i = one(i, j); j = two(i); for(i = 0; i < 6; ++i) fprintf(stderr, "returned from init\n"); for(i = 0; i < SIZE; ++i) temp[i] = (i % 40) + 40; i += j; return 0; } cgdb-0.6.7/lib/tgdb/testsuite/tgdb.base/basic.exp000644 000765 000024 00000003540 12074441140 022556 0ustar00mmuellerstaff000000 000000 # Load the tgdb library load_lib tgdb.exp # Don't wait for more than 10 seconds set timeout 10 # Some basic constants set tgdb_dir "tgdb.base" set source_file_name "basic" set file "$tgdb_dir/$source_file_name" set source_file "$source_file_name.c" # Load the program to test into gdb set test "load file" if [gdb_file_cmd ${file}] then { exit 1 } # Set a breakpoint at main and run set function "main" if [gdb_breakpoint ${function}] then { exit 1 } # Run the program set test "run" send "r\n" expect { -re "Starting program.*$source_file_name.*$tgdb_prompt" { pass "$test" } -re ".*No executable file specified.*$tgdb_prompt" { fail "$test" } timeout { fail "timeout $test" } } # Test out buffering of commands # This is kind of crazy, look at the command to see what is sent. It makes sure that # each of the commands were buffered and sent in order. It also makes sure that # when the proper command was run, the correct command was put on the GDB prompt. # Also, it leaves the nex, at the end. set test "starting buffering commands" send "n\n\n" expect { -re ".*$tgdb_prompt.*$tgdb_prompt$" { pass "$test"} timeout { fail "timeout $test" } } set test "buffering commands" send "\n\n\nnext\nn\n\n\nnex" expect { -re "^\[\r\n\]+next\[\r\n\]+n\[\r\n\]+nex$tgdb_prompt\[\r\n\]+ABCDEFGHI\[\r\n\]+$tgdb_prompt\[\r\n\]+ABCDEFGH\[\r\n\]+${tgdb_prompt}next\[\r\n\]+ABCDEFG\[\r\n\]+${tgdb_prompt}n\[\r\n\]+ABCDEF\[\r\n\]+$tgdb_prompt\[\r\n\]+ABCDE\[\r\n\]+$tgdb_prompt\[\r\n\]+ABCD\[\r\n\]+${tgdb_prompt}nex$" { pass $test } timeout { fail "timeout $test" } } send "t\n" expect { -re "t\[\r\n\]+ABC\[\r\n\]+$tgdb_prompt$" { pass "$test"} timeout { fail "timeout $test" } } set test "sink_after_buffered_commands" send "next\n" expect { -re "next\[\r\n\]+AB\[\r\n\]+$tgdb_prompt$" { pass "$test"} timeout { fail "timeout $test" } } cgdb-0.6.7/lib/tgdb/testsuite/tgdb.base/Makefile.am000644 000765 000024 00000000227 12074441140 023012 0ustar00mmuellerstaff000000 000000 noinst_PROGRAMS = basic overloaded # This program provides tgdb with a readline interface basic_SOURCES = basic.c overloaded_SOURCES = overloaded.cpp cgdb-0.6.7/lib/tgdb/testsuite/tgdb.base/overloaded.cpp000644 000765 000024 00000000261 12074441140 023604 0ustar00mmuellerstaff000000 000000 class A { public: void func ( int a ); void func ( float a ); }; void A::func ( int a ) {} void A::func ( float a ) {} int main ( int argc, char **argv ) { return 0; } cgdb-0.6.7/lib/tgdb/testsuite/tgdb.base/overloaded.exp000644 000765 000024 00000003027 12074441140 023621 0ustar00mmuellerstaff000000 000000 # Load the tgdb library load_lib tgdb.exp # Don't wait for more than 10 seconds set timeout 10 # Some basic constants set tgdb_dir "tgdb.base" set source_file_name "overloaded" set file "$tgdb_dir/$source_file_name" set source_file "$source_file_name.cpp" # Load the program set test "load file" if [gdb_file_cmd ${file}] then { exit 1 } # Change this into a function call proc set_overload_breakpoint { function } { global tgdb_prompt global source_file send "break $function\n" expect { -re "\\\[0\\\] cancel.*\\\[1\\\] all.*\\\[2\\\] $function\[(\].*\[)\] at .*$source_file:.*\\\[3\\\] $function\[(\].*\[)\] at .*$source_file:.*> " { pass "overloaded breakpoint $function" } timeout { fail "setting breakpoint at $function \[(\]timeout\[)\]" ; } } } # Check that overloading function breakpoints work set test "Cancel choice" set function "A::func" set_overload_breakpoint ${function} send "0\n" expect { -re ".*canceled.*$tgdb_prompt" { pass "$test" } timeout { fail "Failed Test: $test \[(\]timeout\[)\]" } } set test "All choice" set_overload_breakpoint ${function} send "1\n" expect { -re ".*Breakpoint.*\[0-9\]*.*Breakpoint.*\[0-9\].*$tgdb_prompt" { pass "$test" } timeout { fail "Failed Test: $test \[(\]timeout\[)\]" } } delete_breakpoints # ## Set a breakpoint at second choice set number "2" set_overload_breakpoint ${function} gdb_overloaded_breakpoint ${number} # ### Set a breakpoint at third choice set number "3" set_overload_breakpoint ${function} gdb_overloaded_breakpoint ${number} cgdb-0.6.7/lib/tgdb/testsuite/tgdb.base/signals.exp000644 000765 000024 00000005314 12074441140 023136 0ustar00mmuellerstaff000000 000000 # This unit is intended to ensure that signal handling is working properly. # At best, it is not. This is just a sanity check. # Signal handling needs to be implemented in a more generic way and safe way. # Load the tgdb library load_lib tgdb.exp # Don't wait for more than 10 seconds set timeout 10 # Some basic constants set tgdb_dir "tgdb.base" set source_file_name "basic" set file "$tgdb_dir/$source_file_name" set source_file "$source_file_name.c" delete_breakpoints # Load the program to test into gdb set test "load file" if [gdb_file_cmd ${file}] then { exit 1 } # testing the ^c signal, "abc^c" set test "priming for signal" send "abc" expect { -re "^abc$" { } timeout { fail "timeout $test" } } set test "priming for signal 2" send "\3" expect { -re "Quit\[\r\n\]+$tgdb_prompt$" { pass "control_c passed" } timeout { fail "timeout $test" } } # Make sure a following signal also works. set test "priming for signal 3" send "\3" expect { -re "Quit\[\r\n\]+$tgdb_prompt$" { pass "control_c passed" } timeout { fail "timeout $test" } } # Test that 'b main^c' will work. Also, make sure the data didn't go # into the history. set test "priming for signal 4" send "b main" expect { -re "^b main$" { } timeout { fail "timeout $test" } } set test "priming for signal 5" send "\3" expect { -re "Quit\[\r\n\]+$tgdb_prompt$" { pass "control_c passed"} timeout { fail "timeout $test" } } # Set a breakpoint at main and run set function "main" if [gdb_breakpoint ${function}] then { exit 1 } # Run the program set test "run" send "r\n" expect { -re "Starting program.*$source_file_name.*$tgdb_prompt" { pass "$test" } -re ".*No executable file specified.*$tgdb_prompt" { fail "$test" } timeout { fail "timeout $test" } } # The next few test are to make sure that if you # 1. run a command # 2. type another command, but interupt it with ^c # 3. Run "\n" to make sure the original command is the command run, # The command that was interuppted should go away forever. # Run "info address" send "info address\n"; expect { -re "info address\[\r\n\]+Argument required\.\[\r\n\]+$tgdb_prompt$" {} timeout { fail "timeout $test" } } # Send "b nex^c", make sure it doesn't go into history. send "b nex" expect { -re "^b nex$" { } timeout { fail "timeout $test" } } send "\3" expect { -re "Quit\[\r\n\]+$tgdb_prompt$" {} timeout { fail "timeout $test" } } # This makes sure that the previous command that was interupted by a signal did # not make it into readline's history send "\n" expect { -re "\[\r\n\]+Argument required\.\[\r\n\]+$tgdb_prompt$" { pass "interuppted command did not enter history" } timeout { fail "timeout $test" } } cgdb-0.6.7/lib/tgdb/testsuite/tgdb.base/watchpoint.exp000644 000765 000024 00000002065 12074441140 023656 0ustar00mmuellerstaff000000 000000 # Load the tgdb library load_lib tgdb.exp # Don't wait for more than 10 seconds set timeout 10 # Some basic constants set tgdb_dir "tgdb.base" set source_file_name "basic" set file "$tgdb_dir/$source_file_name" set source_file "$source_file_name.c" # Load the program to test into gdb set test "load file" if [gdb_file_cmd ${file}] then { exit 1 } # Set a breakpoint at main and run set function "main" if [gdb_breakpoint ${function}] then { exit 1 } # Run the program set test "run" send "r\n" expect { -re "Starting program.*$source_file_name.*$tgdb_prompt" { pass "$test" } -re ".*No executable file specified.*$tgdb_prompt" { fail "$test" } timeout { fail "timeout $test" } } # set a watchpoint on a scalar, probably a hardware watchpoint set variable "argc" if [gdb_watchpoint ${variable}] then { fail "hardware watchpoint" } pass "hardware watchpoint" # set a watchpoint on an aggregate, probably a software watchpoint set variable "software_watchpoint" if [gdb_watchpoint ${variable}] then { fail "software watchpoint" } pass "software watchpoint" cgdb-0.6.7/lib/tgdb/testsuite/lib/tgdb.exp000644 000765 000024 00000012741 12074441140 021335 0ustar00mmuellerstaff000000 000000 # # load a file into the debugger. # return a -1 if anything goes wrong. # proc gdb_file_cmd { arg } { global verbose global loadpath global loadfile global TGDB_DRIVER global tgdb_prompt upvar timeout timeout send "file $arg\n" expect { -re "Reading symbols from.*done.*$tgdb_prompt" { verbose "\t\tLoaded $arg into the $TGDB_DRIVER" return 0 } -re "has no symbol-table.*$tgdb_prompt" { perror "$arg wasn't compiled with \"-g\"" return -1 } -re "A program is being debugged already.*Kill it.*y or n." { send "y\n" verbose "\t\tKilling previous program being debugged" exp_continue } -re "Load new symbol table from \".*\".*y or n." { send "y\n" expect { -re "Reading symbols from.*done.*$tgdb_prompt" { verbose "\t\tLoaded $arg with new symbol table into $TGDB_DRIVER" return 0 } timeout { perror "(timeout) Couldn't load $arg, other program already loaded." return -1 } } } -re "No such file or directory.*$tgdb_prompt" { perror "($arg) No such file or directory\n" return -1 } -re "$tgdb_prompt" { perror "couldn't load $arg into $TGDB_DRIVER." return -1 } timeout { perror "couldn't load $arg into $TGDB_DRIVER (timed out)." return -1 } eof { # This is an attempt to detect a core dump, but seems not to # work. Perhaps we need to match .* followed by eof, in which # gdb_expect does not seem to have a way to do that. perror "couldn't load $arg into $TGDB_DRIVER (end of file)." return -1 } } } proc gdb_breakpoint { function } { global tgdb_prompt send "break $function\n" # The first two regexps are what we get with -g, the third is without -g. expect { -re "Breakpoint \[0-9\]* at .*: file .*, line .*$tgdb_prompt" { return 0} -re "Breakpoint \[0-9\]*: file .*, line .*$tgdb_prompt" { return 0} -re "Breakpoint \[0-9\]* at .*$tgdb_prompt" { return 0} -re "$tgdb_prompt" { fail "setting breakpoint at $function" ; return 1 } timeout { fail "setting breakpoint at $function (timeout)" ; return 1 } } return 1; } proc gdb_overloaded_breakpoint { number } { global tgdb_prompt send "$number\n" # The first two regexps are what we get with -g, the third is without -g. expect { -re "Breakpoint \[0-9\]* at .*: file .*, line .*$tgdb_prompt" { return 0} -re "Breakpoint \[0-9\]*: file .*, line .*$tgdb_prompt" { return 0} -re "Breakpoint \[0-9\]* at .*$tgdb_prompt" { return 0} -re "$tgdb_prompt" { fail "setting breakpoint at $number" ; return 1 } timeout { fail "setting breakpoint at $number (timeout)" ; return 1 } } return 1; } # Many of the tests depend on setting breakpoints at various places and # running until that breakpoint is reached. At times, we want to start # with a clean-slate with respect to breakpoints, so this utility proc # lets us do this without duplicating this code everywhere. # proc delete_breakpoints {} { global tgdb_prompt # we need a larger timeout value here or this thing just confuses # itself. May need a better implementation if possible. - guo # send "delete breakpoints\n" expect { -re "Delete all breakpoints.*y or n.*" { send "y\n"; exp_continue } -re "$tgdb_prompt" { # This happens if there were no breakpoints return 0; } timeout { perror "Delete all breakpoints in delete_breakpoints (timeout)" ; } } send "info breakpoints\n" expect { -re "No breakpoints or watchpoints..*$tgdb_prompt" { return 0} -re "$tgdb_prompt" { perror "breakpoints not deleted" ; return 1} -re "Delete all breakpoints.*or n.*" { send "y\n"; exp_continue } timeout { perror "info breakpoints (timeout)" ; return 1 } } } proc gdb_watchpoint { variable } { global tgdb_prompt send "watch $variable\n" # The first two regexps are what we get with -g, the third is without -g. expect { -re "Hardware watchpoint \[0-9\]*: .*$tgdb_prompt" { return 0} -re "Watchpoint \[0-9\]*: .*$tgdb_prompt" { return 0} -re "No symbol .* in current context\..*$tgdb_prompt" { fail "setting watchpoing at $variable" ; return 1 } -re "Attempt to use a type name as an expression.*$tgdb_prompt" { fail "setting watchpoing at $variable" ; return 1 } -re "$tgdb_prompt" { fail "setting watchpoing at $variable" ; return 1 } timeout { fail "setting watchpoint at $variable (timeout)" ; return 1 } } return 1; } #proc gdb_unload {} { # global verbose # global TGDB_PROMPT # global tgdb_prompt # send "file\n" # expect 60 { # -re "No executable file now\[^\r\n\]*\[\r\n\]" { exp_continue } # -re "No symbol file now\[^\r\n\]*\[\r\n\]" { exp_continue } # -re "A program is being debugged already..*Kill it.*y or n." { # send "y\n" # verbose "\t\tKilling previous program being debugged" # exp_continue # } # -re "Discard symbol table from .*y or n.*$" { # send "y\n" # exp_continue # } # -re "$tgdb_prompt" {} # timeout { # perror "couldn't unload file in $GDB (timed out)." # return -1 # } # } #} cgdb-0.6.7/lib/tgdb/testsuite/config/unix.exp000644 000765 000024 00000002201 12074441140 022065 0ustar00mmuellerstaff000000 000000 # This file is in charge of starting up the tgdb_driver. # The rest of the tests assume that the program has already been started. set timeout 3 global TGDB_DRIVER if ![info exists TGDB_DRIVER] { # set TGDB_DRIVER [findfile $base_dir/../../../objdir "tgdb_driver"] set TGDB_DRIVER "../../tgdb/tgdb-base/src/tgdb_driver" } if ![info exists tgdb_prompt] then { set tgdb_prompt "\[(\]tgdb\[)\] " } # Needed for some tests under Cygwin. global EXEEXT global env if ![info exists env(EXEEXT)] { set EXEEXT "" } else { set EXEEXT $env(EXEEXT) } # # tgdb_exit -- quit and cleanup # proc tgdb_exit {} { send "quit\n" } # # tgdb_start -- start tgdb running # proc tgdb_start {} { global TGDB_DRIVER global tgdb_prompt global spawn_id global verbose if { $verbose > 1 } { send_user "starting $TGDB_DRIVER\n" } spawn $TGDB_DRIVER expect { -re "No such file.*" { perror "Can't start $TGDB_DRIVER" ; return -1; } -re ".*$tgdb_prompt" { return 0; } timeout { perror "Failed to spawn $TGDB_DRIVER (timeout)"; return -1; } } return -1 } if [tgdb_start] then { puts "Error starting program" exit 1 } cgdb-0.6.7/lib/tgdb/gdbmi/gdbmi_tgdb.c000644 000765 000024 00000035065 12074441140 020414 0ustar00mmuellerstaff000000 000000 #if HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #if HAVE_STDIO_H #include #endif /* HAVE_STDIO_H */ #if HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #if HAVE_SYS_STAT_H #include #endif #if HAVE_SIGNAL_H #include #endif /* HAVE_SIGNAL_H */ #if HAVE_ERRNO_H #include #endif /* HAVE_ERRNO_H */ #include "gdbmi_tgdb.h" #include "fork_util.h" #include "fs_util.h" #include "pseudo.h" #include "io.h" #include "tgdb_types.h" #include "queue.h" #include "sys_util.h" #include "ibuf.h" #define PATH_MAX 4096 #define TTY_NAME_SIZE 64 /** * This is the main context for the gdbmi subsytem. */ struct tgdb_gdbmi { /** * This is set when this context has initialized itself */ int tgdb_initialized; /** * writing to this will write to the stdin of the debugger */ int debugger_stdin; /** * Reading from reads the stdout/stderr of the debugger */ int debugger_out; /** * writing to this will write to the stdin of the inferior */ int inferior_stdin; /** * Reading from reads the stdout/stderr of the inferior */ int inferior_out; /** * Only kept around so it can be closed properly */ int inferior_slave_fd; /** * pid of child process. */ pid_t debugger_pid; /** * The config directory that this context can write too. */ char config_dir[PATH_MAX]; /** * The init file for the debugger. */ char gdbmi_gdb_init_file[PATH_MAX]; /** * The name of the inferior tty. */ char inferior_tty_name[TTY_NAME_SIZE]; /** * This is a list of all the commands generated since in the last call. */ struct tgdb_list *client_command_list; /** * This is the current output command from GDB. */ struct ibuf *tgdb_cur_output_command; }; #if 0 //static int gdbmi_set_inferior_tty ( void *ctx ) { // struct annotate_two *a2 = (struct annotate_two *)ctx; // // if ( commands_issue_command ( // a2->c, // a2->client_command_list, // ANNOTATE_TTY, // a2->inferior_tty_name, // 0 ) == -1 ) { // err_msg("%s:%d commands_issue_command error", __FILE__, __LINE__); // return -1; // } // // return 0; //} // ///* This is ok as static, all references will use the same data. */ //static char *gdbmi_tgdb_commands[] = { // "continue", // "finish", // "next", // "run", // "step", // "up", // "down" //}; // // //static int close_inferior_connection ( void *ctx ) { // struct annotate_two *a2 = (struct annotate_two *)ctx; // // if ( a2->inferior_stdin != -1 ) // cgdb_close ( a2->inferior_stdin ); // // a2->inferior_stdin = -1; // a2->inferior_out = -1; // // /* close tty connection */ // if ( a2->inferior_slave_fd != -1 ) // cgdb_close ( a2->inferior_slave_fd ); // // a2->inferior_slave_fd = -1; // // if ( a2->inferior_tty_name[0] != '\0' ) // pty_release ( a2->inferior_tty_name ); // // return 0; //} // ///* Here are the two functions that deal with getting tty information out // * of the annotate_two subsystem. // */ // //int gdbmi_open_new_tty ( // void *ctx, // int *inferior_stdin, // int *inferior_stdout ) { // struct annotate_two *a2 = (struct annotate_two *)ctx; // // close_inferior_connection(a2); // // /* Open up the tty communication */ // if ( util_new_tty(&(a2->inferior_stdin), &(a2->inferior_slave_fd), a2->inferior_tty_name) == -1){ // err_msg("%s:%d -> Could not open child tty", __FILE__, __LINE__); // return -1; // } // // *inferior_stdin = a2->inferior_stdin; // *inferior_stdout = a2->inferior_stdin; // // a2_set_inferior_tty ( a2 ); // // return 0; //} // //char *a2_get_tty_name ( void *ctx ) { // struct annotate_two *a2 = (struct annotate_two *)ctx; // return a2->inferior_tty_name; //} #endif /* initialize_gdbmi * * initializes a gdbmi subsystem and sets up all initial values. */ static struct tgdb_gdbmi *initialize_tgdb_gdbmi(void) { struct tgdb_gdbmi *gdbmi = (struct tgdb_gdbmi *) cgdb_malloc(sizeof (struct tgdb_gdbmi)); gdbmi->tgdb_initialized = 0; gdbmi->debugger_stdin = -1; gdbmi->debugger_out = -1; gdbmi->inferior_stdin = -1; gdbmi->inferior_out = -1; gdbmi->inferior_slave_fd = -1; gdbmi->inferior_tty_name[0] = '\0'; /* null terminate */ gdbmi->config_dir[0] = '\0'; gdbmi->gdbmi_gdb_init_file[0] = '\0'; return gdbmi; } /* tgdb_setup_config_file: * ----------------------- * Creates a config file for the user. * * Pre: The directory already has read/write permissions. This should have * been checked by tgdb-base. * * Return: 1 on success or 0 on error */ static int tgdb_setup_config_file(struct tgdb_gdbmi *gdbmi, const char *dir) { FILE *fp; strncpy(gdbmi->config_dir, dir, strlen(dir) + 1); fs_util_get_path(dir, "gdbmi_gdb_init", gdbmi->gdbmi_gdb_init_file); if ((fp = fopen(gdbmi->gdbmi_gdb_init_file, "w"))) { fprintf(fp, "set height 0\n" "set prompt (tgdbmi) \n"); fclose(fp); } else { logger_write_pos(logger, __FILE__, __LINE__, "fopen error '%s'", gdbmi->gdbmi_gdb_init_file); return 0; } return 1; } void *gdbmi_create_context(const char *debugger, int argc, char **argv, const char *config_dir, struct logger *logger) { struct tgdb_gdbmi *gdbmi = initialize_tgdb_gdbmi(); char gdbmi_debug_file[PATH_MAX]; if (!tgdb_setup_config_file(gdbmi, config_dir)) { logger_write_pos(logger, __FILE__, __LINE__, "tgdb_init_config_file error"); return NULL; } /* Initialize the debug file that gdbmi_tgdb writes to */ fs_util_get_path(config_dir, "gdbmi_tgdb_debug.txt", gdbmi_debug_file); io_debug_init(gdbmi_debug_file); gdbmi->debugger_pid = invoke_debugger(debugger, argc, argv, &gdbmi->debugger_stdin, &gdbmi->debugger_out, 1, gdbmi->gdbmi_gdb_init_file); /* Couldn't invoke process */ if (gdbmi->debugger_pid == -1) return NULL; gdbmi->tgdb_cur_output_command = ibuf_init(); return gdbmi; } int gdbmi_initialize(void *ctx, int *debugger_stdin, int *debugger_stdout, int *inferior_stdin, int *inferior_stdout) { struct tgdb_gdbmi *gdbmi = (struct tgdb_gdbmi *) ctx; gdbmi->client_command_list = tgdb_list_init(); *debugger_stdin = gdbmi->debugger_stdin; *debugger_stdout = gdbmi->debugger_out; gdbmi->tgdb_initialized = 1; #if 0 /* Need to set the prompt via a tgdb_response */ struct tgdb_client_command *client_command = NULL; client_command = tgdb_client_command_create("(tgdbmi) ", TGDB_CLIENT_COMMAND_TGDB_BASE, TGDB_CLIENT_COMMAND_DISPLAY_NOTHING, TGDB_CLIENT_COMMAND_ACTION_CONSOLE_SET_PROMPT, NULL); tgdb_list_append(gdbmi->client_command_list, client_command); #endif return 0; } int gdbmi_shutdown(void *ctx) { struct tgdb_gdbmi *gdbmi = (struct tgdb_gdbmi *) ctx; cgdb_close(gdbmi->debugger_stdin); ibuf_free(gdbmi->tgdb_cur_output_command); gdbmi->tgdb_cur_output_command = NULL; return 0; } #if 0 /* TODO: Implement error messages. */ //int a2_err_msg ( void *ctx ) { // return -1; //} #endif int gdbmi_is_client_ready(void *ctx) { return 1; } enum newlinestyle { GDBMI_NL, GDBMI_CR_NL, GDBMI_CR }; /** * Checks to see if ibuf ends with the string ending. * * \param ibuf * The string to check the ending of * * \param style * represents what kind of newline is associated with this command. * * \param success * 1 if ibuf ends with ending, otherwise 0 * * \return * 0 on success, or -1 on error */ static int ends_with_gdbmi_prompt(struct ibuf *ibuf, enum newlinestyle style, int *success) { char *ibuf_string; int length; if (!ibuf) return -1; if (!success) return -1; *success = 0; length = ibuf_length(ibuf); /* If the string is not long enough, don't try */ if (style == GDBMI_CR_NL && length < 8) return 0; else if (length < 7) return 0; ibuf_string = ibuf_get(ibuf); /* Match the char's backwards, go to the end */ ibuf_string = ibuf_string + length - 1; if (style == GDBMI_CR_NL) ibuf_string -= 2; else ibuf_string--; /* Check for the prompt */ if (*(ibuf_string) == ' ' && *(ibuf_string - 1) == ')' && *(ibuf_string - 2) == 'b' && *(ibuf_string - 3) == 'd' && *(ibuf_string - 4) == 'g' && *(ibuf_string - 5) == '(') *success = 1; /* Look at newline */ return 0; } /** * Determine's what kind of newline the string ends in. * */ static int gdbmi_get_newline_style(struct ibuf *ibuf, enum newlinestyle *style) { char *buf; int length; if (!ibuf) return -1; if (!style) return -1; buf = ibuf_get(ibuf); length = ibuf_length(ibuf); /* Check to see if an entire command has been reached. */ if (buf[length - 1] == '\r') { *style = GDBMI_CR; } else if (buf[length - 1] == '\n') { if (length > 1 && buf[length - 2] == '\r') *style = GDBMI_CR_NL; else *style = GDBMI_NL; } return 0; } /* * 1. Align the 'input' data into null-terminated strings that * end in a newline. * 2. Check to see if a command has been fully recieved. * 2a. If it has, go to step 3 * 2b. If it hasn't, return from the function * 3. parse the command. * 4. traverse the parse tree to populate the tgdb_list with * commands the user/front end is looking for. */ int gdbmi_parse_io(void *ctx, const char *input_data, const size_t input_data_size, char *debugger_output, size_t * debugger_output_size, char *inferior_output, size_t * inferior_output_size, struct tgdb_list *list) { struct tgdb_gdbmi *gdbmi = (struct tgdb_gdbmi *) ctx; int found_command = 0; enum newlinestyle style = GDBMI_NL; ibuf_add(gdbmi->tgdb_cur_output_command, input_data); if (input_data[input_data_size - 1] == '\r' || input_data[input_data_size - 1] == '\n') { if (gdbmi_get_newline_style(gdbmi->tgdb_cur_output_command, &style) == -1) { logger_write_pos(logger, __FILE__, __LINE__, "gdbmi_get_newline_stlye error"); return -1; } if (ends_with_gdbmi_prompt(gdbmi->tgdb_cur_output_command, style, &found_command) == -1) { logger_write_pos(logger, __FILE__, __LINE__, "ends_with_gdbmi_prompt error"); return -1; } } if (found_command) { /* gdbmi_walk_command ( gdbmi->tgdb_cur_output_command );*/ ibuf_clear(gdbmi->tgdb_cur_output_command); } /* Return nothing for now */ *debugger_output_size = 0; *inferior_output_size = 0; if (found_command) return 1; return 0; } struct tgdb_list *gdbmi_get_client_commands(void *ctx) { struct tgdb_gdbmi *gdbmi = (struct tgdb_gdbmi *) ctx; return gdbmi->client_command_list; } #if 0 // //int a2_get_source_absolute_filename ( // void *ctx, // const char *file ) { // struct annotate_two *a2 = (struct annotate_two *)ctx; // // if ( commands_issue_command ( // a2->c, // a2->client_command_list, // ANNOTATE_LIST, // file, // 0 ) == -1 ) { // err_msg("%s:%d commands_issue_command error", __FILE__, __LINE__); // return -1; // } // // if ( commands_issue_command ( // a2->c, // a2->client_command_list, // ANNOTATE_INFO_SOURCE_ABSOLUTE, // file, // 0 ) == -1 ) { // err_msg("%s:%d commands_issue_command error", __FILE__, __LINE__); // return -1; // } // // return 0; //} // //int a2_get_inferior_sources ( void *ctx) { // struct annotate_two *a2 = (struct annotate_two *)ctx; // if ( commands_issue_command ( // a2->c, // a2->client_command_list, // ANNOTATE_INFO_SOURCES, // NULL, // 0 ) == -1 ) { // err_msg("%s:%d commands_issue_command error", __FILE__, __LINE__); // return -1; // } // // return 0; //} // //int a2_change_prompt( // void *ctx, // const char *prompt) { // struct annotate_two *a2 = (struct annotate_two *)ctx; // // /* Must call a callback to change the prompt */ // if ( commands_issue_command ( // a2->c, // a2->client_command_list, // ANNOTATE_SET_PROMPT, // prompt, // 2 ) == -1 ) { // err_msg("%s:%d commands_issue_command error", __FILE__, __LINE__); // return -1; // } // // return 0; //} // //int a2_command_callback( // void *ctx, // const char *command) { // /* Unimplemented */ // return -1; //} // //char *a2_return_client_command ( void *ctx, enum tgdb_command_type c ) { // if ( c < TGDB_CONTINUE || c >= TGDB_ERROR ) // return NULL; // // return a2_tgdb_commands[c]; //} // //char *a2_client_modify_breakpoint ( // void *ctx, // const char *file, // int line, // enum tgdb_breakpoint_action b ) { // char *val = (char*)cgdb_malloc ( sizeof(char)* ( strlen(file) + 128 ) ); // // if ( b == TGDB_BREAKPOINT_ADD ) { // sprintf ( val, "break %s:%d", file, line ); // return val; // } else if ( b == TGDB_BREAKPOINT_DELETE ) { // sprintf ( val, "clear %s:%d", file, line ); // return val; // } else // return NULL; //} #endif pid_t gdbmi_get_debugger_pid(void *ctx) { struct tgdb_gdbmi *gdbmi = (struct tgdb_gdbmi *) ctx; return gdbmi->debugger_pid; } #if 0 //int a2_completion_callback( // void *ctx, // const char *command) { // struct annotate_two *a2 = (struct annotate_two *)ctx; // if ( commands_issue_command ( // a2->c, // a2->client_command_list, // ANNOTATE_COMPLETE, command, 4 ) == -1 ) { // err_msg("%s:%d commands_issue_command error", __FILE__, __LINE__); // return -1; // } // // return 0; //} #endif int gdbmi_user_ran_command(void *ctx) { return 0; } int gdbmi_prepare_for_command(void *ctx, struct tgdb_command *com) { return 0; } #if 0 //int a2_is_misc_prompt ( void *ctx ) { // struct annotate_two *a2 = (struct annotate_two *)ctx; // return globals_is_misc_prompt ( a2->g ); //} #endif cgdb-0.6.7/lib/tgdb/gdbmi/gdbmi_tgdb.h000644 000765 000024 00000023473 12074441140 020421 0ustar00mmuellerstaff000000 000000 #ifndef __GDBMI_TGDB_H__ #define __GDBMI_TGDB_H__ #if HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #ifdef HAVE_SYS_TYPES_H #include #endif /* HAVE_SYS_TYPES_H */ #include "tgdb_types.h" #include "tgdb_command.h" #include "logger.h" /*! \file * gdbmi_tgdb.h * \brief * This interface documents the gdmi context. */ /** * This struct is a reference to a libgdbmi instance. */ struct tgdb_gdbmi; /** * This should probably be moved out of gdbmi_tgdb.h */ enum gdbmi_commands { /** * Currently not used. */ GDBMI_VOID = 0, /** * Get a list of breakpoints. */ GDBMI_INFO_BREAKPOINTS, /** * Tell gdb where to send inferior's output */ GDBMI_TTY, /** * Complete the current console line */ GDBMI_COMPLETE, /** * Show all the sources inferior is made of */ GDBMI_INFO_SOURCES, /** * relative source path. */ GDBMI_INFO_SOURCE_RELATIVE, /** * absolute source path. */ GDBMI_INFO_SOURCE_ABSOLUTE, /** * Shows information on the current source file */ GDBMI_INFO_SOURCE, /** * displays the contents of current source file */ GDBMI_LIST, /** * Sets the prompt. */ GDBMI_SET_PROMPT }; /******************************************************************************/ /** * @name Starting and Stopping Commands. * These functions are for starting and stopping the gdbmi context. */ /******************************************************************************/ /*@{*/ /** * This invokes a libgdbmi library instance. * * The client must call this function before any other function in the * tgdb library. * * \param debugger_path * The path to the desired debugger to use. If this is NULL, then just * "gdb" is used. * * \param argc * The number of arguments to pass to the debugger * * \param argv * The arguments to pass to the debugger * * \param config_dir * The current config directory. Files can be stored here. * * @return * NULL on error, A valid descriptor upon success */ void *gdbmi_create_context(const char *debugger_path, int argc, char **argv, const char *config_dir, struct logger *logger); /** * This initializes the libgdbmi libarary. * * \param ctx * The gdbmi context. * * \param debugger_stdin * Writing to this descriptor, writes to the stdin of the debugger. * * \param debugger_stdout * Reading from this descriptor, reads from the debugger's stdout. * * \param inferior_stdin * Writing to this descriptor, writes to the stdin of the inferior. * * \param inferior_stdout * Reading from this descriptor, reads from the inferior's stdout. * * @return Retruns * 0 on success, otherwise -1 on error. */ int gdbmi_initialize(void *ctx, int *debugger_stdin, int *debugger_stdout, int *inferior_stdin, int *inferior_stdout); /** * Shuts down the gdbmi context. No more calls can be made on the * current context. It will clean up after itself. All descriptors it * opened, it will close. * * \param ctx * The gdbmi context. * * @return * 0 on success, otherwise -1 on error. */ int gdbmi_shutdown(void *ctx); /*@}*/ /******************************************************************************/ /** * @name Status Commands * These functions are for querying the gdbmi context. */ /******************************************************************************/ /*@{*/ /** * Returns the last error message ? * Not implemented yet. * What should it return? How should errors be handled? * * \param ctx * The gdbmi context. * * @return * 0 on success, otherwise -1 on error. */ int gdbmi_err_msg(void *ctx); /** * This determines if the gdbmi context is ready to recieve * another command. * * \param ctx * The gdbmi context. * * @return * 1 if it is ready, 0 if it is not. */ int gdbmi_is_client_ready(void *ctx); /** * This lets the gdbmi know that the user ran a command. * The client can update itself here if it need to. * * \param ctx * The gdbmi context. * * @return * -1 on error, 0 on success */ int gdbmi_user_ran_command(void *ctx); /** * Prepare's the client for the command COM to be run. * * \param ctx * The gdbmi context. * * \param com * The command to be run. * * @return * -1 on error, 0 on success */ int gdbmi_prepare_for_command(void *ctx, struct tgdb_command *com); /** * This is a hack. It should be removed eventually. * It tells tgdb-base not to send its internal commands when this is true. * * \param ctx * The gdbmi context. * * @return * 1 if it is at a misc prompt, 0 if it is not. */ int gdbmi_is_misc_prompt(void *ctx); /*@}*/ /******************************************************************************/ /** * @name Input/Output commands * These functions are for communicating I/O with an gdbmi context. */ /******************************************************************************/ /*@{*/ /** * This recieves all of the output from the debugger. It is all routed * through this function. * * \param ctx * The gdbmi context. * * \param input_data * This is the stdout from the debugger. This is the data that parse_io * will parse. * * \param input_data_size * This is the size of input_data. * * \param debugger_output * This is an out variable. It contains data that has been determined to * be the output of the debugger that the user should see. * * \param debugger_output_size * This is the size of debugger_output * * \param inferior_output * This is an out variable. It contains data that has been determined to * be the output of the inferior that the user should see. * * \param inferior_output_size * This is the size of inferior_output * * \param list * Any commands that the gdbmi context has discovered will * be added to the queue Q. This will eventually update the client * of the libtgdb library. * * @return * 1 when it has finished a command, * 0 on success but hasn't recieved enough I/O to finish the command, * otherwise -1 on error. */ int gdbmi_parse_io(void *ctx, const char *input_data, const size_t input_data_size, char *debugger_output, size_t * debugger_output_size, char *inferior_output, size_t * inferior_output_size, struct tgdb_list *list); /** * Returns all of the commands the gdbmi subsystem generated during * the last call. * * \param ctx * The gdbmi context. * * @return * NULL if no commands were generated. * Otherwise, a list of tgdb_client_commands. */ struct tgdb_list *gdbmi_get_client_commands(void *ctx); /*@}*/ /******************************************************************************/ /** * @name Functional commands * These functinos are used to ask an gdbmi context to perform a task. */ /******************************************************************************/ /*@h*/ /** * Gets the Absolute path of FILE. * * \param ctx * The gdbmi context. * * \param file * The relative path that gdb outputted. * * @return * 0 on success, otherwise -1 on error. */ int gdbmi_get_source_absolute_filename(void *ctx, const char *file); /** * Gets all the source files that the inferior makes up. * * \param ctx * The gdbmi context. * * @return * 0 on success, otherwise -1 on error. */ int gdbmi_get_inferior_sources(void *ctx); /** * This will change the prompt the user sees to PROMPT. * * \param ctx * The gdbmi context. * * \param prompt * The new prompt to change too. * * @return * 0 on success, otherwise -1 on error. */ int gdbmi_change_prompt(void *ctx, const char *prompt); /** * This is called when readline determines a command has been typed. * * \param ctx * The gdbmi context. * * \param command * The command the user typed without the '\n'. * * @return * 0 on success, otherwise -1 on error. */ int gdbmi_command_callback(void *ctx, const char *command); /** * This is called when readline determines a command needs to be completed. * * \param ctx * The gdbmi context. * * \param command * The command to be completed * * @return * 0 on success, otherwise -1 on error. */ int gdbmi_completion_callback(void *ctx, const char *command); /** * This returns the command to send to gdb for the enum C. * It will return NULL on error, otherwise correct string on output. * * \param ctx * The gdbmi context. * * \param c * The command to run. * * @return * Command on success, otherwise NULL on error. */ char *gdbmi_return_client_command(void *ctx, enum tgdb_command_type c); /** * \param ctx * The gdbmi context. * * \param file * The file to set the breakpoint in. * * \param line * The line in FILE to set the breakpoint in. * * \param b * Determines what the user wants to do with the breakpoint. * * @return * NULL on error or message to print to terminal */ char *gdbmi_client_modify_breakpoint(void *ctx, const char *file, int line, enum tgdb_breakpoint_action b); /** * \param ctx * The gdbmi context. * * @return * -1 on error. Or pid on Success. */ pid_t gdbmi_get_debugger_pid(void *ctx); /*@}*/ /******************************************************************************/ /** * @name Inferior tty commands * These functinos are used to alter an gdbmi contexts tty state. */ /******************************************************************************/ /*@{*/ /** * \param ctx * The gdbmi context. * * \param inferior_stdin * Writing to this descriptor, writes to the stdin of the inferior. * * \param inferior_stdout * Reading from this descriptor, reads from the inferior's stdout. * * @return * 0 on success, otherwise -1 on error. */ int gdbmi_open_new_tty(void *ctx, int *inferior_stdin, int *inferior_stdout); /** * \param ctx * The gdbmi context. * * @return * tty name on success, otherwise NULL on error. */ char *gdbmi_get_tty_name(void *ctx); /*@}*/ #endif /* __GDBMI_TGDB_H__ */ cgdb-0.6.7/lib/tgdb/gdbmi/Makefile.am000644 000765 000024 00000000404 12074441140 020207 0ustar00mmuellerstaff000000 000000 AM_CFLAGS = \ -I$(top_srcdir)/lib/util \ -I$(top_srcdir)/lib/adt \ -I$(top_srcdir)/lib/tgdb/tgdb-base # create the input library # This depends on input noinst_LIBRARIES = libtgdb_mi.a libtgdb_mi_a_SOURCES = \ gdbmi_tgdb.c \ gdbmi_tgdb.h cgdb-0.6.7/lib/tgdb/gdbmi/Makefile.in000644 000765 000024 00000035366 12074766253 020256 0ustar00mmuellerstaff000000 000000 # Makefile.in generated by automake 1.13.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = lib/tgdb/gdbmi DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/config/depcomp ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/config/readline_check_version.m4 \ $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LIBRARIES = $(noinst_LIBRARIES) AR = ar ARFLAGS = cru AM_V_AR = $(am__v_AR_@AM_V@) am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@) am__v_AR_0 = @echo " AR " $@; am__v_AR_1 = libtgdb_mi_a_AR = $(AR) $(ARFLAGS) libtgdb_mi_a_LIBADD = am_libtgdb_mi_a_OBJECTS = gdbmi_tgdb.$(OBJEXT) libtgdb_mi_a_OBJECTS = $(am_libtgdb_mi_a_OBJECTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libtgdb_mi_a_SOURCES) DIST_SOURCES = $(libtgdb_mi_a_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ RL_MAJOR = @RL_MAJOR@ RL_MINOR = @RL_MINOR@ RL_VERSION = @RL_VERSION@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ YACC = @YACC@ YFLAGS = @YFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CFLAGS = \ -I$(top_srcdir)/lib/util \ -I$(top_srcdir)/lib/adt \ -I$(top_srcdir)/lib/tgdb/tgdb-base # create the input library # This depends on input noinst_LIBRARIES = libtgdb_mi.a libtgdb_mi_a_SOURCES = \ gdbmi_tgdb.c \ gdbmi_tgdb.h all: all-am .SUFFIXES: .SUFFIXES: .c .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu lib/tgdb/gdbmi/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu lib/tgdb/gdbmi/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) libtgdb_mi.a: $(libtgdb_mi_a_OBJECTS) $(libtgdb_mi_a_DEPENDENCIES) $(EXTRA_libtgdb_mi_a_DEPENDENCIES) $(AM_V_at)-rm -f libtgdb_mi.a $(AM_V_AR)$(libtgdb_mi_a_AR) libtgdb_mi.a $(libtgdb_mi_a_OBJECTS) $(libtgdb_mi_a_LIBADD) $(AM_V_at)$(RANLIB) libtgdb_mi.a mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gdbmi_tgdb.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LIBRARIES) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ clean-noinstLIBRARIES cscopelist-am ctags ctags-am distclean \ distclean-compile distclean-generic distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \ uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: cgdb-0.6.7/lib/tgdb/annotate-two/a2-tgdb.c000644 000765 000024 00000026272 12074441140 021110 0ustar00mmuellerstaff000000 000000 #if HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #if HAVE_STDIO_H #include #endif /* HAVE_STDIO_H */ #if HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #if HAVE_SYS_STAT_H #include #endif #if HAVE_SIGNAL_H #include #endif /* HAVE_SIGNAL_H */ #if HAVE_ERRNO_H #include #endif /* HAVE_ERRNO_H */ #include "a2-tgdb.h" #include "fork_util.h" #include "fs_util.h" #include "pseudo.h" #include "logger.h" #include "io.h" #include "state_machine.h" #include "data.h" #include "commands.h" #include "globals.h" #include "tgdb_types.h" #include "queue.h" #include "sys_util.h" #include "ibuf.h" #include "annotate_two.h" static int a2_set_inferior_tty(void *ctx) { struct annotate_two *a2 = (struct annotate_two *) ctx; if (!a2) { logger_write_pos(logger, __FILE__, __LINE__, "a2_set_inferior_tty error"); return -1; } if (commands_issue_command(a2->c, a2->client_command_list, ANNOTATE_TTY, pty_pair_get_slavename(a2->pty_pair), 0) == -1) { logger_write_pos(logger, __FILE__, __LINE__, "commands_issue_command error"); return -1; } return 0; } static int close_inferior_connection(void *ctx) { struct annotate_two *a2 = (struct annotate_two *) ctx; if (!a2) { logger_write_pos(logger, __FILE__, __LINE__, "close_inferior_connection error"); return -1; } if (a2->pty_pair) pty_pair_destroy(a2->pty_pair); return 0; } /* Here are the two functions that deal with getting tty information out * of the annotate_two subsystem. */ int a2_open_new_tty(void *ctx, int *inferior_stdin, int *inferior_stdout) { struct annotate_two *a2 = (struct annotate_two *) ctx; close_inferior_connection(a2); a2->pty_pair = pty_pair_create(); if (!a2->pty_pair) { logger_write_pos(logger, __FILE__, __LINE__, "pty_pair_create failed"); return -1; } *inferior_stdin = pty_pair_get_masterfd(a2->pty_pair); *inferior_stdout = pty_pair_get_masterfd(a2->pty_pair); a2_set_inferior_tty(a2); return 0; } const char *a2_get_tty_name(void *ctx) { struct annotate_two *a2 = (struct annotate_two *) ctx; if (!a2) { logger_write_pos(logger, __FILE__, __LINE__, "a2_get_tty_name failed"); return NULL; } return pty_pair_get_slavename(a2->pty_pair); } /* initialize_annotate_two * * initializes an annotate_two subsystem and sets up all initial values. */ static struct annotate_two *initialize_annotate_two(void) { struct annotate_two *a2 = (struct annotate_two *) cgdb_malloc(sizeof (struct annotate_two)); a2->tgdb_initialized = 0; a2->debugger_stdin = -1; a2->debugger_out = -1; a2->pty_pair = NULL; /* null terminate */ a2->config_dir[0] = '\0'; a2->a2_gdb_init_file[0] = '\0'; a2->source_already_received = 0; a2->cur_response_list = NULL; return a2; } /* tgdb_setup_config_file: * ----------------------- * Creates a config file for the user. * * Pre: The directory already has read/write permissions. This should have * been checked by tgdb-base. * * Return: 1 on success or 0 on error */ static int tgdb_setup_config_file(struct annotate_two *a2, const char *dir) { FILE *fp; strncpy(a2->config_dir, dir, strlen(dir) + 1); fs_util_get_path(dir, "a2_gdb_init", a2->a2_gdb_init_file); if ((fp = fopen(a2->a2_gdb_init_file, "w"))) { fprintf(fp, "set annotate 2\n" "set height 0\n"); fclose(fp); } else { logger_write_pos(logger, __FILE__, __LINE__, "fopen error '%s'", a2->a2_gdb_init_file); return 0; } return 1; } void *a2_create_context(const char *debugger, int argc, char **argv, const char *config_dir, struct logger *logger) { struct annotate_two *a2 = initialize_annotate_two(); char a2_debug_file[FSUTIL_PATH_MAX]; if (!tgdb_setup_config_file(a2, config_dir)) { logger_write_pos(logger, __FILE__, __LINE__, "tgdb_init_config_file error"); return NULL; } /* Initialize the debug file that a2_tgdb writes to */ fs_util_get_path(config_dir, "a2_tgdb_debug.txt", a2_debug_file); io_debug_init(a2_debug_file); a2->debugger_pid = invoke_debugger(debugger, argc, argv, &a2->debugger_stdin, &a2->debugger_out, 0, a2->a2_gdb_init_file); /* Couldn't invoke process */ if (a2->debugger_pid == -1) return NULL; return a2; } int a2_initialize(void *ctx, int *debugger_stdin, int *debugger_stdout, int *inferior_stdin, int *inferior_stdout) { struct annotate_two *a2 = (struct annotate_two *) ctx; *debugger_stdin = a2->debugger_stdin; *debugger_stdout = a2->debugger_out; a2->data = data_initialize(); a2->sm = state_machine_initialize(); a2->c = commands_initialize(); a2->g = globals_initialize(); a2->client_command_list = tgdb_list_init(); a2_open_new_tty(a2, inferior_stdin, inferior_stdout); /* gdb may already have some breakpoints when it starts. This could happen * if the user puts breakpoints in there .gdbinit. * This makes sure that TGDB asks for the breakpoints on start up. */ if (commands_issue_command(a2->c, a2->client_command_list, ANNOTATE_INFO_BREAKPOINTS, NULL, 0) == -1) { logger_write_pos(logger, __FILE__, __LINE__, "commands_issue_command error"); return -1; } a2->tgdb_initialized = 1; return 0; } /* TODO: Implement shutdown properly */ int a2_shutdown(void *ctx) { struct annotate_two *a2 = (struct annotate_two *) ctx; cgdb_close(a2->debugger_stdin); data_shutdown(a2->data); state_machine_shutdown(a2->sm); commands_shutdown(a2->c); globals_shutdown(a2->g); return 0; } /* TODO: Implement error messages. */ int a2_err_msg(void *ctx) { return -1; } int a2_is_client_ready(void *ctx) { struct annotate_two *a2 = (struct annotate_two *) ctx; if (!a2->tgdb_initialized) return 0; /* If the user is at the prompt */ if (data_get_state(a2->data) == USER_AT_PROMPT) return 1; return 0; } int a2_parse_io(void *ctx, const char *input_data, const size_t input_data_size, char *debugger_output, size_t * debugger_output_size, char *inferior_output, size_t * inferior_output_size, struct tgdb_list *list) { int val; struct annotate_two *a2 = (struct annotate_two *) ctx; a2->command_finished = 0; a2->cur_response_list = list; val = a2_handle_data(a2, a2->sm, input_data, input_data_size, debugger_output, debugger_output_size, list); a2->cur_response_list = NULL; if (a2->command_finished) return 1; else return 0; } struct tgdb_list *a2_get_client_commands(void *ctx) { struct annotate_two *a2 = (struct annotate_two *) ctx; return a2->client_command_list; } int a2_get_source_filename_pair(void *ctx, const char *file) { struct annotate_two *a2 = (struct annotate_two *) ctx; int ret; ret = commands_issue_command(a2->c, a2->client_command_list, ANNOTATE_LIST, file, 0); if (ret == -1) { logger_write_pos(logger, __FILE__, __LINE__, "commands_issue_command error"); return -1; } ret = commands_issue_command(a2->c, a2->client_command_list, ANNOTATE_INFO_SOURCE_FILENAME_PAIR, file, 0); if (ret == -1) { logger_write_pos(logger, __FILE__, __LINE__, "commands_issue_command error"); return -1; } return 0; } int a2_get_current_location(void *ctx, int on_startup) { struct annotate_two *a2 = (struct annotate_two *) ctx; int ret; if (on_startup) { ret = commands_issue_command(a2->c, a2->client_command_list, ANNOTATE_LIST, NULL, 0); if (ret == -1) { logger_write_pos(logger, __FILE__, __LINE__, "commands_issue_command error"); return -1; } } ret = commands_issue_command(a2->c, a2->client_command_list, ANNOTATE_INFO_LINE, NULL, 0); if (ret == -1) { logger_write_pos(logger, __FILE__, __LINE__, "commands_issue_command error"); return -1; } return 0; } int a2_get_inferior_sources(void *ctx) { struct annotate_two *a2 = (struct annotate_two *) ctx; if (commands_issue_command(a2->c, a2->client_command_list, ANNOTATE_INFO_SOURCES, NULL, 0) == -1) { logger_write_pos(logger, __FILE__, __LINE__, "commands_issue_command error"); return -1; } return 0; } char *a2_return_client_command(void *ctx, enum tgdb_command_type c) { char *ret = NULL; switch (c) { case TGDB_CONTINUE: ret = "continue"; break; case TGDB_FINISH: ret = "finish"; break; case TGDB_NEXT: ret = "next"; break; case TGDB_START: ret = "start"; break; case TGDB_RUN: ret = "run"; break; case TGDB_KILL: ret = "kill"; break; case TGDB_STEP: ret = "step"; break; case TGDB_UP: ret = "up"; break; case TGDB_DOWN: ret = "down"; break; } return ret; } char *a2_client_modify_breakpoint(void *ctx, const char *file, int line, enum tgdb_breakpoint_action b) { char *val = (char *) cgdb_malloc(sizeof (char) * (strlen(file) + 128)); if (b == TGDB_BREAKPOINT_ADD) { sprintf(val, "break \"%s\":%d", file, line); return val; } else if (b == TGDB_BREAKPOINT_DELETE) { sprintf(val, "clear \"%s\":%d", file, line); return val; } else if (b == TGDB_TBREAKPOINT_ADD) { sprintf(val, "tbreak \"%s\":%d", file, line); return val; } else return NULL; } pid_t a2_get_debugger_pid(void *ctx) { struct annotate_two *a2 = (struct annotate_two *) ctx; return a2->debugger_pid; } int a2_completion_callback(void *ctx, const char *command) { struct annotate_two *a2 = (struct annotate_two *) ctx; if (commands_issue_command(a2->c, a2->client_command_list, ANNOTATE_COMPLETE, command, 4) == -1) { logger_write_pos(logger, __FILE__, __LINE__, "commands_issue_command error"); return -1; } return 0; } int a2_user_ran_command(void *ctx) { struct annotate_two *a2 = (struct annotate_two *) ctx; return commands_user_ran_command(a2->c, a2->client_command_list); } int a2_prepare_for_command(void *ctx, struct tgdb_command *com) { struct annotate_two *a2 = (struct annotate_two *) ctx; return commands_prepare_for_command(a2, a2->c, com); } int a2_is_misc_prompt(void *ctx) { struct annotate_two *a2 = (struct annotate_two *) ctx; return globals_is_misc_prompt(a2->g); } cgdb-0.6.7/lib/tgdb/annotate-two/a2-tgdb.h000644 000765 000024 00000024226 12074441140 021112 0ustar00mmuellerstaff000000 000000 #ifndef __A2_TGDB_H__ #define __A2_TGDB_H__ #if HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #ifdef HAVE_SYS_TYPES_H #include #endif /* HAVE_SYS_TYPES_H */ #include "tgdb_types.h" #include "tgdb_command.h" #include "logger.h" /*! \file * a2-tgdb.h * \brief * This interface documents the annotate two context. */ /** * This struct is a reference to a libannotate-two instance. */ struct annotate_two; /** * This should probably be moved out of a2-tgdb.h */ enum annotate_commands { /** * Currently not used. */ ANNOTATE_VOID = 0, /** * Get a list of breakpoints. */ ANNOTATE_INFO_BREAKPOINTS, /** * Tell gdb where to send inferior's output */ ANNOTATE_TTY, /** * Complete the current console line */ ANNOTATE_COMPLETE, /** * Show all the sources inferior is made of */ ANNOTATE_INFO_SOURCES, /** * relative source path. */ ANNOTATE_INFO_SOURCE_RELATIVE, /** * absolute source path. */ ANNOTATE_INFO_SOURCE_FILENAME_PAIR, /** * Shows information on the current source file */ ANNOTATE_INFO_SOURCE, /** * displays the contents of current source file */ ANNOTATE_LIST, /** * Get's the current fullname, filename and line number. * This is because the 'info line' command to GDB generates the source * annotation, which in turn causes the a2 subsystem to get the * relative path. */ ANNOTATE_INFO_LINE, /** * Sets the prompt. */ ANNOTATE_SET_PROMPT }; /******************************************************************************/ /** * @name Starting and Stopping Commands. * These functions are for starting and stopping the annotate_two context. */ /******************************************************************************/ /*@{*/ /** * This invokes a libannotate_two library instance. * * The client must call this function before any other function in the * tgdb library. * * \param debugger_path * The path to the desired debugger to use. If this is NULL, then just * "gdb" is used. * * \param argc * The number of arguments to pass to the debugger * * \param argv * The arguments to pass to the debugger * * \param config_dir * The current config directory. Files can be stored here. * * @return * NULL on error, A valid descriptor upon success */ void *a2_create_context(const char *debugger_path, int argc, char **argv, const char *config_dir, struct logger *logger); /** * This initializes the libannotate_two libarary. * * \param a2 * The annotate two context. * * \param debugger_stdin * Writing to this descriptor, writes to the stdin of the debugger. * * \param debugger_stdout * Reading from this descriptor, reads from the debugger's stdout. * * \param inferior_stdin * Writing to this descriptor, writes to the stdin of the inferior. * * \param inferior_stdout * Reading from this descriptor, reads from the inferior's stdout. * * @return Retruns * 0 on success, otherwise -1 on error. */ int a2_initialize(void *a2, int *debugger_stdin, int *debugger_stdout, int *inferior_stdin, int *inferior_stdout); /** * Shuts down the annotate two context. No more calls can be made on the * current context. It will clean up after itself. All descriptors it * opened, it will close. * * \param ctx * The annotate two context. * * @return * 0 on success, otherwise -1 on error. */ int a2_shutdown(void *ctx); /*@}*/ /******************************************************************************/ /** * @name Status Commands * These functions are for querying the annotate_two context. */ /******************************************************************************/ /*@{*/ /** * Returns the last error message ? * Not implemented yet. * What should it return? How should errors be handled? * * \param ctx * The annotate two context. * * @return * 0 on success, otherwise -1 on error. */ int a2_err_msg(void *ctx); /** * This determines if the annotate two context is ready to recieve * another command. * * \param ctx * The annotate two context. * * @return * 1 if it is ready, 0 if it is not. */ int a2_is_client_ready(void *ctx); /** * This lets the annotate_two know that the user ran a command. * The client can update itself here if it need to. * * \param ctx * The annotate two context. * * @return * -1 on error, 0 on success */ int a2_user_ran_command(void *ctx); /** * Prepare's the client for the command COM to be run. * * \param ctx * The annotate two context. * * \param com * The command to be run. * * @return * -1 on error, 0 on success */ int a2_prepare_for_command(void *ctx, struct tgdb_command *com); /** * This is a hack. It should be removed eventually. * It tells tgdb-base not to send its internal commands when this is true. * * \param ctx * The annotate two context. * * @return * 1 if it is at a misc prompt, 0 if it is not. */ int a2_is_misc_prompt(void *ctx); /*@}*/ /******************************************************************************/ /** * @name Input/Output commands * These functions are for communicating I/O with an annotate two context. */ /******************************************************************************/ /*@{*/ /** * This recieves all of the output from the debugger. It is all routed * through this function. * * \param ctx * The annotate two context. * * \param input_data * This is the stdout from the debugger. This is the data that parse_io * will parse. * * \param input_data_size * This is the size of input_data. * * \param debugger_output * This is an out variable. It contains data that has been determined to * be the output of the debugger that the user should see. * * \param debugger_output_size * This is the size of debugger_output * * \param inferior_output * This is an out variable. It contains data that has been determined to * be the output of the inferior that the user should see. * * \param inferior_output_size * This is the size of inferior_output * * \param list * Any commands that the annotate_two context has discovered will * be added to the queue Q. This will eventually update the client * of the libtgdb library. * * @return * 1 when it has finished a command, * 0 on success but hasn't recieved enough I/O to finish the command, * otherwise -1 on error. */ int a2_parse_io(void *ctx, const char *input_data, const size_t input_data_size, char *debugger_output, size_t * debugger_output_size, char *inferior_output, size_t * inferior_output_size, struct tgdb_list *list); /** * Returns all of the commands the annotate two subsystem generated during * the last call. * * \param ctx * The annotate two context. * * @return * NULL if no commands were generated. * Otherwise, a list of tgdb_client_commands. */ struct tgdb_list *a2_get_client_commands(void *ctx); /*@}*/ /******************************************************************************/ /** * @name Functional commands * These functinos are used to ask an annotate_two context to perform a task. */ /******************************************************************************/ /*@{*/ /** * Gets the Absolute path of FILE. * * \param ctx * The annotate two context. * * \param file * The relative path that gdb outputted. * * @return * 0 on success, otherwise -1 on error. */ int a2_get_source_filename_pair(void *ctx, const char *file); /** * Get's the fullname, filename and line number GDB is currently at. * * \param ctx * The annotate two context. * * \param on_startup * This variable can be set to 1 if the front end wants to probe GDB * for the initial file and location of the program being debugged. * However, each initial time after that, this variable should be * set to 0. * * @return * 0 on success, otherwise -1 on error. */ int a2_get_current_location(void *ctx, int on_startup); /** * Gets all the source files that the inferior makes up. * * \param ctx * The annotate two context. * * @return * 0 on success, otherwise -1 on error. */ int a2_get_inferior_sources(void *ctx); /** * This is called when readline determines a command needs to be completed. * * \param ctx * The annotate two context. * * \param command * The command to be completed * * @return * 0 on success, otherwise -1 on error. */ int a2_completion_callback(void *ctx, const char *command); /** * This returns the command to send to gdb for the enum C. * It will return NULL on error, otherwise correct string on output. * * \param ctx * The annotate two context. * * \param c * The command to run. * * @return * Command on success, otherwise NULL on error. */ char *a2_return_client_command(void *ctx, enum tgdb_command_type c); /** * \param ctx * The annotate two context. * * \param file * The file to set the breakpoint in. * * \param line * The line in FILE to set the breakpoint in. * * \param b * Determines what the user wants to do with the breakpoint. * * @return * NULL on error or message to print to terminal */ char *a2_client_modify_breakpoint(void *ctx, const char *file, int line, enum tgdb_breakpoint_action b); /** * \param ctx * The annotate two context. * * @return * -1 on error. Or pid on Success. */ pid_t a2_get_debugger_pid(void *ctx); /*@}*/ /******************************************************************************/ /** * @name Inferior tty commands * These functinos are used to alter an annotate_two contexts tty state. */ /******************************************************************************/ /*@{*/ /** * \param ctx * The annotate two context. * * \param inferior_stdin * Writing to this descriptor, writes to the stdin of the inferior. * * \param inferior_stdout * Reading from this descriptor, reads from the inferior's stdout. * * @return * 0 on success, otherwise -1 on error. */ int a2_open_new_tty(void *ctx, int *inferior_stdin, int *inferior_stdout); /** * \param ctx * The annotate two context. * * @return * tty name on success, otherwise NULL on error. */ const char *a2_get_tty_name(void *ctx); /*@}*/ #endif /* __A2_TGDB_H__ */ cgdb-0.6.7/lib/tgdb/annotate-two/annotate.c000644 000765 000024 00000022466 12074441140 021502 0ustar00mmuellerstaff000000 000000 #if HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #include "annotate.h" #include "sys_util.h" #include "logger.h" #include "data.h" #include "commands.h" #include "globals.h" #include "io.h" static int handle_source(struct annotate_two *a2, const char *buf, size_t n, struct tgdb_list *list) { int ret = commands_parse_source(a2->c, a2->client_command_list, buf, n, list); /* This tells the annotate subsystem if the source annotation has been * reached. This could be useful to the application using TGDB to determine if a single * source annotation has been reached yet. If so, it doesn't have to probe TGDB for the * initiale source file when GDB starts up. * * As of 12/17/2005 it is no longer being used within TGDB. I moved the responsibilty of * probing for the first file to the calling application. If the variable ends up being * useless, it can be removed. */ a2->source_already_received = 1; return ret; } static int handle_misc_pre_prompt(struct annotate_two *a2, const char *buf, size_t n, struct tgdb_list *list) { /* If tgdb is sending a command, then continue past it */ if (data_get_state(a2->data) == INTERNAL_COMMAND) { if (io_write_byte(a2->debugger_stdin, '\n') == -1) logger_write_pos(logger, __FILE__, __LINE__, "Could not send command"); } else { data_set_state(a2, AT_PROMPT); } return 0; } static int handle_misc_prompt(struct annotate_two *a2, const char *buf, size_t n, struct tgdb_list *list) { globals_set_misc_prompt_command(a2->g, 1); data_set_state(a2, USER_AT_PROMPT); a2->command_finished = 1; return 0; } static int handle_misc_post_prompt(struct annotate_two *a2, const char *buf, size_t n, struct tgdb_list *list) { globals_set_misc_prompt_command(a2->g, 0); data_set_state(a2, POST_PROMPT); return 0; } static int handle_pre_prompt(struct annotate_two *a2, const char *buf, size_t n, struct tgdb_list *list) { data_set_state(a2, AT_PROMPT); return 0; } static int handle_prompt(struct annotate_two *a2, const char *buf, size_t n, struct tgdb_list *list) { /* This return TGDB_ABSOLUTE_SOURCE_DENIED if there was no absolute path * given when 'info source' was run. * It tells the gui that the source is not available. */ commands_finalize_command(a2->c, list); /* All done. */ data_set_state(a2, USER_AT_PROMPT); /* 'info sources' is done, return the sources to the gui */ if (global_has_info_sources_started(a2->g) == 1) { global_reset_info_sources_started(a2->g); commands_send_gui_sources(a2->c, list); return 0; } /* 'complete' is done, return the completions to the gui */ if (global_has_completion_started(a2->g) == 1) { global_reset_completion_started(a2->g); commands_send_gui_completions(a2->c, list); return 0; } return 0; } static int handle_post_prompt(struct annotate_two *a2, const char *buf, size_t n, struct tgdb_list *list) { data_set_state(a2, POST_PROMPT); return 0; } static int handle_breakpoints_invalid(struct annotate_two *a2, const char *buf, size_t n, struct tgdb_list *list) { /* Don't use anymore because GDB is buggy */ return 0; } static int handle_breakpoints_headers(struct annotate_two *a2, const char *buf, size_t n, struct tgdb_list *list) { commands_set_state(a2->c, BREAKPOINT_HEADERS, list); return 0; } static int handle_breakpoints_table(struct annotate_two *a2, const char *buf, size_t n, struct tgdb_list *list) { commands_set_state(a2->c, BREAKPOINT_TABLE_BEGIN, list); return 0; } static int handle_breakpoints_table_end(struct annotate_two *a2, const char *buf, size_t n, struct tgdb_list *list) { commands_set_state(a2->c, BREAKPOINT_TABLE_END, list); return 0; } static int handle_unwanted_fields(struct annotate_two *a2, const char *buf, size_t n, struct tgdb_list *list) { return 0; } static int handle_field(struct annotate_two *a2, const char *buf, size_t n, struct tgdb_list *list) { int i = -1; commands_parse_field(a2->c, buf, n, &i); commands_set_field_num(a2->c, i); commands_set_state(a2->c, FIELD, list); return 0; } static int handle_record(struct annotate_two *a2, const char *buf, size_t n, struct tgdb_list *list) { commands_set_state(a2->c, RECORD, list); return 0; } static int handle_error(struct annotate_two *a2, const char *buf, size_t n, struct tgdb_list *list) { data_set_state(a2, POST_PROMPT); /* TEMPORARY */ return 0; } static int handle_error_begin(struct annotate_two *a2, const char *buf, size_t n, struct tgdb_list *list) { /* If the user listed the files ( info sources ) and there is an * annotate error ( usually meaning that gdb can not find the symbols * for the debugged program ) then send a denied response. */ if (commands_get_state(a2->c) == INFO_SOURCES) { struct tgdb_response *response = (struct tgdb_response *) cgdb_malloc(sizeof (struct tgdb_response)); response->header = TGDB_SOURCES_DENIED; tgdb_types_append_command(list, response); return 0; } /* if the user tried to list a file that does not exist */ if (global_has_list_started(a2->g) == 1) { global_list_finished(a2->g); global_set_list_error(a2->g, 1); commands_list_command_finished(a2->c, list, 0); return 0; } /* After a signal is sent (^c), the debugger will then output * something like "Quit\n", so that should be displayed to the user. * Unfortunatly, the debugger ( gdb ) isn't nice enough to return a * post-prompt when a signal is recieved. */ data_set_state(a2, VOID); return 0; } static int handle_quit(struct annotate_two *a2, const char *buf, size_t n, struct tgdb_list *list) { data_set_state(a2, POST_PROMPT); /* TEMPORARY */ return 0; } static int handle_exited(struct annotate_two *a2, const char *buf, size_t n, struct tgdb_list *list) { char *tmp = (char *) malloc(sizeof (char) * (n + 1)); int *i = (int *) malloc(sizeof (int)); struct tgdb_response *response; sprintf(tmp, "%s", buf + 7); /* Skip the 'exited ' part */ *i = atoi(tmp); free(tmp); tmp = NULL; response = (struct tgdb_response *) cgdb_malloc(sizeof (struct tgdb_response)); response->header = TGDB_INFERIOR_EXITED; response->choice.inferior_exited.exit_status = i; tgdb_types_append_command(list, response); return 0; } /** * The main annotation data structure. * It represents all of the supported annotataions that can be parsed. */ static struct annotation { /** * The name of the annotation. */ const char *data; /** * The size of the annotation. */ size_t size; /** * The function to call when the annotation is found. */ int (*f) (struct annotate_two * a2, const char *buf, size_t n, struct tgdb_list * list); } annotations[] = { { "source", 6, handle_source}, { "pre-commands", 12, handle_misc_pre_prompt}, { "commands", 8, handle_misc_prompt}, { "post-commands", 13, handle_misc_post_prompt}, { "pre-overload-choice", 19, handle_misc_pre_prompt}, { "overload-choice", 15, handle_misc_prompt}, { "post-overload-choice", 20, handle_misc_post_prompt}, { "pre-instance-choice", 19, handle_misc_pre_prompt}, { "instance-choice", 15, handle_misc_prompt}, { "post-instance-choice", 20, handle_misc_post_prompt}, { "pre-query", 9, handle_misc_pre_prompt}, { "query", 5, handle_misc_prompt}, { "post-query", 10, handle_misc_post_prompt}, { "pre-prompt-for-continue", 23, handle_misc_pre_prompt}, { "prompt-for-continue", 19, handle_misc_prompt}, { "post-prompt-for-continue", 24, handle_misc_post_prompt}, { "pre-prompt", 10, handle_pre_prompt}, { "prompt", 6, handle_prompt}, { "post-prompt", 11, handle_post_prompt}, { "breakpoints-invalid", 19, handle_breakpoints_invalid}, { "breakpoints-headers", 19, handle_breakpoints_headers}, { "breakpoints-table-end", 21, handle_breakpoints_table_end}, { "breakpoints-table", 17, handle_breakpoints_table}, { "field-", 6, handle_unwanted_fields}, { "field", 5, handle_field}, { "record", 6, handle_record}, { "error-begin", 11, handle_error_begin}, { "error", 5, handle_error}, { "quit", 4, handle_quit}, { "exited", 6, handle_exited}, { NULL, 0, NULL} }; int tgdb_parse_annotation(struct annotate_two *a2, char *data, size_t size, struct tgdb_list *list) { int i; for (i = 0; annotations[i].data != NULL; ++i) { if (strncmp(data, annotations[i].data, annotations[i].size) == 0) { if (annotations[i].f) { if (annotations[i].f(a2, data, size, list) == -1) { logger_write_pos(logger, __FILE__, __LINE__, "parsing annotation failed"); } else break; /* only match one annotation */ } } } /*err_msg("ANNOTION(%s)", data); */ return 0; } cgdb-0.6.7/lib/tgdb/annotate-two/annotate.h000644 000765 000024 00000000547 12074441140 021503 0ustar00mmuellerstaff000000 000000 #ifndef __ANNOTATE_H__ #define __ANNOTATE_H__ #if HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #ifdef HAVE_SYS_TYPES_H #include #endif /* HAVE_SYS_TYPES_H */ #include "tgdb_types.h" #include "annotate_two.h" int tgdb_parse_annotation(struct annotate_two *a2, char *data, size_t size, struct tgdb_list *list); #endif cgdb-0.6.7/lib/tgdb/annotate-two/annotate_two.h000644 000765 000024 00000003712 12074441140 022371 0ustar00mmuellerstaff000000 000000 #ifndef __ANNOTATE_TWO_H__ #define __ANNOTATE_TWO_H__ #if HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #if HAVE_SYS_TYPES_H #include #endif /* HAVE_SYS_TYPES_H */ #include "tgdb_command.h" #include "fs_util.h" #include "fork_util.h" /* For pty_pair_ptr */ #define TTY_NAME_SIZE 64 /** * This is the main context for the annotate two subsytem. */ struct annotate_two { /** * This is set when this context has initialized itself */ int tgdb_initialized; /** * writing to this will write to the stdin of the debugger */ int debugger_stdin; /** * Reading from reads the stdout/stderr of the debugger */ int debugger_out; /** The master, slave and slavename of the pty device */ pty_pair_ptr pty_pair; /** * pid of child process. */ pid_t debugger_pid; /** * ??? */ int command_finished; /** * The config directory that this context can write too. */ char config_dir[FSUTIL_PATH_MAX]; /** * The init file for the debugger. */ char a2_gdb_init_file[FSUTIL_PATH_MAX]; /** * This represents the data subsystem */ struct data *data; /** * This module is used for parsing the output of gdb for annotate 2 * It is used to determine what is a gdb output and what is annotations */ struct state_machine *sm; /** * This module is used for parsing the commands output of gdb */ struct commands *c; /** * This module is used for keeping shared global data */ struct globals *g; /** * This is a list of all the commands generated since in the last call. */ struct tgdb_list *client_command_list; /** * This is used to show if the source annotation has been recieved yet. * It is set to 0 if it hasn't, otherwise 1. */ int source_already_received; /** * The current response list. */ struct tgdb_list *cur_response_list; }; #endif /* __ANNOTATE_TWO_H__ */ cgdb-0.6.7/lib/tgdb/annotate-two/commands.c000644 000765 000024 00000103660 12074441140 021466 0ustar00mmuellerstaff000000 000000 #if HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #ifdef HAVE_SYS_TYPES_H #include #endif /* HAVE_SYS_TYPES_H */ #if HAVE_REGEX_H #include #endif /* HAVE_REGEX_H */ /* Local includes */ #include "commands.h" #include "data.h" #include "io.h" #include "tgdb_types.h" #include "globals.h" #include "logger.h" #include "sys_util.h" #include "queue.h" #include "ibuf.h" #include "a2-tgdb.h" #include "queue.h" #include "tgdb_list.h" #include "annotate_two.h" /** * This structure represents most of the I/O parsing state of the * annotate_two subsytem. */ struct commands { /** The current absolute path the debugger is at in the inferior. */ struct ibuf *absolute_path; /** The current line number the debugger is at in the inferior. */ struct ibuf *line_number; /** The state of the command context. */ enum COMMAND_STATE cur_command_state; /** * This is related to parsing the breakpoint annotations. * It keeps track of the current field we are in. */ int cur_field_num; /** breakpoint information */ /*@{ */ /** A list of breakpoints already parsed. */ struct tgdb_list *breakpoint_list; /** The current breakpoint being parsed. */ struct ibuf *breakpoint_string; /** ??? */ int breakpoint_table; /** If the current breakpoint is enabled */ int breakpoint_enabled; /** ??? */ int breakpoint_started; /* The regular expression matching the breakpoint GDB output */ regex_t regex_bp; /*@} */ /** 'info source' information */ /*@{ */ /** The current info source line being parsed */ struct ibuf *info_source_string; /** The discovered relative path, found from the info source output. */ struct ibuf *info_source_relative_path; /** The discovered absolute path, found from the info source output. */ struct ibuf *info_source_absolute_path; /** Finished parsing the line being looked for. */ int info_source_ready; /** The name of the file requested to have 'info source' run on. */ struct ibuf *last_info_source_requested; /*@} */ /* info sources information {{{ */ /*@{ */ /** ??? Finished parsing the data being looked for. */ int sources_ready; /** All of the sources. */ struct ibuf *info_sources_string; /** All of the source, parsed in put in a list, 1 at a time. */ struct tgdb_list *inferior_source_files; /*@} */ /* }}} */ /* tab completion information {{{ */ /*@{ */ /** ??? Finished parsing the data being looked for. */ int tab_completion_ready; /** A tab completion item */ struct ibuf *tab_completion_string; /** All of the tab completion items, parsed in put in a list, 1 at a time. */ struct tgdb_list *tab_completions; /*@} */ /* }}} */ /** The absolute path prefix output by GDB when 'info source' is given */ const char *source_prefix; /** The length of the line above. */ int source_prefix_length; /** The relative path prefix output by GDB when 'info source' is given */ const char *source_relative_prefix; /** The length of the line above. */ int source_relative_prefix_length; }; struct commands *commands_initialize(void) { struct commands *c = (struct commands *) cgdb_malloc(sizeof (struct commands)); const char *regex = "[io]n (.*) at (.*):([0-9]+)"; c->absolute_path = ibuf_init(); c->line_number = ibuf_init(); c->cur_command_state = VOID_COMMAND; c->cur_field_num = 0; c->breakpoint_list = tgdb_list_init(); c->breakpoint_string = ibuf_init(); c->breakpoint_table = 0; c->breakpoint_enabled = 0; c->breakpoint_started = 0; if (regcomp(&c->regex_bp, regex, REG_EXTENDED) != 0) return NULL; c->info_source_string = ibuf_init(); c->info_source_relative_path = ibuf_init(); c->info_source_absolute_path = ibuf_init(); c->info_source_ready = 0; c->last_info_source_requested = ibuf_init(); c->sources_ready = 0; c->info_sources_string = ibuf_init(); c->inferior_source_files = tgdb_list_init(); c->tab_completion_ready = 0; c->tab_completion_string = ibuf_init(); c->tab_completions = tgdb_list_init(); c->source_prefix = "Located in "; c->source_prefix_length = 11; c->source_relative_prefix = "Current source file is "; c->source_relative_prefix_length = 23; return c; } int free_breakpoint(void *item) { struct tgdb_breakpoint *bp = (struct tgdb_breakpoint *) item; if (bp->file) { free(bp->file); bp->file = NULL; } if (bp->funcname) { free(bp->funcname); bp->funcname = NULL; } free(bp); bp = NULL; return 0; } int free_char_star(void *item) { char *s = (char *) item; free(s); s = NULL; return 0; } void commands_shutdown(struct commands *c) { if (c == NULL) return; ibuf_free(c->absolute_path); c->absolute_path = NULL; ibuf_free(c->line_number); c->line_number = NULL; tgdb_list_free(c->breakpoint_list, free_breakpoint); tgdb_list_destroy(c->breakpoint_list); ibuf_free(c->breakpoint_string); c->breakpoint_string = NULL; regfree(&c->regex_bp); ibuf_free(c->info_source_string); c->info_source_string = NULL; ibuf_free(c->info_source_relative_path); c->info_source_relative_path = NULL; ibuf_free(c->info_source_absolute_path); c->info_source_absolute_path = NULL; ibuf_free(c->info_sources_string); c->info_sources_string = NULL; ibuf_free(c->tab_completion_string); c->tab_completion_string = NULL; tgdb_list_destroy(c->tab_completions); tgdb_list_free(c->inferior_source_files, free_char_star); tgdb_list_destroy(c->inferior_source_files); /* TODO: free source_files queue */ free(c); c = NULL; } int commands_parse_field(struct commands *c, const char *buf, size_t n, int *field) { if (sscanf(buf, "field %d", field) != 1) logger_write_pos(logger, __FILE__, __LINE__, "parsing field annotation failed (%s)\n", buf); return 0; } /* source filename:line:character:middle:addr */ int commands_parse_source(struct commands *c, struct tgdb_list *client_command_list, const char *buf, size_t n, struct tgdb_list *list) { int i = 0; char copy[n + 1]; char *cur = copy + n; struct ibuf *file = ibuf_init(), *line = ibuf_init(); strncpy(copy, buf, n + 1); /* modify local copy */ while (cur != copy && i <= 3) { if (*cur == ':') { if (i == 3) { int length = strlen(cur + 1); char *temp = cgdb_malloc(sizeof (char) * (length + 1)); if (sscanf(cur + 1, "%s", temp) != 1) logger_write_pos(logger, __FILE__, __LINE__, "Could not get line number"); ibuf_add(line, temp); free(temp); temp = NULL; } *cur = '\0'; ++i; } --cur; } /* end while */ { int length = strlen(copy); char *temp = cgdb_malloc(sizeof (char) * (length + 1)); if (strncmp("source ", copy, 7) == 0 && length > 7) { int j; for (j = 7; j < length; j++) ibuf_addchar(file, copy[j]); } else { logger_write_pos(logger, __FILE__, __LINE__, "Could not get file name out of line (%s)", buf); } free(temp); temp = NULL; } ibuf_clear(c->absolute_path); ibuf_add(c->absolute_path, ibuf_get(file)); ibuf_clear(c->line_number); ibuf_add(c->line_number, ibuf_get(line)); ibuf_free(file); ibuf_free(line); /* set up the info_source command to get the relative path */ if (commands_issue_command(c, client_command_list, ANNOTATE_INFO_SOURCE_RELATIVE, NULL, 1) == -1) { logger_write_pos(logger, __FILE__, __LINE__, "commands_issue_command error"); return -1; } return 0; } /** * Parse a breakpoint that GDB passes back when annotate=2 is set. * * Unfortunatly, the line that this function has to parse is completly * ambiguous. GDB does not output a line that can be read in a * non-ambiguous way. Therefore, TGDB tries its best to read the line * properly. The line is in this format. * * '[io]n .* at .*:number' * * so, TGDB can parser the ':number' part without a problem. However, * it may not be able to get function name and filename correctly. If * the filename contains ' at ' in it, then TGDB will stop prematurly. */ static int parse_breakpoint(struct commands *c) { #define BP_REGEX_SIZE (4) char *info_ptr; size_t nmatch = BP_REGEX_SIZE; regmatch_t pmatch[BP_REGEX_SIZE]; char *matches[BP_REGEX_SIZE] = { NULL, NULL, NULL, NULL }; int cur, val; struct tgdb_breakpoint *tb; info_ptr = ibuf_get(c->breakpoint_string); if (!info_ptr) /* This should never really happen */ return -1; /* Check to see if this is a watchpoint, if it is, * don't parse for a breakpoint. */ if (strstr(info_ptr, " at ") == NULL) return 0; val = regexec(&c->regex_bp, info_ptr, nmatch, pmatch, 0); if (val != 0) { logger_write_pos(logger, __FILE__, __LINE__, "regexec failed"); return -1; } /* Get the whole match, function, filename and number name */ for (cur = 0; cur < BP_REGEX_SIZE; ++cur) if (pmatch[cur].rm_so != -1) { int size = pmatch[cur].rm_eo - pmatch[cur].rm_so; matches[cur] = cgdb_malloc(sizeof (char) * (size) + 1); strncpy(matches[cur], &info_ptr[pmatch[cur].rm_so], size); matches[cur][size] = 0; } tb = (struct tgdb_breakpoint *) cgdb_malloc(sizeof (struct tgdb_breakpoint)); tb->funcname = matches[1]; tb->file = matches[2]; tb->line = atoi(matches[3]); if (c->breakpoint_enabled == 1) tb->enabled = 1; else tb->enabled = 0; tgdb_list_append(c->breakpoint_list, tb); /* Matches 1 && 2 are freed by client. */ free(matches[0]); matches[0] = NULL; free(matches[3]); matches[3] = NULL; return 0; } void commands_set_state(struct commands *c, enum COMMAND_STATE state, struct tgdb_list *list) { c->cur_command_state = state; switch (c->cur_command_state) { case RECORD: if (ibuf_length(c->breakpoint_string) > 0) { if (parse_breakpoint(c) == -1) logger_write_pos(logger, __FILE__, __LINE__, "parse_breakpoint error"); ibuf_clear(c->breakpoint_string); c->breakpoint_enabled = 0; } break; case BREAKPOINT_TABLE_END: if (ibuf_length(c->breakpoint_string) > 0) if (parse_breakpoint(c) == -1) logger_write_pos(logger, __FILE__, __LINE__, "parse_breakpoint error"); { struct tgdb_response *response = (struct tgdb_response *) cgdb_malloc(sizeof (struct tgdb_response)); response->header = TGDB_UPDATE_BREAKPOINTS; response->choice.update_breakpoints.breakpoint_list = c->breakpoint_list; /* At this point, annotate needs to send the breakpoints to the gui. * All of the valid breakpoints are stored in breakpoint_queue. */ tgdb_types_append_command(list, response); } ibuf_clear(c->breakpoint_string); c->breakpoint_enabled = 0; c->breakpoint_started = 0; break; case BREAKPOINT_HEADERS: c->breakpoint_table = 0; break; case BREAKPOINT_TABLE_BEGIN: /* The breakpoint queue should be empty at this point */ c->breakpoint_table = 1; c->breakpoint_started = 1; break; case INFO_SOURCE_FILENAME_PAIR: break; case INFO_SOURCE_RELATIVE: break; case INFO_SOURCES: break; default: break; } } void commands_set_field_num(struct commands *c, int field_num) { c->cur_field_num = field_num; /* clear buffer and start over */ if (c->breakpoint_table && c->cur_command_state == FIELD && c->cur_field_num == 5) ibuf_clear(c->breakpoint_string); } enum COMMAND_STATE commands_get_state(struct commands *c) { return c->cur_command_state; } static void commands_prepare_info_source(struct annotate_two *a2, struct commands *c, enum COMMAND_STATE state) { data_set_state(a2, INTERNAL_COMMAND); ibuf_clear(c->info_source_string); ibuf_clear(c->info_source_relative_path); ibuf_clear(c->info_source_absolute_path); if (state == INFO_SOURCE_FILENAME_PAIR) commands_set_state(c, INFO_SOURCE_FILENAME_PAIR, NULL); else if (state == INFO_SOURCE_RELATIVE) commands_set_state(c, INFO_SOURCE_RELATIVE, NULL); c->info_source_ready = 0; } void commands_list_command_finished(struct commands *c, struct tgdb_list *list, int success) { /* The file does not exist and it can not be opened. * So we return that information to the gui. */ struct tgdb_source_file *rejected = (struct tgdb_source_file *) cgdb_malloc(sizeof (struct tgdb_source_file)); struct tgdb_response *response = (struct tgdb_response *) cgdb_malloc(sizeof (struct tgdb_response)); if (c->last_info_source_requested == NULL) rejected->absolute_path = NULL; else rejected->absolute_path = strdup(ibuf_get(c->last_info_source_requested)); response->header = TGDB_ABSOLUTE_SOURCE_DENIED; response->choice.absolute_source_denied.source_file = rejected; tgdb_types_append_command(list, response); } /* This will send to the gui the absolute path to the file being requested. * Otherwise the gui will be notified that the file is not valid. */ static void commands_send_source_absolute_source_file(struct commands *c, struct tgdb_list *list) { /*err_msg("Whats up(%s:%d)\r\n", info_source_buf, info_source_buf_pos); */ unsigned long length = ibuf_length(c->info_source_absolute_path); /* found */ if (length > 0) { char *apath = NULL, *rpath = NULL; struct tgdb_response *response; if (length > 0) apath = ibuf_get(c->info_source_absolute_path); if (ibuf_length(c->info_source_relative_path) > 0) rpath = ibuf_get(c->info_source_relative_path); response = (struct tgdb_response *) cgdb_malloc(sizeof (struct tgdb_response)); response->header = TGDB_FILENAME_PAIR; response->choice.filename_pair.absolute_path = strdup(apath); response->choice.filename_pair.relative_path = strdup(rpath); tgdb_types_append_command(list, response); /* not found */ } else { struct tgdb_source_file *rejected = (struct tgdb_source_file *) cgdb_malloc(sizeof (struct tgdb_source_file)); struct tgdb_response *response = (struct tgdb_response *) cgdb_malloc(sizeof (struct tgdb_response)); response->header = TGDB_ABSOLUTE_SOURCE_DENIED; if (c->last_info_source_requested == NULL) rejected->absolute_path = NULL; else rejected->absolute_path = strdup(ibuf_get(c->last_info_source_requested)); response->choice.absolute_source_denied.source_file = rejected; tgdb_types_append_command(list, response); } } static void commands_send_source_relative_source_file(struct commands *c, struct tgdb_list *list) { /* So far, INFO_SOURCE_RELATIVE is only used when a * TGDB_UPDATE_FILE_POSITION is needed. */ /* This section allocates a new structure to add into the queue * All of its members will need to be freed later. */ struct tgdb_file_position *tfp = (struct tgdb_file_position *) cgdb_malloc(sizeof (struct tgdb_file_position)); struct tgdb_response *response = (struct tgdb_response *) cgdb_malloc(sizeof (struct tgdb_response)); tfp->absolute_path = strdup(ibuf_get(c->absolute_path)); tfp->relative_path = strdup(ibuf_get(c->info_source_relative_path)); tfp->line_number = atoi(ibuf_get(c->line_number)); response->header = TGDB_UPDATE_FILE_POSITION; response->choice.update_file_position.file_position = tfp; tgdb_types_append_command(list, response); } /* commands_process_info_source: * ----------------------------- * * This function is capable of parsing the output of 'info source'. * It can get both the absolute and relative path to the source file. */ static void commands_process_info_source(struct commands *c, struct tgdb_list *list, char a) { unsigned long length; static char *info_ptr; if (c->info_source_ready) /* Already found */ return; info_ptr = ibuf_get(c->info_source_string); length = ibuf_length(c->info_source_string); if (a == '\r') return; if (a == '\n') { /* This is the line containing the absolute path to the source file */ if (length >= c->source_prefix_length && strncmp(info_ptr, c->source_prefix, c->source_prefix_length) == 0) { ibuf_add(c->info_source_absolute_path, info_ptr + c->source_prefix_length); c->info_source_ready = 1; ibuf_clear(c->info_source_string); /* commands_finalize_command will use the populated data */ /* This is the line contatining the relative path to the source file */ } else if (length >= c->source_relative_prefix_length && strncmp(info_ptr, c->source_relative_prefix, c->source_relative_prefix_length) == 0) { ibuf_add(c->info_source_relative_path, info_ptr + c->source_relative_prefix_length); ibuf_clear(c->info_source_string); } else ibuf_clear(c->info_source_string); } else ibuf_addchar(c->info_source_string, a); } static void commands_process_source_line(struct commands *c) { unsigned long length = ibuf_length(c->info_sources_string), i, start = 0; static char *info_ptr; static char *nfile; info_ptr = ibuf_get(c->info_sources_string); for (i = 0; i < length; ++i) { if (i > 0 && info_ptr[i - 1] == ',' && info_ptr[i] == ' ') { nfile = calloc(sizeof (char), i - start); strncpy(nfile, info_ptr + start, i - start - 1); start += ((i + 1) - start); tgdb_list_append(c->inferior_source_files, nfile); } else if (i == length - 1) { nfile = calloc(sizeof (char), i - start + 2); strncpy(nfile, info_ptr + start, i - start + 1); tgdb_list_append(c->inferior_source_files, nfile); } } } /* process's source files */ static void commands_process_sources(struct commands *c, char a) { static const char *sourcesReadyString = "Source files for which symbols "; static const int sourcesReadyStringLength = 31; static char *info_ptr; ibuf_addchar(c->info_sources_string, a); if (a == '\n') { ibuf_delchar(c->info_sources_string); /* remove '\n' and null terminate */ /* valid lines are * 1. after the first line, * 2. do not end in ':' * 3. and are not empty */ info_ptr = ibuf_get(c->info_sources_string); if (strncmp(info_ptr, sourcesReadyString, sourcesReadyStringLength) == 0) c->sources_ready = 1; /* is this a valid line */ if (ibuf_length(c->info_sources_string) > 0 && c->sources_ready && info_ptr[ibuf_length(c->info_sources_string) - 1] != ':') commands_process_source_line(c); ibuf_clear(c->info_sources_string); } } static void commands_process_completion(struct commands *c) { const char *ptr = ibuf_get(c->tab_completion_string); const char *scomplete = "server complete "; /* Do not add the "server complete " matches, which is returned with * GNAT 3.15p version of GDB. Most likely this could happen with other * implementations that are derived from GDB. */ if (strncmp(ptr, scomplete, strlen(scomplete)) != 0) tgdb_list_append(c->tab_completions, strdup(ptr)); } /* process's source files */ static void commands_process_complete(struct commands *c, char a) { ibuf_addchar(c->tab_completion_string, a); if (a == '\n') { ibuf_delchar(c->tab_completion_string); /* remove '\n' and null terminate */ if (ibuf_length(c->tab_completion_string) > 0) commands_process_completion(c); ibuf_clear(c->tab_completion_string); } } void commands_free(struct commands *c, void *item) { free((char *) item); } void commands_send_gui_sources(struct commands *c, struct tgdb_list *list) { /* If the inferior program was not compiled with debug, then no sources * will be available. If no sources are available, do not return the * TGDB_UPDATE_SOURCE_FILES command. */ if (tgdb_list_size(c->inferior_source_files) > 0) { struct tgdb_response *response = (struct tgdb_response *) cgdb_malloc(sizeof (struct tgdb_response)); response->header = TGDB_UPDATE_SOURCE_FILES; response->choice.update_source_files.source_files = c->inferior_source_files; tgdb_types_append_command(list, response); } } void commands_send_gui_completions(struct commands *c, struct tgdb_list *list) { /* If the inferior program was not compiled with debug, then no sources * will be available. If no sources are available, do not return the * TGDB_UPDATE_SOURCE_FILES command. */ /* if (tgdb_list_size ( c->tab_completions ) > 0)*/ struct tgdb_response *response = (struct tgdb_response *) cgdb_malloc(sizeof (struct tgdb_response)); response->header = TGDB_UPDATE_COMPLETIONS; response->choice.update_completions.completion_list = c->tab_completions; tgdb_types_append_command(list, response); } void commands_process(struct commands *c, char a, struct tgdb_list *list) { if (commands_get_state(c) == INFO_SOURCES) { commands_process_sources(c, a); } else if (commands_get_state(c) == COMPLETE) { commands_process_complete(c, a); } else if (commands_get_state(c) == INFO_LIST) { /* do nothing with data */ } else if (commands_get_state(c) == INFO_SOURCE_FILENAME_PAIR || commands_get_state(c) == INFO_SOURCE_RELATIVE) { commands_process_info_source(c, list, a); } else if (c->breakpoint_table && c->cur_command_state == FIELD && c->cur_field_num == 5) { /* the file name and line num */ if (a != '\n' || a != '\r') ibuf_addchar(c->breakpoint_string, a); } else if (c->breakpoint_table && c->cur_command_state == FIELD && c->cur_field_num == 3 && a == 'y') { c->breakpoint_enabled = 1; } } /******************************************************************************* * This must be translated to just return the proper command. ******************************************************************************/ /* commands_prepare_info_breakpoints: * ---------------------------------- * * This prepares the command 'info breakpoints' */ static void commands_prepare_info_breakpoints(struct commands *c) { ibuf_clear(c->breakpoint_string); } /* commands_prepare_tab_completion: * -------------------------------- * * This prepares the tab completion command */ static void commands_prepare_tab_completion(struct annotate_two *a2, struct commands *c) { c->tab_completion_ready = 0; ibuf_clear(c->tab_completion_string); commands_set_state(c, COMPLETE, NULL); global_set_start_completion(a2->g); } /* commands_prepare_info_sources: * ------------------------------ * * This prepares the command 'info sources' by setting certain variables. */ static void commands_prepare_info_sources(struct annotate_two *a2, struct commands *c) { c->sources_ready = 0; ibuf_clear(c->info_sources_string); commands_set_state(c, INFO_SOURCES, NULL); global_set_start_info_sources(a2->g); } /* commands_prepare_list: * ----------------------------- * This runs the command 'list filename:1' and then runs * 'info source' to find out what the absolute path to filename is. * * filename -> The name of the file to check the absolute path of. */ static void commands_prepare_list(struct annotate_two *a2, struct commands *c, char *filename) { commands_set_state(c, INFO_LIST, NULL); global_set_start_list(a2->g); c->info_source_ready = 0; } void commands_finalize_command(struct commands *c, struct tgdb_list *list) { switch (commands_get_state(c)) { case INFO_SOURCE_RELATIVE: case INFO_SOURCE_FILENAME_PAIR: if (c->info_source_ready == 0) { struct tgdb_source_file *rejected = (struct tgdb_source_file *) cgdb_malloc(sizeof (struct tgdb_source_file)); struct tgdb_response *response = (struct tgdb_response *) cgdb_malloc(sizeof (struct tgdb_response)); if (c->last_info_source_requested == NULL) rejected->absolute_path = NULL; else rejected->absolute_path = strdup(ibuf_get(c->last_info_source_requested)); response->header = TGDB_ABSOLUTE_SOURCE_DENIED; response->choice.absolute_source_denied.source_file = rejected; tgdb_types_append_command(list, response); } else { if (commands_get_state(c) == INFO_SOURCE_RELATIVE) commands_send_source_relative_source_file(c, list); else if (commands_get_state(c) == INFO_SOURCE_FILENAME_PAIR) commands_send_source_absolute_source_file(c, list); } break; default: break; } } int commands_prepare_for_command(struct annotate_two *a2, struct commands *c, struct tgdb_command *com) { enum annotate_commands *a_com = (enum annotate_commands *) com->tgdb_client_private_data; /* Set the commands state to nothing */ commands_set_state(c, VOID, NULL); /* The list command is no longer running */ global_list_finished(a2->g); if (global_list_had_error(a2->g) == 1 && commands_get_state(c) == INFO_LIST) { global_set_list_error(a2->g, 0); return -1; } if (a_com == NULL) { data_set_state(a2, USER_COMMAND); return 0; } switch (*a_com) { case ANNOTATE_INFO_SOURCES: commands_prepare_info_sources(a2, c); break; case ANNOTATE_LIST: commands_prepare_list(a2, c, com->tgdb_command_data); break; case ANNOTATE_INFO_LINE: break; case ANNOTATE_INFO_SOURCE_RELATIVE: commands_prepare_info_source(a2, c, INFO_SOURCE_RELATIVE); break; case ANNOTATE_INFO_SOURCE_FILENAME_PAIR: commands_prepare_info_source(a2, c, INFO_SOURCE_FILENAME_PAIR); break; case ANNOTATE_INFO_BREAKPOINTS: commands_prepare_info_breakpoints(c); break; case ANNOTATE_TTY: break; /* Nothing to do */ case ANNOTATE_COMPLETE: commands_prepare_tab_completion(a2, c); io_debug_write_fmt("<%s\n>", com->tgdb_command_data); break; /* Nothing to do */ case ANNOTATE_INFO_SOURCE: case ANNOTATE_SET_PROMPT: case ANNOTATE_VOID: break; default: logger_write_pos(logger, __FILE__, __LINE__, "commands_prepare_for_command error"); break; }; data_set_state(a2, INTERNAL_COMMAND); io_debug_write_fmt("<%s\n>", com->tgdb_command_data); return 0; } /** * This is responsible for creating a command to run through the debugger. * * \param com * The annotate command to run * * \param data * Information that may be needed to create the command * * \return * A command ready to be run through the debugger or NULL on error. * The memory is malloc'd, and must be freed. */ static char *commands_create_command(struct commands *c, enum annotate_commands com, const char *data) { char *ncom = NULL; switch (com) { case ANNOTATE_INFO_SOURCES: ncom = strdup("server info sources\n"); break; case ANNOTATE_LIST: { struct ibuf *temp_file_name = NULL; if (data != NULL) { temp_file_name = ibuf_init(); ibuf_add(temp_file_name, data); } if (data == NULL) ncom = (char *) cgdb_malloc(sizeof (char) * (16)); else ncom = (char *) cgdb_malloc(sizeof (char) * (18 + strlen(data))); strcpy(ncom, "server list "); if (temp_file_name != NULL) { strcat(ncom, "\""); strcat(ncom, ibuf_get(temp_file_name)); strcat(ncom, "\""); strcat(ncom, ":1"); } /* This happens when the user wants to get the absolute path of * the current file. They pass in NULL to represent that. */ if (temp_file_name == NULL) { ibuf_free(c->last_info_source_requested); c->last_info_source_requested = NULL; } else { if (c->last_info_source_requested == NULL) c->last_info_source_requested = ibuf_init(); ibuf_clear(c->last_info_source_requested); ibuf_add(c->last_info_source_requested, ibuf_get(temp_file_name)); } strcat(ncom, "\n"); ibuf_free(temp_file_name); temp_file_name = NULL; break; } case ANNOTATE_INFO_LINE: ncom = strdup("server info line\n"); break; case ANNOTATE_INFO_SOURCE_RELATIVE: case ANNOTATE_INFO_SOURCE_FILENAME_PAIR: ncom = strdup("server info source\n"); break; case ANNOTATE_INFO_BREAKPOINTS: ncom = strdup("server info breakpoints\n"); break; case ANNOTATE_TTY: { struct ibuf *temp_tty_name = ibuf_init(); ibuf_add(temp_tty_name, data); ncom = (char *) cgdb_malloc(sizeof (char) * (13 + strlen(data))); strcpy(ncom, "server tty "); strcat(ncom, ibuf_get(temp_tty_name)); strcat(ncom, "\n"); ibuf_free(temp_tty_name); temp_tty_name = NULL; break; } case ANNOTATE_COMPLETE: ncom = (char *) cgdb_malloc(sizeof (char) * (18 + strlen(data))); strcpy(ncom, "server complete "); strcat(ncom, data); strcat(ncom, "\n"); break; case ANNOTATE_SET_PROMPT: ncom = strdup(data); break; case ANNOTATE_VOID: default: logger_write_pos(logger, __FILE__, __LINE__, "switch error"); break; }; return ncom; } int commands_user_ran_command(struct commands *c, struct tgdb_list *client_command_list) { if (commands_issue_command(c, client_command_list, ANNOTATE_INFO_BREAKPOINTS, NULL, 0) == -1) { logger_write_pos(logger, __FILE__, __LINE__, "commands_issue_command error"); return -1; } #if 0 /* This was added to allow support for TGDB to tell the FE when the user * switched locations due to a 'list foo:1' command. The info line would * get issued and the FE would know exactly what GDB was currently looking * at. However, it was noticed that the FE couldn't distinguish between when * a new file location should be displayed, or when a new file location * shouldn't be displayed. For instance, if the user moves around in the * source window, and then types 'p argc' it would then get the original * position it was just at and the FE would show that spot again, but this * isn't necessarily what the FE wants. */ if (commands_issue_command(c, client_command_list, ANNOTATE_INFO_LINE, NULL, 0) == -1) { logger_write_pos(logger, __FILE__, __LINE__, "commands_issue_command error"); return -1; } #endif return 0; } int commands_issue_command(struct commands *c, struct tgdb_list *client_command_list, enum annotate_commands com, const char *data, int oob) { char *ncom = commands_create_command(c, com, data); struct tgdb_command *client_command = NULL; enum annotate_commands *nacom = (enum annotate_commands *) cgdb_malloc(sizeof (enum annotate_commands)); *nacom = com; if (ncom == NULL) { logger_write_pos(logger, __FILE__, __LINE__, "commands_issue_command error"); return -1; } /* This should send the command to tgdb-base to handle */ if (oob == 0) { client_command = tgdb_command_create(ncom, TGDB_COMMAND_TGDB_CLIENT, (void *) nacom); } else if (oob == 1) { client_command = tgdb_command_create(ncom, TGDB_COMMAND_TGDB_CLIENT_PRIORITY, (void *) nacom); } else if (oob == 4) { client_command = tgdb_command_create(ncom, TGDB_COMMAND_TGDB_CLIENT, (void *) nacom); } if (ncom) { free(ncom); ncom = NULL; } /* Append to the command_container the commands */ tgdb_list_append(client_command_list, client_command); return 0; } cgdb-0.6.7/lib/tgdb/annotate-two/commands.h000644 000765 000024 00000012652 12074441140 021473 0ustar00mmuellerstaff000000 000000 #ifndef __COMMANDS_H__ #define __COMMANDS_H__ #include "tgdb_types.h" #include "tgdb_command.h" #include "a2-tgdb.h" struct commands; /* These are the state that an internal command could lead to */ enum COMMAND_STATE { /* not a state */ VOID_COMMAND, /* These are related to the 'info breakpoints' command */ BREAKPOINT_HEADERS, BREAKPOINT_TABLE_BEGIN, BREAKPOINT_TABLE_END, FIELD, RECORD, /* Related to the 'info sources' command */ INFO_SOURCES, /* Related to the 'server complete' command for tab completion */ COMPLETE, /* Related to the 'info source' command */ INFO_LIST, INFO_SOURCE_FILENAME_PAIR, INFO_SOURCE_RELATIVE }; /* commands_initialize: Initialize the commands unit */ struct commands *commands_initialize(void); void commands_shutdown(struct commands *c); /* commands_parse_field: This is called when tgdb gets a field annotation * from gdb. * buf -> The 'field' annotation recieved from gdb. * n -> The size of the annotation. * field -> the field number outputted. */ int commands_parse_field(struct commands *c, const char *buf, size_t n, int *field); /* commands_parse_source: This is called when tgdb gets a source annotation * from gdb. It parses the annotation and puts the * correct information into com for the gui. * * buf -> The 'source' annotation recieved from gdb. * n -> The size of the annotation. */ int commands_parse_source(struct commands *c, struct tgdb_list *client_command_list, const char *buf, size_t n, struct tgdb_list *list); /* command_set_state: Sets the state of the command package. This should usually be called * after an annotation has been read. */ void commands_set_state(struct commands *c, enum COMMAND_STATE state, struct tgdb_list *list); /* commands_set_field_num: This is used for breakpoint annotations. * field_num is the field that the breakpoint annotation is on. */ void commands_set_field_num(struct commands *c, int field_num); /* command_get_state: Gets the state of the command package * Returns: The current state. */ enum COMMAND_STATE commands_get_state(struct commands *c); /* runs a simple command, output goes to user */ /*int commands_run_command(int fd, struct tgdb_client_command *com);*/ /* commands_issue_command: * ----------------------- * * This is used by the annotations library to internally issure commands to * the debugger. It sends a command to tgdb-base. * * Returns -1 on error, 0 on success */ int commands_issue_command(struct commands *c, struct tgdb_list *client_command_list, enum annotate_commands com, const char *data, int oob); /* commands_process: This function recieves the output from gdb when gdb * is running a command on behalf of this package. * * a -> the character recieved from gdb. * com -> commands to give back to gdb. */ void commands_process(struct commands *c, char a, struct tgdb_list *list); /* commands_list_command_finished: Returns to the gui the absolute path of * the filename requested. * * if success is 0 then the list failed, otherwise it worked. */ void commands_list_command_finished(struct commands *c, struct tgdb_list *list, int success); /* commands_send_gui_sources: This gives the gui all of the sources that were * just read from gdb through an 'info sources' prompt. * * com -> commands to give back to gdb. */ void commands_send_gui_sources(struct commands *c, struct tgdb_list *list); /* This gives the gui all of the completions that were just read from gdb * through a 'complete' command. * */ void commands_send_gui_completions(struct commands *c, struct tgdb_list *list); /* The 3 functions below are for tgdb only. * These functions are responsible for keeping tgdb up to date with gdb. * If a particular piece of information is needed after each command the user * is allowed to give to gdb, then these are the functions that will find out * the missing info. * These functions should NOT be called for the gui to get work done, and they * should not be used for tgdb to get work done. * * THEY ARE STRICTLY FOR KEEPING TGDB UP TO DATE WITH GDB */ /* commands_has_commnands_to_run: Determines if there is a command that * tgdb needs run. * RETURNS: 1 if there is commands to run, otherwise 0 */ int commands_has_commnands_to_run(struct commands *c); /* commands_prepare_for_command: * ----------------------------- * * Prepare's the client for the command COM to be run. * * com: The command to be run. * * Returns: -1 if this command should not be run. 0 otherwise. */ int commands_prepare_for_command(struct annotate_two *a2, struct commands *c, struct tgdb_command *com); /* commands_finalize_command: * -------------------------- * * This can be called to finalize work when the end of a command is reached. */ void commands_finalize_command(struct commands *c, struct tgdb_list *list); /* commands_user_ran_command: * -------------------------- * * This lets the clients know that the user ran a command. * The client can update itself here if it need to. * * Returns: -1 on error, 0 on success */ int commands_user_ran_command(struct commands *c, struct tgdb_list *client_command_list); #endif cgdb-0.6.7/lib/tgdb/annotate-two/data.c000644 000765 000024 00000010156 12074441140 020573 0ustar00mmuellerstaff000000 000000 #if HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #if HAVE_STDIO_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include "data.h" #include "commands.h" #include "globals.h" #include "io.h" #include "logger.h" #include "a2-tgdb.h" #include "sys_util.h" /** * The info stored for each data context. */ struct data { /** * The maximum size of the prompt. */ #define GDB_PROMPT_SIZE 1024 /** * the state of the data context */ enum internal_state data_state; /** * The debugger's prompt. */ char gdb_prompt[GDB_PROMPT_SIZE]; /** * The size of gdb_prompt. */ int gdb_prompt_size; /** * What the debugger's prompt was before. */ char gdb_prompt_last[GDB_PROMPT_SIZE]; }; struct data *data_initialize(void) { struct data *d = (struct data *) cgdb_malloc(sizeof (struct data)); d->data_state = VOID; d->gdb_prompt_size = 0; d->gdb_prompt[0] = 0; d->gdb_prompt_last[0] = 0; return d; } void data_shutdown(struct data *d) { free(d); d = NULL; } enum internal_state data_get_state(struct data *d) { return d->data_state; } void data_set_state(struct annotate_two *a2, enum internal_state state) { /* if tgdb is at an internal command, than nothing changes that * state unless tgdb gets to the prompt annotation. This means that * the internal command is done */ if (a2->data->data_state == INTERNAL_COMMAND && state != USER_AT_PROMPT) return; a2->data->data_state = state; switch (a2->data->data_state) { case VOID: break; case AT_PROMPT: a2->data->gdb_prompt_size = 0; break; case USER_AT_PROMPT: /* Null-Terminate the prompt */ a2->data->gdb_prompt[a2->data->gdb_prompt_size] = '\0'; if (strcmp(a2->data->gdb_prompt, a2->data->gdb_prompt_last) != 0) { strcpy(a2->data->gdb_prompt_last, a2->data->gdb_prompt); /* Update the prompt */ if (a2->cur_response_list) { struct tgdb_response *response = (struct tgdb_response *) cgdb_malloc(sizeof (struct tgdb_response)); response->header = TGDB_UPDATE_CONSOLE_PROMPT_VALUE; response->choice.update_console_prompt_value.prompt_value = cgdb_strdup(a2->data->gdb_prompt_last); tgdb_list_append(a2->cur_response_list, response); } } a2->command_finished = 1; /* This is important, because it resets the commands state. * With this line not here, if the user hits 'o' from cgdb, * then the commands state gets set to INFO_SOURCES, then the * user hits ^c from the gdb window, the error occurs because * commands state is INFO_SOURCES instead of VOID. */ commands_set_state(a2->c, VOID, NULL); break; case POST_PROMPT: a2->data->data_state = VOID; break; case GUI_COMMAND: break; case INTERNAL_COMMAND: break; case USER_COMMAND: break; } /* end switch */ } void data_process(struct annotate_two *a2, char a, char *buf, int *n, struct tgdb_list *list) { switch (a2->data->data_state) { case VOID: buf[(*n)++] = a; break; case AT_PROMPT: a2->data->gdb_prompt[a2->data->gdb_prompt_size++] = a; /* buf[(*n)++] = a;*/ break; case USER_AT_PROMPT: break; case GUI_COMMAND: case INTERNAL_COMMAND: if (a2->data->data_state == INTERNAL_COMMAND) commands_process(a2->c, a, list); else if (a2->data->data_state == GUI_COMMAND) buf[(*n)++] = a; break; /* do nothing */ case USER_COMMAND: break; case POST_PROMPT: break; } /* end switch */ } cgdb-0.6.7/lib/tgdb/annotate-two/data.h000644 000765 000024 00000003526 12074441140 020603 0ustar00mmuellerstaff000000 000000 /* data: * ----- * * This unit recieves all of the data that was not an annotation from gdb. * It gets the data 1 character at a time and passes it along to the * commands unit when necessary. * */ #ifndef __DATA_H__ #define __DATA_H__ #ifdef __cplusplus extern "C" { #endif #include "tgdb_types.h" #include "tgdb_command.h" #include "annotate_two.h" struct data; enum internal_state { VOID, /* not interesting */ AT_PROMPT, /* the prompt is being displayed */ USER_AT_PROMPT, /* the user is typing at prompt */ POST_PROMPT, /* the user is done at the prompt */ USER_COMMAND, /* this is a command issued by the user */ GUI_COMMAND, /* this is a command issued to gdb by tgdb (not the user) */ INTERNAL_COMMAND /* This is a command issued by tgdb */ }; struct data *data_initialize(void); void data_shutdown(struct data *d); /* data_set_state: Sets the state of the data package. This should usually be called * after an annotation has been read. */ void data_set_state(struct annotate_two *a2, enum internal_state state); /* data_get_state: Gets the state of the data package * Returns: The current state. */ enum internal_state data_get_state(struct data *d); /* data_process: This process's every character that is outputted from gdb not * including annotations. * * a - A character read from gdb. * buf - This is a buffer of information that will get returned to the user * based on whatever the character a was. * n - This is the current size of buf. */ void data_process(struct annotate_two *a2, char a, char *buf, int *n, struct tgdb_list *list); #ifdef __cplusplus } #endif #endif cgdb-0.6.7/lib/tgdb/annotate-two/globals.c000644 000765 000024 00000005014 12074441140 021302 0ustar00mmuellerstaff000000 000000 #if HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include "tgdb_types.h" #include "globals.h" #include "sys_util.h" /** * The globals context. * This store various amounts of global data for the annotate_two context. */ struct globals { /** * This determines if the char enter has been typed by the * user since the prompt annotation has been sent by gdb */ unsigned short info_sources_started; unsigned short completion_started; /** * Has the 'list' command been started. */ unsigned short list_started; /** * Did the list have an error? */ unsigned short list_had_error; /** * Is a misc prompt command be run. */ unsigned short misc_prompt_command; }; struct globals *globals_initialize(void) { struct globals *g = (struct globals *) cgdb_malloc(sizeof (struct globals)); g->info_sources_started = 0; g->completion_started = 0; g->list_started = 0; g->list_had_error = 0; g->misc_prompt_command = 0; return g; } /* For info_sources_started */ void globals_shutdown(struct globals *g) { free(g); g = NULL; } /* This turns true if tgdb gets a misc prompt. This is so that we do not * send commands to gdb at this point. */ int globals_is_misc_prompt(struct globals *g) { return g->misc_prompt_command; } void globals_set_misc_prompt_command(struct globals *g, unsigned short set) { g->misc_prompt_command = set; } void global_set_start_info_sources(struct globals *g) { g->info_sources_started = 1; } int global_has_info_sources_started(struct globals *g) { return g->info_sources_started; } void global_reset_info_sources_started(struct globals *g) { g->info_sources_started = 0; } void global_set_start_completion(struct globals *g) { g->completion_started = 1; } int global_has_completion_started(struct globals *g) { return g->completion_started; } void global_reset_completion_started(struct globals *g) { g->completion_started = 0; } /* For list_started */ void global_set_start_list(struct globals *g) { g->list_started = 1; g->list_had_error = 0; } int global_has_list_started(struct globals *g) { return g->list_started; } void global_list_finished(struct globals *g) { g->list_started = 0; } /* For list_had_error */ unsigned short global_list_had_error(struct globals *g) { return g->list_had_error; } void global_set_list_error(struct globals *g, unsigned short error) { g->list_had_error = error; } cgdb-0.6.7/lib/tgdb/annotate-two/globals.h000644 000765 000024 00000002122 12074441140 021304 0ustar00mmuellerstaff000000 000000 #ifndef __GLOBALS_H__ #define __GLOBALS_H__ /* This unit holds global data to tgdb. It helps keep track of obscure states */ struct globals; int globals_is_misc_prompt(struct globals *g); void globals_set_misc_prompt_command(struct globals *g, unsigned short set); struct globals *globals_initialize(void); void globals_shutdown(struct globals *g); /* These check to see if the gui is working on getting the source files that * make up the program being debugged. */ void global_set_start_info_sources(struct globals *g); int global_has_info_sources_started(struct globals *g); void global_reset_info_sources_started(struct globals *g); void global_set_start_completion(struct globals *g); int global_has_completion_started(struct globals *g); void global_reset_completion_started(struct globals *g); /* Lists a file */ void global_set_start_list(struct globals *g); int global_has_list_started(struct globals *g); void global_list_finished(struct globals *g); unsigned short global_list_had_error(struct globals *g); void global_set_list_error(struct globals *g, unsigned short error); #endif cgdb-0.6.7/lib/tgdb/annotate-two/Makefile.am000644 000765 000024 00000000707 12074441140 021553 0ustar00mmuellerstaff000000 000000 libtgdb_a2_a_CFLAGS = \ -I$(top_srcdir)/lib/adt \ -I$(top_srcdir)/lib/util \ -I$(top_srcdir)/lib/tgdb/tgdb-base # create the input library # This depends on input noinst_LIBRARIES = libtgdb_a2.a libtgdb_a2_a_SOURCES = \ a2-tgdb.c \ a2-tgdb.h \ annotate.c \ annotate.h \ annotate_two.h \ commands.c \ commands.h \ data.c \ data.h \ globals.c \ globals.h \ state_machine.c \ state_machine.h cgdb-0.6.7/lib/tgdb/annotate-two/Makefile.in000644 000765 000024 00000065425 12074766253 021613 0ustar00mmuellerstaff000000 000000 # Makefile.in generated by automake 1.13.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = lib/tgdb/annotate-two DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/config/depcomp ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/config/readline_check_version.m4 \ $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LIBRARIES = $(noinst_LIBRARIES) AR = ar ARFLAGS = cru AM_V_AR = $(am__v_AR_@AM_V@) am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@) am__v_AR_0 = @echo " AR " $@; am__v_AR_1 = libtgdb_a2_a_AR = $(AR) $(ARFLAGS) libtgdb_a2_a_LIBADD = am_libtgdb_a2_a_OBJECTS = libtgdb_a2_a-a2-tgdb.$(OBJEXT) \ libtgdb_a2_a-annotate.$(OBJEXT) \ libtgdb_a2_a-commands.$(OBJEXT) libtgdb_a2_a-data.$(OBJEXT) \ libtgdb_a2_a-globals.$(OBJEXT) \ libtgdb_a2_a-state_machine.$(OBJEXT) libtgdb_a2_a_OBJECTS = $(am_libtgdb_a2_a_OBJECTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__depfiles_maybe = depfiles am__mv = mv -f AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libtgdb_a2_a_SOURCES) DIST_SOURCES = $(libtgdb_a2_a_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ RL_MAJOR = @RL_MAJOR@ RL_MINOR = @RL_MINOR@ RL_VERSION = @RL_VERSION@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ YACC = @YACC@ YFLAGS = @YFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ libtgdb_a2_a_CFLAGS = \ -I$(top_srcdir)/lib/adt \ -I$(top_srcdir)/lib/util \ -I$(top_srcdir)/lib/tgdb/tgdb-base # create the input library # This depends on input noinst_LIBRARIES = libtgdb_a2.a libtgdb_a2_a_SOURCES = \ a2-tgdb.c \ a2-tgdb.h \ annotate.c \ annotate.h \ annotate_two.h \ commands.c \ commands.h \ data.c \ data.h \ globals.c \ globals.h \ state_machine.c \ state_machine.h all: all-am .SUFFIXES: .SUFFIXES: .c .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu lib/tgdb/annotate-two/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu lib/tgdb/annotate-two/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) libtgdb_a2.a: $(libtgdb_a2_a_OBJECTS) $(libtgdb_a2_a_DEPENDENCIES) $(EXTRA_libtgdb_a2_a_DEPENDENCIES) $(AM_V_at)-rm -f libtgdb_a2.a $(AM_V_AR)$(libtgdb_a2_a_AR) libtgdb_a2.a $(libtgdb_a2_a_OBJECTS) $(libtgdb_a2_a_LIBADD) $(AM_V_at)$(RANLIB) libtgdb_a2.a mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtgdb_a2_a-a2-tgdb.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtgdb_a2_a-annotate.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtgdb_a2_a-commands.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtgdb_a2_a-data.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtgdb_a2_a-globals.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libtgdb_a2_a-state_machine.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` libtgdb_a2_a-a2-tgdb.o: a2-tgdb.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libtgdb_a2_a_CFLAGS) $(CFLAGS) -MT libtgdb_a2_a-a2-tgdb.o -MD -MP -MF $(DEPDIR)/libtgdb_a2_a-a2-tgdb.Tpo -c -o libtgdb_a2_a-a2-tgdb.o `test -f 'a2-tgdb.c' || echo '$(srcdir)/'`a2-tgdb.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libtgdb_a2_a-a2-tgdb.Tpo $(DEPDIR)/libtgdb_a2_a-a2-tgdb.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='a2-tgdb.c' object='libtgdb_a2_a-a2-tgdb.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libtgdb_a2_a_CFLAGS) $(CFLAGS) -c -o libtgdb_a2_a-a2-tgdb.o `test -f 'a2-tgdb.c' || echo '$(srcdir)/'`a2-tgdb.c libtgdb_a2_a-a2-tgdb.obj: a2-tgdb.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libtgdb_a2_a_CFLAGS) $(CFLAGS) -MT libtgdb_a2_a-a2-tgdb.obj -MD -MP -MF $(DEPDIR)/libtgdb_a2_a-a2-tgdb.Tpo -c -o libtgdb_a2_a-a2-tgdb.obj `if test -f 'a2-tgdb.c'; then $(CYGPATH_W) 'a2-tgdb.c'; else $(CYGPATH_W) '$(srcdir)/a2-tgdb.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libtgdb_a2_a-a2-tgdb.Tpo $(DEPDIR)/libtgdb_a2_a-a2-tgdb.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='a2-tgdb.c' object='libtgdb_a2_a-a2-tgdb.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libtgdb_a2_a_CFLAGS) $(CFLAGS) -c -o libtgdb_a2_a-a2-tgdb.obj `if test -f 'a2-tgdb.c'; then $(CYGPATH_W) 'a2-tgdb.c'; else $(CYGPATH_W) '$(srcdir)/a2-tgdb.c'; fi` libtgdb_a2_a-annotate.o: annotate.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libtgdb_a2_a_CFLAGS) $(CFLAGS) -MT libtgdb_a2_a-annotate.o -MD -MP -MF $(DEPDIR)/libtgdb_a2_a-annotate.Tpo -c -o libtgdb_a2_a-annotate.o `test -f 'annotate.c' || echo '$(srcdir)/'`annotate.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libtgdb_a2_a-annotate.Tpo $(DEPDIR)/libtgdb_a2_a-annotate.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='annotate.c' object='libtgdb_a2_a-annotate.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libtgdb_a2_a_CFLAGS) $(CFLAGS) -c -o libtgdb_a2_a-annotate.o `test -f 'annotate.c' || echo '$(srcdir)/'`annotate.c libtgdb_a2_a-annotate.obj: annotate.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libtgdb_a2_a_CFLAGS) $(CFLAGS) -MT libtgdb_a2_a-annotate.obj -MD -MP -MF $(DEPDIR)/libtgdb_a2_a-annotate.Tpo -c -o libtgdb_a2_a-annotate.obj `if test -f 'annotate.c'; then $(CYGPATH_W) 'annotate.c'; else $(CYGPATH_W) '$(srcdir)/annotate.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libtgdb_a2_a-annotate.Tpo $(DEPDIR)/libtgdb_a2_a-annotate.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='annotate.c' object='libtgdb_a2_a-annotate.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libtgdb_a2_a_CFLAGS) $(CFLAGS) -c -o libtgdb_a2_a-annotate.obj `if test -f 'annotate.c'; then $(CYGPATH_W) 'annotate.c'; else $(CYGPATH_W) '$(srcdir)/annotate.c'; fi` libtgdb_a2_a-commands.o: commands.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libtgdb_a2_a_CFLAGS) $(CFLAGS) -MT libtgdb_a2_a-commands.o -MD -MP -MF $(DEPDIR)/libtgdb_a2_a-commands.Tpo -c -o libtgdb_a2_a-commands.o `test -f 'commands.c' || echo '$(srcdir)/'`commands.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libtgdb_a2_a-commands.Tpo $(DEPDIR)/libtgdb_a2_a-commands.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='commands.c' object='libtgdb_a2_a-commands.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libtgdb_a2_a_CFLAGS) $(CFLAGS) -c -o libtgdb_a2_a-commands.o `test -f 'commands.c' || echo '$(srcdir)/'`commands.c libtgdb_a2_a-commands.obj: commands.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libtgdb_a2_a_CFLAGS) $(CFLAGS) -MT libtgdb_a2_a-commands.obj -MD -MP -MF $(DEPDIR)/libtgdb_a2_a-commands.Tpo -c -o libtgdb_a2_a-commands.obj `if test -f 'commands.c'; then $(CYGPATH_W) 'commands.c'; else $(CYGPATH_W) '$(srcdir)/commands.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libtgdb_a2_a-commands.Tpo $(DEPDIR)/libtgdb_a2_a-commands.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='commands.c' object='libtgdb_a2_a-commands.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libtgdb_a2_a_CFLAGS) $(CFLAGS) -c -o libtgdb_a2_a-commands.obj `if test -f 'commands.c'; then $(CYGPATH_W) 'commands.c'; else $(CYGPATH_W) '$(srcdir)/commands.c'; fi` libtgdb_a2_a-data.o: data.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libtgdb_a2_a_CFLAGS) $(CFLAGS) -MT libtgdb_a2_a-data.o -MD -MP -MF $(DEPDIR)/libtgdb_a2_a-data.Tpo -c -o libtgdb_a2_a-data.o `test -f 'data.c' || echo '$(srcdir)/'`data.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libtgdb_a2_a-data.Tpo $(DEPDIR)/libtgdb_a2_a-data.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='data.c' object='libtgdb_a2_a-data.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libtgdb_a2_a_CFLAGS) $(CFLAGS) -c -o libtgdb_a2_a-data.o `test -f 'data.c' || echo '$(srcdir)/'`data.c libtgdb_a2_a-data.obj: data.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libtgdb_a2_a_CFLAGS) $(CFLAGS) -MT libtgdb_a2_a-data.obj -MD -MP -MF $(DEPDIR)/libtgdb_a2_a-data.Tpo -c -o libtgdb_a2_a-data.obj `if test -f 'data.c'; then $(CYGPATH_W) 'data.c'; else $(CYGPATH_W) '$(srcdir)/data.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libtgdb_a2_a-data.Tpo $(DEPDIR)/libtgdb_a2_a-data.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='data.c' object='libtgdb_a2_a-data.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libtgdb_a2_a_CFLAGS) $(CFLAGS) -c -o libtgdb_a2_a-data.obj `if test -f 'data.c'; then $(CYGPATH_W) 'data.c'; else $(CYGPATH_W) '$(srcdir)/data.c'; fi` libtgdb_a2_a-globals.o: globals.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libtgdb_a2_a_CFLAGS) $(CFLAGS) -MT libtgdb_a2_a-globals.o -MD -MP -MF $(DEPDIR)/libtgdb_a2_a-globals.Tpo -c -o libtgdb_a2_a-globals.o `test -f 'globals.c' || echo '$(srcdir)/'`globals.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libtgdb_a2_a-globals.Tpo $(DEPDIR)/libtgdb_a2_a-globals.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='globals.c' object='libtgdb_a2_a-globals.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libtgdb_a2_a_CFLAGS) $(CFLAGS) -c -o libtgdb_a2_a-globals.o `test -f 'globals.c' || echo '$(srcdir)/'`globals.c libtgdb_a2_a-globals.obj: globals.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libtgdb_a2_a_CFLAGS) $(CFLAGS) -MT libtgdb_a2_a-globals.obj -MD -MP -MF $(DEPDIR)/libtgdb_a2_a-globals.Tpo -c -o libtgdb_a2_a-globals.obj `if test -f 'globals.c'; then $(CYGPATH_W) 'globals.c'; else $(CYGPATH_W) '$(srcdir)/globals.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libtgdb_a2_a-globals.Tpo $(DEPDIR)/libtgdb_a2_a-globals.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='globals.c' object='libtgdb_a2_a-globals.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libtgdb_a2_a_CFLAGS) $(CFLAGS) -c -o libtgdb_a2_a-globals.obj `if test -f 'globals.c'; then $(CYGPATH_W) 'globals.c'; else $(CYGPATH_W) '$(srcdir)/globals.c'; fi` libtgdb_a2_a-state_machine.o: state_machine.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libtgdb_a2_a_CFLAGS) $(CFLAGS) -MT libtgdb_a2_a-state_machine.o -MD -MP -MF $(DEPDIR)/libtgdb_a2_a-state_machine.Tpo -c -o libtgdb_a2_a-state_machine.o `test -f 'state_machine.c' || echo '$(srcdir)/'`state_machine.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libtgdb_a2_a-state_machine.Tpo $(DEPDIR)/libtgdb_a2_a-state_machine.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='state_machine.c' object='libtgdb_a2_a-state_machine.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libtgdb_a2_a_CFLAGS) $(CFLAGS) -c -o libtgdb_a2_a-state_machine.o `test -f 'state_machine.c' || echo '$(srcdir)/'`state_machine.c libtgdb_a2_a-state_machine.obj: state_machine.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libtgdb_a2_a_CFLAGS) $(CFLAGS) -MT libtgdb_a2_a-state_machine.obj -MD -MP -MF $(DEPDIR)/libtgdb_a2_a-state_machine.Tpo -c -o libtgdb_a2_a-state_machine.obj `if test -f 'state_machine.c'; then $(CYGPATH_W) 'state_machine.c'; else $(CYGPATH_W) '$(srcdir)/state_machine.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libtgdb_a2_a-state_machine.Tpo $(DEPDIR)/libtgdb_a2_a-state_machine.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='state_machine.c' object='libtgdb_a2_a-state_machine.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libtgdb_a2_a_CFLAGS) $(CFLAGS) -c -o libtgdb_a2_a-state_machine.obj `if test -f 'state_machine.c'; then $(CYGPATH_W) 'state_machine.c'; else $(CYGPATH_W) '$(srcdir)/state_machine.c'; fi` ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LIBRARIES) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ clean-noinstLIBRARIES cscopelist-am ctags ctags-am distclean \ distclean-compile distclean-generic distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \ uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: cgdb-0.6.7/lib/tgdb/annotate-two/state_machine.c000644 000765 000024 00000015172 12074441140 022471 0ustar00mmuellerstaff000000 000000 #if HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #if HAVE_STDIO_H #include #endif /* HAVE_STDIO_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #include "state_machine.h" #include "annotate.h" #include "logger.h" #include "data.h" #include "globals.h" #include "annotate_two.h" #include "sys_util.h" #include "ibuf.h" /* This package looks for annotations coming from gdb's output. * The program that is being debugged does not have its ouput pass * through here. So only gdb's ouput is filtered here. * * This is a simple state machine that is looking for annotations * in gdb's output. Annotations are of the form * '\n\032\032annotation\n' * However, on windows \n gets mapped to \r\n So we take account * for that by matching the form * '\r+\n\032\032annotation\r+\n' * * When an annotation is found, this unit passes the annotation to the * annotate unit and this unit is free of all responsibility :) */ enum state { DATA, /* data from debugger */ NEW_LINE, /* got '\n' */ CONTROL_Z, /* got first ^Z '\032' */ ANNOTATION, /* got second ^Z '\032' */ NL_DATA /* got a nl at the end of annotation */ }; /** * The data needed to parse the output of GDB. */ struct state_machine { /** * Annotations will be stored here. */ struct ibuf *tgdb_buffer; /** * The state of the annotation parser ( current context ). */ enum state tgdb_state; }; struct state_machine *state_machine_initialize(void) { struct state_machine *sm = (struct state_machine *) cgdb_malloc(sizeof (struct state_machine)); sm->tgdb_buffer = ibuf_init(); sm->tgdb_state = DATA; return sm; } void state_machine_shutdown(struct state_machine *sm) { ibuf_free(sm->tgdb_buffer); free(sm); sm = NULL; } int a2_handle_data(struct annotate_two *a2, struct state_machine *sm, const char *data, const size_t size, char *gui_data, size_t * gui_size, struct tgdb_list *command_list) { int i, counter = 0; /* track state to find next file and line number */ for (i = 0; i < size; ++i) { switch (data[i]) { /* Ignore all car returns outputted by gdb */ case '\r': break; case '\n': switch (sm->tgdb_state) { case DATA: sm->tgdb_state = NEW_LINE; break; case NEW_LINE: sm->tgdb_state = NEW_LINE; data_process(a2, '\n', gui_data, &counter, command_list); break; case CONTROL_Z: sm->tgdb_state = DATA; data_process(a2, '\n', gui_data, &counter, command_list); data_process(a2, '\032', gui_data, &counter, command_list); break; case ANNOTATION: /* Found an annotation */ sm->tgdb_state = NL_DATA; tgdb_parse_annotation(a2, ibuf_get(sm->tgdb_buffer), ibuf_length(sm->tgdb_buffer), command_list); ibuf_clear(sm->tgdb_buffer); break; case NL_DATA: sm->tgdb_state = NEW_LINE; break; default: logger_write_pos(logger, __FILE__, __LINE__, "Bad state transition"); break; } /* end switch */ break; case '\032': switch (sm->tgdb_state) { case DATA: sm->tgdb_state = DATA; data_process(a2, '\032', gui_data, &counter, command_list); break; case NEW_LINE: sm->tgdb_state = CONTROL_Z; break; case NL_DATA: sm->tgdb_state = CONTROL_Z; break; case CONTROL_Z: sm->tgdb_state = ANNOTATION; break; case ANNOTATION: ibuf_addchar(sm->tgdb_buffer, data[i]); break; default: logger_write_pos(logger, __FILE__, __LINE__, "Bad state transition"); break; } /* end switch */ break; default: switch (sm->tgdb_state) { case DATA: data_process(a2, data[i], gui_data, &counter, command_list); break; case NL_DATA: sm->tgdb_state = DATA; data_process(a2, data[i], gui_data, &counter, command_list); break; case NEW_LINE: sm->tgdb_state = DATA; data_process(a2, '\n', gui_data, &counter, command_list); data_process(a2, data[i], gui_data, &counter, command_list); break; case CONTROL_Z: sm->tgdb_state = DATA; data_process(a2, '\n', gui_data, &counter, command_list); data_process(a2, '\032', gui_data, &counter, command_list); data_process(a2, data[i], gui_data, &counter, command_list); break; case ANNOTATION: ibuf_addchar(sm->tgdb_buffer, data[i]); break; default: logger_write_pos(logger, __FILE__, __LINE__, "Bad state transition"); break; } /* end switch */ break; } /* end switch */ } /* end for */ gui_data[counter] = '\0'; *gui_size = counter; return 0; } cgdb-0.6.7/lib/tgdb/annotate-two/state_machine.h000644 000765 000024 00000002547 12074441140 022500 0ustar00mmuellerstaff000000 000000 /* state_machine: * ------------- * * This unit is responsible for parsing annotations from the output of gdb. * It can distinguish between output that is an annotation and output that * is not an annotation. It sends all output that is not an annotation to * the data package and all output that is an annotation to the annotation * package. It does not interpret the data in any way. * All ouput from gdb must be filtered through this function. */ #ifndef __STATE_MACHINE_H__ #define __STATE_MACHINE_H__ #if HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #ifdef HAVE_SYS_TYPES_H #include #endif /* HAVE_SYS_TYPES_H */ #include "tgdb_types.h" #include "a2-tgdb.h" struct state_machine; struct state_machine *state_machine_initialize(void); void state_machine_shutdown(struct state_machine *sm); /** * \param data * The buffer to parse. * * \param size * The size of the buffer data. * * \param gui_data * This is the information in DATA that was not an annotation. * * \param gui_size * The size of the buffer gui_data. * * \param command_list * If a command was generated from an annotation, its put in here. */ int a2_handle_data(struct annotate_two *a2, struct state_machine *sm, const char *data, const size_t size, char *gui_data, size_t * gui_size, struct tgdb_list *command_list); #endif cgdb-0.6.7/lib/rline/Makefile.am000644 000765 000024 00000000231 12074441140 017314 0ustar00mmuellerstaff000000 000000 AM_CFLAGS = \ -I$(top_srcdir)/lib/adt \ -I$(top_srcdir)/lib/util noinst_LIBRARIES = librline.a librline_a_SOURCES = \ rline.c \ rline.h cgdb-0.6.7/lib/rline/Makefile.in000644 000765 000024 00000035120 12074766253 017351 0ustar00mmuellerstaff000000 000000 # Makefile.in generated by automake 1.13.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = lib/rline DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/config/depcomp ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/config/readline_check_version.m4 \ $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LIBRARIES = $(noinst_LIBRARIES) AR = ar ARFLAGS = cru AM_V_AR = $(am__v_AR_@AM_V@) am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@) am__v_AR_0 = @echo " AR " $@; am__v_AR_1 = librline_a_AR = $(AR) $(ARFLAGS) librline_a_LIBADD = am_librline_a_OBJECTS = rline.$(OBJEXT) librline_a_OBJECTS = $(am_librline_a_OBJECTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(librline_a_SOURCES) DIST_SOURCES = $(librline_a_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ RL_MAJOR = @RL_MAJOR@ RL_MINOR = @RL_MINOR@ RL_VERSION = @RL_VERSION@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ YACC = @YACC@ YFLAGS = @YFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CFLAGS = \ -I$(top_srcdir)/lib/adt \ -I$(top_srcdir)/lib/util noinst_LIBRARIES = librline.a librline_a_SOURCES = \ rline.c \ rline.h all: all-am .SUFFIXES: .SUFFIXES: .c .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu lib/rline/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu lib/rline/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) librline.a: $(librline_a_OBJECTS) $(librline_a_DEPENDENCIES) $(EXTRA_librline_a_DEPENDENCIES) $(AM_V_at)-rm -f librline.a $(AM_V_AR)$(librline_a_AR) librline.a $(librline_a_OBJECTS) $(librline_a_LIBADD) $(AM_V_at)$(RANLIB) librline.a mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rline.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LIBRARIES) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ clean-noinstLIBRARIES cscopelist-am ctags ctags-am distclean \ distclean-compile distclean-generic distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \ uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: cgdb-0.6.7/lib/rline/rline.c000644 000765 000024 00000026123 12074441140 016545 0ustar00mmuellerstaff000000 000000 #include #include "rline.h" #if HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STDIO_H #include #endif /* HAVE_STDIO_H */ #if HAVE_SYS_IOCTL_H #include #endif /* HAVE_SYS_IOCTL_H */ #if HAVE_TERMIOS_H #include #endif /* HAVE_TERMIOS_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ /* includes {{{*/ #ifdef HAVE_LIBREADLINE #if defined(HAVE_READLINE_READLINE_H) #include #elif defined(HAVE_READLINE_H) #include #endif /* !defined(HAVE_READLINE_H) */ #if defined(HAVE_READLINE_HISTORY_H) #include #elif defined(HAVE_HISTORY_H) #include #endif /* defined(HAVE_READLINE_HISTORY_H) */ #endif /* HAVE_LIBREADLINE */ /* }}}*/ struct rline { /* The input to readline. Writing to this, writes to readline. */ FILE *input; /* The output of readline. When readline writes data, it goes to this * descritpor. Thus, reading from this, get's readline's output. */ FILE *output; /* The user defined tab completion function */ completion_cb *tab_completion; /* The user defined tab completion function */ rl_command_func_t *rline_rl_last_func; /* The value of rl_completion_query_items before its set to -1. * It is set to -1 so that readline will not attempt to ask "y or no", * since that particular functionality of readline does not work with * the alternative interface. */ int rline_rl_completion_query_items; }; static void custom_deprep_term_function() { } /* Createing and Destroying a librline context. {{{*/ struct rline *rline_initialize(int slavefd, command_cb * command, completion_cb * completion, char *TERM) { struct rline *rline = (struct rline *) malloc(sizeof (struct rline)); if (!rline) return NULL; /* Initialize each member variable */ rline->input = NULL; rline->output = NULL; rline->input = fdopen(slavefd, "r"); if (!rline->input) { rline_shutdown(rline); return NULL; } rline->output = fdopen(slavefd, "w"); if (!rline->output) { rline_shutdown(rline); return NULL; } rline->tab_completion = completion; rline->rline_rl_last_func = NULL; rline->rline_rl_completion_query_items = rl_completion_query_items; rl_readline_name = "cgdb"; rl_instream = rline->input; rl_outstream = rline->output; /* Tell readline not to put the initial prompt */ rl_already_prompted = 1; /* Tell readline not to catch signals */ rl_catch_signals = 0; rl_catch_sigwinch = 0; /* Tell readline what the prompt is if it needs to put it back */ rl_callback_handler_install("(gdb) ", command); rl_bind_key('\t', completion); /* Set the terminal type to dumb so the output of readline can be * understood by tgdb */ if (rl_reset_terminal(TERM) == -1) { rline_shutdown(rline); return NULL; } /* For some reason, readline can not deprep the terminal. * However, it doesn't matter because no other application is working on * the terminal besides readline */ rl_deprep_term_function = custom_deprep_term_function; /* These variables are here to make sure readline doesn't * attempt to query the user to determine if it wants more input. */ rl_completion_query_items = -1; rl_variable_bind("page-completions", "0"); rl_completer_word_break_characters = " \t\n!@#$%^&*()+=|~`}{[]\"';:?/>.<,-"; rl_completer_quote_characters = "'"; return rline; } int rline_shutdown(struct rline *rline) { if (!rline) return -1; /* Should this be OK? */ if (rline->input) fclose(rline->input); if (rline->output) fclose(rline->output); free(rline); rline = NULL; return 0; } /*@}*/ /* }}}*/ /* Reading and Writing the librline context. {{{*/ int rline_read_history(struct rline *rline, const char *file) { if (!rline) return -1; using_history(); read_history(file); history_set_pos(history_length); return 0; } int rline_write_history(struct rline *rline, const char *file) { if (!rline) return -1; write_history(file); return 0; } /*@}*/ /* }}}*/ /* Functional commands {{{*/ int rline_set_prompt(struct rline *rline, const char *prompt) { if (!rline) return -1; rl_set_prompt(prompt); return 0; } int rline_clear(struct rline *rline) { if (!rline) return -1; /* Clear whatever readline has in it's buffer. */ rl_point = 0; rl_end = 0; rl_mark = 0; rl_delete_text(0, rl_end); return 0; } int rline_add_history(struct rline *rline, const char *line) { if (!rline) return -1; if (!line) return -1; add_history(line); return 0; } int rline_get_prompt(struct rline *rline, char **prompt) { if (!rline) return -1; if (!prompt) return -1; *prompt = rl_prompt; return 0; } int rline_get_current_line(struct rline *rline, char **current_line) { if (!rline) return -1; if (!current_line) return -1; *current_line = rl_line_buffer; return 0; } int rline_rl_forced_update_display(struct rline *rline) { if (!rline) return -1; rl_forced_update_display(); return 0; } int rline_rl_callback_read_char(struct rline *rline) { if (!rline) return -1; /* Capture the last function used here. */ rline->rline_rl_last_func = rl_last_func; rl_callback_read_char(); return 0; } static tgdb_list_iterator *rline_local_iter; /** * Return to readline a possible completion. * * \param text * The text that is being completed. It can be a subset of the full current * line (rl_line_buffer) at the prompt. * * \param matches * The current number of matches so far * * \return * A possible match, or NULL if none left. */ char *rline_rl_completion_entry_function(const char *text, int matches) { if (rline_local_iter) { /** * 'local' is a possible completion. 'text' is the data to be completed. * 'word' is the current possible match started off at the same point * in local, that text is started in rl_line_buffer. * * In C++ if you do "b 'classname::functionam". This will complete * the line like "b 'classname::functioname'". */ char *local = tgdb_list_get_item(rline_local_iter); char *word = local + rl_point - strlen(text); rline_local_iter = tgdb_list_next(rline_local_iter); return strdup(word); } return NULL; } /* This is necessary because we want to make what the user has typed * against a list of possibilites. For example, if the user has typed * 'b ma', the completion possibities should at least have 'b main'. * The default readline word break includes a ' ', which would not * result in 'b main' as the completion result. */ char *rline_rl_cpvfunc_t(void) { return ""; } int rline_rl_complete(struct rline *rline, struct tgdb_list *list, display_callback display_cb) { int size; int key; rl_command_func_t *compare_func = NULL; if (!rline) return -1; /* Currently, if readline output's the tab completion to rl_outstream, it will fill * the pty between it and CGDB and will cause CGDB to hang. */ if (!display_cb) return -1; size = tgdb_list_size(list); if (size == 0) { rl_completion_word_break_hook = NULL; rl_completion_entry_function = NULL; } else { rl_completion_word_break_hook = rline_rl_cpvfunc_t; rl_completion_entry_function = rline_rl_completion_entry_function; } rl_completion_display_matches_hook = display_cb; rline_local_iter = tgdb_list_get_first(list); /* This is probably a hack, however it works for now. * * Basically, rl_complete is working fine. After the call to rl_complete, * rl_line_buffer contains the proper data. However, the CGDB main loop * always call rline_rl_forced_update_display, which in the case of tab * completion does this, (gdb) b ma(gdb) b main * * Normally, this works fine because the user hits '\n', which puts the prompt * on the next line. In this case, the user hit's \t. * * In order work around this problem, simply putting the \r should work * for now. * * This obviously shouldn't be done when readline is doing * `?' means list the possible completions. * style completion. Because that actuall does list all of the values on * a different line. In this situation the \r goes after the completion * is done, since only the current prompt is on that line. */ /* Another confusing comparison. This checks to see if the last * readline function and the current readline function and the * tab completion callback are all the same. This ensures that this * is the second time the user hit \t in a row. Instead of simply * calling rl_complete_internal, it's better to call, rl_completion_mode * because this checks to see what kind of completion should be done. */ if (rline->rline_rl_last_func == rline->tab_completion && rline->rline_rl_last_func == rl_last_func) compare_func = rline->tab_completion; key = rl_completion_mode(compare_func); if (key == TAB) fprintf(rline->output, "\r"); rl_complete_internal(key); if (key != TAB) fprintf(rline->output, "\r"); return 0; } int rline_resize_terminal_and_redisplay(struct rline *rline, int rows, int cols) { struct winsize size; if (!rline) return -1; size.ws_row = rows; size.ws_col = cols; size.ws_xpixel = 0; size.ws_ypixel = 0; ioctl(fileno(rline->input), TIOCSWINSZ, &size); rl_resize_terminal(); return 0; } int rline_get_rl_completion_query_items(struct rline *rline) { if (!rline) return -1; return rline->rline_rl_completion_query_items; } int rline_get_keyseq(struct rline *rline, const char *named_function, std_list keyseq_list) { rl_command_func_t *func; char **invoking_keyseqs = NULL; char **invoking_keyseqs_cur = NULL; char *new_keyseq = NULL; int len; if (!keyseq_list) return -1; func = rl_named_function(named_function); if (func == 0) return 0; invoking_keyseqs = rl_invoking_keyseqs(func); invoking_keyseqs_cur = invoking_keyseqs; while (invoking_keyseqs_cur && (*invoking_keyseqs_cur)) { new_keyseq = (char *) cgdb_malloc((2 * strlen(*invoking_keyseqs_cur)) + 1); if (rl_translate_keyseq(*invoking_keyseqs_cur, new_keyseq, &len)) { free(new_keyseq); free(*invoking_keyseqs_cur); /* Can't do much about readline failing, just continue on. */ continue; } /* If the append function breaks, in serious trouble */ std_list_append(keyseq_list, new_keyseq); free(*invoking_keyseqs_cur); invoking_keyseqs_cur++; } free(invoking_keyseqs); return 0; } /*@}*/ /* }}}*/ cgdb-0.6.7/lib/rline/rline.h000644 000765 000024 00000020052 12074441140 016545 0ustar00mmuellerstaff000000 000000 #ifndef __RL_H__ #define __RL_H__ /*! * \file * rl.h * * \brief * This interface is the abstraction layer to the GNU readline library. * Currently readline only supports 1 instance of itself per program. Until it * supports multiple instance's, this library will also only support a single * instance. */ #include "tgdb_list.h" #include "std_list.h" /* Createing and Destroying a librline context. {{{ */ /******************************************************************************/ /** * @name Createing and Destroying a librline context. * These functions are for createing and destroying a rline context. */ /******************************************************************************/ /*@{*/ /** * This struct is a reference to a librline instance. */ struct rline; /** * The signature of the callback function that rline calls when it detects * that a command has been typed by the user. */ typedef void command_cb(char *); /** * The signature of the callback function that rline calls when it detects * that the user has requested completion on the current line. */ typedef int completion_cb(int, int); /** * This initializes an rline library instance. * * The client must call this function before any other function in the * rline library. * * \param slavefd * This is the file descriptor representing the slave side of a terminal device. * * \param command * The command callback that should be used when readline completes a command. * * \param completion * The completion callback that should be used when readline requests completion. * * \param TERM * Pass in the TERM that readline should think it's output should be like. * * @return * NULL on error, a valid context on success. */ struct rline *rline_initialize(int slavefd, command_cb * command, completion_cb * completion, char *TERM); /** * This will terminate a librline session. No functions should be called on * the rline context passed into this function after this call. * * \param rline * An instance of the rline library to operate on. * * @return * 0 on success or -1 on error */ int rline_shutdown(struct rline *rline); /*@}*/ /* }}}*/ /* Reading and Writing the librline context. {{{*/ /******************************************************************************/ /** * @name Reading and Writing the librline context. * These functions are for reading and writing an rline context. */ /******************************************************************************/ /*@{*/ /** * Read readline history into memory. * * \param rline * The readline context to operate on. * * \param file * The filename to be used that contains the readline history. * * \return * 0 on success or -1 on error */ int rline_read_history(struct rline *rline, const char *file); /** * Write readline history to file. * * \param rline * The readline context to operate on. * * \param file * The filename to write the readline history to. * * \return * 0 on success or -1 on error */ int rline_write_history(struct rline *rline, const char *file); /*@}*/ /* }}}*/ /* Functional commands {{{*/ /******************************************************************************/ /** * @name Functional commands * These functinos are used to ask the librline context to perform a task. */ /******************************************************************************/ /*@{*/ /** * Ask librline to change the current prompt that it use's. * * \param rline * The readline context to operate on. * * \param prompt * The prompt to give to readline. * * \return * 0 on success or -1 on error. */ int rline_set_prompt(struct rline *rline, const char *prompt); /** * Get the current prompt that readline is using. * * \param rline * The readline context to operate on. * * \param prompt * The prompt that readline is currently using. This will point to the same * memory that readline is using. Do not attempt to free or modify this * memory directly. * * \return * 0 on success or -1 on error. */ int rline_get_prompt(struct rline *rline, char **prompt); /** * Get the current line that readline has. * * \param rline * The readline context to operate on. * * \param prompt * The current line the user has typed in. * * \return * 0 on success or -1 on error. */ int rline_get_current_line(struct rline *rline, char **current_line); /** * Clear the data currently entered at the prompt. This function currently * is implemented in such a way that the data is cleared upon the return * of this function. This is so that signal handlers can easily clear the data * without worrying about race conditions. * * \param rline * The readline context to operate on. * * \return * 0 on success or -1 on error. */ int rline_clear(struct rline *rline); /** * Add a history entry to the list of history items. * * This function will fail if LINE == NULL. * * \param rline * The readline context to operate on. * * \param line * The line to add to the history. * * \return * 0 on success or -1 on error. */ int rline_add_history(struct rline *rline, const char *line); /** * Force the update of readline. This will write the contents of its * current buffer out. * * \param rline * The readline context to operate on. * * \return * 0 on success or -1 on error. */ int rline_rl_forced_update_display(struct rline *rline); /** * This tells readline to read from it's input. The caller of this function * must have detected that input was ready on this descritpor. If input is not * ready, this function will hang. * * \param rline * The readline context to operate on. * * \return * 0 on success or -1 on error. */ int rline_rl_callback_read_char(struct rline *rline); typedef void (*display_callback) (char **, int, int); /** * This function will complete the current line that readline has. It will * get the completions and return them to the display callback to be * displayed in any way the client sees appropriate. The current readline * line will be modified after this call if appropriate. * * \param rline * The readline context to operate on. * * \param list * The list of possible items to complete. * * \param display_cb * This function will be called with a list of possible completions, if there are any. * * \return * 0 on success or -1 on error. */ int rline_rl_complete(struct rline *rline, struct tgdb_list *list, display_callback display_cb); /** * This will adjust the size of the PTY that readline is working on, then * it will alert readline that it will need to be redisplay it's data. * * \param rline * The readline context to operate on. * * \param rows * The new number of rows the readline pty should be. * * \param cols * The new number of cols the readline pty should be. * * \return * 0 on success or -1 on error. */ int rline_resize_terminal_and_redisplay(struct rline *rline, int rows, int cols); /** * Get's the value of rl_completion_query_items. * * \param rline * The readline context to operate on. * * \param query_items * * \return * The value of rl_completion_query_items, if rline is NULL then -1. */ int rline_get_rl_completion_query_items(struct rline *rline); /** * This will get the key sequences that readline uses for a certain key. * * \param rline * The readline context to operate on. * * \param named_function * The readline function to get the key sequences for. * Examples are "beginning-of-line" and "end-of-line" * * \param keyseq_list * A list of key sequences (char*) that can be used to map to * the named_function the user requested. This variable should * be allocated before calling this function and must be destroyed * by the caller later. Each item put into this list must also * be destroyed. You can use xfree to do this. * * NOTE: If rline_get_keyseq fails with a -1, it's important for * this function to clean up the memory already put into the keyseq_list * * \return * 0 on success or -1 on error */ int rline_get_keyseq(struct rline *rline, const char *named_function, std_list keyseq_list); /*@}*/ /* }}}*/ #endif /* __RL_H__ */ cgdb-0.6.7/lib/kui/kui.c000644 000765 000024 00000067634 12074441140 015717 0ustar00mmuellerstaff000000 000000 /* includes {{{ */ #include /* strdup */ #include #include #include #include "kui.h" #include "sys_util.h" #include "io.h" #include "kui_term.h" #include "kui_tree.h" /* }}} */ /* struct kui_map {{{ */ /** * A kui map structure. * * This is simply a key/value pair as far as the outside * world is concerned. */ struct kui_map { /** * The user wants this map to be activated when he/she types this sequence. * This data representation is entirly in ascii, since the user has to * be able to type the sequence on the keyboard. */ char *original_key; /** * This is the list of keys that must be matched, in order for this map * to be activated. The value of each item is either an ascii char typed * by the user, or it is a high level terminal escape sequence. * * This is a NULL terminated list. */ int *literal_key; /** * The value is the substitution data, if the literal_key is typed. */ char *original_value; /** * This data is passed in place of the key, if the user types the * literal_key. * * This is a NULL terminated list. */ int *literal_value; }; struct kui_map *kui_map_create(const char *key_data, const char *value_data) { struct kui_map *map; char *key, *value; /* Validify parameters */ if (!key_data || !value_data) return NULL; map = (struct kui_map *) malloc(sizeof (struct kui_map)); if (!map) return NULL; /* Initialize all fields */ map->original_key = NULL; map->literal_key = NULL; map->original_value = NULL; map->literal_value = NULL; key = strdup(key_data); if (!key) { kui_map_destroy(map); return NULL; } value = strdup(value_data); if (!value) { kui_map_destroy(map); return NULL; } map->original_key = key; map->original_value = value; if (kui_term_string_to_key_array(map->original_key, &map->literal_key) == -1) { kui_map_destroy(map); return NULL; } if (kui_term_string_to_key_array(map->original_value, &map->literal_value) == -1) { kui_map_destroy(map); return NULL; } return map; } int kui_map_destroy(struct kui_map *map) { if (!map) return -1; if (map->original_key) { free(map->original_key); map->original_key = NULL; } if (map->original_value) { free(map->original_value); map->original_value = NULL; } if (map->literal_key) { free(map->literal_key); map->literal_key = NULL; } if (map->literal_value) { free(map->literal_value); map->literal_value = NULL; } free(map); map = NULL; return 0; } int kui_map_get_key(struct kui_map *map, char **key) { if (!map) return -1; *key = map->original_key; return 0; } int kui_map_get_literal_key(struct kui_map *map, int **key) { if (!map) return -1; *key = map->literal_key; return 0; } int kui_map_get_value(struct kui_map *map, char **value) { if (!map) return -1; *value = map->original_value; return 0; } int kui_map_get_literal_value(struct kui_map *map, int **value) { if (!map) return -1; *value = map->literal_value; return 0; } int kui_map_print_cgdb_key_array(struct kui_map *map) { if (!map) return -1; if (kui_term_print_key_array(map->literal_value) == -1) return -1; return 0; } /* }}} */ /* struct kui_map_set {{{ */ /* Kui map set */ /** * This maintains a list of maps. It also is capable of tracking if a user is * matching any map in this set with the current key strokes being typed. */ struct kui_map_set { /* The ktree used in determining if a map has been reached or is being * reached. Of course, nothing could match also. This structure is efficient * in doing the work, it looks only at the current key read. */ struct kui_tree *ktree; /* A linked list of the maps being checked for. */ std_list maps; }; static int kui_map_destroy_callback(void *data) { struct kui_map *map; if (!data) return -1; map = (struct kui_map *) data; return kui_map_destroy(map); } struct kui_map_set *kui_ms_create(void) { struct kui_map_set *map; map = (struct kui_map_set *) malloc(sizeof (struct kui_map_set)); if (!map) return NULL; map->maps = std_list_create(kui_map_destroy_callback); if (!map->maps) { kui_ms_destroy(map); return NULL; } map->ktree = kui_tree_create(); if (!map->ktree) { kui_ms_destroy(map); return NULL; } return map; } int kui_ms_destroy(struct kui_map_set *kui_ms) { int retval = 0; if (!kui_ms) return -1; if (kui_ms->ktree) { if (kui_tree_destroy(kui_ms->ktree) == -1) retval = -1; } if (kui_ms->maps) { if (std_list_destroy(kui_ms->maps) == -1) retval = -1; kui_ms->maps = NULL; } free(kui_ms); kui_ms = NULL; return retval; } static int kui_map_compare_callback(const void *a, const void *b) { struct kui_map *one = (struct kui_map *) a; struct kui_map *two = (struct kui_map *) b; return strcmp(one->original_key, two->original_key); } static int kui_map_compare_key_callback(const void *a, const void *b) { struct kui_map *one = (struct kui_map *) a; char *two = (char *) b; return strcmp(one->original_key, two); } int kui_ms_register_map(struct kui_map_set *kui_ms, const char *key_data, const char *value_data) { struct kui_map *map; if (!kui_ms) return -1; map = kui_map_create(key_data, value_data); if (!map) return -1; if (std_list_insert_sorted(kui_ms->maps, map, kui_map_compare_callback) == -1) return -1; if (kui_tree_insert(kui_ms->ktree, map->literal_key, map) == -1) return -1; return 0; } int kui_ms_deregister_map(struct kui_map_set *kui_ms, const char *key) { std_list_iterator iter; struct kui_map *map; void *data; if (!kui_ms) return -1; iter = std_list_find(kui_ms->maps, key, kui_map_compare_key_callback); if (!iter) return -1; if (std_list_get_data(iter, &data) == -1) return -1; /* If the mapping exists, remove it. */ if (data) { map = (struct kui_map *) data; /* Delete from the tree */ if (kui_tree_delete(kui_ms->ktree, map->literal_key) == -1) return -1; if (std_list_remove(kui_ms->maps, iter) == NULL) return -1; } return 0; } /* }}} */ /* struct kuictx {{{ */ /** * A Key User Interface context. */ struct kuictx { /** * The list of kui_map_set structures. */ std_list kui_map_set_list; /** * A list of characters, used as a buffer for stdin. */ std_list buffer; /** * A volitale buffer. This is reset upon every call to kui_getkey. */ std_list volatile_buffer; /** * The callback function used to get data read in. */ kui_getkey_callback callback; /** * Milliseconds to block on a read. */ int ms; /** * state data */ void *state_data; /** * The file descriptor to read from. */ int fd; }; static int kui_ms_destroy_int_callback(void *param) { int *i = (int *) param; if (!i) return -1; free(i); i = NULL; return 0; } struct kuictx *kui_create(int stdinfd, kui_getkey_callback callback, int ms, void *state_data) { struct kuictx *kctx; kctx = (struct kuictx *) malloc(sizeof (struct kuictx)); if (!kctx) return NULL; kctx->callback = callback; kctx->state_data = state_data; kctx->kui_map_set_list = std_list_create(NULL); kctx->ms = ms; if (!kctx->kui_map_set_list) { kui_destroy(kctx); return NULL; } kctx->fd = stdinfd; kctx->buffer = std_list_create(kui_ms_destroy_int_callback); if (!kctx->buffer) { kui_destroy(kctx); return NULL; } kctx->volatile_buffer = std_list_create(kui_ms_destroy_int_callback); if (!kctx->volatile_buffer) { kui_destroy(kctx); return NULL; } return kctx; } int kui_destroy(struct kuictx *kctx) { int ret = 0; if (!kctx) return -1; if (kctx->kui_map_set_list) { if (std_list_destroy(kctx->kui_map_set_list) == -1) ret = -1; kctx->kui_map_set_list = NULL; } if (kctx->buffer) { if (std_list_destroy(kctx->buffer) == -1) ret = -1; kctx->buffer = NULL; } if (kctx->volatile_buffer) { if (std_list_destroy(kctx->volatile_buffer) == -1) ret = -1; kctx->volatile_buffer = NULL; } free(kctx); kctx = NULL; return ret; } std_list kui_get_map_sets(struct kuictx * kctx) { if (!kctx) return NULL; return kctx->kui_map_set_list; } int kui_clear_map_sets(struct kuictx *kctx) { if (!kctx) return -1; return std_list_remove_all(kctx->kui_map_set_list); } int kui_add_map_set(struct kuictx *kctx, struct kui_map_set *kui_ms) { if (!kctx) return -1; if (!kui_ms) return -1; if (std_list_append(kctx->kui_map_set_list, kui_ms) == -1) return -1; return 0; } /** * This basically get's a char from the internal buffer within the kui context * or it get's a charachter from the standard input file descriptor. * * It only blocks for a limited amount of time, waiting for user input. * * \param kctx * The kui context to operate on. * * \param key * The key that was read * * @return * 1 on success, * 0 if no more input, * or -1 on error. */ static int kui_findchar(struct kuictx *kctx, int *key) { int length; void *data; std_list_iterator iter; if (!key) return -1; /* Use the buffer first. */ length = std_list_length(kctx->buffer); if (length == -1) return -1; if (length > 0) { /* Take the first char in the list */ iter = std_list_begin(kctx->buffer); if (!iter) return -1; if (std_list_get_data(iter, &data) == -1) return -1; /* Get the char */ *key = *(int *) data; /* Delete the item */ if (std_list_remove(kctx->buffer, iter) == NULL) return -1; } else { /* Otherwise, look to read in a char, * This function called returns the same conditions as this function*/ return kctx->callback(kctx->fd, kctx->ms, kctx->state_data, key); } return 1; } /** * Updates the state data for each map set in the kui * * \param data * The kui context to operate on. * * \param user_data * Not used * * @return * 1 on success, 0 to stop, -1 on error */ static int kui_reset_state_data(void *data, void *user_data) { struct kui_map_set *map_set = (struct kui_map_set *) data; if (kui_tree_reset_state(map_set->ktree) == -1) return -1; return 1; } /** * Updates each list in the kui context. * * \param data * The kui context to operate on. * * \param user_data * The key received. * * @return * 1 on success, 0 to stop, -1 on error */ static int kui_update_each_list(struct kuictx *kctx, int key, int *map_found) { std_list_iterator iter; struct kui_map_set *map_set; void *data; if (!kctx) return -1; *map_found = 0; /* Continue if at least 1 of the lists still says * KUI_MAP_STILL_LOOKING. If none of the lists is at this state, then * there is no need to keep looking */ for (iter = std_list_begin(kctx->kui_map_set_list); iter != std_list_end(kctx->kui_map_set_list); iter = std_list_next(iter)) { if (std_list_get_data(iter, &data) == -1) return -1; map_set = (struct kui_map_set *) data; if (kui_tree_push_key(map_set->ktree, key, map_found) == -1) return -1; if (*map_found) { /* If a map was found, reset the extra char's read */ if (std_list_remove_all(kctx->volatile_buffer) == -1) return -1; } } return 0; } /** * Checks to see if any of the map set's are matching a map. * If they are, then the kui context should keep trying to match. Otherwise * it should stop trying to match. * * \param kctx * The kui context to operate on. * * \param should_continue * outbound as 1 if the kui context should keep looking, otherwise 0. * * @return * 0 on success, or -1 on error. */ static int kui_should_continue_looking(struct kuictx *kctx, int *should_continue) { std_list_iterator iter; struct kui_map_set *map_set; void *data; enum kui_tree_state map_state; if (!kctx) return -1; if (!should_continue) return -1; *should_continue = 0; /* Continue if at least 1 of the lists still says * KUI_MAP_STILL_LOOKING. If none of the lists is at this state, then * there is no need to keep looking */ for (iter = std_list_begin(kctx->kui_map_set_list); iter != std_list_end(kctx->kui_map_set_list); iter = std_list_next(iter)) { if (std_list_get_data(iter, &data) == -1) return -1; map_set = (struct kui_map_set *) data; if (kui_tree_get_state(map_set->ktree, &map_state) == -1) return -1; if (map_state == KUI_TREE_MATCHING) *should_continue = 1; } return 0; } /** * Update each map list's state. * * \param data * The kui context to operate on. * * \param user_data * Unused * * @return * 1 on success, 0 to stop, -1 on error */ static int kui_finalize_state(void *data, void *user_data) { struct kui_map_set *map_set = (struct kui_map_set *) data; if (kui_tree_finalize_state(map_set->ktree) == -1) return -1; return 1; } /** * Checks to see if a kui map has been found. * * \param kctx * The kui context to operate on. * * \param was_map_found * outbound as 1 if a map was found , otherwise 0. * * \param the_map_found * If was_map_found returns as 1, then this is the map that was found. * * @return * 0 on success, or -1 on error. */ static int kui_was_map_found(struct kuictx *kctx, int *was_map_found, struct kui_map **the_map_found) { std_list_iterator iter; struct kui_map_set *map_set; void *data; enum kui_tree_state map_state; if (!was_map_found) return -1; if (!the_map_found) return -1; *was_map_found = 0; /* At this point, the loop exited for one of several reasons. * * Each list has a correct state value. If one of the lists has the value * KUI_MAP_FOUND, then a map was found. This should be the value used. * * If none of the lists has the value kui_map_found, then no map was found. * What a shame. Why did I write all of this code ?!? */ for (iter = std_list_begin(kctx->kui_map_set_list); iter != std_list_end(kctx->kui_map_set_list); iter = std_list_next(iter)) { if (std_list_get_data(iter, &data) == -1) return -1; map_set = (struct kui_map_set *) data; if (kui_tree_get_state(map_set->ktree, &map_state) == -1) return -1; if (map_state == KUI_TREE_FOUND) { void *data; if (kui_tree_get_data(map_set->ktree, &data) == -1) return -1; *was_map_found = 1; *the_map_found = (struct kui_map *) data; } } return 0; } static int intlen(const int *val) { int length = 0; while (val[length] != 0) ++length; return length; } /** * Updates the kui context buffer. * * \param kctx * The kui context to operate on. * * \param the_map_found * The map that was found, valid if map_was_found is 1 * * \param map_was_found * 1 if a map was found, otherwise 0 * * \param key * The key the user typed this time around. * * @return * 0 on success, or -1 on error. * * Here is a simple example to help illustrate this algorithm. * * map ab xyz * map abcdf do_not_reach * * the buffer contained, abcdefgh * * abcde is read in coming into this function. * * so, ab matches a map, cde is read in to continue matching * but never does. that means fgh is left in the buffer. * * ab changes to xyz. * cde needs to be put back. * * so you end up with * xyzcdefgh * * which means that you put back the extra char's first. * Then you put back the map. * * The only 2 things to know are, what are the extra chars * and what is the value of the map. */ static int kui_update_buffer(struct kuictx *kctx, struct kui_map *the_map_found, int map_was_found, int *key) { int i; std_list_iterator iter; if (!map_was_found) { void *data; iter = std_list_end(kctx->volatile_buffer); iter = std_list_previous(iter); if (!iter || iter == std_list_end(kctx->volatile_buffer)) return -1; if (std_list_get_data(iter, &data) == -1) return -1; *key = *(int *) data; if (std_list_remove(kctx->volatile_buffer, iter) == NULL) return -1; } /* Add the extra char's read */ for (iter = std_list_begin(kctx->volatile_buffer); iter != std_list_end(kctx->volatile_buffer); iter = std_list_next(iter)) { int *val = malloc(sizeof (int)); void *data; if (!val) return -1; if (std_list_get_data(iter, &data) == -1) return -1; *val = *(int *) data; if (std_list_prepend(kctx->buffer, val) == -1) return -1; } /* Add the map value */ if (map_was_found) { int length; /* Add the value onto the buffer */ length = intlen(the_map_found->literal_value); for (i = length - 1; i >= 0; --i) { int *val = malloc(sizeof (int)); if (!val) return -1; *val = the_map_found->literal_value[i]; if (std_list_prepend(kctx->buffer, val) == -1) return -1; } } return 0; } /** * Get's the next char. * * \param map_found * returns as 0 if no map was found. In this case, the return value is valid. * returns as 1 if a mapping was found. In this case the return value is not * valid. * * @return * -1 on error * The key on success ( valid if map_found == 0 ) */ static int kui_findkey(struct kuictx *kctx, int *was_map_found) { int key, retval; int should_continue; struct kui_map *the_map_found = NULL; int *val; int map_found; /* Validate parameters */ if (!kctx) return -1; if (!was_map_found) return -1; if (!kctx->kui_map_set_list) return -1; /* Initialize variables on stack */ key = -1; *was_map_found = 0; should_continue = 0; if (std_list_remove_all(kctx->volatile_buffer) == -1) return -1; /* Reset the state data for all of the lists */ if (std_list_foreach(kctx->kui_map_set_list, kui_reset_state_data, NULL) == -1) return -1; /* Start the main loop */ while (1) { retval = kui_findchar(kctx, &key); if (retval == -1) return -1; /* If there is no more data ready, stop. */ if (retval == 0) break; /* Append to the list */ val = malloc(sizeof (int)); if (!val) return -1; *val = key; if (std_list_prepend(kctx->volatile_buffer, val) == -1) return -1; /* Update each list, with the character read, and the position. */ if (kui_update_each_list(kctx, key, &map_found) == -1) return -1; /* Check to see if at least a single map is being matched */ if (kui_should_continue_looking(kctx, &should_continue) == -1) return -1; if (!should_continue) break; } key = 0; /* This should no longer be used. Enforcing that. */ /* All done looking for chars, let lists that matched a mapping * be known. ex KUI_MAP_STILL_LOOKING => KUI_MAP_FOUND. This * happens when * map abc xyz * map abcde xyz * * If the user types abcd, the list will still be looking, * even though it already found a mapping. */ if (std_list_foreach(kctx->kui_map_set_list, kui_finalize_state, NULL) == -1) return -1; /* Check to see if a map was found. * If it was, get the map also. */ if (kui_was_map_found(kctx, was_map_found, &the_map_found) == -1) return -1; /* Update the buffer and get the final char. */ if (kui_update_buffer(kctx, the_map_found, *was_map_found, &key) == -1) return -1; return key; } int kui_getkey(struct kuictx *kctx) { int map_found; int key; /* If a map was found, restart the algorithm. */ do { key = kui_findkey(kctx, &map_found); if (key == -1) return -1; } while (map_found == 1); return key; } int kui_cangetkey(struct kuictx *kctx) { int length; /* Use the buffer first. */ length = std_list_length(kctx->buffer); if (length == -1) return -1; if (length > 0) return 1; return 0; } int kui_set_blocking_ms(struct kuictx *kctx, unsigned long msec) { if (!kctx) return -1; kctx->ms = msec; return 0; } int kui_get_blocking_ms(struct kuictx *kctx, unsigned long *msec) { if (!kctx || !msec) return -1; *msec = kctx->ms; return 0; } /* }}} */ /* struct kui_manager {{{ */ /** * The main kui context. * This context is capable of doing all the work associated with the KUI. */ struct kui_manager { /* The terminal escape sequence mappings */ struct kuictx *terminal_keys; /* The user defined mappings */ struct kuictx *normal_keys; /* Need a reference to the terminal escape sequence mappings when destroying * this context. (a list is populated in the create function) */ struct kui_map_set *terminal_key_set; }; static int create_terminal_mappings(struct kui_manager *kuim, struct kuictx *i) { struct kui_map_set *terminal_map; /* Create the terminal kui map */ terminal_map = kui_term_get_terminal_mappings(); if (!terminal_map) return -1; kuim->terminal_key_set = terminal_map; if (kui_add_map_set(i, terminal_map) == -1) return -1; return 0; } int char_callback(const int fd, const unsigned int ms, const void *obj, int *key) { return io_getchar(fd, ms, key); } int kui_callback(const int fd, const unsigned int ms, const void *obj, int *key) { struct kuictx *kctx = (struct kuictx *) obj; int result; if (!key) return -1; result = kui_cangetkey(kctx); if (result == -1) return -1; if (result == 1) { *key = kui_getkey(kctx); if (*key == -1) return -1; } /* If there is no data ready, check the I/O */ if (result == 0) { result = io_data_ready(kctx->fd, ms); if (result == -1) return -1; if (result == 1) { *key = kui_getkey(kctx); if (*key == -1) return -1; } if (result == 0) return 0; } return 1; } struct kui_manager *kui_manager_create(int stdinfd, unsigned int keycode_timeout, unsigned int mapping_timeout) { struct kui_manager *man; man = (struct kui_manager *) malloc(sizeof (struct kui_manager)); if (!man) return NULL; man->normal_keys = NULL; man->terminal_keys = kui_create(stdinfd, char_callback, keycode_timeout, NULL); if (!man->terminal_keys) { kui_manager_destroy(man); return NULL; } if (create_terminal_mappings(man, man->terminal_keys) == -1) { kui_manager_destroy(man); return NULL; } man->normal_keys = kui_create(-1, kui_callback, mapping_timeout, man->terminal_keys); if (!man->normal_keys) { kui_manager_destroy(man); return NULL; } return man; } int kui_manager_destroy(struct kui_manager *kuim) { int ret = 0; if (!kuim) return 0; if (kui_ms_destroy(kuim->terminal_key_set) == -1) ret = -1; if (kui_destroy(kuim->terminal_keys) == -1) ret = -1; if (kui_destroy(kuim->normal_keys) == -1) ret = -1; free(kuim); kuim = NULL; return ret; } std_list kui_manager_get_map_sets(struct kui_manager * kuim) { if (!kuim) return NULL; return kui_get_map_sets(kuim->normal_keys); } int kui_manager_clear_map_sets(struct kui_manager *kuim) { if (!kuim) return -1; return kui_clear_map_sets(kuim->normal_keys); } int kui_manager_add_map_set(struct kui_manager *kuim, struct kui_map_set *kui_ms) { if (!kuim) return -1; return kui_add_map_set(kuim->normal_keys, kui_ms); } int kui_manager_cangetkey(struct kui_manager *kuim) { if (!kuim) return -1; /* I'm not sure if checking the terminal keys here is the best solution. * * It might make more sense to flow the extra characters read from during * the terminal keys processing up to the normal keys buffer after a * mapping is found. * * For now this seems to work. Essentially, the next read get's the buffered * terminal keys first which is what should happen anyways. */ return kui_cangetkey(kuim->terminal_keys) || kui_cangetkey(kuim->normal_keys); } int kui_manager_getkey(struct kui_manager *kuim) { if (!kuim) return -1; return kui_getkey(kuim->normal_keys); } int kui_manager_getkey_blocking(struct kui_manager *kuim) { if (!kuim) return -1; unsigned long terminal_keys_msec, normal_keys_msec, val; /* Get the original values */ kui_get_blocking_ms(kuim->terminal_keys, &terminal_keys_msec); kui_get_blocking_ms(kuim->normal_keys, &normal_keys_msec); /* Set the values to be blocking */ kui_set_blocking_ms(kuim->terminal_keys, -1); kui_set_blocking_ms(kuim->normal_keys, -1); /* Get the key */ val = kui_getkey(kuim->normal_keys); /* Restore the values */ kui_set_blocking_ms(kuim->terminal_keys, terminal_keys_msec); kui_set_blocking_ms(kuim->normal_keys, normal_keys_msec); return val; } int kui_manager_set_terminal_escape_sequence_timeout(struct kui_manager *kuim, unsigned int msec) { if (!kuim) return -1; return kui_set_blocking_ms(kuim->terminal_keys, msec); } int kui_manager_set_key_mapping_timeout(struct kui_manager *kuim, unsigned int msec) { if (!kuim) return -1; return kui_set_blocking_ms(kuim->normal_keys, msec); } int kui_manager_get_terminal_keys_kui_map(struct kui_manager *kuim, enum cgdb_key key, std_list kui_map_set) { struct kui_map_set *map_set; struct kuictx *terminalkeys; std_list map_sets; std_list_iterator iter, kui_map_set_iter; void *data; const char *keycode_str; if (!kuim) return -1; keycode_str = kui_term_get_keycode_from_cgdb_key(key); if (keycode_str == NULL) return -1; /* The first map set in the terminal_keys */ terminalkeys = kuim->terminal_keys; map_sets = kui_get_map_sets(terminalkeys); if (std_list_length(map_sets) > 0) { iter = std_list_begin(map_sets); if (std_list_get_data(iter, &data) == -1) { return -1; } map_set = (struct kui_map_set *) data; } /* At this point, the kui_map_set is available * Add each kui_map_set into it. */ for (kui_map_set_iter = std_list_begin(kui_map_set); kui_map_set_iter != std_list_end(kui_map_set); kui_map_set_iter = std_list_next(kui_map_set_iter)) { if (std_list_get_data(kui_map_set_iter, &data) == -1) return -1; kui_ms_register_map(map_set, data, keycode_str); } return 0; } /* }}} */ cgdb-0.6.7/lib/kui/kui.h000644 000765 000024 00000035722 12074441140 015715 0ustar00mmuellerstaff000000 000000 #ifndef __KUI_H__ #define __KUI_H__ /* includes {{{ */ #include "std_list.h" #include "kui_cgdb_key.h" /* }}} */ /* Doxygen headers {{{ */ /*! * \file * kui.h * * \brief * This interface is intended to be the abstraction layer between an * application wanting key input from a user and the user themselves. */ /* }}} */ /* struct kui_map {{{ */ /******************************************************************************/ /** * @name Creating and Destroying a kui_map. * These functions are for createing and destroying a kui map. * * A kui map is basically a key value pair. As far as the map is concerned both * the key and the value are of type 'char*'. This is because, the user needs to * type the map in at the keyboard. This may seem obvious at first, but things * like ESCAPE and HOME have to be typed in also. */ /******************************************************************************/ /*@{*/ struct kui_map; /** * Create a kui map. * * \param key_data * The map's key data * * \param value_data * The map's value data * * @return * A new instance on success, or NULL on error. */ struct kui_map *kui_map_create(const char *key_data, const char *value_data); /** * Destroy a kui map. * * \param map * The map to destroy. * * @return * 0 on success, -1 on error */ int kui_map_destroy(struct kui_map *map); /*@}*/ /******************************************************************************/ /** * @name General operations on a kui map. * These function's are the basic functions used to operate on a kui map context */ /******************************************************************************/ /*@{*/ /** * Get's the maps key. * * \param map * A map * * \param key * Get's the key as a null terminated string. * The key should not be modified upon return. Also, it is invalid if the map * is destroyed. * * @return * 0 on success, -1 on error */ int kui_map_get_key(struct kui_map *map, char **key); /** * Get's the maps value. * * \param map * A map * * \param value * Get's the value as a null terminated string. * The value should not be modified upon return. Also, it is invalid if the map * is destroyed. * * @return * 0 on success, -1 on error */ int kui_map_get_value(struct kui_map *map, char **value); /** * Used for debugging. * Print's the translated value. * * \param map * The map context * * @return * 0 on success, -1 on error */ int kui_map_print_cgdb_key_array(struct kui_map *map); /*@}*/ /* }}} */ /* struct kui_map_set {{{ */ /******************************************************************************/ /** * @name Creating and Destroying a kui_map_set. * These functions are for createing and destroying a kui map set. * * A kui map set is simply a grouping of maps that the client associated * together. At this level, a map is defined as a key/value pair. The key and * the value are simply character arrays. * * A Kui map set is an easy way to swap out what the application wishes * to have libkui look for when the user is typing input. For instance, * if the application wants libkui to look for certain sequences when the * user is doing task A, and look for other sequences the user is doing task * B, the application coud simply create 2 kui map sets and swap them * out using TODO. */ /******************************************************************************/ /*@{*/ struct kui_map_set; /** * Create a kui map set. * * @return * A new instance on success, or NULL on error. */ struct kui_map_set *kui_ms_create(void); /** * Destroys a kui map set. * * \param kui_ms * The kui map set to destroy. * * @return * 0 on success or -1 on error */ int kui_ms_destroy(struct kui_map_set *kui_ms); /*@}*/ /******************************************************************************/ /** * @name General operations on a kui map set context. * These function's are the basic functions used to operate on a kui map * set context */ /******************************************************************************/ /*@{*/ /** * Add a map to the map set. * * \param kui_ms * The kui map set to add to. * * \param key * A key. Should be null terminated. * * \param value * A value. Should be null terminated. * * @return * 0 on success, or -1 on error */ int kui_ms_register_map(struct kui_map_set *kui_ms, const char *key, const char *value); /** * Remove a map from the map set. * * \param kui_ms * The kui map set to add to. * * \param key * A key. Should be null terminated. * * @return * 0 on success, * or -1 on error * or -2 if map did not exist. */ int kui_ms_deregister_map(struct kui_map_set *kui_ms, const char *key); /** * Get's a list of kui_map's. This way, someone can iterate through * the list. * * \param kui_ms * A kui map set. * * @return * The list of maps, or NULL on error. * If there are no maps, of course the empty list will be returned. */ std_list kui_ms_get_maps(struct kui_map_set *kui_ms); /*@}*/ /* }}} */ /* struct kuictx {{{ */ /******************************************************************************/ /** * @name Creating and Destroying a kui context. * These functions are for createing and destroying a * "Key User Interface" Context * * This is capable of reading in any type of single/multibyte sequence and * abstracting the details from any higher level. */ /******************************************************************************/ /*@{*/ struct kuictx; /** * The callback function that libkui will call when it needs a character * to be read. * * \param fd * The descriptor to read in from. ( if needed ) * * \param ms * The The amount of time in milliseconds to wait for input. * Pass 0, if you do not want to wait. * * \param obj * A piece of state data to pass along * * \param key * The key read * * Must return * 1 on success, * 0 if no more input, * or -1 on error. */ typedef int (*kui_getkey_callback) (const int fd, const unsigned int ms, const void *obj, int *key); /** * Initializes the Key User Interface unit * * \param stdinfd * The descriptor to read from when looking for the next char * * \param callback * The function that libkui calls to have 1 char read. * * \param ms * The number of milliseconds that this context should block while * attempting to match a mapping by waiting for the user to type * the next key. * * \param state_data * This is a piece of data that is not looked at by this context. It * is passed to the callback. * * @return * A new instance on success, or NULL on error. */ struct kuictx *kui_create(int stdinfd, kui_getkey_callback callback, int ms, void *state_data); /** * Destroys a kui context * * \param kctx * The kui context * * @return * 0 on success, -1 on error */ int kui_destroy(struct kuictx *kctx); /*@}*/ /******************************************************************************/ /** * @name General operations on a kui context. * These function's are the basic functions used to operate on a kui context */ /******************************************************************************/ /*@{*/ /** * Get's the current map set for the kui context. * * \param kctx * The kui context to get the sequence set of * * @return * The list of map sets, or NULL on error. * If there are no map sets, of course the empty list will be returned. */ std_list kui_get_map_sets(struct kuictx *kctx); /** * This will clear all of the map sets from the KUI. * It will not release the memory associated with these sets. * * \param kctx * The KUI context to clear the sets from * * \return * 0 on success or -1 on error. */ int kui_clear_map_sets(struct kuictx *kctx); /** * Add's a kui map set to the kui context. * * \param kctx * The kui context to add the map set of * * \param kui_ms * The new kui map set to use. * * @return * 0 on success, or -1 on error. */ int kui_add_map_set(struct kuictx *kctx, struct kui_map_set *kui_ms); /** * Determine's if libkui has data ready to read. It has already been * read by the file descriptor, or it was buffered through some other * means. * * \param kctx * The kui context. * * @return * -1 on error, otherwise 1 if can get a key, or 0 if nothing available. */ int kui_cangetkey(struct kuictx *kctx); /** * Get's the next key for the application to process. * * \param kctx * The kui context. * * @return * -1 on error, otherwise, a valid key. * A key can either be a normal ascii key, or a CGDB_KEY_* value. */ int kui_getkey(struct kuictx *kctx); /** * Tell's the kui context the maximum number of milliseconds that it is allowed * to block while waiting to complete a mapping. * * \param kctx * The kui context. * * \param msec * The maximum number of milliseconds to block while waiting to complete a map * The value 0 causes no waiting. * The value -1 causes an indefinate amount of blocking. * * \return * 0 on success, or -1 on error. */ int kui_set_blocking_ms(struct kuictx *kctx, unsigned long msec); /** * Get the number of milliseconds that the kui should block while waiting to * complete a mapping. This value is set with kui_set_blocking_ms. * * \param kctx * The kui context. * * \param msec * The number of milliseconds. * * \return * 0 on success, or -1 on error. */ int kui_get_blocking_ms(struct kuictx *kctx, unsigned long *msec); /*@}*/ /* }}} */ /* struct kui_managaer {{{ */ /******************************************************************************/ /** * @name Creating and Destroying a kui manager. * These functions are for createing and destroying a * "Key User Interface" manager * * This is capable of reading in any type of single/multibyte sequence and * abstracting the details from any higher level. */ /******************************************************************************/ /*@{*/ struct kui_manager; /** * Initializes the Key User Interface manager * * \param stdinfd * The descriptor to read from when looking for the next char * * \param keycode_timeout * The timeout to use while waiting to match a keyboard code. * * \param mapping_timeout * The timeout to use while waiting to match a mapping sequence. * * @return * A new instance on success, or NULL on error. */ struct kui_manager *kui_manager_create(int stdinfd, unsigned int keycode_timeout, unsigned int mapping_timeout); /** * Destroys a kui context * * \param kuim * The kui manager * * @return * 0 on success, -1 on error */ int kui_manager_destroy(struct kui_manager *kuim); /*@}*/ /******************************************************************************/ /** * @name General operations on a kui manager context. * These function's are the basic functions used to operate on a kui context */ /******************************************************************************/ /*@{*/ /** * Get's the current map set for the kui context. * * \param kuim * The kui manager context to get the sequence set of * * @return * The list of map sets, or NULL on error. * If there are no map sets, of course the empty list will be returned. */ std_list kui_manager_get_map_sets(struct kui_manager *kuim); /** * This will clear all of the map sets from the KUI manager. * It will not release the memory associated with these sets. * * \param kuim * The KUI context to clear the sets from * * \return * 0 on success or -1 on error. */ int kui_manager_clear_map_sets(struct kui_manager *kuim); /** * Add's a kui map set to the kui context. * * \param kuim * The kui context to add the map set of * * \param kui_ms * The new kui map set to use. * * @return * 0 on success, or -1 on error. */ int kui_manager_add_map_set(struct kui_manager *kuim, struct kui_map_set *kui_ms); /** * Determine's if libkui has data ready to read. It has already been * read by the file descriptor, or it was buffered through some other * means. * * \param kuim * The kui context. * * @return * -1 on error, otherwise 1 if can get a key, or 0 if nothing available. */ int kui_manager_cangetkey(struct kui_manager *kuim); /** * Get's the next key for the application to process. * * In the event that this is called when kui_manager_cangetkey returns 0, * and the caller didn't check the input file handle to determine if there * was input, this is a non-blocking call. Use kui_manager_getkey_blocking * if you want the semantics to be a blocking call. * * \param kuim * The kui context. * * @return * -1 on error, otherwise, a valid key. * A key can either be a normal ascii key, or a CGDB_KEY_* value. */ int kui_manager_getkey(struct kui_manager *kuim); /** * This is the same as kui_manager_getkey excpet that if no data is ready * to be read, this call will block until data is ready. * * \param kuim * The kui context. * * \return * -1 on error, otherwise, a valid key. * A key can either be a normal ascii key, or a CGDB_KEY_* value. */ int kui_manager_getkey_blocking(struct kui_manager *kuim); /** * Set's the terminal escape sequence time out value. * This is used to tell CGDB how long to block when looking to match terminal * escape sequences. For instance, in order to get F11, Maybe it's necessary * for the charachters 27(ESC) 80(P) 81(Q) to get sent. So, if the user types * these within msec each, then CGDB_KEY_F11 get's returned, otherwise the * key's are returned as typed. * * \param kuim * The kui context * * \param msec * The maximum number of milliseconds to block while waiting to complete a * terminal escape sequence. * * \return * 0 on success, or -1 on error. */ int kui_manager_set_terminal_escape_sequence_timeout(struct kui_manager *kuim, unsigned int msec); /** * Set's the timeout that will be used when matching a mapping. * * \param kuim * The kui context * * \param msec * The maximum number of milliseconds to block while waiting to complete a * mapping sequence. * * \return * 0 on success, or -1 on error. */ int kui_manager_set_key_mapping_timeout(struct kui_manager *kuim, unsigned int msec); /** * Allow the user to make terminal key bindings. * * This API doesn't really fit in. It's due to the fact that some * of the terminfo entries are incorrect on some machines but * readline knows the key sequences because the OS vendors decided * to hard code the terminal key sequences into the /etc/inputrc. * * Therefor, I'm creating an API that is specific to the task, * rather than a general API that allows the user to modify * the terminal key mappings. If this is needed in the future * it can be added. * * \param kuim * The kui context * * \param key * The key to bind the key sequences too. * * \param keyseq_list * The list of key sequences to bind to the key. Instead of just * making this a 'char*', it's a list, so that multiple sequences * can be bound in a single function call. * * \return * 0 on success or -1 on error */ int kui_manager_get_terminal_keys_kui_map(struct kui_manager *kuim, enum cgdb_key key, std_list kui_map_set); /*@}*/ /* }}} */ #endif /* __KUI_H__ */ cgdb-0.6.7/lib/kui/kui_cgdb_key.h000644 000765 000024 00000004161 12074441140 017535 0ustar00mmuellerstaff000000 000000 #ifndef __KUI_CGDB_KEY_H__ #define __KUI_CGDB_KEY_H__ /* enum cgdb_key {{{ */ /** * The high level keys. * * This represents key's that can not be represented in 1 ascii key. */ /** * notation meaning * -------- ------- * * zero * backspace * tab * linefeed * formfeed * carriage return * same as * same as * escape * space * less-than * backslash * vertical bar * delete * cursor-up * cursor-down * cursor-left * cursor-right * shift-cursor-up * shift-cursor-down * shift-cursor-left * shift-cursor-right * control-cursor-left * control-cursor-right * - function keys 1 to 12 * help key * undo key * insert key * home * end * page-up * page-down * shift-key * control-key * alt-key */ enum cgdb_key { CGDB_KEY_ESC = 10000, CGDB_KEY_UP, CGDB_KEY_DOWN, CGDB_KEY_LEFT, CGDB_KEY_RIGHT, CGDB_KEY_HOME, CGDB_KEY_END, CGDB_KEY_PPAGE, CGDB_KEY_NPAGE, CGDB_KEY_DC, CGDB_KEY_IC, /* Function Keys */ CGDB_KEY_F1, CGDB_KEY_F2, CGDB_KEY_F3, CGDB_KEY_F4, CGDB_KEY_F5, CGDB_KEY_F6, CGDB_KEY_F7, CGDB_KEY_F8, CGDB_KEY_F9, CGDB_KEY_F10, CGDB_KEY_F11, CGDB_KEY_F12, /* Ctrl Keys */ CGDB_KEY_CTRL_A, CGDB_KEY_CTRL_B, CGDB_KEY_CTRL_C, CGDB_KEY_CTRL_D, CGDB_KEY_CTRL_E, CGDB_KEY_CTRL_F, CGDB_KEY_CTRL_G, CGDB_KEY_CTRL_H, CGDB_KEY_CTRL_I, CGDB_KEY_CTRL_J, CGDB_KEY_CTRL_K, CGDB_KEY_CTRL_L, CGDB_KEY_CTRL_M, CGDB_KEY_CTRL_N, CGDB_KEY_CTRL_O, CGDB_KEY_CTRL_P, CGDB_KEY_CTRL_Q, CGDB_KEY_CTRL_R, CGDB_KEY_CTRL_S, CGDB_KEY_CTRL_T, CGDB_KEY_CTRL_U, CGDB_KEY_CTRL_V, CGDB_KEY_CTRL_W, CGDB_KEY_CTRL_X, CGDB_KEY_CTRL_Y, CGDB_KEY_CTRL_Z, CGDB_KEY_ERROR }; /* }}} */ #endif cgdb-0.6.7/lib/kui/kui_driver.c000644 000765 000024 00000022162 12074441140 017255 0ustar00mmuellerstaff000000 000000 #if HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #if HAVE_CURSES_H #include #elif HAVE_NCURSES_CURSES_H #include #endif #if HAVE_STDIO_H #include #endif /* HAVE_STDIO_H */ #ifdef HAVE_SYS_TIME_H #include #endif /* Library includes */ #ifdef HAVE_SYS_SELECT_H #include #endif #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_REGEX_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #if HAVE_ERRNO_H #include #endif /* HAVE_ERRNO_H */ #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #ifdef HAVE_GETOPT_H #include #endif #include #include "kui.h" #include "kui_term.h" struct kui_map_set *map; struct kui_manager *manager; static void kui_shutdown(int use_endwin) { kui_manager_destroy(manager); kui_ms_destroy(map); /* Shutdown curses */ echo(); if (use_endwin) endwin(); exit(0); } static void usage(void) { printf("KUI Usage:\r\n" " kui_driver [kui options]\r\n" "\r\n" "KUI Options:\r\n" #ifdef HAVE_GETOPT_H " --file Load an rc file consisting of map and unmap commands.\r\n" #else " -f Load an rc file consisting of map and unmap commands.\r\n" #endif #ifdef HAVE_GETOPT_H " --help Print help (this message) and then exit.\r\n" #else " -h Print help (this message) and then exit.\r\n" #endif "\r\nType 'q' to quit and Ctrl-z to send map or unmap command.\r\n"); fflush(stdout); } static int load_map(const char *line) { /* Read a complete line, and check to see if it's a * map or umap command. */ regex_t regex_map_t, regex_unmap_t; const char *regex_map = "map +([^ ]+) +([^ ]+)"; const char *regex_unmap = "unmap +([^ ]+)"; size_t nmatch = 3; regmatch_t pmatch[3]; regcomp(®ex_map_t, regex_map, REG_EXTENDED); regcomp(®ex_unmap_t, regex_unmap, REG_EXTENDED); if (regexec(®ex_map_t, line, nmatch, pmatch, 0) == 0) { if (pmatch[0].rm_so != -1 && pmatch[1].rm_so != -1 && pmatch[2].rm_so != -1) { int size; char *key, *value; size = pmatch[1].rm_eo - pmatch[1].rm_so; key = (char *) cgdb_malloc(sizeof (char) * (size) + 1); strncpy(key, &line[pmatch[1].rm_so], size); key[size] = 0; size = pmatch[2].rm_eo - pmatch[2].rm_so; value = (char *) cgdb_malloc(sizeof (char) * (size) + 1); strncpy(value, &line[pmatch[2].rm_so], size); value[size] = 0; if (kui_ms_register_map(map, key, value) == 0) { fprintf(stderr, "\r\nregestered key=%s value=%s", key, value); return 1; } } } else if (regexec(®ex_unmap_t, line, nmatch, pmatch, 0) == 0) { if (pmatch[0].rm_so != -1 && pmatch[1].rm_so != -1) { int size; char *key; size = pmatch[1].rm_eo - pmatch[1].rm_so; key = (char *) cgdb_malloc(sizeof (char) * (size) + 1); strncpy(key, &line[pmatch[1].rm_so], size); key[size] = 0; if (kui_ms_deregister_map(map, key) == 0) { fprintf(stderr, "\r\nderegister key=%s", key); return 1; } } } regfree(®ex_map_t); regfree(®ex_unmap_t); return 0; } static int read_mappings(const char *file) { FILE *fd = fopen(file, "r"); if (!fd) { fprintf(stderr, "%s:%d fopen failed\n", __FILE__, __LINE__); return 0; } while (!feof(fd)) { char line[4096]; if (fgets(line, 4096, fd) == NULL) break; line[strlen(line) - 1] = '\0'; load_map(line); } fclose(fd); return 0; } static void parse_long_options(int argc, char **argv) { int opt, option_index = 0; const char *args = "hf:"; #ifdef HAVE_GETOPT_H static struct option long_options[] = { {"file", 1, 0, 'f'}, {"help", 0, 0, 'h'}, {0, 0, 0, 0} }; #endif while (1) { #ifdef HAVE_GETOPT_H opt = getopt_long(argc, argv, args, long_options, &option_index); #else opt = getopt(argc, argv, args); #endif if (opt == -1) break; switch (opt) { case 'f': /* Load a file */ read_mappings(optarg); break; case '?': case 'h': endwin(); usage(); kui_shutdown(0); default: break; } } } void main_loop(struct kui_manager *i) { int max; fd_set rfds; int result; max = STDIN_FILENO; while (1) { FD_ZERO(&rfds); FD_SET(STDIN_FILENO, &rfds); fprintf(stderr, "\r\n(kui) "); result = select(max + 1, &rfds, NULL, NULL, NULL); /* if the signal interuppted system call keep going */ if (result == -1 && errno == EINTR) continue; else if (result == -1) /* on error ... must die -> stupid OS */ fprintf(stderr, "%s:%d select failed\n", __FILE__, __LINE__); if (FD_ISSET(STDIN_FILENO, &rfds)) { while (1) { int c = kui_manager_getkey(i); if (c == -1) { fprintf(stderr, "kui_manager_getkey failed\n"); return; } if (c == 'q') { fprintf(stderr, "User aborted\r\n"); return; } else if (kui_term_is_cgdb_key(c) && c == CGDB_KEY_CTRL_Z) { /* Read a complete line, and check to see if it's a * map or umap command. */ char c; char line[4096]; int pos = 0; fprintf(stderr, "\r\n(kui_map)"); do { c = fgetc(stdin); line[pos++] = c; fprintf(stderr, "%c", c); } while (c != '\r' && c != '\n' && pos < 4095); line[pos++] = 0; load_map(line); } else { if (kui_term_is_cgdb_key(c)) { char *val; char *sequence; val = (char *) kui_term_get_string_from_key(c); fprintf(stderr, "%s", val); /* Print out the sequence recieved */ sequence = (char *) kui_term_get_ascii_char_sequence_from_key(c); while (sequence && sequence[0]) { fprintf(stderr, "[%d]", sequence[0]); sequence = sequence + 1; } } else fprintf(stderr, "%c", c); } if (kui_manager_cangetkey(i) == 1) continue; else break; } } } } static int create_mappings(struct kui_manager *kuim) { map = kui_ms_create(); if (!map) return -1; #if 0 #if 1 if (kui_ms_register_map(map, "abc", "xyz") == -1) { /* TODO: Free map and return */ return -1; } if (kui_ms_deregister_map(map, "abc") == -1) { /* TODO: Free map and return */ return -1; } #endif if (kui_ms_register_map(map, "abc", "xyz") == -1) { /* TODO: Free map and return */ return -1; } if (kui_ms_register_map(map, "abc", "xyp") == -1) { /* TODO: Free map and return */ return -1; } #if 0 if (kui_ms_register_map(map, "xyzd", "") == -1) { /* TODO: Free map and return */ return -1; } if (kui_ms_register_map(map, "xyzd", "") == -1) { /* TODO: Free map and return */ return -1; } if (kui_ms_register_map(map, "a", "xyz") == -1) { /* TODO: Free map and return */ return -1; } if (kui_ms_register_map(map, "a", "xxx") == -1) { /* TODO: Free map and return */ return -1; } if (kui_ms_register_map(map, "a", "xxx") == -1) { /* TODO: Free map and return */ return -1; } if (kui_ms_register_map(map, "", "") == -1) { /* TODO: Free map and return */ return -1; } if (kui_ms_register_map(map, "", "pargc") == -1) { /* TODO: Free map and return */ return -1; } #endif #endif if (kui_manager_add_map_set(kuim, map) == -1) return -1; return 0; } int main(int argc, char **argv) { /* Initalize curses */ initscr(); noecho(); raw(); refresh(); manager = kui_manager_create(STDIN_FILENO, 40, 1000); create_mappings(manager); parse_long_options(argc, argv); main_loop(manager); kui_shutdown(1); return 0; } cgdb-0.6.7/lib/kui/kui_term.c000644 000765 000024 00000043701 12074441140 016733 0ustar00mmuellerstaff000000 000000 #if HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #if HAVE_CURSES_H #include #elif HAVE_NCURSES_CURSES_H #include #endif /* HAVE_CURSES_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #if HAVE_STRINGS_H #include #endif /* HAVE_STRINGS_H */ #if HAVE_STDLIB_H #include /* for getenv */ #endif /* HAVE_STDLIB_H */ #if HAVE_STDIO_H #include /* for stderr */ #endif /* HAVE_STDIO_H */ /* term.h prototypes */ extern int tgetent(); extern int tgetflag(); extern int tgetnum(); extern char *tgetstr(); extern int tputs(); extern char *tgoto(); #include "kui_term.h" #define MAXLINE 4096 #define MAX_SEQ_LIST_SIZE 8 /** * This contains all of the ESC sequences this unit cares about. * It contains the correct information to get esc sequences out of both * termcap and terminfo. */ struct tlist { /* The key */ enum cgdb_key key; /* the termcap capability name */ char *tname; /* the termcap key sequence */ char *tname_seq; /* the terminfo capability name */ char *tiname; /* the terminfo key sequence */ char *tiname_seq; } seqlist[] = { { CGDB_KEY_END, "@7", NULL, "kend", NULL}, { CGDB_KEY_HOME, "kh", NULL, "khome", NULL}, { CGDB_KEY_HOME, "kH", NULL, "kll", NULL}, { CGDB_KEY_DC, "kD", NULL, "kdch1", NULL}, { CGDB_KEY_IC, "kI", NULL, "kich1", NULL}, { CGDB_KEY_NPAGE, "kN", NULL, "knp", NULL}, { CGDB_KEY_PPAGE, "kP", NULL, "kpp", NULL}, /* For arrow keys */ { CGDB_KEY_DOWN, "kd", NULL, "kcud1", NULL}, { CGDB_KEY_LEFT, "kl", NULL, "kcub1", NULL}, { CGDB_KEY_RIGHT, "kr", NULL, "kcuf1", NULL}, { CGDB_KEY_UP, "ku", NULL, "kcuu1", NULL}, { CGDB_KEY_LEFT, "le", NULL, "cub1", NULL}, { CGDB_KEY_RIGHT, "nd", NULL, "cuf1", NULL}, { CGDB_KEY_UP, "up", NULL, "cuu1", NULL}, /* Function keys */ { CGDB_KEY_F1, "k1", NULL, "kf1", NULL}, { CGDB_KEY_F2, "k2", NULL, "kf2", NULL}, { CGDB_KEY_F3, "k3", NULL, "kf3", NULL}, { CGDB_KEY_F4, "k4", NULL, "kf4", NULL}, { CGDB_KEY_F5, "k5", NULL, "kf5", NULL}, { CGDB_KEY_F6, "k6", NULL, "kf6", NULL}, { CGDB_KEY_F7, "k7", NULL, "kf7", NULL}, { CGDB_KEY_F8, "k8", NULL, "kf8", NULL}, { CGDB_KEY_F9, "k9", NULL, "kf9", NULL}, { CGDB_KEY_F10, "k;", NULL, "kf10", NULL}, { CGDB_KEY_F11, "F1", NULL, "kf11", NULL}, { CGDB_KEY_F12, "F2", NULL, "kf12", NULL}, { CGDB_KEY_ERROR, NULL, NULL, NULL, NULL} }; /* This represents all of the hard coded key data. */ struct keydata { enum cgdb_key key; char *key_seq; } hard_coded_bindings[] = { { CGDB_KEY_ESC, "\033"}, /* Arrow bindings */ /* These should be first, because readline hard codes them and when I * walk this list to get the key bindings, I want these for the arrows */ { CGDB_KEY_UP, "\033[A"}, { CGDB_KEY_DOWN, "\033[B"}, { CGDB_KEY_RIGHT, "\033[C"}, { CGDB_KEY_LEFT, "\033[D"}, { CGDB_KEY_HOME, "\033[H"}, { CGDB_KEY_END, "\033[F"}, /* Arrow bindings, MSDOS */ { CGDB_KEY_UP, "\033[0A"}, { CGDB_KEY_LEFT, "\033[0B"}, { CGDB_KEY_RIGHT, "\033[0C"}, { CGDB_KEY_DOWN, "\033[0D"}, { CGDB_KEY_UP, "\033OA"}, { CGDB_KEY_DOWN, "\033OB"}, { CGDB_KEY_RIGHT, "\033OC"}, { CGDB_KEY_LEFT, "\033OD"}, { CGDB_KEY_HOME, "\033OH"}, { CGDB_KEY_END, "\033OF"}, /* Ctrl bindings */ { CGDB_KEY_CTRL_A, "\001"}, { CGDB_KEY_CTRL_B, "\002"}, { CGDB_KEY_CTRL_C, "\003"}, { CGDB_KEY_CTRL_D, "\004"}, { CGDB_KEY_CTRL_E, "\005"}, { CGDB_KEY_CTRL_F, "\006"}, { CGDB_KEY_CTRL_G, "\007"}, { CGDB_KEY_CTRL_H, "\010"}, { CGDB_KEY_CTRL_I, "\011"}, { CGDB_KEY_CTRL_J, "\012"}, { CGDB_KEY_CTRL_K, "\013"}, { CGDB_KEY_CTRL_L, "\014"}, { CGDB_KEY_CTRL_M, "\015"}, { CGDB_KEY_CTRL_N, "\016"}, { CGDB_KEY_CTRL_O, "\017"}, { CGDB_KEY_CTRL_P, "\020"}, { CGDB_KEY_CTRL_Q, "\021"}, { CGDB_KEY_CTRL_R, "\022"}, { CGDB_KEY_CTRL_S, "\023"}, { CGDB_KEY_CTRL_T, "\024"}, { CGDB_KEY_CTRL_U, "\025"}, { CGDB_KEY_CTRL_V, "\026"}, { CGDB_KEY_CTRL_W, "\027"}, { CGDB_KEY_CTRL_X, "\030"}, { CGDB_KEY_CTRL_Y, "\031"}, { CGDB_KEY_CTRL_Z, "\032"}, { CGDB_KEY_ERROR, NULL} }; /** * This is the main data structure in determining the string representation * of a keycode that can be used in a map command. All of the hard coded * keycodes that can be used in a map is stored here. Some keycodes can not * be hard coded and are read from the termcap/terminfo library. */ struct cgdb_keycode_data { /* This is the "key" that can be converted to text. */ int key; /* This is the text value associated with the key */ const char *keycode; /* This is here purely for debugging purposes, it is used to print out the key * in human readable form. */ const char *key_as_string; } cgdb_keycodes[] = { /* Shift keys */ { 'A', "", ""}, { 'B', "", ""}, { 'C', "", ""}, { 'D', "", ""}, { 'E', "", ""}, { 'F', "", ""}, { 'G', "", ""}, { 'H', "", ""}, { 'I', "", ""}, { 'J', "", ""}, { 'K', "", ""}, { 'L', "", ""}, { 'M', "", ""}, { 'N', "", ""}, { 'O', "", ""}, { 'P', "", ""}, { 'Q', "", ""}, { 'R', "", ""}, { 'S', "", ""}, { 'T', "", ""}, { 'U', "", ""}, { 'V', "", ""}, { 'W', "", ""}, { 'X', "", ""}, { 'Y', "", ""}, { 'Z', "", ""}, /* The enum cgdb keys in order */ { CGDB_KEY_ESC, "", "CGDB_KEY_ESC"}, { CGDB_KEY_UP, "", "CGDB_KEY_UP"}, { CGDB_KEY_DOWN, "", "CGDB_KEY_DOWN"}, { CGDB_KEY_LEFT, "", "CGDB_KEY_LEFT"}, { CGDB_KEY_RIGHT, "", "CGDB_KEY_RIGHT"}, { CGDB_KEY_HOME, "", "CGDB_KEY_HOME"}, { CGDB_KEY_END, "", "CGDB_KEY_END"}, { CGDB_KEY_PPAGE, "", "CGDB_KEY_PPAGE"}, { CGDB_KEY_NPAGE, "", "CGDB_KEY_NPAGE"}, { CGDB_KEY_DC, "", "CGDB_KEY_DC"}, { CGDB_KEY_IC, "", "CGDB_KEY_IC"}, { CGDB_KEY_F1, "", "CGDB_KEY_F1"}, { CGDB_KEY_F2, "", "CGDB_KEY_F2"}, { CGDB_KEY_F3, "", "CGDB_KEY_F3"}, { CGDB_KEY_F4, "", "CGDB_KEY_F4"}, { CGDB_KEY_F5, "", "CGDB_KEY_F5"}, { CGDB_KEY_F6, "", "CGDB_KEY_F6"}, { CGDB_KEY_F7, "", "CGDB_KEY_F7"}, { CGDB_KEY_F8, "", "CGDB_KEY_F8"}, { CGDB_KEY_F9, "", "CGDB_KEY_F9"}, { CGDB_KEY_F10, "", "CGDB_KEY_F10"}, { CGDB_KEY_F11, "", "CGDB_KEY_F11"}, { CGDB_KEY_F12, "", "CGDB_KEY_F12"}, { CGDB_KEY_CTRL_A, "", "CGDB_KEY_CTRL_A"}, { CGDB_KEY_CTRL_B, "", "CGDB_KEY_CTRL_B"}, { CGDB_KEY_CTRL_C, "", "CGDB_KEY_CTRL_C"}, { CGDB_KEY_CTRL_D, "", "CGDB_KEY_CTRL_D"}, { CGDB_KEY_CTRL_E, "", "CGDB_KEY_CTRL_E"}, { CGDB_KEY_CTRL_F, "", "CGDB_KEY_CTRL_F"}, { CGDB_KEY_CTRL_G, "", "CGDB_KEY_CTRL_G"}, { CGDB_KEY_CTRL_H, "", "CGDB_KEY_CTRL_H"}, { CGDB_KEY_CTRL_I, "", "CGDB_KEY_CTRL_I"}, { CGDB_KEY_CTRL_J, "", "CGDB_KEY_CTRL_J"}, { CGDB_KEY_CTRL_K, "", "CGDB_KEY_CTRL_K"}, { CGDB_KEY_CTRL_L, "", "CGDB_KEY_CTRL_L"}, { CGDB_KEY_CTRL_M, "", "CGDB_KEY_CTRL_M"}, { CGDB_KEY_CTRL_N, "", "CGDB_KEY_CTRL_N"}, { CGDB_KEY_CTRL_O, "", "CGDB_KEY_CTRL_O"}, { CGDB_KEY_CTRL_P, "", "CGDB_KEY_CTRL_P"}, { CGDB_KEY_CTRL_Q, "", "CGDB_KEY_CTRL_Q"}, { CGDB_KEY_CTRL_R, "", "CGDB_KEY_CTRL_R"}, { CGDB_KEY_CTRL_S, "", "CGDB_KEY_CTRL_S"}, { CGDB_KEY_CTRL_T, "", "CGDB_KEY_CTRL_T"}, { CGDB_KEY_CTRL_U, "", "CGDB_KEY_CTRL_U"}, { CGDB_KEY_CTRL_V, "", "CGDB_KEY_CTRL_V"}, { CGDB_KEY_CTRL_W, "", "CGDB_KEY_CTRL_W"}, { CGDB_KEY_CTRL_X, "", "CGDB_KEY_CTRL_X"}, { CGDB_KEY_CTRL_Y, "", "CGDB_KEY_CTRL_Y"}, { CGDB_KEY_CTRL_Z, "", "CGDB_KEY_CTRL_Z"}, { 0, "", ""}, { CGDB_KEY_CTRL_H, "", ""}, { CGDB_KEY_CTRL_I, "", ""}, { CGDB_KEY_CTRL_J, "", ""}, { CGDB_KEY_CTRL_L, "", ""}, { CGDB_KEY_CTRL_M, "", ""}, { CGDB_KEY_CTRL_M, "", ""}, { CGDB_KEY_CTRL_M, "", ""}, { 32, "", ""}, { 60, "", ""}, { 92, "", ""}, { 124, "", ""}, { 127, "", ""}, { CGDB_KEY_ERROR, "CGDB_KEY_ERROR", "CGDB_KEY_ERROR"} }; /** * This adds key bindings that many terminals use. * * @return * 0 on success, or -1 on error */ static int add_keybindings(struct kui_map_set *map) { int i, val; const char *keycode; for (i = 0; hard_coded_bindings[i].key != CGDB_KEY_ERROR; ++i) { keycode = kui_term_get_keycode_from_cgdb_key(hard_coded_bindings[i].key); val = kui_ms_register_map(map, hard_coded_bindings[i].key_seq, keycode); if (val == -1) return -1; } return 0; } /* Gets a single key sequence */ static int import_keyseq(struct tlist *list, struct kui_map_set *map) { int ret; static char *term_buffer = (char *) NULL; static char *buffer = (char *) NULL; char *env; if (term_buffer == 0) { term_buffer = (char *) malloc(4080); buffer = (char *) malloc(4080); } env = getenv("TERM"); if (!env) return -1; ret = tgetent(term_buffer, env); if (ret == 0) return -1; else if (ret == -1) return -1; /* Set up the termcap seq */ list->tname_seq = tgetstr(list->tname, &buffer); if (list->tname_seq == 0) { /*fprintf ( stderr, "CAPNAME (%s) is not present in this TERM's termcap description\n", i->tname); */ } else if (list->tname_seq == (char *) -1) { /* fprintf ( stderr, "CAPNAME (%s) is not a termcap string capability\n", i->tname); */ } else { const char *keycode; keycode = kui_term_get_keycode_from_cgdb_key(list->key); ret = kui_ms_register_map(map, list->tname_seq, keycode); if (ret == -1) return -1; } /* Set up the terminfo seq */ list->tiname_seq = tigetstr(list->tiname); if (list->tiname_seq == 0) { /* fprintf ( stderr, "CAPNAME (%s) is not present in this TERM's terminfo description\n", i->tiname); */ } else if (list->tiname_seq == (char *) -1) { /* fprintf ( stderr, "CAPNAME (%s) is not a terminfo string capability\n", i->tiname); */ } else { const char *keycode; keycode = kui_term_get_keycode_from_cgdb_key(list->key); ret = kui_ms_register_map(map, list->tiname_seq, keycode); if (ret == -1) return -1; } return 0; } /** * Read's in all of the termcap and terminfo key sequences. * * @return * 0 on success, or -1 on error */ static int import_keyseqs(struct kui_map_set *map) { int i; for (i = 0; seqlist[i].tname != NULL; i++) import_keyseq(&seqlist[i], map); return 0; } struct kui_map_set *kui_term_get_terminal_mappings(void) { struct kui_map_set *map; map = kui_ms_create(); if (import_keyseqs(map) == -1) return NULL; if (!map) return NULL; /* Add all the extra's */ if (add_keybindings(map) == -1) { /* TODO: Free map and return */ return NULL; } return map; } int kui_term_get_cgdb_key_from_keycode(const char *keycode) { int i; for (i = 0; cgdb_keycodes[i].key != CGDB_KEY_ERROR; ++i) { struct cgdb_keycode_data *ckey = &cgdb_keycodes[i]; if (strcasecmp(keycode, ckey->keycode) == 0) return ckey->key; } return CGDB_KEY_ERROR; } const char *kui_term_get_string_from_key(int key) { int i; for (i = 0; cgdb_keycodes[i].key != CGDB_KEY_ERROR; ++i) { struct cgdb_keycode_data *ckey = &cgdb_keycodes[i]; int tkey = ckey->key; if (key == tkey) return ckey->key_as_string; } return NULL; } const char *kui_term_get_keycode_from_cgdb_key(int key) { int i; for (i = 0; cgdb_keycodes[i].key != CGDB_KEY_ERROR; ++i) { struct cgdb_keycode_data *ckey = &cgdb_keycodes[i]; int tkey = ckey->key; if (key == tkey) return ckey->keycode; } return NULL; } int kui_term_is_cgdb_key(int key) { if (key >= CGDB_KEY_ESC && key <= CGDB_KEY_ERROR) return 1; return 0; } char *kui_term_get_ascii_char_sequence_from_key(int key) { int i; if (key < CGDB_KEY_ESC || key >= CGDB_KEY_ERROR) return NULL; for (i = 0; hard_coded_bindings[i].key != CGDB_KEY_ERROR; ++i) { if (key == hard_coded_bindings[i].key) { return hard_coded_bindings[i].key_seq; } } /* It wasn't one of the hardcoded values. The only thing left is the * termcap or terminfo entries. Try the termcap first, since that's * what readline uses. */ for (i = 0; seqlist[i].key != CGDB_KEY_ERROR; ++i) { if (key == seqlist[i].key) { if (seqlist[i].tname_seq) return seqlist[i].tname_seq; else if (seqlist[i].tiname_seq) return seqlist[i].tiname_seq; } } return NULL; } int kui_term_string_to_key_array(const char *string, int **cgdb_key_array) { int i; enum state_type { KUI_MAP_STATE_NORMAL, KUI_MAP_STATE_MACRO } state; char cur_char; int length; /* A buffer to store macros */ char *macro; int macro_pos; /* A buffer to store the outbound parameter */ int *local_cgdb_key_array; int cgdb_key_array_pos; /* Verify parameters */ if (!string) return -1; if (!cgdb_key_array) return -1; /* Initial stack parameters */ state = KUI_MAP_STATE_NORMAL; length = strlen(string); /* * Assertion * * The macro and output buffer will always be smaller than the input * buffer. So, to make life easy, they are always malloced to be the * size of the input buffer. This may be a little wasteful, but it should * not be to bad. Later, if a better ADT is available, use it here. */ /* Initialize the macro buffer */ macro = (char *) malloc(sizeof (char) * (length + 1)); macro_pos = 0; /* Initialize the output buffer */ local_cgdb_key_array = (int *) malloc(sizeof (int) * (length + 1)); cgdb_key_array_pos = 0; for (i = 0; i < length; i++) { cur_char = string[i]; switch (state) { case KUI_MAP_STATE_NORMAL: /* Check for keycode start */ if (cur_char == '<') { state = KUI_MAP_STATE_MACRO; /* Capture macro */ macro[macro_pos++] = cur_char; } else { /* Place into output buffer */ local_cgdb_key_array[cgdb_key_array_pos++] = (int) cur_char; } break; case KUI_MAP_STATE_MACRO: /* Getting a macro start symbol within a macro means that from the * first '<' until here was not a macro. Dump it into the * output buffer and start fresh, assumming this is the start * of a new macro. */ if (cur_char == '<') { int j; for (j = 0; j < macro_pos; ++j) local_cgdb_key_array[cgdb_key_array_pos++] = macro[j]; macro_pos = 0; } /* Capture macro */ macro[macro_pos++] = cur_char; if (cur_char == '>') { int cgdb_key; state = KUI_MAP_STATE_NORMAL; /* Null terminate macro captured */ macro[macro_pos] = '\0'; /* Place captured macro into output buffer */ cgdb_key = kui_term_get_cgdb_key_from_keycode(macro); if (cgdb_key == -1) return -1; /* The key doesn't exist, write the data into the * buffer. */ if (cgdb_key == CGDB_KEY_ERROR) { int j; for (j = 0; j < macro_pos; ++j) local_cgdb_key_array[cgdb_key_array_pos++] = macro[j]; } else local_cgdb_key_array[cgdb_key_array_pos++] = cgdb_key; macro_pos = 0; } break; } } /* This means that there was a '<' symbol not eventually followed by a '>' * symbol. Therefore, everything from the '<' on is not part of a macro. It * should be copied into the output buffer exactly the way it is. */ if (state == KUI_MAP_STATE_MACRO) { int j; for (j = 0; j < macro_pos; ++j) local_cgdb_key_array[cgdb_key_array_pos++] = macro[j]; } local_cgdb_key_array[cgdb_key_array_pos++] = 0; *cgdb_key_array = local_cgdb_key_array; free(macro); macro = NULL; return 0; } int kui_term_print_key_array(int *cgdb_key_array) { int i; if (!cgdb_key_array) return -1; /* Display output buffer */ fprintf(stderr, "CGDB_KEY_ARRAY("); for (i = 0; cgdb_key_array[i] != 0; i++) { int is_ckey; is_ckey = kui_term_is_cgdb_key(cgdb_key_array[i]); if (is_ckey) { fprintf(stderr, "%s", kui_term_get_string_from_key(cgdb_key_array[i])); } else { fprintf(stderr, "%c", cgdb_key_array[i]); } } fprintf(stderr, ")\r\n"); return 0; } cgdb-0.6.7/lib/kui/kui_term.h000644 000765 000024 00000006140 12074441140 016734 0ustar00mmuellerstaff000000 000000 #ifndef __INPUT_H__ #define __INPUT_H__ /* includes {{{*/ #include "kui.h" #include "kui_cgdb_key.h" /* }}}*/ /* Doxygen headers {{{ */ /*! * \file * kui_term.h * * \brief * This interface is intended to provide a key interface to an application. It * represents unprintable char's and terminal escape sequences via an enumeration. * This enumeration has convertion functions capable of changing an enum into * an ascii representation and back. */ /* }}} */ /** * A new kui_map_set get's created each time this function is returned. * * This basically abstracts away the keyboard. A map will be created for * each abstract key the user has on there keyboard (HOME,END,PGUP,ESC). * * @return * The new kui_map, or NULL on error. */ struct kui_map_set *kui_term_get_terminal_mappings(void); /** * Determine if a key is a cgdb_key. This is true if the key passed in is in * the bounds of the cgdb_key enumeration. * * \param key * The key to check * * @return * 1 if the key is a cgdb_key, otherwise 0 * */ int kui_term_is_cgdb_key(int key); /** * This get's the ascii character representation of the key. * * \param key * The cgdb_key to get the ascii character sequence of. * * \return * The ascii charachter sequence on success. If key is not a cgdb_key * or if this function fails, NULL will return. */ char *kui_term_get_ascii_char_sequence_from_key(int key); /** * Get's the cgdb_key from the keycode. * * \param keycode * The code to get the corresponding key from * * @return * The new key, or -1 on error. * CGDB_KEY_ERROR is returned if no key matches the keycode. */ int kui_term_get_cgdb_key_from_keycode(const char *keycode); /** * Get's the key in string form. * * \param key * The key to get in string form. * * @return * The string form. or NULL on error. * if CGDB_KEY_ERROR is passed in, "CGDB_KEY_ERROR" will be returned. */ const char *kui_term_get_string_from_key(int key); /** * Get's the keycode associated with this key. * * \param key * The key to get the keycode of. * * @return * The keycode. or NULL on error. * if CGDB_KEY_ERROR is passed in, "CGDB_KEY_ERROR" will be returned. */ const char *kui_term_get_keycode_from_cgdb_key(int key); /* * Parses the original buffer, and if successful * will create an output buffer. The output buffer is allocated for you. * When you are done with it, you should free it. * * Basically, this function translates strings like * 'abde' into an int array containing * * a * b * CGDB_KEY_ESC * CGDB_KEY_HOME * d * e * CGDB_KEY_PPAGE * NULL * * \param string * The value to translate * * \param literal * An outbound parameter, which is a null-terminated * int pointer, containing all valid int's. * * @return * 0 on success, or -1 on error. */ int kui_term_string_to_key_array(const char *string, int **key_array); /** * Print's a key_array in human readable form. This is mostly used for * debugging purposes. * * \param key_array * The key array to print. * * @return * 0 on success, or -1 on error. */ int kui_term_print_key_array(int *key_array); #endif /* __INPUT_H__ */ cgdb-0.6.7/lib/kui/kui_tree.c000644 000765 000024 00000022404 12074441140 016720 0ustar00mmuellerstaff000000 000000 #include #include #include "kui_tree.h" /* Internal Documentation {{{*/ /* * This documentation is intended to be a brief description behind how kui_tree * works internally. * */ /* }}}*/ /* struct kui_tree_node {{{ */ /** * This is a node in the ku_tree. * It represents a single key. Many nodes could make up a single map. */ struct kui_tree_node { /** * The key this node represents. */ int key; /** * If non-null, this node represents a macro and the data is * the value of the macro. * * Otherwise, this node is not the end of a macro. */ void *macro_value; /** * A doubly linked list of all the children. * The list is sorted by the key so that a faster lookup can happen. * * If this is a bottleneck, it can be changed into a hash, or something * more efficient. */ std_list children; }; /** * Destroys a kui tree node. * * \param ktnode * The tree node to destroy * * @return * 0 on success, or -1 on error. */ int kui_tree_node_destroy(struct kui_tree_node *ktnode) { int retval = 0; if (!ktnode) return -1; if (ktnode->children) { if (std_list_destroy(ktnode->children) == -1) retval = -1; ktnode->children = NULL; } free(ktnode); ktnode = NULL; return retval; } static int destroy_kui_tree_node_callback(void *data) { struct kui_tree_node *ktnode = (struct kui_tree_node *) data; if (!ktnode) return -1; return kui_tree_node_destroy(ktnode); } /** * Creates a new kui tree node. * * @return * A new instance on success, or NULL on error. */ struct kui_tree_node *kui_tree_node_create(void) { struct kui_tree_node *ktnode; ktnode = (struct kui_tree_node *) malloc(sizeof (struct kui_tree_node)); if (!ktnode) return NULL; ktnode->key = 0; ktnode->macro_value = NULL; /* Allocate children */ ktnode->children = std_list_create(destroy_kui_tree_node_callback); if (!ktnode->children) { kui_tree_node_destroy(ktnode); return NULL; } return ktnode; } /** * Finds a pointer to the child node. * * \param key * The key to look for. * * \param children * The children to look in * * \param found * If the key was found, this will return as true, otherwise false. * * \param ktnode * If found, this will be the node that contains the item. * * \return * 0 on success, or -1 on error. */ static int kui_tree_find(int key, std_list children, int *found, struct kui_tree_node **ktnode) { struct kui_tree_node *node; std_list_iterator iter; *found = 0; *ktnode = NULL; /* Look for the key in the children */ for (iter = std_list_begin(children); iter != std_list_end(children); iter = std_list_next(iter)) { void *data; if (std_list_get_data(iter, &data) == -1) return -1; node = (struct kui_tree_node *) data; if (node->key == key) { *found = 1; *ktnode = node; break; } else if (node->key > key) break; } return 0; } static int kui_tree_node_compare_callback(const void *a, const void *b) { struct kui_tree_node *one = (struct kui_tree_node *) a; struct kui_tree_node *two = (struct kui_tree_node *) b; if (one->key == two->key) return 0; else if (one->key < two->key) return -1; else return 1; } static int kui_tree_node_key_compare_callback(const void *a, const void *b) { struct kui_tree_node *one = (struct kui_tree_node *) a; int two = *(int *) b; if (one->key == two) return 0; else if (one->key < two) return -1; else return 1; } static int kui_tree_node_insert(struct kui_tree_node *ktnode, int *klist, void *data) { struct kui_tree_node *node; int found; if (!ktnode) return -1; if (klist[0] == 0) { ktnode->macro_value = data; return 0; } if (kui_tree_find(klist[0], ktnode->children, &found, &node) == -1) return -1; /* If the node was found, use it, otherwise create a new one */ if (!found) { node = kui_tree_node_create(); if (!node) return -1; node->key = klist[0]; if (std_list_insert_sorted(ktnode->children, node, kui_tree_node_compare_callback) == -1) return -1; } return kui_tree_node_insert(node, &klist[1], data); } static int kui_tree_node_delete(struct kui_tree_node *ktnode, struct kui_tree_node **from, int *klist) { struct kui_tree_node *node; int found; if (!ktnode) return -1; /* base case */ if (klist[0] == 0) return 0; if (kui_tree_find(klist[0], ktnode->children, &found, &node) == -1) return -1; if (!found) /* The key must be found */ return -1; if (kui_tree_node_delete(node, from, &klist[1]) == -1) return -1; /* No need to mess with the bottom node on the way out */ if (klist[1] == 0) { *from = node; return 0; } /* If "from" has no children, remove it from the current node's children * and then delete it. * If it has children, leave it alone. */ if (std_list_length((*from)->children) == 0) { std_list_iterator iter; iter = std_list_find(node->children, &(*from)->key, kui_tree_node_key_compare_callback); if (!iter) return -1; /* From is freed by std_list_remove callback */ if (std_list_remove(node->children, iter) == NULL) return -1; } *from = node; return 0; } /* }}} */ /* struct kui_tree {{{ */ /** * This data structure is capable of storing a set of maps internally in such a * way that it is easy to see what maps are active if a char at a time is fed * to this structure. * * Also, it can determine what mapping was reached if one was found. */ struct kui_tree { /* The root of the tree */ struct kui_tree_node *root; /* The current position pointing into the tree ( while looking for a map ) */ struct kui_tree_node *cur; /* The last node found while looking for a map. */ /* This happens because maps can be subsets of other maps. */ struct kui_tree_node *found_node; /* The internal state of the tree ( still looking, map found, not found ) */ enum kui_tree_state state; /* If a map was found at all, this is set to 1 while looking, otherwise 0. */ int found; }; int kui_tree_destroy(struct kui_tree *ktree) { int retval = 0; if (!ktree) return -1; if (kui_tree_node_destroy(ktree->root) == -1) retval = -1; free(ktree); ktree = NULL; return retval; } struct kui_tree *kui_tree_create(void) { struct kui_tree *ktree; ktree = (struct kui_tree *) malloc(sizeof (struct kui_tree)); if (!ktree) return NULL; ktree->root = kui_tree_node_create(); if (!ktree->root) { kui_tree_destroy(ktree); return NULL; } return ktree; } int kui_tree_insert(struct kui_tree *ktree, int *klist, void *data) { return kui_tree_node_insert(ktree->root, klist, data); } int kui_tree_delete(struct kui_tree *ktree, int *klist) { struct kui_tree_node *from; if (kui_tree_node_delete(ktree->root, &from, klist) == -1) return -1; if (std_list_length(from->children) == 0) { std_list_iterator iter; iter = std_list_find(ktree->root->children, &from->key, kui_tree_node_key_compare_callback); if (!iter) return -1; /* From is freed by std_list_remove callback */ if (std_list_remove(ktree->root->children, iter) == NULL) return -1; } return 0; } int kui_tree_reset_state(struct kui_tree *ktree) { if (!ktree) return -1; ktree->cur = ktree->root; ktree->state = KUI_TREE_MATCHING; ktree->found = 0; ktree->found_node = NULL; return 0; } int kui_tree_finalize_state(struct kui_tree *ktree) { if (!ktree) return -1; if (ktree->found) ktree->state = KUI_TREE_FOUND; return 0; } int kui_tree_get_state(struct kui_tree *ktree, enum kui_tree_state *state) { if (!ktree) return -1; *state = ktree->state; return 0; } int kui_tree_get_data(struct kui_tree *ktree, void *data) { if (!ktree) return -1; if (!ktree->found) return -1; memcpy(data, &ktree->found_node->macro_value, sizeof (void *)); return 0; } int kui_tree_push_key(struct kui_tree *ktree, int key, int *map_found) { int found; struct kui_tree_node *ktnode; *map_found = 0; if (ktree->state != KUI_TREE_MATCHING) return -1; /* Check to see if this key matches */ if (kui_tree_find(key, ktree->cur->children, &found, &ktnode) == -1) return -1; /* Not found */ if (!found) { ktree->state = KUI_TREE_NOT_FOUND; ktree->cur = NULL; return 0; } if (found) { ktree->cur = ktnode; if (std_list_length(ktnode->children) == 0) ktree->state = KUI_TREE_FOUND; if (ktnode->macro_value) { ktree->found = 1; ktree->found_node = ktnode; *map_found = 1; } } return 0; } /* }}} */ cgdb-0.6.7/lib/kui/kui_tree.h000644 000765 000024 00000011471 12074441140 016727 0ustar00mmuellerstaff000000 000000 #ifndef __KUI_TREE_H__ #define __KUI_TREE_H__ /* Includes {{{*/ #include "std_list.h" /* }}}*/ /* Doxygen headers {{{ */ /*! * \file * kui_tree.h * * \brief * This interface is the algorithm behind libkui's fast macro finding abilities. * It is a statefull data structure, which can be told to start matching, to * recieve input, and then to stop matching. When it is told to stop, it knows * exactly which macro's have been completed, and how much data is extra. */ /* }}} */ /* struct kui_map {{{ */ /******************************************************************************/ /** * @name Creating and Destroying a kui_map. * These functions are for createing and destroying a kui map. * * A kui map is basically a key value pair. As far as the map is concerned both * the key and the value are of type 'char*'. This is because, the user needs to * type the map in at the keyboard. This may seem obvious at first, but things * like ESCAPE and HOME have to be typed in also. */ /******************************************************************************/ /*@{*/ struct kui_tree; /** * Create a kui tree. This data structure is designed specifically for * the Key User Interface. It should be optimized for speed, since determining * what key the user wants to be processed next should be fast. * * @return * A new instance on success, or NULL on error. */ struct kui_tree *kui_tree_create(void); /** * Destroy a kui map. * * \param ktree * The kui tree to destroy * * @return * 0 on success, or -1 on error. */ int kui_tree_destroy(struct kui_tree *ktree); /*@}*/ /******************************************************************************/ /** * @name Inserting and Deleteing from a kui_tree * These are the basic functions of adding to and removing from a kui_tree */ /******************************************************************************/ /*@{*/ /** * Adding a key to the kui tree. * * \param ktree * The tree to add a new key too. * * \param klist * The data to add into the tree. * It is a null terminated list. * * \param data * If this is the "value" part of the map being inserted. * * @return * 0 on success, or -1 on error. */ int kui_tree_insert(struct kui_tree *ktree, int *klist, void *data); /** * Adding a key from the kui tree. * * \param ktree * The tree to delete a key from. * * \param klist * The key to remove from the tree * It is a null terminated list. * * @return * 0 on success, or -1 on error. */ int kui_tree_delete(struct kui_tree *ktree, int *klist); /*@}*/ /******************************************************************************/ /** * @name Setting and Querying the state of a kui_tree * A kui_tree is a stateful ADT. This interface documents how to set/get * the state of a particular kui tree. */ /******************************************************************************/ /*@{*/ enum kui_tree_state { KUI_TREE_FOUND = 0, KUI_TREE_MATCHING, KUI_TREE_NOT_FOUND, KUI_TREE_ERROR }; /** * To start searching for a macro, reset the state of the tree. * * \param ktree * The tree to start searching for a macro in. * * @return * 0 on success, or -1 on error. */ int kui_tree_reset_state(struct kui_tree *ktree); /** * To finish searching for a macro, finalize the state of the tree. * This allows the tree to do any book keeping it must do, and allows it * to find out exaclty which macro should was called, and how many extra * key strokes have been recieved. * * \param ktree * The tree to finalize the state of. * * @return * 0 on success, or -1 on error. */ int kui_tree_finalize_state(struct kui_tree *ktree); /** * Get's the state of the current tree. * * \param ktree * The tree to get the state of. * * \param state * The state of the tree * * @return * 0 on success, or -1 on error. */ int kui_tree_get_state(struct kui_tree *ktree, enum kui_tree_state *state); /** * Get's the data if the state is KUI_TREE_FOUND. * * \param ktree * The tree to get the data from * * \param data * The data put in for this macro * * \return * 0 on success, or -1 on error. */ int kui_tree_get_data(struct kui_tree *ktree, void *data); /*@}*/ /******************************************************************************/ /** * @name General operations on a kui tree. * These function's are the basic functions used to operate on a kui tree */ /******************************************************************************/ /*@{*/ /** * Advance the state of the tree by one key. * * \param ktree * The tree to change the state of. * * \param key * The data. * * \param map_found * returns as 1 if a map was found with this char push, otherwise 0 * * @return * 0 on success, or -1 on error. */ int kui_tree_push_key(struct kui_tree *ktree, int key, int *map_found); /*@}*/ /* }}} */ #endif cgdb-0.6.7/lib/kui/Makefile.am000644 000765 000024 00000001144 12074441140 016777 0ustar00mmuellerstaff000000 000000 AM_CFLAGS = \ -I$(top_srcdir)/lib/adt \ -I$(top_srcdir)/lib/util # create the input library noinst_LIBRARIES = libkui.a libkui_a_SOURCES = \ kui.c \ kui.h \ kui_cgdb_key.h \ kui_term.c \ kui_term.h \ kui_tree.c \ kui_tree.h # Installs the driver programs into progs directory noinst_PROGRAMS = kui_driver # This is the kui driver kui_driver_LDFLAGS = \ -L$(top_builddir)/lib/adt \ -L$(top_builddir)/lib/util kui_driver_LDADD = libkui.a \ $(top_builddir)/lib/adt/libadt.a \ $(top_builddir)/lib/util/libutil.a kui_driver_SOURCES = kui_driver.c kui_driver_CFLAGS = $(AM_CFLAGS) cgdb-0.6.7/lib/kui/Makefile.in000644 000765 000024 00000043635 12074766253 017042 0ustar00mmuellerstaff000000 000000 # Makefile.in generated by automake 1.13.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ noinst_PROGRAMS = kui_driver$(EXEEXT) subdir = lib/kui DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/config/depcomp ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/config/readline_check_version.m4 \ $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LIBRARIES = $(noinst_LIBRARIES) AR = ar ARFLAGS = cru AM_V_AR = $(am__v_AR_@AM_V@) am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@) am__v_AR_0 = @echo " AR " $@; am__v_AR_1 = libkui_a_AR = $(AR) $(ARFLAGS) libkui_a_LIBADD = am_libkui_a_OBJECTS = kui.$(OBJEXT) kui_term.$(OBJEXT) \ kui_tree.$(OBJEXT) libkui_a_OBJECTS = $(am_libkui_a_OBJECTS) PROGRAMS = $(noinst_PROGRAMS) am_kui_driver_OBJECTS = kui_driver-kui_driver.$(OBJEXT) kui_driver_OBJECTS = $(am_kui_driver_OBJECTS) kui_driver_DEPENDENCIES = libkui.a $(top_builddir)/lib/adt/libadt.a \ $(top_builddir)/lib/util/libutil.a kui_driver_LINK = $(CCLD) $(kui_driver_CFLAGS) $(CFLAGS) \ $(kui_driver_LDFLAGS) $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__depfiles_maybe = depfiles am__mv = mv -f AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libkui_a_SOURCES) $(kui_driver_SOURCES) DIST_SOURCES = $(libkui_a_SOURCES) $(kui_driver_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ RL_MAJOR = @RL_MAJOR@ RL_MINOR = @RL_MINOR@ RL_VERSION = @RL_VERSION@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ YACC = @YACC@ YFLAGS = @YFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CFLAGS = \ -I$(top_srcdir)/lib/adt \ -I$(top_srcdir)/lib/util # create the input library noinst_LIBRARIES = libkui.a libkui_a_SOURCES = \ kui.c \ kui.h \ kui_cgdb_key.h \ kui_term.c \ kui_term.h \ kui_tree.c \ kui_tree.h # This is the kui driver kui_driver_LDFLAGS = \ -L$(top_builddir)/lib/adt \ -L$(top_builddir)/lib/util kui_driver_LDADD = libkui.a \ $(top_builddir)/lib/adt/libadt.a \ $(top_builddir)/lib/util/libutil.a kui_driver_SOURCES = kui_driver.c kui_driver_CFLAGS = $(AM_CFLAGS) all: all-am .SUFFIXES: .SUFFIXES: .c .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu lib/kui/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu lib/kui/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) libkui.a: $(libkui_a_OBJECTS) $(libkui_a_DEPENDENCIES) $(EXTRA_libkui_a_DEPENDENCIES) $(AM_V_at)-rm -f libkui.a $(AM_V_AR)$(libkui_a_AR) libkui.a $(libkui_a_OBJECTS) $(libkui_a_LIBADD) $(AM_V_at)$(RANLIB) libkui.a clean-noinstPROGRAMS: -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) kui_driver$(EXEEXT): $(kui_driver_OBJECTS) $(kui_driver_DEPENDENCIES) $(EXTRA_kui_driver_DEPENDENCIES) @rm -f kui_driver$(EXEEXT) $(AM_V_CCLD)$(kui_driver_LINK) $(kui_driver_OBJECTS) $(kui_driver_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kui.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kui_driver-kui_driver.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kui_term.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kui_tree.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` kui_driver-kui_driver.o: kui_driver.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(kui_driver_CFLAGS) $(CFLAGS) -MT kui_driver-kui_driver.o -MD -MP -MF $(DEPDIR)/kui_driver-kui_driver.Tpo -c -o kui_driver-kui_driver.o `test -f 'kui_driver.c' || echo '$(srcdir)/'`kui_driver.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/kui_driver-kui_driver.Tpo $(DEPDIR)/kui_driver-kui_driver.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='kui_driver.c' object='kui_driver-kui_driver.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(kui_driver_CFLAGS) $(CFLAGS) -c -o kui_driver-kui_driver.o `test -f 'kui_driver.c' || echo '$(srcdir)/'`kui_driver.c kui_driver-kui_driver.obj: kui_driver.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(kui_driver_CFLAGS) $(CFLAGS) -MT kui_driver-kui_driver.obj -MD -MP -MF $(DEPDIR)/kui_driver-kui_driver.Tpo -c -o kui_driver-kui_driver.obj `if test -f 'kui_driver.c'; then $(CYGPATH_W) 'kui_driver.c'; else $(CYGPATH_W) '$(srcdir)/kui_driver.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/kui_driver-kui_driver.Tpo $(DEPDIR)/kui_driver-kui_driver.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='kui_driver.c' object='kui_driver-kui_driver.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(kui_driver_CFLAGS) $(CFLAGS) -c -o kui_driver-kui_driver.obj `if test -f 'kui_driver.c'; then $(CYGPATH_W) 'kui_driver.c'; else $(CYGPATH_W) '$(srcdir)/kui_driver.c'; fi` ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LIBRARIES) $(PROGRAMS) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-noinstLIBRARIES clean-noinstPROGRAMS \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ clean-noinstLIBRARIES clean-noinstPROGRAMS cscopelist-am ctags \ ctags-am distclean distclean-compile distclean-generic \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: cgdb-0.6.7/lib/gdbmi/gdbmi_driver.c000644 000765 000024 00000002106 12074441140 020035 0ustar00mmuellerstaff000000 000000 #include #include #include #include "gdbmi_pt.h" #include "gdbmi_parser.h" static void usage(char *progname) { printf("%s \n", progname); exit(-1); } int main(int argc, char **argv) { gdbmi_parser_ptr parser_ptr; gdbmi_output_ptr output_ptr; int result, parse_failed; if (argc != 2) usage(argv[0]); parser_ptr = gdbmi_parser_create(); result = gdbmi_parser_parse_file(parser_ptr, argv[1], &output_ptr, &parse_failed); if (result == -1) { fprintf(stderr, "%s:%d", __FILE__, __LINE__); return -1; } if (parse_failed) { if (result == -1) { fprintf(stderr, "%s:%d", __FILE__, __LINE__); return -1; } } else { print_gdbmi_output(output_ptr); } if (parse_failed) { output_ptr = NULL; } else { if (destroy_gdbmi_output(output_ptr) == -1) { fprintf(stderr, "%s:%d", __FILE__, __LINE__); return -1; } } gdbmi_parser_destroy(parser_ptr); return 0; } cgdb-0.6.7/lib/gdbmi/gdbmi_grammar.c000644 000765 000024 00000165026 12074441140 020203 0ustar00mmuellerstaff000000 000000 /* A Bison parser, made by GNU Bison 2.3a+. */ /* Skeleton implementation for Bison's Yacc-like parsers in C Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. 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 3 of the License, 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. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton. Alternatively, if you modify or redistribute the parser skeleton itself, you may (at your option) remove this special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ /* C LALR(1) parser skeleton written by Richard Stallman, by simplifying the original so-called "semantic" parser. */ /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local variables, as they might otherwise be expanded by user macros. There are some unavoidable exceptions within include files to define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ /* Identify Bison output. */ #define YYBISON 1 /* Bison version. */ #define YYBISON_VERSION "2.3a+" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" /* Pure parsers. */ #define YYPURE 1 /* Push parsers. */ #define YYPUSH 1 /* Pull parsers. */ #define YYPULL 0 /* Using locations. */ #define YYLSP_NEEDED 0 /* Substitute the variable and function names. */ #define yypush_parse gdbmi_push_parse #define yypstate_new gdbmi_pstate_new #define yypstate_delete gdbmi_pstate_delete #define yypstate gdbmi_pstate #define yylex gdbmi_lex #define yyerror gdbmi_error #define yylval gdbmi_lval #define yychar gdbmi_char #define yydebug gdbmi_debug #define yynerrs gdbmi_nerrs /* Copy the first part of user declarations. */ /* Line 189 of yacc.c */ #line 8 "../../../../cgdb/lib/gdbmi/src/gdbmi_grammar.y" #include #include #include #include "gdbmi_pt.h" extern char *gdbmi_text; extern int gdbmi_lex(void); extern int gdbmi_lineno; void gdbmi_error(gdbmi_pdata_ptr gdbmi_pdata, const char *s) { fprintf(stderr, "%s:%d Error %s", __FILE__, __LINE__, s); if (strcmp(gdbmi_text, "\n") == 0) fprintf(stderr, "%s:%d at end of line %d\n", __FILE__, __LINE__, gdbmi_lineno); else { fprintf(stderr, "%s:%d at token(%s), line (%d)\n", __FILE__, __LINE__, gdbmi_text, gdbmi_lineno); gdbmi_lex(); fprintf(stderr, "%s:%d before (%s)\n", __FILE__, __LINE__, gdbmi_text); } } /* Line 189 of yacc.c */ #line 111 "../../../../cgdb/lib/gdbmi/src/gdbmi_grammar.c" /* Enabling traces. */ #ifndef YYDEBUG #define YYDEBUG 0 #endif /* Enabling verbose error messages. */ #ifdef YYERROR_VERBOSE #undef YYERROR_VERBOSE #define YYERROR_VERBOSE 1 #else #define YYERROR_VERBOSE 0 #endif /* Enabling the token table. */ #ifndef YYTOKEN_TABLE #define YYTOKEN_TABLE 0 #endif /* "%code requires" blocks. */ /* Line 209 of yacc.c */ #line 5 "../../../../cgdb/lib/gdbmi/src/gdbmi_grammar.y" struct gdbmi_pdata; /* Line 209 of yacc.c */ #line 139 "../../../../cgdb/lib/gdbmi/src/gdbmi_grammar.c" /* Tokens. */ #ifndef YYTOKENTYPE #define YYTOKENTYPE /* Put the tokens into the symbol table, so that GDB and other debuggers know about them. */ enum yytokentype { OPEN_BRACE = 258, CLOSED_BRACE = 259, OPEN_PAREN = 260, CLOSED_PAREN = 261, ADD_OP = 262, MULT_OP = 263, EQUAL_SIGN = 264, TILDA = 265, AT_SYMBOL = 266, AMPERSAND = 267, OPEN_BRACKET = 268, CLOSED_BRACKET = 269, NEWLINE = 270, INTEGER_LITERAL = 271, STRING_LITERAL = 272, CSTRING = 273, COMMA = 274, CARROT = 275 }; #endif /* Tokens. */ #define OPEN_BRACE 258 #define CLOSED_BRACE 259 #define OPEN_PAREN 260 #define CLOSED_PAREN 261 #define ADD_OP 262 #define MULT_OP 263 #define EQUAL_SIGN 264 #define TILDA 265 #define AT_SYMBOL 266 #define AMPERSAND 267 #define OPEN_BRACKET 268 #define CLOSED_BRACKET 269 #define NEWLINE 270 #define INTEGER_LITERAL 271 #define STRING_LITERAL 272 #define CSTRING 273 #define COMMA 274 #define CARROT 275 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE { /* Line 214 of yacc.c */ #line 53 "../../../../cgdb/lib/gdbmi/src/gdbmi_grammar.y" struct gdbmi_output *u_output; struct gdbmi_oob_record *u_oob_record; struct gdbmi_result_record *u_result_record; int u_result_class; int u_async_record_choice; struct gdbmi_result *u_result; long u_token; struct gdbmi_async_record *u_async_record; struct gdbmi_stream_record *u_stream_record; int u_async_class; char *u_variable; struct gdbmi_value *u_value; struct gdbmi_tuple *u_tuple; struct gdbmi_list *u_list; int u_stream_record_choice; /* Line 214 of yacc.c */ #line 216 "../../../../cgdb/lib/gdbmi/src/gdbmi_grammar.c" } YYSTYPE; #define YYSTYPE_IS_TRIVIAL 1 #define yystype YYSTYPE /* obsolescent; will be withdrawn */ #define YYSTYPE_IS_DECLARED 1 #endif #ifndef YYPUSH_DECLS #define YYPUSH_DECLS struct yypstate; typedef struct yypstate yypstate; enum { YYPUSH_MORE = 4 }; #if defined __STDC__ || defined __cplusplus int yypush_parse(yypstate * yyps, int yypushed_char, YYSTYPE const *yypushed_val, struct gdbmi_pdata *gdbmi_pdata); #else int yypush_parse(); #endif #if defined __STDC__ || defined __cplusplus yypstate *yypstate_new(void); #else yypstate *yypstate_new(); #endif #if defined __STDC__ || defined __cplusplus void yypstate_delete(yypstate * yyps); #else void yypstate_delete(); #endif #endif /* Copy the second part of user declarations. */ /* Line 264 of yacc.c */ #line 252 "../../../../cgdb/lib/gdbmi/src/gdbmi_grammar.c" #ifdef short #undef short #endif #ifdef YYTYPE_UINT8 typedef YYTYPE_UINT8 yytype_uint8; #else typedef unsigned char yytype_uint8; #endif #ifdef YYTYPE_INT8 typedef YYTYPE_INT8 yytype_int8; #elif (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) typedef signed char yytype_int8; #else typedef short int yytype_int8; #endif #ifdef YYTYPE_UINT16 typedef YYTYPE_UINT16 yytype_uint16; #else typedef unsigned short int yytype_uint16; #endif #ifdef YYTYPE_INT16 typedef YYTYPE_INT16 yytype_int16; #else typedef short int yytype_int16; #endif #ifndef YYSIZE_T #ifdef __SIZE_TYPE__ #define YYSIZE_T __SIZE_TYPE__ #elif defined size_t #define YYSIZE_T size_t #elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) #include /* INFRINGES ON USER NAME SPACE */ #define YYSIZE_T size_t #else #define YYSIZE_T unsigned int #endif #endif #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #ifndef YY_ #if YYENABLE_NLS #if ENABLE_NLS #include /* INFRINGES ON USER NAME SPACE */ #define YY_(msgid) dgettext ("bison-runtime", msgid) #endif #endif #ifndef YY_ #define YY_(msgid) msgid #endif #endif /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ #define YYUSE(e) ((void) (e)) #else #define YYUSE(e) /* empty */ #endif /* Identity function, used to suppress warnings about constant conditions. */ #ifndef lint #define YYID(n) (n) #else #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static int YYID(int yyi) #else static int YYID(yyi) int yyi; #endif { return yyi; } #endif #if ! defined yyoverflow || YYERROR_VERBOSE #ifdef YYSTACK_ALLOC /* Pacify GCC's `empty if-body' warning. */ #define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) #ifndef YYSTACK_ALLOC_MAXIMUM /* The OS might guarantee only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely invoke alloca (N) if N exceeds 4096. Use a slightly smaller number to allow for a few compiler-allocated temporary stack slots. */ #define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ #endif #else #define YYSTACK_ALLOC YYMALLOC #define YYSTACK_FREE YYFREE #ifndef YYSTACK_ALLOC_MAXIMUM #define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM #endif #if (defined __cplusplus && ! defined _STDLIB_H \ && ! ((defined YYMALLOC || defined malloc) \ && (defined YYFREE || defined free))) #include /* INFRINGES ON USER NAME SPACE */ #ifndef _STDLIB_H #define _STDLIB_H 1 #endif #endif #ifndef YYMALLOC #define YYMALLOC malloc #if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void *malloc(YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ #endif #endif #ifndef YYFREE #define YYFREE free #if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void free(void *); /* INFRINGES ON USER NAME SPACE */ #endif #endif #endif #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ #if (! defined yyoverflow \ && (! defined __cplusplus \ || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { yytype_int16 yyss_alloc; YYSTYPE yyvs_alloc; }; /* The size of the maximum gap between one aligned stack and the next. */ #define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) /* The size of an array large to enough to hold all stacks, each with N elements. */ #define YYSTACK_BYTES(N) \ ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) /* Copy COUNT objects from FROM to TO. The source and destination do not overlap. */ #ifndef YYCOPY #if defined __GNUC__ && 1 < __GNUC__ #define YYCOPY(To, From, Count) \ __builtin_memcpy (To, From, (Count) * sizeof (*(From))) #else #define YYCOPY(To, From, Count) \ do \ { \ YYSIZE_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (To)[yyi] = (From)[yyi]; \ } \ while (YYID (0)) #endif #endif /* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ #define YYSTACK_RELOCATE(Stack_alloc, Stack) \ do \ { \ YYSIZE_T yynewbytes; \ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ Stack = &yyptr->Stack_alloc; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ while (YYID (0)) #endif /* YYFINAL -- State number of the termination state. */ #define YYFINAL 4 /* YYLAST -- Last index in YYTABLE. */ #define YYLAST 46 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 21 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 22 /* YYNRULES -- Number of rules. */ #define YYNRULES 40 /* YYNRULES -- Number of states. */ #define YYNSTATES 61 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 275 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 }; #if YYDEBUG /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in YYRHS. */ static const yytype_uint8 yyprhs[] = { 0, 0, 3, 5, 8, 15, 16, 20, 21, 24, 28, 34, 36, 38, 42, 48, 50, 52, 54, 56, 58, 60, 64, 68, 70, 72, 76, 78, 80, 82, 85, 89, 92, 96, 100, 103, 105, 107, 109, 110, 112 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int8 yyrhs[] = { 22, 0, -1, 23, -1, 22, 23, -1, 24, 25, 5, 34, 6, 15, -1, -1, 24, 27, 15, -1, -1, 26, 15, -1, 41, 20, 30, -1, 41, 20, 30, 19, 32, -1, 28, -1, 39, -1, 41, 29, 31, -1, 41, 29, 31, 19, 32, -1, 8, -1, 7, -1, 9, -1, 17, -1, 17, -1, 33, -1, 32, 19, 33, -1, 34, 9, 36, -1, 17, -1, 36, -1, 35, 19, 36, -1, 18, -1, 37, -1, 38, -1, 3, 4, -1, 3, 32, 4, -1, 13, 14, -1, 13, 35, 14, -1, 13, 32, 14, -1, 40, 18, -1, 10, -1, 11, -1, 12, -1, -1, 42, -1, 16, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { 0, 96, 96, 100, 105, 116, 120, 124, 128, 132, 139, 146, 152, 158, 165, 173, 177, 181, 185, 200, 207, 211, 215, 221, 225, 229, 233, 239, 245, 251, 255, 260, 264, 270, 276, 282, 286, 290, 294, 298, 302 }; #endif #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { "$end", "error", "$undefined", "OPEN_BRACE", "CLOSED_BRACE", "OPEN_PAREN", "CLOSED_PAREN", "ADD_OP", "MULT_OP", "EQUAL_SIGN", "TILDA", "AT_SYMBOL", "AMPERSAND", "OPEN_BRACKET", "CLOSED_BRACKET", "NEWLINE", "INTEGER_LITERAL", "STRING_LITERAL", "CSTRING", "COMMA", "CARROT", "$accept", "output_list", "output", "opt_oob_record_list", "opt_result_record", "result_record", "oob_record", "async_record", "async_record_class", "result_class", "async_class", "result_list", "result", "variable", "value_list", "value", "tuple", "list", "stream_record", "stream_record_class", "opt_token", "token", 0 }; #endif #ifdef YYPRINT /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to token YYLEX-NUM. */ static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275 }; #endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { 0, 21, 22, 22, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 29, 30, 31, 32, 32, 33, 34, 35, 35, 36, 36, 36, 37, 37, 38, 38, 38, 39, 40, 40, 40, 41, 41, 42 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ static const yytype_uint8 yyr2[] = { 0, 2, 1, 2, 6, 0, 3, 0, 2, 3, 5, 1, 1, 3, 5, 1, 1, 1, 1, 1, 1, 3, 3, 1, 1, 3, 1, 1, 1, 2, 3, 2, 3, 3, 2, 1, 1, 1, 0, 1, 1 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state STATE-NUM when YYTABLE doesn't specify something else to do. Zero means the default is an error. */ static const yytype_uint8 yydefact[] = { 5, 5, 2, 38, 1, 3, 35, 36, 37, 40, 0, 0, 0, 11, 12, 0, 0, 39, 0, 8, 6, 34, 16, 15, 17, 0, 0, 23, 0, 18, 9, 19, 13, 0, 0, 0, 4, 10, 20, 0, 14, 0, 0, 21, 0, 0, 26, 22, 27, 28, 29, 0, 31, 0, 0, 24, 30, 33, 32, 0, 25 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int8 yydefgoto[] = { -1, 1, 2, 3, 10, 11, 12, 13, 26, 30, 32, 37, 38, 39, 54, 47, 48, 49, 14, 15, 16, 17 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ #define YYPACT_NINF -40 static const yytype_int8 yypact[] = { -40, 7, -40, 19, -40, -40, -40, -40, -40, -40, -4, -6, -2, -40, -40, 10, 14, -40, 16, -40, -40, -40, -40, -40, -40, 20, 21, -40, 30, -40, 22, -40, 23, 24, 16, 16, -40, 25, -40, 31, 25, 16, -1, -40, 1, -3, -40, -40, -40, -40, -40, 0, -40, -11, 13, -40, -40, -40, -40, -1, -40 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { -40, -40, 42, -40, -40, -40, -40, -40, -40, -40, -40, -19, 4, 28, -40, -39, -40, -40, -40, -40, -40, -40 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ #define YYTABLE_NINF -8 static const yytype_int8 yytable[] = { 44, 18, 44, 57, 56, 50, 55, 4, 41, 19, 45, 52, 45, 20, 27, 46, 40, 46, 27, 41, 60, 22, 23, 24, -7, 51, 53, 58, 21, 6, 7, 8, 59, 27, 25, 9, 33, 29, 31, 36, 42, 34, 35, 5, 41, 43, 28 }; static const yytype_uint8 yycheck[] = { 3, 5, 3, 14, 4, 4, 45, 0, 19, 15, 13, 14, 13, 15, 17, 18, 35, 18, 17, 19, 59, 7, 8, 9, 5, 44, 45, 14, 18, 10, 11, 12, 19, 17, 20, 16, 6, 17, 17, 15, 9, 19, 19, 1, 19, 41, 18 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { 0, 22, 23, 24, 0, 23, 10, 11, 12, 16, 25, 26, 27, 28, 39, 40, 41, 42, 5, 15, 15, 18, 7, 8, 9, 20, 29, 17, 34, 17, 30, 17, 31, 6, 19, 19, 15, 32, 33, 34, 32, 19, 9, 33, 3, 13, 18, 36, 37, 38, 4, 32, 14, 32, 35, 36, 4, 14, 14, 19, 36 }; #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYEMPTY (-2) #define YYEOF 0 #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab #define YYERROR goto yyerrorlab /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. Once GCC version 2 has supplanted version 1, this can go. */ #define YYFAIL goto yyerrlab #define YYRECOVERING() (!!yyerrstatus) #define YYBACKUP(Token, Value) \ do \ if (yychar == YYEMPTY && yylen == 1) \ { \ yychar = (Token); \ yylval = (Value); \ yytoken = YYTRANSLATE (yychar); \ YYPOPSTACK (1); \ goto yybackup; \ } \ else \ { \ yyerror (gdbmi_pdata, YY_("syntax error: cannot back up")); \ YYERROR; \ } \ while (YYID (0)) #define YYTERROR 1 #define YYERRCODE 256 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. If N is 0, then set CURRENT to the empty location which ends the previous symbol: RHS[0] (always defined). */ #define YYRHSLOC(Rhs, K) ((Rhs)[K]) #ifndef YYLLOC_DEFAULT #define YYLLOC_DEFAULT(Current, Rhs, N) \ do \ if (YYID (N)) \ { \ (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ } \ else \ { \ (Current).first_line = (Current).last_line = \ YYRHSLOC (Rhs, 0).last_line; \ (Current).first_column = (Current).last_column = \ YYRHSLOC (Rhs, 0).last_column; \ } \ while (YYID (0)) #endif /* YY_LOCATION_PRINT -- Print the location on the stream. This macro was not mandated originally: define only if we know we won't break user code: when these are the locations we know. */ #ifndef YY_LOCATION_PRINT #if YYLTYPE_IS_TRIVIAL #define YY_LOCATION_PRINT(File, Loc) \ fprintf (File, "%d.%d-%d.%d", \ (Loc).first_line, (Loc).first_column, \ (Loc).last_line, (Loc).last_column) #else #define YY_LOCATION_PRINT(File, Loc) ((void) 0) #endif #endif /* YYLEX -- calling `yylex' with the right arguments. */ #ifdef YYLEX_PARAM #define YYLEX yylex (&yylval, YYLEX_PARAM) #else #define YYLEX yylex (&yylval) #endif /* Enable debugging if requested. */ #if YYDEBUG #ifndef YYFPRINTF #include /* INFRINGES ON USER NAME SPACE */ #define YYFPRINTF fprintf #endif #define YYDPRINTF(Args) \ do { \ if (yydebug) \ YYFPRINTF Args; \ } while (YYID (0)) #define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ do { \ if (yydebug) \ { \ YYFPRINTF (stderr, "%s ", Title); \ yy_symbol_print (stderr, \ Type, Value, gdbmi_pdata); \ YYFPRINTF (stderr, "\n"); \ } \ } while (YYID (0)) /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ /*ARGSUSED*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_symbol_value_print(FILE * yyoutput, int yytype, YYSTYPE const *const yyvaluep, struct gdbmi_pdata *gdbmi_pdata) #else static void yy_symbol_value_print(yyoutput, yytype, yyvaluep, gdbmi_pdata) FILE *yyoutput; int yytype; YYSTYPE const *const yyvaluep; struct gdbmi_pdata *gdbmi_pdata; #endif { if (!yyvaluep) return; YYUSE(gdbmi_pdata); #ifdef YYPRINT if (yytype < YYNTOKENS) YYPRINT(yyoutput, yytoknum[yytype], *yyvaluep); #else YYUSE(yyoutput); #endif switch (yytype) { default: break; } } /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_symbol_print(FILE * yyoutput, int yytype, YYSTYPE const *const yyvaluep, struct gdbmi_pdata *gdbmi_pdata) #else static void yy_symbol_print(yyoutput, yytype, yyvaluep, gdbmi_pdata) FILE *yyoutput; int yytype; YYSTYPE const *const yyvaluep; struct gdbmi_pdata *gdbmi_pdata; #endif { if (yytype < YYNTOKENS) YYFPRINTF(yyoutput, "token %s (", yytname[yytype]); else YYFPRINTF(yyoutput, "nterm %s (", yytname[yytype]); yy_symbol_value_print(yyoutput, yytype, yyvaluep, gdbmi_pdata); YYFPRINTF(yyoutput, ")"); } /*------------------------------------------------------------------. | yy_stack_print -- Print the state stack from its BOTTOM up to its | | TOP (included). | `------------------------------------------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_stack_print(yytype_int16 * yybottom, yytype_int16 * yytop) #else static void yy_stack_print(yybottom, yytop) yytype_int16 *yybottom; yytype_int16 *yytop; #endif { YYFPRINTF(stderr, "Stack now"); for (; yybottom <= yytop; yybottom++) { int yybot = *yybottom; YYFPRINTF(stderr, " %d", yybot); } YYFPRINTF(stderr, "\n"); } #define YY_STACK_PRINT(Bottom, Top) \ do { \ if (yydebug) \ yy_stack_print ((Bottom), (Top)); \ } while (YYID (0)) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_reduce_print(YYSTYPE * yyvsp, int yyrule, struct gdbmi_pdata *gdbmi_pdata) #else static void yy_reduce_print(yyvsp, yyrule, gdbmi_pdata) YYSTYPE *yyvsp; int yyrule; struct gdbmi_pdata *gdbmi_pdata; #endif { int yynrhs = yyr2[yyrule]; int yyi; unsigned long int yylno = yyrline[yyrule]; YYFPRINTF(stderr, "Reducing stack by rule %d (line %lu):\n", yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { YYFPRINTF(stderr, " $%d = ", yyi + 1); yy_symbol_print(stderr, yyrhs[yyprhs[yyrule] + yyi], &(yyvsp[(yyi + 1) - (yynrhs)]) , gdbmi_pdata); YYFPRINTF(stderr, "\n"); } } #define YY_REDUCE_PRINT(Rule) \ do { \ if (yydebug) \ yy_reduce_print (yyvsp, Rule, gdbmi_pdata); \ } while (YYID (0)) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ int yydebug; #else /* !YYDEBUG */ #define YYDPRINTF(Args) #define YY_SYMBOL_PRINT(Title, Type, Value, Location) #define YY_STACK_PRINT(Bottom, Top) #define YY_REDUCE_PRINT(Rule) #endif /* !YYDEBUG */ /* YYINITDEPTH -- initial size of the parser's stacks. */ #ifndef YYINITDEPTH #define YYINITDEPTH 200 #endif /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only if the built-in stack extension method is used). Do not make this value too large; the results are undefined if YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) evaluated with infinite-precision integer arithmetic. */ #ifndef YYMAXDEPTH #define YYMAXDEPTH 10000 #endif #if YYERROR_VERBOSE #ifndef yystrlen #if defined __GLIBC__ && defined _STRING_H #define yystrlen strlen #else /* Return the length of YYSTR. */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static YYSIZE_T yystrlen(const char *yystr) #else static YYSIZE_T yystrlen(yystr) const char *yystr; #endif { YYSIZE_T yylen; for (yylen = 0; yystr[yylen]; yylen++) continue; return yylen; } #endif #endif #ifndef yystpcpy #if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE #define yystpcpy stpcpy #else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static char *yystpcpy(char *yydest, const char *yysrc) #else static char *yystpcpy(yydest, yysrc) char *yydest; const char *yysrc; #endif { char *yyd = yydest; const char *yys = yysrc; while ((*yyd++ = *yys++) != '\0') continue; return yyd - 1; } #endif #endif #ifndef yytnamerr /* Copy to YYRES the contents of YYSTR after stripping away unnecessary quotes and backslashes, so that it's suitable for yyerror. The heuristic is that double-quoting is unnecessary unless the string contains an apostrophe, a comma, or backslash (other than backslash-backslash). YYSTR is taken from yytname. If YYRES is null, do not copy; instead, return the length of what the result would have been. */ static YYSIZE_T yytnamerr(char *yyres, const char *yystr) { if (*yystr == '"') { YYSIZE_T yyn = 0; char const *yyp = yystr; for (;;) switch (*++yyp) { case '\'': case ',': goto do_not_strip_quotes; case '\\': if (*++yyp != '\\') goto do_not_strip_quotes; /* Fall through. */ default: if (yyres) yyres[yyn] = *yyp; yyn++; break; case '"': if (yyres) yyres[yyn] = '\0'; return yyn; } do_not_strip_quotes:; } if (!yyres) return yystrlen(yystr); return yystpcpy(yyres, yystr) - yyres; } #endif /* Copy into YYRESULT an error message about the unexpected token YYCHAR while in state YYSTATE. Return the number of bytes copied, including the terminating null byte. If YYRESULT is null, do not copy anything; just return the number of bytes that would be copied. As a special case, return 0 if an ordinary "syntax error" message will do. Return YYSIZE_MAXIMUM if overflow occurs during size calculation. */ static YYSIZE_T yysyntax_error(char *yyresult, int yystate, int yychar) { int yyn = yypact[yystate]; if (!(YYPACT_NINF < yyn && yyn <= YYLAST)) return 0; else { int yytype = YYTRANSLATE(yychar); YYSIZE_T yysize0 = yytnamerr(0, yytname[yytype]); YYSIZE_T yysize = yysize0; YYSIZE_T yysize1; int yysize_overflow = 0; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; int yyx; #if 0 /* This is so xgettext sees the translatable formats that are constructed on the fly. */ YY_("syntax error, unexpected %s"); YY_("syntax error, unexpected %s, expecting %s"); YY_("syntax error, unexpected %s, expecting %s or %s"); YY_("syntax error, unexpected %s, expecting %s or %s or %s"); YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); #endif char *yyfmt; char const *yyf; static char const yyunexpected[] = "syntax error, unexpected %s"; static char const yyexpecting[] = ", expecting %s"; static char const yyor[] = " or %s"; char yyformat[sizeof yyunexpected + sizeof yyexpecting - 1 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) * (sizeof yyor - 1))]; char const *yyprefix = yyexpecting; /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. */ int yyxbegin = yyn < 0 ? -yyn : 0; /* Stay within bounds of both yycheck and yytname. */ int yychecklim = YYLAST - yyn + 1; int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; int yycount = 1; yyarg[0] = yytname[yytype]; yyfmt = yystpcpy(yyformat, yyunexpected); for (yyx = yyxbegin; yyx < yyxend; ++yyx) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) { if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) { yycount = 1; yysize = yysize0; yyformat[sizeof yyunexpected - 1] = '\0'; break; } yyarg[yycount++] = yytname[yyx]; yysize1 = yysize + yytnamerr(0, yytname[yyx]); yysize_overflow |= (yysize1 < yysize); yysize = yysize1; yyfmt = yystpcpy(yyfmt, yyprefix); yyprefix = yyor; } yyf = YY_(yyformat); yysize1 = yysize + yystrlen(yyf); yysize_overflow |= (yysize1 < yysize); yysize = yysize1; if (yysize_overflow) return YYSIZE_MAXIMUM; if (yyresult) { /* Avoid sprintf, as that infringes on the user's name space. Don't have undefined behavior even if the translation produced a string with the wrong number of "%s"s. */ char *yyp = yyresult; int yyi = 0; while ((*yyp = *yyf) != '\0') { if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) { yyp += yytnamerr(yyp, yyarg[yyi++]); yyf += 2; } else { yyp++; yyf++; } } } return yysize; } } #endif /* YYERROR_VERBOSE */ /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ /*ARGSUSED*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yydestruct(const char *yymsg, int yytype, YYSTYPE * yyvaluep, struct gdbmi_pdata *gdbmi_pdata) #else static void yydestruct(yymsg, yytype, yyvaluep, gdbmi_pdata) const char *yymsg; int yytype; YYSTYPE *yyvaluep; struct gdbmi_pdata *gdbmi_pdata; #endif { YYUSE(yyvaluep); YYUSE(gdbmi_pdata); if (!yymsg) yymsg = "Deleting"; YY_SYMBOL_PRINT(yymsg, yytype, yyvaluep, yylocationp); switch (yytype) { default: break; } } struct yypstate { /* Number of syntax errors so far. */ int yynerrs; int yystate; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; /* The stacks and their tools: `yyss': related to states. `yyvs': related to semantic values. Refer to the stacks thru separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* The state stack. */ yytype_int16 yyssa[YYINITDEPTH]; yytype_int16 *yyss; yytype_int16 *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs; YYSTYPE *yyvsp; YYSIZE_T yystacksize; /* Used to determine if this is the first time this instance has been used. */ int yynew; }; /* Initialize the parser data structure. */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) yypstate *yypstate_new(void) #else yypstate *yypstate_new() #endif { yypstate *yyps; yyps = (yypstate *) malloc(sizeof *yyps); if (!yyps) return 0; yyps->yynew = 1; return yyps; } #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void yypstate_delete(yypstate * yyps) #else void yypstate_delete(yyps) yypstate *yyps; #endif { #ifndef yyoverflow /* If the stack was reallocated but the parse did not complete, then the stack still needs to be freed. */ if (!yyps->yynew && yyps->yyss != yyps->yyssa) YYSTACK_FREE(yyps->yyss); #endif free(yyps); } #define gdbmi_nerrs yyps->gdbmi_nerrs #define yystate yyps->yystate #define yyerrstatus yyps->yyerrstatus #define yyssa yyps->yyssa #define yyss yyps->yyss #define yyssp yyps->yyssp #define yyvsa yyps->yyvsa #define yyvs yyps->yyvs #define yyvsp yyps->yyvsp #define yystacksize yyps->yystacksize /*-------------------------. | yyparse or yypush_parse. | `-------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) int yypush_parse(yypstate * yyps, int yypushed_char, YYSTYPE const *yypushed_val, struct gdbmi_pdata *gdbmi_pdata) #else int yypush_parse(yyps, yypushed_char, yypushed_val, gdbmi_pdata) yypstate *yyps; int yypushed_char; YYSTYPE const *yypushed_val; struct gdbmi_pdata *gdbmi_pdata; #endif { /* The lookahead symbol. */ int yychar; /* The semantic value of the lookahead symbol. */ YYSTYPE yylval; int yyn; int yyresult; /* Lookahead token as an internal (translated) token number. */ int yytoken; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; #if YYERROR_VERBOSE /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; char *yymsg = yymsgbuf; YYSIZE_T yymsg_alloc = sizeof yymsgbuf; #endif #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; if (!yyps->yynew) { yyn = yypact[yystate]; goto yyread_pushed_token; } yytoken = 0; yyss = yyssa; yyvs = yyvsa; yystacksize = YYINITDEPTH; YYDPRINTF((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ yyssp = yyss; yyvsp = yyvs; goto yysetstate; /*------------------------------------------------------------. | yynewstate -- Push a new state, which is found in yystate. | `------------------------------------------------------------*/ yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. So pushing a state here evens the stacks. */ yyssp++; yysetstate: *yyssp = yystate; if (yyss + yystacksize - 1 <= yyssp) { /* Get the current used size of the three stacks, in elements. */ YYSIZE_T yysize = yyssp - yyss + 1; #ifdef yyoverflow { /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; yytype_int16 *yyss1 = yyss; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow(YY_("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), &yystacksize); yyss = yyss1; yyvs = yyvs1; } #else /* no yyoverflow */ #ifndef YYSTACK_RELOCATE goto yyexhaustedlab; #else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; { yytype_int16 *yyss1 = yyss; union yyalloc *yyptr = (union yyalloc *) YYSTACK_ALLOC(YYSTACK_BYTES(yystacksize)); if (!yyptr) goto yyexhaustedlab; YYSTACK_RELOCATE(yyss_alloc, yyss); YYSTACK_RELOCATE(yyvs_alloc, yyvs); #undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE(yyss1); } #endif #endif /* no yyoverflow */ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; YYDPRINTF((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) YYABORT; } YYDPRINTF((stderr, "Entering state %d\n", yystate)); if (yystate == YYFINAL) YYACCEPT; goto yybackup; /*-----------. | yybackup. | `-----------*/ yybackup: /* Do appropriate processing given the current state. Read a lookahead token if we need one and don't already have one. */ /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; /* Not known => get a lookahead token if don't already have one. */ /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ if (yychar == YYEMPTY) { if (!yyps->yynew) { YYDPRINTF((stderr, "Return for a new token:\n")); yyresult = YYPUSH_MORE; goto yypushreturn; } yyps->yynew = 0; yyread_pushed_token: YYDPRINTF((stderr, "Reading a token: ")); yychar = yypushed_char; if (yypushed_val) yylval = *yypushed_val; } if (yychar <= YYEOF) { yychar = yytoken = YYEOF; YYDPRINTF((stderr, "Now at end of input.\n")); } else { yytoken = YYTRANSLATE(yychar); YY_SYMBOL_PRINT("Next token is", yytoken, &yylval, &yylloc); } /* If the proper action on seeing token YYTOKEN is to reduce or to detect an error, take that action. */ yyn += yytoken; if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) goto yydefault; yyn = yytable[yyn]; if (yyn <= 0) { if (yyn == 0 || yyn == YYTABLE_NINF) goto yyerrlab; yyn = -yyn; goto yyreduce; } /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; /* Shift the lookahead token. */ YY_SYMBOL_PRINT("Shifting", yytoken, &yylval, &yylloc); /* Discard the shifted token. */ yychar = YYEMPTY; yystate = yyn; *++yyvsp = yylval; goto yynewstate; /*-----------------------------------------------------------. | yydefault -- do the default action for the current state. | `-----------------------------------------------------------*/ yydefault: yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; goto yyreduce; /*-----------------------------. | yyreduce -- Do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: `$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison users should not rely upon it. Assigning to YYVAL unconditionally makes the parser a bit smaller, and it avoids a GCC warning that YYVAL may be used uninitialized. */ yyval = yyvsp[1 - yylen]; YY_REDUCE_PRINT(yyn); switch (yyn) { case 2: /* Line 1464 of yacc.c */ #line 96 "../../../../cgdb/lib/gdbmi/src/gdbmi_grammar.y" { gdbmi_pdata->tree = (yyvsp[(1) - (1)].u_output); } break; case 3: /* Line 1464 of yacc.c */ #line 100 "../../../../cgdb/lib/gdbmi/src/gdbmi_grammar.y" { gdbmi_pdata->tree = append_gdbmi_output(gdbmi_pdata->tree, (yyvsp[(2) - (2)].u_output)); gdbmi_pdata->parsed_one = 1; } break; case 4: /* Line 1464 of yacc.c */ #line 105 "../../../../cgdb/lib/gdbmi/src/gdbmi_grammar.y" { (yyval.u_output) = create_gdbmi_output(); (yyval.u_output)->oob_record = (yyvsp[(1) - (6)].u_oob_record); (yyval.u_output)->result_record = (yyvsp[(2) - (6)].u_result_record); if (strcmp("gdb", (yyvsp[(4) - (6)].u_variable)) != 0) gdbmi_error(gdbmi_pdata, "Syntax error, expected 'gdb'"); free((yyvsp[(4) - (6)].u_variable)); } break; case 5: /* Line 1464 of yacc.c */ #line 116 "../../../../cgdb/lib/gdbmi/src/gdbmi_grammar.y" { (yyval.u_oob_record) = NULL; } break; case 6: /* Line 1464 of yacc.c */ #line 120 "../../../../cgdb/lib/gdbmi/src/gdbmi_grammar.y" { (yyval.u_oob_record) = append_gdbmi_oob_record((yyvsp[(1) - (3)].u_oob_record), (yyvsp[(2) - (3)].u_oob_record)); } break; case 7: /* Line 1464 of yacc.c */ #line 124 "../../../../cgdb/lib/gdbmi/src/gdbmi_grammar.y" { (yyval.u_result_record) = NULL; } break; case 8: /* Line 1464 of yacc.c */ #line 128 "../../../../cgdb/lib/gdbmi/src/gdbmi_grammar.y" { (yyval.u_result_record) = (yyvsp[(1) - (2)].u_result_record); } break; case 9: /* Line 1464 of yacc.c */ #line 132 "../../../../cgdb/lib/gdbmi/src/gdbmi_grammar.y" { (yyval.u_result_record) = create_gdbmi_result_record(); (yyval.u_result_record)->token = (yyvsp[(1) - (3)].u_token); (yyval.u_result_record)->result_class = (yyvsp[(3) - (3)].u_result_class); (yyval.u_result_record)->result = NULL; } break; case 10: /* Line 1464 of yacc.c */ #line 139 "../../../../cgdb/lib/gdbmi/src/gdbmi_grammar.y" { (yyval.u_result_record) = create_gdbmi_result_record(); (yyval.u_result_record)->token = (yyvsp[(1) - (5)].u_token); (yyval.u_result_record)->result_class = (yyvsp[(3) - (5)].u_result_class); (yyval.u_result_record)->result = (yyvsp[(5) - (5)].u_result); } break; case 11: /* Line 1464 of yacc.c */ #line 146 "../../../../cgdb/lib/gdbmi/src/gdbmi_grammar.y" { (yyval.u_oob_record) = create_gdbmi_oob_record(); (yyval.u_oob_record)->record = GDBMI_ASYNC; (yyval.u_oob_record)->option.async_record = (yyvsp[(1) - (1)].u_async_record); } break; case 12: /* Line 1464 of yacc.c */ #line 152 "../../../../cgdb/lib/gdbmi/src/gdbmi_grammar.y" { (yyval.u_oob_record) = create_gdbmi_oob_record(); (yyval.u_oob_record)->record = GDBMI_STREAM; (yyval.u_oob_record)->option.stream_record = (yyvsp[(1) - (1)].u_stream_record); } break; case 13: /* Line 1464 of yacc.c */ #line 158 "../../../../cgdb/lib/gdbmi/src/gdbmi_grammar.y" { (yyval.u_async_record) = create_gdbmi_async_record(); (yyval.u_async_record)->token = (yyvsp[(1) - (3)].u_token); (yyval.u_async_record)->async_record = (yyvsp[(2) - (3)].u_async_record_choice); (yyval.u_async_record)->async_class = (yyvsp[(3) - (3)].u_async_class); } break; case 14: /* Line 1464 of yacc.c */ #line 165 "../../../../cgdb/lib/gdbmi/src/gdbmi_grammar.y" { (yyval.u_async_record) = create_gdbmi_async_record(); (yyval.u_async_record)->token = (yyvsp[(1) - (5)].u_token); (yyval.u_async_record)->async_record = (yyvsp[(2) - (5)].u_async_record_choice); (yyval.u_async_record)->async_class = (yyvsp[(3) - (5)].u_async_class); (yyval.u_async_record)->result = (yyvsp[(5) - (5)].u_result); } break; case 15: /* Line 1464 of yacc.c */ #line 173 "../../../../cgdb/lib/gdbmi/src/gdbmi_grammar.y" { (yyval.u_async_record_choice) = GDBMI_EXEC; } break; case 16: /* Line 1464 of yacc.c */ #line 177 "../../../../cgdb/lib/gdbmi/src/gdbmi_grammar.y" { (yyval.u_async_record_choice) = GDBMI_STATUS; } break; case 17: /* Line 1464 of yacc.c */ #line 181 "../../../../cgdb/lib/gdbmi/src/gdbmi_grammar.y" { (yyval.u_async_record_choice) = GDBMI_NOTIFY; } break; case 18: /* Line 1464 of yacc.c */ #line 185 "../../../../cgdb/lib/gdbmi/src/gdbmi_grammar.y" { if (strcmp("done", gdbmi_text) == 0) (yyval.u_result_class) = GDBMI_DONE; else if (strcmp("running", gdbmi_text) == 0) (yyval.u_result_class) = GDBMI_RUNNING; else if (strcmp("connected", gdbmi_text) == 0) (yyval.u_result_class) = GDBMI_CONNECTED; else if (strcmp("error", gdbmi_text) == 0) (yyval.u_result_class) = GDBMI_ERROR; else if (strcmp("exit", gdbmi_text) == 0) (yyval.u_result_class) = GDBMI_EXIT; else gdbmi_error(gdbmi_pdata, "Syntax error, expected 'done|running|connected|error|exit"); } break; case 19: /* Line 1464 of yacc.c */ #line 200 "../../../../cgdb/lib/gdbmi/src/gdbmi_grammar.y" { if (strcmp("stopped", gdbmi_text) != 0) gdbmi_error(gdbmi_pdata, "Syntax error, expected 'stopped'"); (yyval.u_async_class) = GDBMI_STOPPED; } break; case 20: /* Line 1464 of yacc.c */ #line 207 "../../../../cgdb/lib/gdbmi/src/gdbmi_grammar.y" { (yyval.u_result) = append_gdbmi_result(NULL, (yyvsp[(1) - (1)].u_result)); } break; case 21: /* Line 1464 of yacc.c */ #line 211 "../../../../cgdb/lib/gdbmi/src/gdbmi_grammar.y" { (yyval.u_result) = append_gdbmi_result((yyvsp[(1) - (3)].u_result), (yyvsp[(3) - (3)].u_result)); } break; case 22: /* Line 1464 of yacc.c */ #line 215 "../../../../cgdb/lib/gdbmi/src/gdbmi_grammar.y" { (yyval.u_result) = create_gdbmi_result(); (yyval.u_result)->variable = (yyvsp[(1) - (3)].u_variable); (yyval.u_result)->value = (yyvsp[(3) - (3)].u_value); } break; case 23: /* Line 1464 of yacc.c */ #line 221 "../../../../cgdb/lib/gdbmi/src/gdbmi_grammar.y" { (yyval.u_variable) = strdup(gdbmi_text); } break; case 24: /* Line 1464 of yacc.c */ #line 225 "../../../../cgdb/lib/gdbmi/src/gdbmi_grammar.y" { (yyval.u_value) = append_gdbmi_value(NULL, (yyvsp[(1) - (1)].u_value)); } break; case 25: /* Line 1464 of yacc.c */ #line 229 "../../../../cgdb/lib/gdbmi/src/gdbmi_grammar.y" { (yyval.u_value) = append_gdbmi_value((yyvsp[(1) - (3)].u_value), (yyvsp[(3) - (3)].u_value)); } break; case 26: /* Line 1464 of yacc.c */ #line 233 "../../../../cgdb/lib/gdbmi/src/gdbmi_grammar.y" { (yyval.u_value) = create_gdbmi_value(); (yyval.u_value)->value_choice = GDBMI_CSTRING; (yyval.u_value)->option.cstring = strdup(gdbmi_text); } break; case 27: /* Line 1464 of yacc.c */ #line 239 "../../../../cgdb/lib/gdbmi/src/gdbmi_grammar.y" { (yyval.u_value) = create_gdbmi_value(); (yyval.u_value)->value_choice = GDBMI_TUPLE; (yyval.u_value)->option.tuple = (yyvsp[(1) - (1)].u_tuple); } break; case 28: /* Line 1464 of yacc.c */ #line 245 "../../../../cgdb/lib/gdbmi/src/gdbmi_grammar.y" { (yyval.u_value) = create_gdbmi_value(); (yyval.u_value)->value_choice = GDBMI_LIST; (yyval.u_value)->option.list = (yyvsp[(1) - (1)].u_list); } break; case 29: /* Line 1464 of yacc.c */ #line 251 "../../../../cgdb/lib/gdbmi/src/gdbmi_grammar.y" { (yyval.u_tuple) = NULL; } break; case 30: /* Line 1464 of yacc.c */ #line 255 "../../../../cgdb/lib/gdbmi/src/gdbmi_grammar.y" { (yyval.u_tuple) = create_gdbmi_tuple(); (yyval.u_tuple)->result = (yyvsp[(2) - (3)].u_result); } break; case 31: /* Line 1464 of yacc.c */ #line 260 "../../../../cgdb/lib/gdbmi/src/gdbmi_grammar.y" { (yyval.u_list) = NULL; } break; case 32: /* Line 1464 of yacc.c */ #line 264 "../../../../cgdb/lib/gdbmi/src/gdbmi_grammar.y" { (yyval.u_list) = create_gdbmi_list(); (yyval.u_list)->list_choice = GDBMI_VALUE; (yyval.u_list)->option.value = (yyvsp[(2) - (3)].u_value); } break; case 33: /* Line 1464 of yacc.c */ #line 270 "../../../../cgdb/lib/gdbmi/src/gdbmi_grammar.y" { (yyval.u_list) = create_gdbmi_list(); (yyval.u_list)->list_choice = GDBMI_RESULT; (yyval.u_list)->option.result = (yyvsp[(2) - (3)].u_result); } break; case 34: /* Line 1464 of yacc.c */ #line 276 "../../../../cgdb/lib/gdbmi/src/gdbmi_grammar.y" { (yyval.u_stream_record) = create_gdbmi_stream_record(); (yyval.u_stream_record)->stream_record = (yyvsp[(1) - (2)].u_stream_record_choice); (yyval.u_stream_record)->cstring = strdup(gdbmi_text); } break; case 35: /* Line 1464 of yacc.c */ #line 282 "../../../../cgdb/lib/gdbmi/src/gdbmi_grammar.y" { (yyval.u_stream_record_choice) = GDBMI_CONSOLE; } break; case 36: /* Line 1464 of yacc.c */ #line 286 "../../../../cgdb/lib/gdbmi/src/gdbmi_grammar.y" { (yyval.u_stream_record_choice) = GDBMI_TARGET; } break; case 37: /* Line 1464 of yacc.c */ #line 290 "../../../../cgdb/lib/gdbmi/src/gdbmi_grammar.y" { (yyval.u_stream_record_choice) = GDBMI_LOG; } break; case 38: /* Line 1464 of yacc.c */ #line 294 "../../../../cgdb/lib/gdbmi/src/gdbmi_grammar.y" { (yyval.u_token) = -1; } break; case 39: /* Line 1464 of yacc.c */ #line 298 "../../../../cgdb/lib/gdbmi/src/gdbmi_grammar.y" { (yyval.u_token) = (yyvsp[(1) - (1)].u_token); } break; case 40: /* Line 1464 of yacc.c */ #line 302 "../../../../cgdb/lib/gdbmi/src/gdbmi_grammar.y" { (yyval.u_token) = atol(gdbmi_text); } break; /* Line 1464 of yacc.c */ #line 1934 "../../../../cgdb/lib/gdbmi/src/gdbmi_grammar.c" default: break; } YY_SYMBOL_PRINT("-> $$ =", yyr1[yyn], &yyval, &yyloc); YYPOPSTACK(yylen); yylen = 0; YY_STACK_PRINT(yyss, yyssp); *++yyvsp = yyval; /* Now `shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ yyn = yyr1[yyn]; yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) yystate = yytable[yystate]; else yystate = yydefgoto[yyn - YYNTOKENS]; goto yynewstate; /*------------------------------------. | yyerrlab -- here on detecting error | `------------------------------------*/ yyerrlab: /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { ++yynerrs; #if ! YYERROR_VERBOSE yyerror(gdbmi_pdata, YY_("syntax error")); #else { YYSIZE_T yysize = yysyntax_error(0, yystate, yychar); if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) { YYSIZE_T yyalloc = 2 * yysize; if (!(yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) yyalloc = YYSTACK_ALLOC_MAXIMUM; if (yymsg != yymsgbuf) YYSTACK_FREE(yymsg); yymsg = (char *) YYSTACK_ALLOC(yyalloc); if (yymsg) yymsg_alloc = yyalloc; else { yymsg = yymsgbuf; yymsg_alloc = sizeof yymsgbuf; } } if (0 < yysize && yysize <= yymsg_alloc) { (void) yysyntax_error(yymsg, yystate, yychar); yyerror(gdbmi_pdata, yymsg); } else { yyerror(gdbmi_pdata, YY_("syntax error")); if (yysize != 0) goto yyexhaustedlab; } } #endif } if (yyerrstatus == 3) { /* If just tried and failed to reuse lookahead token after an error, discard it. */ if (yychar <= YYEOF) { /* Return failure if at end of input. */ if (yychar == YYEOF) YYABORT; } else { yydestruct("Error: discarding", yytoken, &yylval, gdbmi_pdata); yychar = YYEMPTY; } } /* Else will try to reuse lookahead token after shifting the error token. */ goto yyerrlab1; /*---------------------------------------------------. | yyerrorlab -- error raised explicitly by YYERROR. | `---------------------------------------------------*/ yyerrorlab: /* Pacify compilers like GCC when the user code never invokes YYERROR and the label yyerrorlab therefore never appears in user code. */ if ( /*CONSTCOND*/ 0) goto yyerrorlab; /* Do not reclaim the symbols of the rule which action triggered this YYERROR. */ YYPOPSTACK(yylen); yylen = 0; YY_STACK_PRINT(yyss, yyssp); yystate = *yyssp; goto yyerrlab1; /*-------------------------------------------------------------. | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) { yyn = yypact[yystate]; if (yyn != YYPACT_NINF) { yyn += YYTERROR; if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) { yyn = yytable[yyn]; if (0 < yyn) break; } } /* Pop the current state because it cannot handle the error token. */ if (yyssp == yyss) YYABORT; yydestruct("Error: popping", yystos[yystate], yyvsp, gdbmi_pdata); YYPOPSTACK(1); yystate = *yyssp; YY_STACK_PRINT(yyss, yyssp); } *++yyvsp = yylval; /* Shift the error token. */ YY_SYMBOL_PRINT("Shifting", yystos[yyn], yyvsp, yylsp); yystate = yyn; goto yynewstate; /*-------------------------------------. | yyacceptlab -- YYACCEPT comes here. | `-------------------------------------*/ yyacceptlab: yyresult = 0; goto yyreturn; /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ yyabortlab: yyresult = 1; goto yyreturn; #if !defined(yyoverflow) || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ yyexhaustedlab: yyerror(gdbmi_pdata, YY_("memory exhausted")); yyresult = 2; /* Fall through. */ #endif yyreturn: if (yychar != YYEMPTY) yydestruct("Cleanup: discarding lookahead", yytoken, &yylval, gdbmi_pdata); /* Do not reclaim the symbols of the rule which action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK(yylen); YY_STACK_PRINT(yyss, yyssp); while (yyssp != yyss) { yydestruct("Cleanup: popping", yystos[*yyssp], yyvsp, gdbmi_pdata); YYPOPSTACK(1); } #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE(yyss); #endif yyps->yynew = 1; yypushreturn: #if YYERROR_VERBOSE if (yymsg != yymsgbuf) YYSTACK_FREE(yymsg); #endif /* Make sure YYID is used. */ return YYID(yyresult); } cgdb-0.6.7/lib/gdbmi/gdbmi_grammar.h000644 000765 000024 00000010333 12074441140 020176 0ustar00mmuellerstaff000000 000000 /* A Bison parser, made by GNU Bison 2.3a+. */ /* Skeleton interface for Bison's Yacc-like parsers in C Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. 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 3 of the License, 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. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton. Alternatively, if you modify or redistribute the parser skeleton itself, you may (at your option) remove this special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ /* "%code requires" blocks. */ /* Line 1685 of yacc.c */ #line 5 "../../../../cgdb/lib/gdbmi/src/gdbmi_grammar.y" struct gdbmi_pdata; /* Line 1685 of yacc.c */ #line 44 "../../../../cgdb/lib/gdbmi/src/gdbmi_grammar.h" /* Tokens. */ #ifndef YYTOKENTYPE #define YYTOKENTYPE /* Put the tokens into the symbol table, so that GDB and other debuggers know about them. */ enum yytokentype { OPEN_BRACE = 258, CLOSED_BRACE = 259, OPEN_PAREN = 260, CLOSED_PAREN = 261, ADD_OP = 262, MULT_OP = 263, EQUAL_SIGN = 264, TILDA = 265, AT_SYMBOL = 266, AMPERSAND = 267, OPEN_BRACKET = 268, CLOSED_BRACKET = 269, NEWLINE = 270, INTEGER_LITERAL = 271, STRING_LITERAL = 272, CSTRING = 273, COMMA = 274, CARROT = 275 }; #endif /* Tokens. */ #define OPEN_BRACE 258 #define CLOSED_BRACE 259 #define OPEN_PAREN 260 #define CLOSED_PAREN 261 #define ADD_OP 262 #define MULT_OP 263 #define EQUAL_SIGN 264 #define TILDA 265 #define AT_SYMBOL 266 #define AMPERSAND 267 #define OPEN_BRACKET 268 #define CLOSED_BRACKET 269 #define NEWLINE 270 #define INTEGER_LITERAL 271 #define STRING_LITERAL 272 #define CSTRING 273 #define COMMA 274 #define CARROT 275 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE { /* Line 1685 of yacc.c */ #line 53 "../../../../cgdb/lib/gdbmi/src/gdbmi_grammar.y" struct gdbmi_output *u_output; struct gdbmi_oob_record *u_oob_record; struct gdbmi_result_record *u_result_record; int u_result_class; int u_async_record_choice; struct gdbmi_result *u_result; long u_token; struct gdbmi_async_record *u_async_record; struct gdbmi_stream_record *u_stream_record; int u_async_class; char *u_variable; struct gdbmi_value *u_value; struct gdbmi_tuple *u_tuple; struct gdbmi_list *u_list; int u_stream_record_choice; /* Line 1685 of yacc.c */ #line 121 "../../../../cgdb/lib/gdbmi/src/gdbmi_grammar.h" } YYSTYPE; #define YYSTYPE_IS_TRIVIAL 1 #define yystype YYSTYPE /* obsolescent; will be withdrawn */ #define YYSTYPE_IS_DECLARED 1 #endif #ifndef YYPUSH_DECLS #define YYPUSH_DECLS struct gdbmi_pstate; typedef struct gdbmi_pstate gdbmi_pstate; enum { YYPUSH_MORE = 4 }; #if defined __STDC__ || defined __cplusplus int gdbmi_push_parse(gdbmi_pstate * yyps, int yypushed_char, YYSTYPE const *yypushed_val, struct gdbmi_pdata *gdbmi_pdata); #else int gdbmi_push_parse(); #endif #if defined __STDC__ || defined __cplusplus gdbmi_pstate *gdbmi_pstate_new(void); #else gdbmi_pstate *gdbmi_pstate_new(); #endif #if defined __STDC__ || defined __cplusplus void gdbmi_pstate_delete(gdbmi_pstate * yyps); #else void gdbmi_pstate_delete(); #endif #endif cgdb-0.6.7/lib/gdbmi/gdbmi_grammar.y000644 000765 000024 00000015107 12074441140 020223 0ustar00mmuellerstaff000000 000000 %name-prefix="gdbmi_" %define api.pure %define api.push_pull "push" %defines %code requires { struct gdbmi_pdata; } %parse-param { struct gdbmi_pdata *gdbmi_pdata } %{ #include #include #include #include "gdbmi_pt.h" extern char *gdbmi_text; extern int gdbmi_lex (void); extern int gdbmi_lineno; void gdbmi_error (gdbmi_pdata_ptr gdbmi_pdata, const char *s) { fprintf (stderr, "%s:%d Error %s", __FILE__, __LINE__, s); if (strcmp (gdbmi_text, "\n") == 0) fprintf (stderr, "%s:%d at end of line %d\n", __FILE__, __LINE__, gdbmi_lineno); else { fprintf (stderr, "%s:%d at token(%s), line (%d)\n", __FILE__, __LINE__, gdbmi_text, gdbmi_lineno ); gdbmi_lex(); fprintf (stderr, "%s:%d before (%s)\n", __FILE__, __LINE__, gdbmi_text); } } %} %token OPEN_BRACE /* { */ %token CLOSED_BRACE /* } */ %token OPEN_PAREN /* ( */ %token CLOSED_PAREN /* ) */ %token ADD_OP /* + */ %token MULT_OP /* * */ %token EQUAL_SIGN /* = */ %token TILDA /* ~ */ %token AT_SYMBOL /* @ */ %token AMPERSAND /* & */ %token OPEN_BRACKET /* [ */ %token CLOSED_BRACKET /* ] */ %token NEWLINE /* \n \r\n \r */ %token INTEGER_LITERAL /* A number 1234 */ %token STRING_LITERAL /* A string literal */ %token CSTRING /* "a string like \" this " */ %token COMMA /* , */ %token CARROT /* ^ */ %union { struct gdbmi_output *u_output; struct gdbmi_oob_record *u_oob_record; struct gdbmi_result_record *u_result_record; int u_result_class; int u_async_record_choice; struct gdbmi_result *u_result; long u_token; struct gdbmi_async_record *u_async_record; struct gdbmi_stream_record *u_stream_record; int u_async_class; char *u_variable; struct gdbmi_value *u_value; struct gdbmi_tuple *u_tuple; struct gdbmi_list *u_list; int u_stream_record_choice; } %type output_list %type output %type oob_record %type opt_oob_record_list %type opt_result_record %type result_record %type result_class %type async_record_class %type result_list %type result %type opt_token %type token %type async_record %type stream_record %type async_class %type variable %type value %type value_list %type tuple %type list %type stream_record_class %start output_list %% output_list: output { gdbmi_pdata->tree = $1; }; output_list: output_list output { gdbmi_pdata->tree = append_gdbmi_output (gdbmi_pdata->tree, $2); gdbmi_pdata->parsed_one = 1; }; output: opt_oob_record_list opt_result_record OPEN_PAREN variable CLOSED_PAREN NEWLINE { $$ = create_gdbmi_output (); $$->oob_record = $1; $$->result_record = $2; if (strcmp ("gdb", $4) != 0) gdbmi_error (gdbmi_pdata, "Syntax error, expected 'gdb'"); free ($4); } ; opt_oob_record_list: { $$ = NULL; }; opt_oob_record_list: opt_oob_record_list oob_record NEWLINE { $$ = append_gdbmi_oob_record ($1, $2); }; opt_result_record: { $$ = NULL; }; opt_result_record: result_record NEWLINE { $$ = $1; }; result_record: opt_token CARROT result_class { $$ = create_gdbmi_result_record (); $$->token = $1; $$->result_class = $3; $$->result = NULL; }; result_record: opt_token CARROT result_class COMMA result_list { $$ = create_gdbmi_result_record (); $$->token = $1; $$->result_class = $3; $$->result = $5; }; oob_record: async_record { $$ = create_gdbmi_oob_record(); $$->record = GDBMI_ASYNC; $$->option.async_record = $1; }; oob_record: stream_record { $$ = create_gdbmi_oob_record(); $$->record = GDBMI_STREAM; $$->option.stream_record = $1; }; async_record: opt_token async_record_class async_class { $$ = create_gdbmi_async_record (); $$->token = $1; $$->async_record = $2; $$->async_class = $3; }; async_record: opt_token async_record_class async_class COMMA result_list { $$ = create_gdbmi_async_record (); $$->token = $1; $$->async_record = $2; $$->async_class = $3; $$->result = $5; }; async_record_class: MULT_OP { $$ = GDBMI_EXEC; }; async_record_class: ADD_OP { $$ = GDBMI_STATUS; }; async_record_class: EQUAL_SIGN { $$ = GDBMI_NOTIFY; }; result_class: STRING_LITERAL { if (strcmp ("done", gdbmi_text) == 0) $$ = GDBMI_DONE; else if (strcmp ("running", gdbmi_text) == 0) $$ = GDBMI_RUNNING; else if (strcmp ("connected", gdbmi_text) == 0) $$ = GDBMI_CONNECTED; else if (strcmp ("error", gdbmi_text) == 0) $$ = GDBMI_ERROR; else if (strcmp ("exit", gdbmi_text) == 0) $$ = GDBMI_EXIT; else gdbmi_error (gdbmi_pdata, "Syntax error, expected 'done|running|connected|error|exit"); }; async_class: STRING_LITERAL { if (strcmp ("stopped", gdbmi_text) != 0) gdbmi_error (gdbmi_pdata, "Syntax error, expected 'stopped'" ); $$ = GDBMI_STOPPED; }; result_list: result { $$ = append_gdbmi_result (NULL, $1); }; result_list: result_list COMMA result { $$ = append_gdbmi_result ($1, $3); }; result: variable EQUAL_SIGN value { $$ = create_gdbmi_result (); $$->variable = $1; $$->value = $3; }; variable: STRING_LITERAL { $$ = strdup (gdbmi_text); }; value_list: value { $$ = append_gdbmi_value (NULL, $1); }; value_list: value_list COMMA value { $$ = append_gdbmi_value ($1, $3); }; value: CSTRING { $$ = create_gdbmi_value (); $$->value_choice = GDBMI_CSTRING; $$->option.cstring = strdup (gdbmi_text); }; value: tuple { $$ = create_gdbmi_value (); $$->value_choice = GDBMI_TUPLE; $$->option.tuple = $1; }; value: list { $$ = create_gdbmi_value (); $$->value_choice = GDBMI_LIST; $$->option.list = $1; }; tuple: OPEN_BRACE CLOSED_BRACE { $$ = NULL; }; tuple: OPEN_BRACE result_list CLOSED_BRACE { $$ = create_gdbmi_tuple (); $$->result = $2; }; list: OPEN_BRACKET CLOSED_BRACKET { $$ = NULL; }; list: OPEN_BRACKET value_list CLOSED_BRACKET { $$ = create_gdbmi_list (); $$->list_choice = GDBMI_VALUE; $$->option.value = $2; }; list: OPEN_BRACKET result_list CLOSED_BRACKET { $$ = create_gdbmi_list (); $$->list_choice = GDBMI_RESULT; $$->option.result = $2; }; stream_record: stream_record_class CSTRING { $$ = create_gdbmi_stream_record (); $$->stream_record = $1; $$->cstring = strdup ( gdbmi_text ); }; stream_record_class: TILDA { $$ = GDBMI_CONSOLE; }; stream_record_class: AT_SYMBOL { $$ = GDBMI_TARGET; }; stream_record_class: AMPERSAND { $$ = GDBMI_LOG; }; opt_token: { $$ = -1; }; opt_token: token { $$ = $1; }; token: INTEGER_LITERAL { $$ = atol (gdbmi_text); }; cgdb-0.6.7/lib/gdbmi/gdbmi_lexer.c000644 000765 000024 00000143477 12074766273 017723 0ustar00mmuellerstaff000000 000000 #line 2 "gdbmi_lexer.c" #line 4 "gdbmi_lexer.c" #define YY_INT_ALIGNED short int /* A lexical scanner generated by flex */ #define yy_create_buffer gdbmi__create_buffer #define yy_delete_buffer gdbmi__delete_buffer #define yy_flex_debug gdbmi__flex_debug #define yy_init_buffer gdbmi__init_buffer #define yy_flush_buffer gdbmi__flush_buffer #define yy_load_buffer_state gdbmi__load_buffer_state #define yy_switch_to_buffer gdbmi__switch_to_buffer #define yyin gdbmi_in #define yyleng gdbmi_leng #define yylex gdbmi_lex #define yylineno gdbmi_lineno #define yyout gdbmi_out #define yyrestart gdbmi_restart #define yytext gdbmi_text #define yywrap gdbmi_wrap #define yyalloc gdbmi_alloc #define yyrealloc gdbmi_realloc #define yyfree gdbmi_free #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 #define YY_FLEX_SUBMINOR_VERSION 35 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif /* First, we deal with platform-specific or compiler-specific issues. */ /* begin standard C headers. */ #include #include #include #include /* end standard C headers. */ /* flex integer type definitions */ #ifndef FLEXINT_H #define FLEXINT_H /* C99 systems have . Non-C99 systems may or may not. */ #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, * if you want the limit (max/min) macros for int types. */ #ifndef __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS 1 #endif #include typedef int8_t flex_int8_t; typedef uint8_t flex_uint8_t; typedef int16_t flex_int16_t; typedef uint16_t flex_uint16_t; typedef int32_t flex_int32_t; typedef uint32_t flex_uint32_t; typedef uint64_t flex_uint64_t; #else typedef signed char flex_int8_t; typedef short int flex_int16_t; typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; #endif /* ! C99 */ /* Limits of integral types. */ #ifndef INT8_MIN #define INT8_MIN (-128) #endif #ifndef INT16_MIN #define INT16_MIN (-32767-1) #endif #ifndef INT32_MIN #define INT32_MIN (-2147483647-1) #endif #ifndef INT8_MAX #define INT8_MAX (127) #endif #ifndef INT16_MAX #define INT16_MAX (32767) #endif #ifndef INT32_MAX #define INT32_MAX (2147483647) #endif #ifndef UINT8_MAX #define UINT8_MAX (255U) #endif #ifndef UINT16_MAX #define UINT16_MAX (65535U) #endif #ifndef UINT32_MAX #define UINT32_MAX (4294967295U) #endif #endif /* ! FLEXINT_H */ #ifdef __cplusplus /* The "const" storage-class-modifier is valid. */ #define YY_USE_CONST #else /* ! __cplusplus */ /* C99 requires __STDC__ to be defined as 1. */ #if defined (__STDC__) #define YY_USE_CONST #endif /* defined (__STDC__) */ #endif /* ! __cplusplus */ #ifdef YY_USE_CONST #define yyconst const #else #define yyconst #endif /* Returned upon end-of-file. */ #define YY_NULL 0 /* Promotes a possibly negative, possibly signed char to an unsigned * integer for use as an array index. If the signed char is negative, * we want to instead treat it as an 8-bit unsigned char, hence the * double cast. */ #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) /* Enter a start condition. This macro really ought to take a parameter, * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ #define BEGIN (yy_start) = 1 + 2 * /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ #define YY_START (((yy_start) - 1) / 2) #define YYSTATE YY_START /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) /* Special action meaning "start processing a new file". */ #define YY_NEW_FILE gdbmi_restart(gdbmi_in ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ #ifndef YY_BUF_SIZE #define YY_BUF_SIZE 16384 #endif /* The state buf must be large enough to hold one state per character in the main buffer. */ #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) #ifndef YY_TYPEDEF_YY_BUFFER_STATE #define YY_TYPEDEF_YY_BUFFER_STATE typedef struct yy_buffer_state *YY_BUFFER_STATE; #endif #ifndef YY_TYPEDEF_YY_SIZE_T #define YY_TYPEDEF_YY_SIZE_T typedef size_t yy_size_t; #endif extern yy_size_t gdbmi_leng; extern FILE *gdbmi_in, *gdbmi_out; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires * access to the local variable yy_act. Since yyless() is a macro, it would break * existing scanners that call yyless() from OUTSIDE gdbmi_lex. * One obvious solution it to make yy_act a global. I tried that, and saw * a 5% performance hit in a non-gdbmi_lineno scanner, because yy_act is * normally declared as a register variable-- so it is not worth it. */ #define YY_LESS_LINENO(n) \ do { \ yy_size_t yyl;\ for ( yyl = n; yyl < gdbmi_leng; ++yyl )\ if ( gdbmi_text[yyl] == '\n' )\ --gdbmi_lineno;\ }while(0) /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ do \ { \ /* Undo effects of setting up gdbmi_text. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ *yy_cp = (yy_hold_char); \ YY_RESTORE_YY_MORE_OFFSET \ (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ YY_DO_BEFORE_ACTION; /* set up gdbmi_text again */ \ } \ while ( 0 ) #define unput(c) yyunput( c, (yytext_ptr) ) #ifndef YY_STRUCT_YY_BUFFER_STATE #define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state { FILE *yy_input_file; char *yy_ch_buf; /* input buffer */ char *yy_buf_pos; /* current position in input buffer */ /* Size of input buffer in bytes, not including room for EOB * characters. */ yy_size_t yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. */ yy_size_t yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to * delete it. */ int yy_is_our_buffer; /* Whether this is an "interactive" input source; if so, and * if we're using stdio for input, then we want to use getc() * instead of fread(), to make sure we stop fetching input after * each newline. */ int yy_is_interactive; /* Whether we're considered to be at the beginning of a line. * If so, '^' rules will be active on the next match, otherwise * not. */ int yy_at_bol; int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ /* Whether to try to fill the input buffer when we reach the * end of it. */ int yy_fill_buffer; int yy_buffer_status; #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 /* When an EOF's been seen but there's still some text to process * then we mark the buffer as YY_EOF_PENDING, to indicate that we * shouldn't try reading from the input source any more. We might * still have a bunch of tokens to match, though, because of * possible backing-up. * * When we actually see the EOF, we change the status to "new" * (via gdbmi_restart()), so that the user can continue scanning by * just pointing gdbmi_in at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 }; #endif /* !YY_STRUCT_YY_BUFFER_STATE */ /* Stack of input buffers. */ static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general * "scanner state". * * Returns the top of the stack, or NULL. */ #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ : NULL) /* Same as previous macro, but useful when we know that the buffer stack is not * NULL or when we need an lvalue. For internal use only. */ #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] /* yy_hold_char holds the character lost when gdbmi_text is formed. */ static char yy_hold_char; static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ yy_size_t gdbmi_leng; /* Points to current character in buffer. */ static char *yy_c_buf_p = (char *) 0; static int yy_init = 0; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ /* Flag which is used to allow gdbmi_wrap()'s to do buffer switches * instead of setting up a fresh gdbmi_in. A bit of a hack ... */ static int yy_did_buffer_switch_on_eof; void gdbmi_restart (FILE *input_file ); void gdbmi__switch_to_buffer (YY_BUFFER_STATE new_buffer ); YY_BUFFER_STATE gdbmi__create_buffer (FILE *file,int size ); void gdbmi__delete_buffer (YY_BUFFER_STATE b ); void gdbmi__flush_buffer (YY_BUFFER_STATE b ); void gdbmi_push_buffer_state (YY_BUFFER_STATE new_buffer ); void gdbmi_pop_buffer_state (void ); static void gdbmi_ensure_buffer_stack (void ); static void gdbmi__load_buffer_state (void ); static void gdbmi__init_buffer (YY_BUFFER_STATE b,FILE *file ); #define YY_FLUSH_BUFFER gdbmi__flush_buffer(YY_CURRENT_BUFFER ) YY_BUFFER_STATE gdbmi__scan_buffer (char *base,yy_size_t size ); YY_BUFFER_STATE gdbmi__scan_string (yyconst char *yy_str ); YY_BUFFER_STATE gdbmi__scan_bytes (yyconst char *bytes,yy_size_t len ); void *gdbmi_alloc (yy_size_t ); void *gdbmi_realloc (void *,yy_size_t ); void gdbmi_free (void * ); #define yy_new_buffer gdbmi__create_buffer #define yy_set_interactive(is_interactive) \ { \ if ( ! YY_CURRENT_BUFFER ){ \ gdbmi_ensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ gdbmi__create_buffer(gdbmi_in,YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } #define yy_set_bol(at_bol) \ { \ if ( ! YY_CURRENT_BUFFER ){\ gdbmi_ensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ gdbmi__create_buffer(gdbmi_in,YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ } #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) /* Begin user sect3 */ typedef unsigned char YY_CHAR; FILE *gdbmi_in = (FILE *) 0, *gdbmi_out = (FILE *) 0; typedef int yy_state_type; extern int gdbmi_lineno; int gdbmi_lineno = 1; extern char *gdbmi_text; #define yytext_ptr gdbmi_text static yy_state_type yy_get_previous_state (void ); static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); static int yy_get_next_buffer (void ); static void yy_fatal_error (yyconst char msg[] ); /* Done after the current pattern has been matched and before the * corresponding action - sets up gdbmi_text. */ #define YY_DO_BEFORE_ACTION \ (yytext_ptr) = yy_bp; \ gdbmi_leng = (yy_size_t) (yy_cp - yy_bp); \ (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; #define YY_NUM_RULES 23 #define YY_END_OF_BUFFER 24 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info { flex_int32_t yy_verify; flex_int32_t yy_nxt; }; static yyconst flex_int16_t yy_accept[33] = { 0, 0, 0, 24, 21, 19, 15, 17, 21, 8, 13, 14, 4, 3, 2, 18, 5, 7, 20, 9, 10, 1, 11, 12, 6, 16, 0, 22, 0, 18, 20, 20, 0 } ; static yyconst flex_int32_t yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 2, 2, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 5, 1, 1, 1, 6, 1, 7, 8, 9, 10, 11, 12, 1, 1, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 1, 1, 1, 14, 1, 1, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 17, 18, 19, 20, 16, 1, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 21, 1, 22, 23, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } ; static yyconst flex_int32_t yy_meta[24] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } ; static yyconst flex_int16_t yy_base[34] = { 0, 0, 0, 42, 43, 43, 43, 38, 19, 43, 43, 43, 43, 43, 43, 26, 43, 43, 13, 43, 43, 43, 43, 43, 43, 43, 22, 43, 35, 22, 18, 20, 43, 27 } ; static yyconst flex_int16_t yy_def[34] = { 0, 32, 1, 32, 32, 32, 32, 32, 33, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 33, 32, 33, 32, 32, 32, 0, 32 } ; static yyconst flex_int16_t yy_nxt[67] = { 0, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 4, 15, 16, 17, 18, 19, 4, 20, 21, 22, 23, 24, 27, 30, 30, 27, 26, 31, 30, 30, 30, 30, 30, 29, 31, 28, 32, 29, 28, 25, 32, 3, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32 } ; static yyconst flex_int16_t yy_chk[67] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 18, 18, 26, 33, 18, 30, 30, 31, 31, 30, 29, 31, 8, 28, 15, 26, 7, 3, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32 } ; /* Table of booleans, true if rule could match eol. */ static yyconst flex_int32_t yy_rule_can_match_eol[24] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, }; static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; extern int gdbmi__flex_debug; int gdbmi__flex_debug = 0; /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. */ #define REJECT reject_used_but_not_detected #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *gdbmi_text; #line 1 "/Users/mmueller/mike/dev/cgdb/lib/gdbmi/gdbmi_lexer.l" #line 11 "/Users/mmueller/mike/dev/cgdb/lib/gdbmi/gdbmi_lexer.l" #include #include "gdbmi_grammar.h" #line 516 "gdbmi_lexer.c" #define INITIAL 0 #ifndef YY_NO_UNISTD_H /* Special case for "unistd.h", since it is non-ANSI. We include it way * down here because we want the user's section 1 to have been scanned first. * The user has a chance to override it with an option. */ #include #endif #ifndef YY_EXTRA_TYPE #define YY_EXTRA_TYPE void * #endif static int yy_init_globals (void ); /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ int gdbmi_lex_destroy (void ); int gdbmi_get_debug (void ); void gdbmi_set_debug (int debug_flag ); YY_EXTRA_TYPE gdbmi_get_extra (void ); void gdbmi_set_extra (YY_EXTRA_TYPE user_defined ); FILE *gdbmi_get_in (void ); void gdbmi_set_in (FILE * in_str ); FILE *gdbmi_get_out (void ); void gdbmi_set_out (FILE * out_str ); yy_size_t gdbmi_get_leng (void ); char *gdbmi_get_text (void ); int gdbmi_get_lineno (void ); void gdbmi_set_lineno (int line_number ); /* Macros after this point can all be overridden by user definitions in * section 1. */ #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus extern "C" int gdbmi_wrap (void ); #else extern int gdbmi_wrap (void ); #endif #endif static void yyunput (int c,char *buf_ptr ); #ifndef yytext_ptr static void yy_flex_strncpy (char *,yyconst char *,int ); #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen (yyconst char * ); #endif #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (void ); #else static int input (void ); #endif #endif /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE #define YY_READ_BUF_SIZE 8192 #endif /* Copy whatever the last rule matched to the standard output. */ #ifndef ECHO /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ #define ECHO fwrite( gdbmi_text, gdbmi_leng, 1, gdbmi_out ) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, * is returned in "result". */ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ yy_size_t n; \ for ( n = 0; n < max_size && \ (c = getc( gdbmi_in )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ if ( c == '\n' ) \ buf[n++] = (char) c; \ if ( c == EOF && ferror( gdbmi_in ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ else \ { \ errno=0; \ while ( (result = fread(buf, 1, max_size, gdbmi_in))==0 && ferror(gdbmi_in)) \ { \ if( errno != EINTR) \ { \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ break; \ } \ errno=0; \ clearerr(gdbmi_in); \ } \ }\ \ #endif /* No semi-colon after return; correct usage is to write "yyterminate();" - * we don't want an extra ';' after the "return" because that will cause * some compilers to complain about unreachable statements. */ #ifndef yyterminate #define yyterminate() return YY_NULL #endif /* Number of entries by which start-condition stack grows. */ #ifndef YY_START_STACK_INCR #define YY_START_STACK_INCR 25 #endif /* Report a fatal error. */ #ifndef YY_FATAL_ERROR #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) #endif /* end tables serialization structures and prototypes */ /* Default declaration of generated scanner - a define so the user can * easily add parameters. */ #ifndef YY_DECL #define YY_DECL_IS_OURS 1 extern int gdbmi_lex (void); #define YY_DECL int gdbmi_lex (void) #endif /* !YY_DECL */ /* Code executed at the beginning of each rule, after gdbmi_text and gdbmi_leng * have been set up. */ #ifndef YY_USER_ACTION #define YY_USER_ACTION #endif /* Code executed at the end of each rule. */ #ifndef YY_BREAK #define YY_BREAK break; #endif #define YY_RULE_SETUP \ YY_USER_ACTION /** The main scanner function which does all the work. */ YY_DECL { register yy_state_type yy_current_state; register char *yy_cp, *yy_bp; register int yy_act; #line 16 "/Users/mmueller/mike/dev/cgdb/lib/gdbmi/gdbmi_lexer.l" #line 701 "gdbmi_lexer.c" if ( !(yy_init) ) { (yy_init) = 1; #ifdef YY_USER_INIT YY_USER_INIT; #endif if ( ! (yy_start) ) (yy_start) = 1; /* first start state */ if ( ! gdbmi_in ) gdbmi_in = stdin; if ( ! gdbmi_out ) gdbmi_out = stdout; if ( ! YY_CURRENT_BUFFER ) { gdbmi_ensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = gdbmi__create_buffer(gdbmi_in,YY_BUF_SIZE ); } gdbmi__load_buffer_state( ); } while ( 1 ) /* loops until end-of-file is reached */ { yy_cp = (yy_c_buf_p); /* Support of gdbmi_text. */ *yy_cp = (yy_hold_char); /* yy_bp points to the position in yy_ch_buf of the start of * the current run. */ yy_bp = yy_cp; yy_current_state = (yy_start); yy_match: do { register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 33 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } while ( yy_base[yy_current_state] != 43 ); yy_find_action: yy_act = yy_accept[yy_current_state]; if ( yy_act == 0 ) { /* have to back up */ yy_cp = (yy_last_accepting_cpos); yy_current_state = (yy_last_accepting_state); yy_act = yy_accept[yy_current_state]; } YY_DO_BEFORE_ACTION; if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] ) { yy_size_t yyl; for ( yyl = 0; yyl < gdbmi_leng; ++yyl ) if ( gdbmi_text[yyl] == '\n' ) gdbmi_lineno++; ; } do_action: /* This label is used only to access EOF actions. */ switch ( yy_act ) { /* beginning of action switch */ case 0: /* must back up */ /* undo the effects of YY_DO_BEFORE_ACTION */ *yy_cp = (yy_hold_char); yy_cp = (yy_last_accepting_cpos); yy_current_state = (yy_last_accepting_state); goto yy_find_action; case 1: YY_RULE_SETUP #line 18 "/Users/mmueller/mike/dev/cgdb/lib/gdbmi/gdbmi_lexer.l" { return CARROT; } YY_BREAK case 2: YY_RULE_SETUP #line 19 "/Users/mmueller/mike/dev/cgdb/lib/gdbmi/gdbmi_lexer.l" { return COMMA; } YY_BREAK case 3: YY_RULE_SETUP #line 20 "/Users/mmueller/mike/dev/cgdb/lib/gdbmi/gdbmi_lexer.l" { return ADD_OP; } YY_BREAK case 4: YY_RULE_SETUP #line 21 "/Users/mmueller/mike/dev/cgdb/lib/gdbmi/gdbmi_lexer.l" { return MULT_OP; } YY_BREAK case 5: YY_RULE_SETUP #line 22 "/Users/mmueller/mike/dev/cgdb/lib/gdbmi/gdbmi_lexer.l" { return EQUAL_SIGN; } YY_BREAK case 6: YY_RULE_SETUP #line 23 "/Users/mmueller/mike/dev/cgdb/lib/gdbmi/gdbmi_lexer.l" { return TILDA; } YY_BREAK case 7: YY_RULE_SETUP #line 24 "/Users/mmueller/mike/dev/cgdb/lib/gdbmi/gdbmi_lexer.l" { return AT_SYMBOL; } YY_BREAK case 8: YY_RULE_SETUP #line 25 "/Users/mmueller/mike/dev/cgdb/lib/gdbmi/gdbmi_lexer.l" { return AMPERSAND; } YY_BREAK case 9: YY_RULE_SETUP #line 26 "/Users/mmueller/mike/dev/cgdb/lib/gdbmi/gdbmi_lexer.l" { return OPEN_BRACKET; } YY_BREAK case 10: YY_RULE_SETUP #line 27 "/Users/mmueller/mike/dev/cgdb/lib/gdbmi/gdbmi_lexer.l" { return CLOSED_BRACKET; } YY_BREAK case 11: YY_RULE_SETUP #line 28 "/Users/mmueller/mike/dev/cgdb/lib/gdbmi/gdbmi_lexer.l" { return OPEN_BRACE; } YY_BREAK case 12: YY_RULE_SETUP #line 29 "/Users/mmueller/mike/dev/cgdb/lib/gdbmi/gdbmi_lexer.l" { return CLOSED_BRACE; } YY_BREAK case 13: YY_RULE_SETUP #line 30 "/Users/mmueller/mike/dev/cgdb/lib/gdbmi/gdbmi_lexer.l" { return OPEN_PAREN; } YY_BREAK case 14: YY_RULE_SETUP #line 31 "/Users/mmueller/mike/dev/cgdb/lib/gdbmi/gdbmi_lexer.l" { return CLOSED_PAREN; } YY_BREAK case 15: /* rule 15 can match eol */ YY_RULE_SETUP #line 33 "/Users/mmueller/mike/dev/cgdb/lib/gdbmi/gdbmi_lexer.l" { return NEWLINE; } YY_BREAK case 16: /* rule 16 can match eol */ YY_RULE_SETUP #line 34 "/Users/mmueller/mike/dev/cgdb/lib/gdbmi/gdbmi_lexer.l" { return NEWLINE; } YY_BREAK case 17: YY_RULE_SETUP #line 35 "/Users/mmueller/mike/dev/cgdb/lib/gdbmi/gdbmi_lexer.l" { return NEWLINE; } YY_BREAK case 18: YY_RULE_SETUP #line 37 "/Users/mmueller/mike/dev/cgdb/lib/gdbmi/gdbmi_lexer.l" { return INTEGER_LITERAL; } YY_BREAK case 19: YY_RULE_SETUP #line 39 "/Users/mmueller/mike/dev/cgdb/lib/gdbmi/gdbmi_lexer.l" {} YY_BREAK case 20: YY_RULE_SETUP #line 40 "/Users/mmueller/mike/dev/cgdb/lib/gdbmi/gdbmi_lexer.l" { return STRING_LITERAL; } YY_BREAK case 21: YY_RULE_SETUP #line 41 "/Users/mmueller/mike/dev/cgdb/lib/gdbmi/gdbmi_lexer.l" { return STRING_LITERAL; } YY_BREAK case 22: /* rule 22 can match eol */ YY_RULE_SETUP #line 43 "/Users/mmueller/mike/dev/cgdb/lib/gdbmi/gdbmi_lexer.l" { return CSTRING; } YY_BREAK case 23: YY_RULE_SETUP #line 46 "/Users/mmueller/mike/dev/cgdb/lib/gdbmi/gdbmi_lexer.l" ECHO; YY_BREAK #line 912 "gdbmi_lexer.c" case YY_STATE_EOF(INITIAL): yyterminate(); case YY_END_OF_BUFFER: { /* Amount of text matched not including the EOB char. */ int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; /* Undo the effects of YY_DO_BEFORE_ACTION. */ *yy_cp = (yy_hold_char); YY_RESTORE_YY_MORE_OFFSET if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) { /* We're scanning a new file or input source. It's * possible that this happened because the user * just pointed gdbmi_in at a new source and called * gdbmi_lex(). If so, then we have to assure * consistency between YY_CURRENT_BUFFER and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; YY_CURRENT_BUFFER_LVALUE->yy_input_file = gdbmi_in; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; } /* Note that here we test for yy_c_buf_p "<=" to the position * of the first EOB in the buffer, since yy_c_buf_p will * already have been incremented past the NUL character * (since all states make transitions on EOB to the * end-of-buffer state). Contrast this with the test * in input(). */ if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) { /* This was really a NUL. */ yy_state_type yy_next_state; (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state( ); /* Okay, we're now positioned to make the NUL * transition. We couldn't have * yy_get_previous_state() go ahead and do it * for us because it doesn't know how to deal * with the possibility of jamming (and we don't * want to build jamming into it because then it * will run more slowly). */ yy_next_state = yy_try_NUL_trans( yy_current_state ); yy_bp = (yytext_ptr) + YY_MORE_ADJ; if ( yy_next_state ) { /* Consume the NUL. */ yy_cp = ++(yy_c_buf_p); yy_current_state = yy_next_state; goto yy_match; } else { yy_cp = (yy_c_buf_p); goto yy_find_action; } } else switch ( yy_get_next_buffer( ) ) { case EOB_ACT_END_OF_FILE: { (yy_did_buffer_switch_on_eof) = 0; if ( gdbmi_wrap( ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up * gdbmi_text, we can now set up * yy_c_buf_p so that if some total * hoser (like flex itself) wants to * call the scanner after we return the * YY_NULL, it'll still work - another * YY_NULL will get returned. */ (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; yy_act = YY_STATE_EOF(YY_START); goto do_action; } else { if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; } break; } case EOB_ACT_CONTINUE_SCAN: (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state( ); yy_cp = (yy_c_buf_p); yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_match; case EOB_ACT_LAST_MATCH: (yy_c_buf_p) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; yy_current_state = yy_get_previous_state( ); yy_cp = (yy_c_buf_p); yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_find_action; } break; } default: YY_FATAL_ERROR( "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ } /* end of gdbmi_lex */ /* yy_get_next_buffer - try to read in a new buffer * * Returns a code representing an action: * EOB_ACT_LAST_MATCH - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */ static int yy_get_next_buffer (void) { register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; register char *source = (yytext_ptr); register int number_to_move, i; int ret_val; if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) YY_FATAL_ERROR( "fatal flex scanner internal error--end of buffer missed" ); if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) { /* Don't try to fill the buffer, so this is an EOF. */ if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) { /* We matched a single character, the EOB, so * treat this as a final EOF. */ return EOB_ACT_END_OF_FILE; } else { /* We matched some text prior to the EOB, first * process it. */ return EOB_ACT_LAST_MATCH; } } /* Try to read more data. */ /* First move last chars to start of buffer. */ number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) /* don't do the read, it's not guaranteed to return an EOF, * just force an EOF */ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; else { yy_size_t num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ /* just a shorter name for the current buffer */ YY_BUFFER_STATE b = YY_CURRENT_BUFFER; int yy_c_buf_p_offset = (int) ((yy_c_buf_p) - b->yy_ch_buf); if ( b->yy_is_our_buffer ) { yy_size_t new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; else b->yy_buf_size *= 2; b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ gdbmi_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); } else /* Can't grow it, we don't own it. */ b->yy_ch_buf = 0; if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; } if ( num_to_read > YY_READ_BUF_SIZE ) num_to_read = YY_READ_BUF_SIZE; /* Read in more data. */ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), (yy_n_chars), num_to_read ); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } if ( (yy_n_chars) == 0 ) { if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; gdbmi_restart(gdbmi_in ); } else { ret_val = EOB_ACT_LAST_MATCH; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_EOF_PENDING; } } else ret_val = EOB_ACT_CONTINUE_SCAN; if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) gdbmi_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); } (yy_n_chars) += number_to_move; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; return ret_val; } /* yy_get_previous_state - get the state just before the EOB char was reached */ static yy_state_type yy_get_previous_state (void) { register yy_state_type yy_current_state; register char *yy_cp; yy_current_state = (yy_start); for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) { register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 33 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; } return yy_current_state; } /* yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis * next_state = yy_try_NUL_trans( current_state ); */ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) { register int yy_is_jam; register char *yy_cp = (yy_c_buf_p); register YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 33 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; yy_is_jam = (yy_current_state == 32); return yy_is_jam ? 0 : yy_current_state; } static void yyunput (int c, register char * yy_bp ) { register char *yy_cp; yy_cp = (yy_c_buf_p); /* undo effects of setting up gdbmi_text */ *yy_cp = (yy_hold_char); if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) { /* need to shift things up to make room */ /* +2 for EOB chars. */ register yy_size_t number_to_move = (yy_n_chars) + 2; register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; register char *source = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) *--dest = *--source; yy_cp += (int) (dest - source); yy_bp += (int) (dest - source); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) YY_FATAL_ERROR( "flex scanner push-back overflow" ); } *--yy_cp = (char) c; if ( c == '\n' ){ --gdbmi_lineno; } (yytext_ptr) = yy_bp; (yy_hold_char) = *yy_cp; (yy_c_buf_p) = yy_cp; } #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (void) #else static int input (void) #endif { int c; *(yy_c_buf_p) = (yy_hold_char); if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) { /* yy_c_buf_p now points to the character we want to return. * If this occurs *before* the EOB characters, then it's a * valid NUL; if not, then we've hit the end of the buffer. */ if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) /* This was really a NUL. */ *(yy_c_buf_p) = '\0'; else { /* need more input */ yy_size_t offset = (yy_c_buf_p) - (yytext_ptr); ++(yy_c_buf_p); switch ( yy_get_next_buffer( ) ) { case EOB_ACT_LAST_MATCH: /* This happens because yy_g_n_b() * sees that we've accumulated a * token and flags that we need to * try matching the token before * proceeding. But for input(), * there's no matching to consider. * So convert the EOB_ACT_LAST_MATCH * to EOB_ACT_END_OF_FILE. */ /* Reset buffer status. */ gdbmi_restart(gdbmi_in ); /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { if ( gdbmi_wrap( ) ) return 0; if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; #ifdef __cplusplus return yyinput(); #else return input(); #endif } case EOB_ACT_CONTINUE_SCAN: (yy_c_buf_p) = (yytext_ptr) + offset; break; } } } c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ *(yy_c_buf_p) = '\0'; /* preserve gdbmi_text */ (yy_hold_char) = *++(yy_c_buf_p); if ( c == '\n' ) gdbmi_lineno++; ; return c; } #endif /* ifndef YY_NO_INPUT */ /** Immediately switch to a different input stream. * @param input_file A readable stream. * * @note This function does not reset the start condition to @c INITIAL . */ void gdbmi_restart (FILE * input_file ) { if ( ! YY_CURRENT_BUFFER ){ gdbmi_ensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = gdbmi__create_buffer(gdbmi_in,YY_BUF_SIZE ); } gdbmi__init_buffer(YY_CURRENT_BUFFER,input_file ); gdbmi__load_buffer_state( ); } /** Switch to a different input buffer. * @param new_buffer The new input buffer. * */ void gdbmi__switch_to_buffer (YY_BUFFER_STATE new_buffer ) { /* TODO. We should be able to replace this entire function body * with * gdbmi_pop_buffer_state(); * gdbmi_push_buffer_state(new_buffer); */ gdbmi_ensure_buffer_stack (); if ( YY_CURRENT_BUFFER == new_buffer ) return; if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ *(yy_c_buf_p) = (yy_hold_char); YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } YY_CURRENT_BUFFER_LVALUE = new_buffer; gdbmi__load_buffer_state( ); /* We don't actually know whether we did this switch during * EOF (gdbmi_wrap()) processing, but the only time this flag * is looked at is after gdbmi_wrap() is called, so it's safe * to go ahead and always set it. */ (yy_did_buffer_switch_on_eof) = 1; } static void gdbmi__load_buffer_state (void) { (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; gdbmi_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file; (yy_hold_char) = *(yy_c_buf_p); } /** Allocate and initialize an input buffer state. * @param file A readable stream. * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. * * @return the allocated buffer state. */ YY_BUFFER_STATE gdbmi__create_buffer (FILE * file, int size ) { YY_BUFFER_STATE b; b = (YY_BUFFER_STATE) gdbmi_alloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in gdbmi__create_buffer()" ); b->yy_buf_size = size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ b->yy_ch_buf = (char *) gdbmi_alloc(b->yy_buf_size + 2 ); if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in gdbmi__create_buffer()" ); b->yy_is_our_buffer = 1; gdbmi__init_buffer(b,file ); return b; } /** Destroy the buffer. * @param b a buffer created with gdbmi__create_buffer() * */ void gdbmi__delete_buffer (YY_BUFFER_STATE b ) { if ( ! b ) return; if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) gdbmi_free((void *) b->yy_ch_buf ); gdbmi_free((void *) b ); } #ifndef __cplusplus extern int isatty (int ); #endif /* __cplusplus */ /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, * such as during a gdbmi_restart() or at EOF. */ static void gdbmi__init_buffer (YY_BUFFER_STATE b, FILE * file ) { int oerrno = errno; gdbmi__flush_buffer(b ); b->yy_input_file = file; b->yy_fill_buffer = 1; /* If b is the current buffer, then gdbmi__init_buffer was _probably_ * called from gdbmi_restart() or through yy_get_next_buffer. * In that case, we don't want to reset the lineno or column. */ if (b != YY_CURRENT_BUFFER){ b->yy_bs_lineno = 1; b->yy_bs_column = 0; } b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; errno = oerrno; } /** Discard all buffered characters. On the next scan, YY_INPUT will be called. * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. * */ void gdbmi__flush_buffer (YY_BUFFER_STATE b ) { if ( ! b ) return; b->yy_n_chars = 0; /* We always need two end-of-buffer characters. The first causes * a transition to the end-of-buffer state. The second causes * a jam in that state. */ b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; b->yy_buf_pos = &b->yy_ch_buf[0]; b->yy_at_bol = 1; b->yy_buffer_status = YY_BUFFER_NEW; if ( b == YY_CURRENT_BUFFER ) gdbmi__load_buffer_state( ); } /** Pushes the new state onto the stack. The new state becomes * the current state. This function will allocate the stack * if necessary. * @param new_buffer The new state. * */ void gdbmi_push_buffer_state (YY_BUFFER_STATE new_buffer ) { if (new_buffer == NULL) return; gdbmi_ensure_buffer_stack(); /* This block is copied from gdbmi__switch_to_buffer. */ if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ *(yy_c_buf_p) = (yy_hold_char); YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } /* Only push if top exists. Otherwise, replace top. */ if (YY_CURRENT_BUFFER) (yy_buffer_stack_top)++; YY_CURRENT_BUFFER_LVALUE = new_buffer; /* copied from gdbmi__switch_to_buffer. */ gdbmi__load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } /** Removes and deletes the top of the stack, if present. * The next element becomes the new top. * */ void gdbmi_pop_buffer_state (void) { if (!YY_CURRENT_BUFFER) return; gdbmi__delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; if ((yy_buffer_stack_top) > 0) --(yy_buffer_stack_top); if (YY_CURRENT_BUFFER) { gdbmi__load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } } /* Allocates the stack if it does not exist. * Guarantees space for at least one push. */ static void gdbmi_ensure_buffer_stack (void) { yy_size_t num_to_alloc; if (!(yy_buffer_stack)) { /* First allocation is just for 2 elements, since we don't know if this * scanner will even need a stack. We use 2 instead of 1 to avoid an * immediate realloc on the next call. */ num_to_alloc = 1; (yy_buffer_stack) = (struct yy_buffer_state**)gdbmi_alloc (num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in gdbmi_ensure_buffer_stack()" ); memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); (yy_buffer_stack_max) = num_to_alloc; (yy_buffer_stack_top) = 0; return; } if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ /* Increase the buffer to prepare for a possible push. */ int grow_size = 8 /* arbitrary grow size */; num_to_alloc = (yy_buffer_stack_max) + grow_size; (yy_buffer_stack) = (struct yy_buffer_state**)gdbmi_realloc ((yy_buffer_stack), num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in gdbmi_ensure_buffer_stack()" ); /* zero only the new slots.*/ memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); (yy_buffer_stack_max) = num_to_alloc; } } /** Setup the input buffer state to scan directly from a user-specified character buffer. * @param base the character buffer * @param size the size in bytes of the character buffer * * @return the newly allocated buffer state object. */ YY_BUFFER_STATE gdbmi__scan_buffer (char * base, yy_size_t size ) { YY_BUFFER_STATE b; if ( size < 2 || base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ return 0; b = (YY_BUFFER_STATE) gdbmi_alloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in gdbmi__scan_buffer()" ); b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; b->yy_is_our_buffer = 0; b->yy_input_file = 0; b->yy_n_chars = b->yy_buf_size; b->yy_is_interactive = 0; b->yy_at_bol = 1; b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; gdbmi__switch_to_buffer(b ); return b; } /** Setup the input buffer state to scan a string. The next call to gdbmi_lex() will * scan from a @e copy of @a str. * @param yystr a NUL-terminated string to scan * * @return the newly allocated buffer state object. * @note If you want to scan bytes that may contain NUL values, then use * gdbmi__scan_bytes() instead. */ YY_BUFFER_STATE gdbmi__scan_string (yyconst char * yystr ) { return gdbmi__scan_bytes(yystr,strlen(yystr) ); } /** Setup the input buffer state to scan the given bytes. The next call to gdbmi_lex() will * scan from a @e copy of @a bytes. * @param bytes the byte buffer to scan * @param len the number of bytes in the buffer pointed to by @a bytes. * * @return the newly allocated buffer state object. */ YY_BUFFER_STATE gdbmi__scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len ) { YY_BUFFER_STATE b; char *buf; yy_size_t n, i; /* Get memory for full buffer, including space for trailing EOB's. */ n = _yybytes_len + 2; buf = (char *) gdbmi_alloc(n ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in gdbmi__scan_bytes()" ); for ( i = 0; i < _yybytes_len; ++i ) buf[i] = yybytes[i]; buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; b = gdbmi__scan_buffer(buf,n ); if ( ! b ) YY_FATAL_ERROR( "bad buffer in gdbmi__scan_bytes()" ); /* It's okay to grow etc. this buffer, and we should throw it * away when we're done. */ b->yy_is_our_buffer = 1; return b; } #ifndef YY_EXIT_FAILURE #define YY_EXIT_FAILURE 2 #endif static void yy_fatal_error (yyconst char* msg ) { (void) fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } /* Redefine yyless() so it works in section 3 code. */ #undef yyless #define yyless(n) \ do \ { \ /* Undo effects of setting up gdbmi_text. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ gdbmi_text[gdbmi_leng] = (yy_hold_char); \ (yy_c_buf_p) = gdbmi_text + yyless_macro_arg; \ (yy_hold_char) = *(yy_c_buf_p); \ *(yy_c_buf_p) = '\0'; \ gdbmi_leng = yyless_macro_arg; \ } \ while ( 0 ) /* Accessor methods (get/set functions) to struct members. */ /** Get the current line number. * */ int gdbmi_get_lineno (void) { return gdbmi_lineno; } /** Get the input stream. * */ FILE *gdbmi_get_in (void) { return gdbmi_in; } /** Get the output stream. * */ FILE *gdbmi_get_out (void) { return gdbmi_out; } /** Get the length of the current token. * */ yy_size_t gdbmi_get_leng (void) { return gdbmi_leng; } /** Get the current token. * */ char *gdbmi_get_text (void) { return gdbmi_text; } /** Set the current line number. * @param line_number * */ void gdbmi_set_lineno (int line_number ) { gdbmi_lineno = line_number; } /** Set the input stream. This does not discard the current * input buffer. * @param in_str A readable stream. * * @see gdbmi__switch_to_buffer */ void gdbmi_set_in (FILE * in_str ) { gdbmi_in = in_str ; } void gdbmi_set_out (FILE * out_str ) { gdbmi_out = out_str ; } int gdbmi_get_debug (void) { return gdbmi__flex_debug; } void gdbmi_set_debug (int bdebug ) { gdbmi__flex_debug = bdebug ; } static int yy_init_globals (void) { /* Initialization is the same as for the non-reentrant scanner. * This function is called from gdbmi_lex_destroy(), so don't allocate here. */ /* We do not touch gdbmi_lineno unless the option is enabled. */ gdbmi_lineno = 1; (yy_buffer_stack) = 0; (yy_buffer_stack_top) = 0; (yy_buffer_stack_max) = 0; (yy_c_buf_p) = (char *) 0; (yy_init) = 0; (yy_start) = 0; /* Defined in main.c */ #ifdef YY_STDINIT gdbmi_in = stdin; gdbmi_out = stdout; #else gdbmi_in = (FILE *) 0; gdbmi_out = (FILE *) 0; #endif /* For future reference: Set errno on error, since we are called by * gdbmi_lex_init() */ return 0; } /* gdbmi_lex_destroy is for both reentrant and non-reentrant scanners. */ int gdbmi_lex_destroy (void) { /* Pop the buffer stack, destroying each element. */ while(YY_CURRENT_BUFFER){ gdbmi__delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; gdbmi_pop_buffer_state(); } /* Destroy the stack itself. */ gdbmi_free((yy_buffer_stack) ); (yy_buffer_stack) = NULL; /* Reset the globals. This is important in a non-reentrant scanner so the next time * gdbmi_lex() is called, initialization will occur. */ yy_init_globals( ); return 0; } /* * Internal utility routines. */ #ifndef yytext_ptr static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) { register int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen (yyconst char * s ) { register int n; for ( n = 0; s[n]; ++n ) ; return n; } #endif void *gdbmi_alloc (yy_size_t size ) { return (void *) malloc( size ); } void *gdbmi_realloc (void * ptr, yy_size_t size ) { /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter * because both ANSI C and C++ allow castless assignment from * any pointer type to void*, and deal with argument conversions * as though doing an assignment. */ return (void *) realloc( (char *) ptr, size ); } void gdbmi_free (void * ptr ) { free( (char *) ptr ); /* see gdbmi_realloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" #line 46 "/Users/mmueller/mike/dev/cgdb/lib/gdbmi/gdbmi_lexer.l" /* I don't know what this function does. However, it avoids a link error. */ int gdbmi_wrap (void) { if (0) yyunput(0, ""); return 1; } cgdb-0.6.7/lib/gdbmi/gdbmi_lexer.l000644 000765 000024 00000002552 12074441140 017677 0ustar00mmuellerstaff000000 000000 %option prefix="gdbmi_" %option outfile="lex.yy.c" %option yylineno DIGIT [0-9] L [a-zA-Z_] T [0-9a-zA-Z_-] IDENTIFIER {L}+{T}* %{ #include #include "gdbmi_grammar.h" %} %% "^" { return CARROT; } "," { return COMMA; } "+" { return ADD_OP; } "*" { return MULT_OP; } "=" { return EQUAL_SIGN; } "~" { return TILDA; } "@" { return AT_SYMBOL; } "&" { return AMPERSAND; } "[" { return OPEN_BRACKET; } "]" { return CLOSED_BRACKET; } "{" { return OPEN_BRACE; } "}" { return CLOSED_BRACE; } "(" { return OPEN_PAREN; } ")" { return CLOSED_PAREN; } \n { return NEWLINE; } \r\n { return NEWLINE; } \r { return NEWLINE; } {DIGIT}+ { return INTEGER_LITERAL; } [ \t\v\f] {} {IDENTIFIER} { return STRING_LITERAL; } . { return STRING_LITERAL; } \"(\\.|[^\\"])*\" { return CSTRING; } %% /* I don't know what this function does. However, it avoids a link error. */ int gdbmi_wrap (void) { if (0) yyunput(0, ""); return 1; } cgdb-0.6.7/lib/gdbmi/gdbmi_oc.c000644 000765 000024 00000124513 12074441140 017152 0ustar00mmuellerstaff000000 000000 #include #include #include #include "gdbmi_oc.h" #if 0 static const char *const async_reason_string_lookup[] = { "breakpoint-hit", "watchpoint-trigger", "read-watchpoint-trigger", "access-watchpoint-trigger", "function-finished", "location-reached", "watchpoint-scope", "end-stepping-range", "exited-signalled", "exited", "exited-normally", "signal-received", NULL }; /* Represents the reason why GDB is sending an asynchronous command to the front end. */ enum async_reply_reason { EXEC_ASYNC_BREAKPOINT_HIT = 0, EXEC_ASYNC_WATCHPOINT_TRIGGER, EXEC_ASYNC_READ_WATCHPOINT_TRIGGER, EXEC_ASYNC_ACCESS_WATCHPOINT_TRIGGER, EXEC_ASYNC_FUNCTION_FINISHED, EXEC_ASYNC_LOCATION_REACHED, EXEC_ASYNC_WATCHPOINT_SCOPE, EXEC_ASYNC_END_STEPPING_RANGE, EXEC_ASYNC_EXITED_SIGNALLED, EXEC_ASYNC_EXITED, EXEC_ASYNC_EXITED_NORMALLY, EXEC_ASYNC_SIGNAL_RECEIVED, /* This is here only to represent the number of enums. */ EXEC_ASYNC_LAST }; static const char *async_reason_lookup(enum async_reply_reason reason) { return async_reason_string_lookup[reason]; } #endif struct gdbmi_input_command_hash { const char *const cstring_val; enum gdbmi_input_command enum_val; } gdbmi_input_lookup[] = { { "-file-list-exec-source-file", GDBMI_FILE_LIST_EXEC_SOURCE_FILE}, { "-file-list-exec-source-files", GDBMI_FILE_LIST_EXEC_SOURCE_FILES}, { "-break-list", GDBMI_BREAK_LIST}, { NULL, GDBMI_LAST} }; static enum gdbmi_input_command gdbmi_input_command_lookup(const char *command) { int i; for (i = 0; gdbmi_input_lookup[i].cstring_val; ++i) if (strcmp(command, gdbmi_input_lookup[i].cstring_val) == 0) return gdbmi_input_lookup[i].enum_val; return GDBMI_LAST; } /* Creating, Destroying and printing gdbmi_oc */ gdbmi_oc_ptr create_gdbmi_oc(void) { gdbmi_oc_ptr oc_ptr = calloc(1, sizeof (struct gdbmi_oc)); if (!oc_ptr) return NULL; oc_ptr->input_command = GDBMI_LAST; return oc_ptr; } int destroy_gdbmi_oc(gdbmi_oc_ptr param) { if (!param) return 0; if (destroy_gdbmi_cstring_ll(param->console_output) == -1) return -1; param->console_output = NULL; switch (param->input_command) { case GDBMI_FILE_LIST_EXEC_SOURCE_FILE: free(param->input_commands.file_list_exec_source_file.file); param->input_commands.file_list_exec_source_file.file = NULL; free(param->input_commands.file_list_exec_source_file.fullname); param->input_commands.file_list_exec_source_file.fullname = NULL; break; case GDBMI_FILE_LIST_EXEC_SOURCE_FILES: if (destroy_gdbmi_file_path_info(param->input_commands. file_list_exec_source_files.file_name_pair) == -1) return -1; break; case GDBMI_BREAK_LIST: if (destroy_gdbmi_breakpoint(param->input_commands.break_list. breakpoint_ptr) == -1) return -1; break; case GDBMI_LAST: break; }; if (destroy_gdbmi_oc(param->next) == -1) return -1; param->next = NULL; free(param); param = NULL; return 0; } gdbmi_oc_ptr append_gdbmi_oc(gdbmi_oc_ptr list, gdbmi_oc_ptr item) { if (!item) return NULL; if (!list) list = item; else { gdbmi_oc_ptr cur = list; while (cur->next) cur = cur->next; cur->next = item; } return list; } int print_gdbmi_oc(gdbmi_oc_ptr param) { gdbmi_oc_ptr cur = param; while (cur) { if (cur->is_asynchronous) printf("asynchronous\n"); else printf("synchronous\n"); if (print_gdbmi_cstring_ll(cur->console_output) == -1) return -1; switch (cur->input_command) { case GDBMI_FILE_LIST_EXEC_SOURCE_FILE: printf("file-list-exec-source-file\n"); printf("line=%d\n", cur->input_commands.file_list_exec_source_file.line); printf("file=%s\n", cur->input_commands.file_list_exec_source_file.file); printf("fullname=%s\n", cur->input_commands.file_list_exec_source_file. fullname); break; case GDBMI_FILE_LIST_EXEC_SOURCE_FILES: { gdbmi_oc_file_path_info_ptr file_ptr; printf("file-list-exec-source-files\n"); file_ptr = cur->input_commands.file_list_exec_source_files. file_name_pair; if (print_gdbmi_file_path_info(file_ptr) == -1) { fprintf(stderr, "%s:%d\n", __FILE__, __LINE__); return -1; } } break; case GDBMI_BREAK_LIST: { gdbmi_oc_breakpoint_ptr breakpoint_ptr; printf("break-list\n"); breakpoint_ptr = cur->input_commands.break_list.breakpoint_ptr; if (print_gdbmi_breakpoint(breakpoint_ptr) == -1) { fprintf(stderr, "%s:%d\n", __FILE__, __LINE__); return -1; } } case GDBMI_LAST: break; }; cur = cur->next; } return 0; } /** * This will convert a cstring that was passed from GDB to the front end. * A typically cstring will look like, * "Type \"show copying\" to see the conditions.\n" * The \" should be converted to a ", and the \n should be converted to a * newline. Also, the first and last " should go away. The other cases are * handled in the code bleow. * * \param orig * The string to convert * * \param new * The new string, the memory will be allocated in this function and passed back. * * \return * 0 on success, -1 on error. */ static int convert_cstring(const char *orig, char **new) { int length; char *nstring; int i, cur; if (!orig || !new) return -1; length = strlen(orig); nstring = malloc(sizeof (char) * (length + 1)); cur = 0; /* Loop from 1 to length -1 to skip the first and last char, * they are the " chars. */ for (i = 1; i < length - 1; ++i) { if (orig[i] == '\\') { i++; switch (orig[i]) { case 'n': nstring[cur++] = '\r'; nstring[cur++] = '\n'; break; case '"': nstring[cur++] = '"'; break; case 't': nstring[cur++] = '\t'; break; case '\\': nstring[cur++] = '\\'; break; default: fprintf(stderr, "%s:%d char(%d)\n", __FILE__, __LINE__, orig[i]); return -1; }; } else nstring[cur++] = orig[i]; } nstring[cur] = '\0'; *new = nstring; return 0; } /** * This will take in a single MI output command parse tree and return a * single MI output commands data structure. * * \param output_ptr * The MI parse tree * * \param oc_ptr * On return, this will be the MI output command that were derived from the * MI output command parse tree. * * \return * 0 on success, -1 on error. */ static int gdbmi_get_output_command(gdbmi_output_ptr output_ptr, gdbmi_oc_ptr * oc_ptr) { if (!output_ptr || !oc_ptr) return -1; *oc_ptr = create_gdbmi_oc(); if (!(*oc_ptr)) { fprintf(stderr, "%s:%d\n", __FILE__, __LINE__); return -1; } /* Check to see if the output command is synchronous or asynchronous */ if (!output_ptr->result_record) (*oc_ptr)->is_asynchronous = 1; /* Walk the output_ptr to get the MI stream record's */ if (output_ptr->oob_record) { gdbmi_oob_record_ptr cur = output_ptr->oob_record; while (cur) { if (cur->record == GDBMI_STREAM) { if (cur->option.stream_record->stream_record == GDBMI_CONSOLE) { char *orig = cur->option.stream_record->cstring; gdbmi_oc_cstring_ll_ptr ncstring = create_gdbmi_cstring_ll(); if (convert_cstring(orig, &(ncstring->cstring)) == -1) { fprintf(stderr, "%s:%d\n", __FILE__, __LINE__); return -1; } (*oc_ptr)->console_output = append_gdbmi_cstring_ll( (*oc_ptr)->console_output, ncstring); } } cur = cur->next; } } return 0; } static int gdbmi_get_specific_output_command(gdbmi_output_ptr output_ptr, gdbmi_oc_ptr oc_ptr, gdbmi_oc_cstring_ll_ptr mi_input_cmds) { /* If the command is synchronous, then it is a response to an MI input command. */ char *mi_input_cmd; enum gdbmi_input_command mi_input_cmd_kind; if (!mi_input_cmds) { fprintf(stderr, "%s:%d\n", __FILE__, __LINE__); return -1; } mi_input_cmd = mi_input_cmds->cstring; mi_input_cmd_kind = gdbmi_input_command_lookup(mi_input_cmd); oc_ptr->input_command = mi_input_cmd_kind; switch (mi_input_cmd_kind) { case GDBMI_FILE_LIST_EXEC_SOURCE_FILE: { gdbmi_result_ptr result_ptr = output_ptr->result_record->result; while (result_ptr) { if (strcmp(result_ptr->variable, "line") == 0) { char *nline; if (convert_cstring(result_ptr->value->option.cstring, &nline) == -1) { fprintf(stderr, "%s:%d\n", __FILE__, __LINE__); return -1; } oc_ptr->input_commands.file_list_exec_source_file.line = atoi(nline); free(nline); nline = NULL; } else if (strcmp(result_ptr->variable, "file") == 0) { char *nline; if (convert_cstring(result_ptr->value->option.cstring, &nline) == -1) { fprintf(stderr, "%s:%d\n", __FILE__, __LINE__); return -1; } oc_ptr->input_commands.file_list_exec_source_file.file = nline; } else if (strcmp(result_ptr->variable, "fullname") == 0) { char *nline; if (convert_cstring(result_ptr->value->option.cstring, &nline) == -1) { fprintf(stderr, "%s:%d\n", __FILE__, __LINE__); return -1; } oc_ptr->input_commands.file_list_exec_source_file.fullname = nline; } result_ptr = result_ptr->next; } } break; case GDBMI_FILE_LIST_EXEC_SOURCE_FILES: { gdbmi_result_ptr result_ptr = output_ptr->result_record->result; while (result_ptr) { if (strcmp(result_ptr->variable, "files") == 0) { if (result_ptr->value->value_choice == GDBMI_LIST) { gdbmi_list_ptr list = result_ptr->value->option.list; while (list) { if (list->list_choice == GDBMI_VALUE) { gdbmi_value_ptr value_ptr = list->option.value; while (value_ptr) { if (value_ptr->value_choice == GDBMI_TUPLE) { gdbmi_oc_file_path_info_ptr ptr = create_gdbmi_file_path_info(); gdbmi_result_ptr result = value_ptr->option.tuple->result; while (result) { if (strcmp(result->variable, "file") == 0) { if (convert_cstring(result-> value->option. cstring, &(ptr->file)) == -1) { fprintf(stderr, "%s:%d\n", __FILE__, __LINE__); return -1; } } else if (strcmp(result->variable, "fullname") == 0) { if (convert_cstring(result-> value->option. cstring, &(ptr->fullname)) == -1) { fprintf(stderr, "%s:%d\n", __FILE__, __LINE__); return -1; } } result = result->next; } oc_ptr->input_commands. file_list_exec_source_files. file_name_pair = append_gdbmi_file_path_info (oc_ptr->input_commands. file_list_exec_source_files. file_name_pair, ptr); } value_ptr = value_ptr->next; } } list = list->next; } } } result_ptr = result_ptr->next; } } break; case GDBMI_BREAK_LIST: { gdbmi_result_ptr result_ptr = output_ptr->result_record->result; if (strcmp(result_ptr->variable, "BreakpointTable") == 0) { if (result_ptr->value->value_choice == GDBMI_TUPLE) { result_ptr = result_ptr->value->option.tuple->result; while (result_ptr) { if (strcmp(result_ptr->variable, "body") == 0) { if (result_ptr->value->value_choice == GDBMI_LIST) { gdbmi_list_ptr list_ptr = result_ptr->value->option.list; if (list_ptr && list_ptr->list_choice == GDBMI_RESULT) { gdbmi_result_ptr result_ptr = list_ptr->option.result; while (result_ptr) { if (strcmp(result_ptr->variable, "bkpt") == 0) { gdbmi_oc_breakpoint_ptr ptr = create_gdbmi_breakpoint(); gdbmi_value_ptr value_ptr = result_ptr->value; if (value_ptr->value_choice == GDBMI_TUPLE) { gdbmi_result_ptr result_ptr = value_ptr->option. tuple->result; while (result_ptr) { if (strcmp(result_ptr-> variable, "number") == 0) { if (result_ptr->value-> value_choice == GDBMI_CSTRING) { char *nstr; if (convert_cstring (result_ptr-> value-> option. cstring, &nstr) == -1) { fprintf(stderr, "%s:%d\n", __FILE__, __LINE__); return -1; } ptr->number = atoi(nstr); free(nstr); nstr = NULL; } } else if (strcmp (result_ptr-> variable, "type") == 0) { if (result_ptr->value-> value_choice == GDBMI_CSTRING) { if (strcmp (result_ptr-> value-> option. cstring, "\"breakpoint\"") == 0) ptr->type = GDBMI_BREAKPOINT; else if (strcmp (result_ptr-> value-> option. cstring, "\"watchpoint\"") == 0) ptr->type = GDBMI_WATCHPOINT; } } else if (strcmp (result_ptr-> variable, "disp") == 0) { if (result_ptr->value-> value_choice == GDBMI_CSTRING) { if (strcmp (result_ptr-> value-> option. cstring, "\"keep\"") == 0) ptr->disposition = GDBMI_KEEP; else if (strcmp (result_ptr-> value-> option. cstring, "\"nokeep\"") == 0) ptr->disposition = GDBMI_NOKEEP; } } else if (strcmp (result_ptr-> variable, "enabled") == 0) { if (result_ptr->value-> value_choice == GDBMI_CSTRING) { if (strcmp (result_ptr-> value-> option. cstring, "\"y\"") == 0) ptr->enabled = 1; else ptr->enabled = 0; } } else if (strcmp (result_ptr-> variable, "addr") == 0) { if (result_ptr->value-> value_choice == GDBMI_CSTRING) { if (convert_cstring (result_ptr-> value-> option. cstring, &ptr-> address) == -1) { fprintf(stderr, "%s:%d\n", __FILE__, __LINE__); return -1; } } } else if (strcmp (result_ptr-> variable, "func") == 0) { if (result_ptr->value-> value_choice == GDBMI_CSTRING) { if (convert_cstring (result_ptr-> value-> option. cstring, &ptr-> func) == -1) { fprintf(stderr, "%s:%d\n", __FILE__, __LINE__); return -1; } } } else if (strcmp (result_ptr-> variable, "file") == 0) { if (result_ptr->value-> value_choice == GDBMI_CSTRING) { if (convert_cstring (result_ptr-> value-> option. cstring, &ptr-> file) == -1) { fprintf(stderr, "%s:%d\n", __FILE__, __LINE__); return -1; } } } else if (strcmp (result_ptr-> variable, "fullname") == 0) { if (result_ptr->value-> value_choice == GDBMI_CSTRING) { if (convert_cstring (result_ptr-> value-> option. cstring, &ptr-> fullname) == -1) { fprintf(stderr, "%s:%d\n", __FILE__, __LINE__); return -1; } } } else if (strcmp (result_ptr-> variable, "line") == 0) { if (result_ptr->value-> value_choice == GDBMI_CSTRING) { char *nstr; if (convert_cstring (result_ptr-> value-> option. cstring, &nstr) == -1) { fprintf(stderr, "%s:%d\n", __FILE__, __LINE__); return -1; } ptr->line = atoi(nstr); free(nstr); nstr = NULL; } } else if (strcmp (result_ptr-> variable, "times") == 0) { if (result_ptr->value-> value_choice == GDBMI_CSTRING) { char *nstr; if (convert_cstring (result_ptr-> value-> option. cstring, &nstr) == -1) { fprintf(stderr, "%s:%d\n", __FILE__, __LINE__); return -1; } ptr->times = atoi(nstr); free(nstr); nstr = NULL; } } result_ptr = result_ptr->next; } } oc_ptr->input_commands.break_list. breakpoint_ptr = append_gdbmi_breakpoint (oc_ptr->input_commands. break_list.breakpoint_ptr, ptr); } result_ptr = result_ptr->next; } } } } result_ptr = result_ptr->next; } } } } break; case GDBMI_LAST: fprintf(stderr, "%s:%d\n", __FILE__, __LINE__); return -1; }; return 0; } /** * There is a list of MI output commands, and a list of MI input commands. * For each MI input command, I need to find the corresponding output command. If there * are asynchronous output commands, they need to be detected and not counted as a response * to the input command. */ int gdbmi_get_output_commands(gdbmi_output_ptr output_ptr, gdbmi_oc_cstring_ll_ptr mi_input_cmds, gdbmi_oc_ptr * oc_ptr) { gdbmi_output_ptr cur = output_ptr; gdbmi_oc_cstring_ll_ptr cur_mi_input_cmds = mi_input_cmds; int result; if (!output_ptr || !oc_ptr) return -1; *oc_ptr = NULL; while (cur) { gdbmi_oc_ptr cur_oc_ptr = NULL; result = gdbmi_get_output_command(cur, &cur_oc_ptr); if (result == -1) { fprintf(stderr, "%s:%d\n", __FILE__, __LINE__); return -1; } *oc_ptr = append_gdbmi_oc(*oc_ptr, cur_oc_ptr); /* If it is not asynchronous, then need to get the specific results */ if (!cur_oc_ptr->is_asynchronous) { result = gdbmi_get_specific_output_command(cur, cur_oc_ptr, cur_mi_input_cmds); if (result == -1) { fprintf(stderr, "%s:%d\n", __FILE__, __LINE__); return -1; } cur_mi_input_cmds = cur_mi_input_cmds->next; } cur = cur->next; } if (cur_mi_input_cmds != NULL) { fprintf(stderr, "%s:%d\n", __FILE__, __LINE__); return -1; } return 0; } gdbmi_oc_cstring_ll_ptr create_gdbmi_cstring_ll(void) { return calloc(1, sizeof (struct gdbmi_oc_cstring_ll)); } int destroy_gdbmi_cstring_ll(gdbmi_oc_cstring_ll_ptr param) { if (!param) return 0; free(param->cstring); param->cstring = NULL; if (destroy_gdbmi_cstring_ll(param->next) == -1) return -1; param->next = NULL; free(param); return 0; } gdbmi_oc_cstring_ll_ptr append_gdbmi_cstring_ll(gdbmi_oc_cstring_ll_ptr list, gdbmi_oc_cstring_ll_ptr item) { if (!item) return NULL; if (!list) list = item; else { gdbmi_oc_cstring_ll_ptr cur = list; while (cur->next) cur = cur->next; cur->next = item; } return list; } int print_gdbmi_cstring_ll(gdbmi_oc_cstring_ll_ptr param) { gdbmi_oc_cstring_ll_ptr cur = param; while (cur) { printf("cstring->(%s)\n", cur->cstring); cur = cur->next; } return 0; } gdbmi_oc_file_path_info_ptr create_gdbmi_file_path_info(void) { return calloc(1, sizeof (struct gdbmi_oc_file_path_info)); } int destroy_gdbmi_file_path_info(gdbmi_oc_file_path_info_ptr param) { if (!param) return 0; free(param->file); param->file = NULL; free(param->fullname); param->fullname = NULL; if (destroy_gdbmi_file_path_info(param->next) == -1) return -1; param->next = NULL; free(param); return 0; } gdbmi_oc_file_path_info_ptr append_gdbmi_file_path_info(gdbmi_oc_file_path_info_ptr list, gdbmi_oc_file_path_info_ptr item) { if (!item) return NULL; if (!list) list = item; else { gdbmi_oc_file_path_info_ptr cur = list; while (cur->next) cur = cur->next; cur->next = item; } return list; } int print_gdbmi_file_path_info(gdbmi_oc_file_path_info_ptr param) { gdbmi_oc_file_path_info_ptr cur = param; while (cur) { printf("file->(%s)\n", cur->file); printf("fullname->(%s)\n", cur->fullname); cur = cur->next; } return 0; } gdbmi_oc_breakpoint_ptr create_gdbmi_breakpoint(void) { return calloc(1, sizeof (struct gdbmi_oc_breakpoint)); } int destroy_gdbmi_breakpoint(gdbmi_oc_breakpoint_ptr param) { if (!param) return 0; if (param->address) { free(param->address); param->address = NULL; } if (param->func) { free(param->func); param->func = NULL; } if (param->file) { free(param->file); param->file = NULL; } if (param->fullname) { free(param->fullname); param->fullname = NULL; } if (destroy_gdbmi_breakpoint(param->next) == -1) return -1; param->next = NULL; free(param); param = NULL; return 0; } gdbmi_oc_breakpoint_ptr append_gdbmi_breakpoint(gdbmi_oc_breakpoint_ptr list, gdbmi_oc_breakpoint_ptr item) { if (!item) return NULL; if (!list) list = item; else { gdbmi_oc_breakpoint_ptr cur = list; while (cur->next) cur = cur->next; cur->next = item; } return list; } int print_gdbmi_breakpoint(gdbmi_oc_breakpoint_ptr param) { gdbmi_oc_breakpoint_ptr cur = param; while (cur) { printf("number=%d\n", cur->number); switch (cur->type) { case GDBMI_BREAKPOINT: printf("GDBMI_BREAKPOINT\n"); break; case GDBMI_WATCHPOINT: printf("GDBMI_WATCHPOINT\n"); break; default: return -1; }; switch (cur->disposition) { case GDBMI_KEEP: printf("GDBMI_KEEP\n"); break; case GDBMI_NOKEEP: printf("GDBMI_NOKEEP\n"); break; default: return -1; }; printf("enabled=%d\n", cur->enabled); printf("address->(%s)\n", cur->address); printf("func->(%s)\n", cur->func); printf("file->(%s)\n", cur->file); printf("fullname->(%s)\n", cur->fullname); printf("line=%d\n", cur->line); printf("times=%d\n", cur->times); cur = cur->next; } return 0; } cgdb-0.6.7/lib/gdbmi/gdbmi_oc.h000644 000765 000024 00000010540 12074441140 017151 0ustar00mmuellerstaff000000 000000 #ifndef __GDBMI_OC_H__ #define __GDBMI_OC_H__ #include "gdbmi_pt.h" struct gdbmi_oc; typedef struct gdbmi_oc *gdbmi_oc_ptr; /* The possible/implemented GDBMI commands */ enum gdbmi_input_command { /* 24.7 GDB/MI Program control */ GDBMI_FILE_LIST_EXEC_SOURCE_FILE, GDBMI_FILE_LIST_EXEC_SOURCE_FILES, /* 24.5 GDB/MI Breakpoint table commands */ GDBMI_BREAK_LIST, GDBMI_LAST }; /* A cstring linked list for use by the gdbmi output commands */ struct gdbmi_oc_cstring_ll; typedef struct gdbmi_oc_cstring_ll *gdbmi_oc_cstring_ll_ptr; struct gdbmi_oc_cstring_ll { /* The cstring */ char *cstring; /* A pointer to the next output */ gdbmi_oc_cstring_ll_ptr next; }; /* A file path linked list, for use by the gdbmi output commands */ struct gdbmi_oc_file_path_info; typedef struct gdbmi_oc_file_path_info *gdbmi_oc_file_path_info_ptr; struct gdbmi_oc_file_path_info { /* The filename, relative path. */ char *file; /* The fullname, absolute path. */ char *fullname; /* A pointer to the next file path. */ gdbmi_oc_file_path_info_ptr next; }; enum breakpoint_type { GDBMI_BREAKPOINT, GDBMI_WATCHPOINT }; enum breakpoint_disposition { GDBMI_KEEP, GDBMI_NOKEEP }; struct gdbmi_oc_breakpoint; typedef struct gdbmi_oc_breakpoint *gdbmi_oc_breakpoint_ptr; struct gdbmi_oc_breakpoint { int number; enum breakpoint_type type; enum breakpoint_disposition disposition; /* 1 if enabled, otherwise 0 */ int enabled; char *address; char *func; char *file; char *fullname; int line; int times; gdbmi_oc_breakpoint_ptr next; }; struct gdbmi_oc { /* If this is 1, then the command was asynchronous, otherwise it wasn't */ int is_asynchronous; /* The console output. This is a null terminated list. */ gdbmi_oc_cstring_ll_ptr console_output; /* The GDBMI output command this represents. If set to GDBMI_LAST, * then this is an asynchronous command. */ enum gdbmi_input_command input_command; union { /* 24.7 GDB/MI Program control */ struct { int line; char *file; char *fullname; } file_list_exec_source_file; struct { gdbmi_oc_file_path_info_ptr file_name_pair; } file_list_exec_source_files; /* 24.5 GDB/MI Breakpoint table commands */ struct { gdbmi_oc_breakpoint_ptr breakpoint_ptr; } break_list; } input_commands; /* The next MI output command */ gdbmi_oc_ptr next; }; /** * This will take in a parse tree and return a list of MI output commands. * * \param output_ptr * The MI parse tree * * \param mi_input_cmds * The next MI input command. * * \param oc_ptr * On return, this will be the MI output commands that were derived from the * parse tree. * * \return * 0 on success, -1 on error. */ int gdbmi_get_output_commands(gdbmi_output_ptr output_ptr, gdbmi_oc_cstring_ll_ptr mi_input_cmds, gdbmi_oc_ptr * oc_ptr); /* Creating, Destroying and printing MI output commands */ gdbmi_oc_ptr create_gdbmi_oc(void); int destroy_gdbmi_oc(gdbmi_oc_ptr param); gdbmi_oc_ptr append_gdbmi_oc(gdbmi_oc_ptr list, gdbmi_oc_ptr item); int print_gdbmi_oc(gdbmi_oc_ptr param); /* Creating, Destroying and printing MI cstring linked lists */ gdbmi_oc_cstring_ll_ptr create_gdbmi_cstring_ll(void); int destroy_gdbmi_cstring_ll(gdbmi_oc_cstring_ll_ptr param); gdbmi_oc_cstring_ll_ptr append_gdbmi_cstring_ll(gdbmi_oc_cstring_ll_ptr list, gdbmi_oc_cstring_ll_ptr item); int print_gdbmi_cstring_ll(gdbmi_oc_cstring_ll_ptr param); /* Creating, Destroying and printing MI file_path linked lists */ gdbmi_oc_file_path_info_ptr create_gdbmi_file_path_info(void); int destroy_gdbmi_file_path_info(gdbmi_oc_file_path_info_ptr param); gdbmi_oc_file_path_info_ptr append_gdbmi_file_path_info(gdbmi_oc_file_path_info_ptr list, gdbmi_oc_file_path_info_ptr item); int print_gdbmi_file_path_info(gdbmi_oc_file_path_info_ptr param); /* Creating, Destroying and printing MI breakpoint_list linked lists */ gdbmi_oc_breakpoint_ptr create_gdbmi_breakpoint(void); int destroy_gdbmi_breakpoint(gdbmi_oc_breakpoint_ptr param); gdbmi_oc_breakpoint_ptr append_gdbmi_breakpoint(gdbmi_oc_breakpoint_ptr list, gdbmi_oc_breakpoint_ptr item); int print_gdbmi_breakpoint(gdbmi_oc_breakpoint_ptr param); #endif /* __GDBMI_OC_H__ */ cgdb-0.6.7/lib/gdbmi/gdbmi_parser.c000644 000765 000024 00000007704 12074441140 020047 0ustar00mmuellerstaff000000 000000 #include #include #include #include "gdbmi_grammar.h" #include "gdbmi_parser.h" int gdbmi_parse(void); /* flex */ typedef struct yy_buffer_state *YY_BUFFER_STATE; extern YY_BUFFER_STATE gdbmi__scan_string(const char *yy_str); extern void gdbmi__delete_buffer(YY_BUFFER_STATE state); extern FILE *gdbmi_in; extern int gdbmi_lex(void); extern char *gdbmi_text; extern int gdbmi_lineno; struct gdbmi_parser { char *last_error; gdbmi_pstate *mips; gdbmi_pdata_ptr pdata_ptr; }; gdbmi_parser_ptr gdbmi_parser_create(void) { gdbmi_parser_ptr parser; parser = (gdbmi_parser_ptr) malloc(sizeof (struct gdbmi_parser)); parser->last_error = NULL; if (!parser) { fprintf(stderr, "%s:%d", __FILE__, __LINE__); return NULL; } /* Create a new parser instance */ parser->mips = gdbmi_pstate_new(); if (!parser) { fprintf(stderr, "%s:%d", __FILE__, __LINE__); return NULL; } /* Create the data the parser parses into */ parser->pdata_ptr = create_gdbmi_pdata(); if (!parser->pdata_ptr) { fprintf(stderr, "%s:%d", __FILE__, __LINE__); return NULL; } return parser; } int gdbmi_parser_destroy(gdbmi_parser_ptr parser) { if (!parser) return -1; if (parser->last_error) { free(parser->last_error); parser->last_error = NULL; } if (parser->mips) { /* Free the parser instance */ gdbmi_pstate_delete(parser->mips); parser->mips = NULL; } if (parser->pdata_ptr) { destroy_gdbmi_pdata(parser->pdata_ptr); parser->pdata_ptr = NULL; } free(parser); parser = NULL; return 0; } int gdbmi_parser_parse_string(gdbmi_parser_ptr parser, const char *mi_command, gdbmi_output_ptr * pt, int *parse_failed) { YY_BUFFER_STATE state; int pattern; int mi_status; if (!parser) return -1; if (!mi_command) return -1; if (!parse_failed) return -1; /* Initialize output parameters */ *pt = 0; *parse_failed = 0; parser->pdata_ptr->parsed_one = 0; /* Create a new input buffer for flex. */ state = gdbmi__scan_string(strdup(mi_command)); /* Create a new input buffer for flex and * iterate over all the tokens. */ do { pattern = gdbmi_lex(); if (pattern == 0) break; mi_status = gdbmi_push_parse(parser->mips, pattern, NULL, parser->pdata_ptr); } while (mi_status == YYPUSH_MORE); /* Parser is done, this should never happen */ if (mi_status != YYPUSH_MORE && mi_status != 0) { *parse_failed = 1; } else if (parser->pdata_ptr->parsed_one) { *pt = parser->pdata_ptr->tree; parser->pdata_ptr->tree = NULL; } /* Free the scanners buffer */ gdbmi__delete_buffer(state); return 0; } int gdbmi_parser_parse_file(gdbmi_parser_ptr parser, const char *mi_command_file, gdbmi_output_ptr * pt, int *parse_failed) { int pattern; int mi_status; if (!parser) return -1; if (!mi_command_file) return -1; if (!parse_failed) return -1; *pt = 0; *parse_failed = 0; /* Initialize data */ gdbmi_in = fopen(mi_command_file, "r"); if (!gdbmi_in) { fprintf(stderr, "%s:%d", __FILE__, __LINE__); return -1; } /* Create a new input buffer for flex and * iterate over all the tokens. */ do { pattern = gdbmi_lex(); if (pattern == 0) break; mi_status = gdbmi_push_parse(parser->mips, pattern, NULL, parser->pdata_ptr); } while (mi_status == YYPUSH_MORE); /* Parser is done, this should never happen */ if (mi_status != YYPUSH_MORE && mi_status != 0) { *parse_failed = 1; } else { *pt = parser->pdata_ptr->tree; parser->pdata_ptr->tree = NULL; } fclose(gdbmi_in); return 0; } cgdb-0.6.7/lib/gdbmi/gdbmi_parser.h000644 000765 000024 00000007064 12074441140 020053 0ustar00mmuellerstaff000000 000000 #ifndef __GDBMI_PARSER_H__ #define __GDBMI_PARSER_H__ #include "gdbmi_pt.h" /* Doxygen headers {{{ */ /*! * \file * gdbmi_parser.h * * \brief * This interface is intended to be the abstraction layer that is capable of * parsing MI commands that are sent by GDB and determining if they are valid * or not. The input to this interface is a single MI command. This consists * of one or more lines. That output is an MI parse tree, which represents * the MI command in memory. The application should only use this parse * tree to understand the command. */ /* }}} */ /* struct gdbmi_parser {{{ */ /** * @name Creating and destroying a gdbmi_parser context * * The GDBMI parser context can be created and destroyed here. */ /*@{*/ struct gdbmi_parser; typedef struct gdbmi_parser *gdbmi_parser_ptr; /** * Create a gdbmi_parser context. * * \return * The new instance of a gdbmi_parser, or NULL on error */ gdbmi_parser_ptr gdbmi_parser_create(void); /** * Destroy a gdbmi_parser context. * * \param parser * The instance the parser to destroy * * \return * 0 on succes, or -1 on error. */ int gdbmi_parser_destroy(gdbmi_parser_ptr parser); /*@}*/ /** * @name parsing functions * * These functions tell the context what to parse. */ /*@{*/ /** * Tell the MI parser to parse the data. * * The data must be either a full line or multiple full lines. (ending in \n) * The normal usage of this function is to call it over and over again with * more data and wait for it to return an mi output command. * * It would be more convienent to allow the parser to parse any random * data but that would require flex to be a push flexer. It may even have * this feature but since I already changed bison, I don't want to think * anymore right now about how to improve this interface. It's good enough * for a first shot. * * \param parser * The gdbmi_parser context to operate on. * * \param mi_data * The null terminated mi data. This consists of one or more lines. * * \param pt * If this function is successful (returns 0), then pt may be set. * If the mi_data parameter completes an mi output command, than pt will * be non-null and represent the command parsed. Otherwise, if it is waiting * for more intput, it will be returned as NULL. * * The user is responsible for freeing this data structure on there own. * * \param parse_failed * 1 if the parser failed to parse the command, otherwise 0 * If there was an error, it was written to the global logger. * Also, pt is invalid if there is an error, it should not be displayed or freed * * \return * 0 on succes, or -1 on error. */ int gdbmi_parser_parse_string(gdbmi_parser_ptr parser, const char *mi_data, gdbmi_output_ptr * pt, int *parse_failed); /** * Tell the MI parser to parse the mi_command from a file. * * \param parser * The gdbmi_parser context to operate on. * * \param mi_command_file * The command file containing the mi command to parse. * * \param pt * If this function is successful (returns 0), then pt will be * the parse tree representing the mi_command. * * The user is responsible for freeing this data structure on there own. * * \param parse_failed * 1 if the parser failed to parse the command, otherwise 0 * If there was an error, it was written to the global logger. * Also, pt is invalid if there is an error, it should not be displayed or freed * * \return * 0 on succes, or -1 on error. */ int gdbmi_parser_parse_file(gdbmi_parser_ptr parser_ptr, const char *mi_command_file, gdbmi_output_ptr * pt, int *parse_failed); /*@}*/ /* }}} */ #endif cgdb-0.6.7/lib/gdbmi/gdbmi_pt.c000644 000765 000024 00000033732 12074441140 017176 0ustar00mmuellerstaff000000 000000 #include #include #include "gdbmi_pt.h" int print_token(long l) { if (l == -1) return 0; printf("token(%ld)", l); return 0; } /* Print result class */ int print_gdbmi_result_class(enum gdbmi_result_class param) { switch (param) { case GDBMI_DONE: printf("GDBMI_DONE\n"); break; case GDBMI_RUNNING: printf("GDBMI_RUNNING\n"); break; case GDBMI_CONNECTED: printf("GDBMI_CONNECTED\n"); break; case GDBMI_ERROR: printf("GDBMI_ERROR\n"); break; case GDBMI_EXIT: printf("EXIT\n"); break; default: return -1; }; return 0; } /* Creating and Destroying */ gdbmi_pdata_ptr create_gdbmi_pdata(void) { return calloc(1, sizeof (struct gdbmi_pdata)); } int destroy_gdbmi_pdata(gdbmi_pdata_ptr param) { if (!param) return 0; free(param); return 0; } /* Creating, Destroying and printing gdbmi_output */ gdbmi_output_ptr create_gdbmi_output(void) { return calloc(1, sizeof (struct gdbmi_output)); } int destroy_gdbmi_output(gdbmi_output_ptr param) { if (!param) return 0; if (destroy_gdbmi_oob_record(param->oob_record) == -1) return -1; param->oob_record = NULL; if (destroy_gdbmi_result_record(param->result_record) == -1) return -1; param->result_record = NULL; if (destroy_gdbmi_output(param->next) == -1) return -1; param->next = NULL; free(param); param = NULL; return 0; } gdbmi_output_ptr append_gdbmi_output(gdbmi_output_ptr list, gdbmi_output_ptr item) { if (!item) return NULL; if (!list) list = item; else { gdbmi_output_ptr cur = list; while (cur->next) cur = cur->next; cur->next = item; } return list; } int print_gdbmi_output(gdbmi_output_ptr param) { gdbmi_output_ptr cur = param; int result; while (cur) { result = print_gdbmi_oob_record(cur->oob_record); if (result == -1) return -1; result = print_gdbmi_result_record(cur->result_record); if (result == -1) return -1; cur = cur->next; } return 0; } /* Creating, Destroying and printing record */ gdbmi_result_record_ptr create_gdbmi_result_record(void) { return calloc(1, sizeof (struct gdbmi_result_record)); } int destroy_gdbmi_result_record(gdbmi_result_record_ptr param) { if (!param) return 0; if (destroy_gdbmi_result(param->result) == -1) return -1; param->result = NULL; free(param); param = NULL; return 0; } int print_gdbmi_result_record(gdbmi_result_record_ptr param) { int result; if (!param) return 0; result = print_token(param->token); if (result == -1) return -1; result = print_gdbmi_result_class(param->result_class); if (result == -1) return -1; result = print_gdbmi_result(param->result); if (result == -1) return -1; return 0; } /* Creating, Destroying and printing result */ gdbmi_result_ptr create_gdbmi_result(void) { return calloc(1, sizeof (struct gdbmi_result_record)); } int destroy_gdbmi_result(gdbmi_result_ptr param) { if (!param) return 0; if (param->variable) { free(param->variable); param->variable = NULL; } if (destroy_gdbmi_value(param->value) == -1) return -1; param->value = NULL; if (destroy_gdbmi_result(param->next) == -1) return -1; param->next = NULL; free(param); param = NULL; return 0; } gdbmi_result_ptr append_gdbmi_result(gdbmi_result_ptr list, gdbmi_result_ptr item) { if (!item) return NULL; if (!list) list = item; else { gdbmi_result_ptr cur = list; while (cur->next) cur = cur->next; cur->next = item; } return list; } int print_gdbmi_result(gdbmi_result_ptr param) { gdbmi_result_ptr cur = param; int result; while (cur) { printf("variable->(%s)\n", cur->variable); result = print_gdbmi_value(cur->value); if (result == -1) return -1; cur = cur->next; } return 0; } int print_gdbmi_oob_record_choice(enum gdbmi_oob_record_choice param) { switch (param) { case GDBMI_ASYNC: printf("GDBMI_ASYNC\n"); break; case GDBMI_STREAM: printf("GDBMI_STREAM\n"); break; default: return -1; }; return 0; } /* Creating, Destroying and printing oob_record */ gdbmi_oob_record_ptr create_gdbmi_oob_record(void) { return calloc(1, sizeof (struct gdbmi_oob_record)); } int destroy_gdbmi_oob_record(gdbmi_oob_record_ptr param) { if (!param) return 0; if (param->record == GDBMI_ASYNC) { if (destroy_gdbmi_async_record(param->option.async_record) == -1) return -1; param->option.async_record = NULL; } else if (param->record == GDBMI_STREAM) { if (destroy_gdbmi_stream_record(param->option.stream_record) == -1) return -1; param->option.stream_record = NULL; } else { return -1; } if (destroy_gdbmi_oob_record(param->next) == -1) return -1; param->next = NULL; free(param); param = NULL; return 0; } gdbmi_oob_record_ptr append_gdbmi_oob_record(gdbmi_oob_record_ptr list, gdbmi_oob_record_ptr item) { if (!item) return NULL; if (!list) list = item; else { gdbmi_oob_record_ptr cur = list; while (cur->next) cur = cur->next; cur->next = item; } return list; } int print_gdbmi_oob_record(gdbmi_oob_record_ptr param) { gdbmi_oob_record_ptr cur = param; int result; while (cur) { result = print_gdbmi_oob_record_choice(cur->record); if (result == -1) return -1; if (cur->record == GDBMI_ASYNC) { result = print_gdbmi_async_record(cur->option.async_record); if (result == -1) return -1; } else if (cur->record == GDBMI_STREAM) { result = print_gdbmi_stream_record(cur->option.stream_record); if (result == -1) return -1; } else return -1; cur = cur->next; } return 0; } int print_gdbmi_async_record_choice(enum gdbmi_async_record_choice param) { switch (param) { case GDBMI_STATUS: printf("GDBMI_STATUS\n"); break; case GDBMI_EXEC: printf("GDBMI_EXEC\n"); break; case GDBMI_NOTIFY: printf("GDBMI_NOTIFY\n"); break; default: return -1; }; return 0; } int print_gdbmi_stream_record_choice(enum gdbmi_stream_record_choice param) { switch (param) { case GDBMI_CONSOLE: printf("GDBMI_CONSOLE\n"); break; case GDBMI_TARGET: printf("GDBMI_TARGET\n"); break; case GDBMI_LOG: printf("GDBMI_LOG\n"); break; default: return -1; }; return 0; } /* Creating, Destroying and printing async_record */ gdbmi_async_record_ptr create_gdbmi_async_record(void) { return calloc(1, sizeof (struct gdbmi_async_record)); } int destroy_gdbmi_async_record(gdbmi_async_record_ptr param) { if (!param) return 0; if (destroy_gdbmi_result(param->result) == -1) return -1; param->result = NULL; free(param); param = NULL; return 0; } int print_gdbmi_async_record(gdbmi_async_record_ptr param) { int result; if (!param) return 0; result = print_token(param->token); if (result == -1) return -1; result = print_gdbmi_async_record_choice(param->async_record); if (result == -1) return -1; result = print_gdbmi_async_class(param->async_class); if (result == -1) return -1; result = print_gdbmi_result(param->result); if (result == -1) return -1; return 0; } int print_gdbmi_async_class(enum gdbmi_async_class param) { switch (param) { case GDBMI_STOPPED: printf("GDBMI_STOPPED\n"); break; default: return -1; }; return 0; } int print_gdbmi_value_choice(enum gdbmi_value_choice param) { switch (param) { case GDBMI_CSTRING: printf("GDBMI_CSTRING\n"); break; case GDBMI_TUPLE: printf("GDBMI_TUPLE\n"); break; case GDBMI_LIST: printf("GDBMI_LIST\n"); break; default: return -1; }; return 0; } /* Creating, Destroying and printing value */ gdbmi_value_ptr create_gdbmi_value(void) { return calloc(1, sizeof (struct gdbmi_value)); } int destroy_gdbmi_value(gdbmi_value_ptr param) { if (!param) return 0; if (param->value_choice == GDBMI_CSTRING) { if (param->option.cstring) { free(param->option.cstring); param->option.cstring = NULL; } } else if (param->value_choice == GDBMI_TUPLE) { if (destroy_gdbmi_tuple(param->option.tuple) == -1) return -1; param->option.tuple = NULL; } else if (param->value_choice == GDBMI_LIST) { if (destroy_gdbmi_list(param->option.list) == -1) return -1; param->option.list = NULL; } else return -1; if (destroy_gdbmi_value(param->next) == -1) return -1; param->next = NULL; free(param); param = NULL; return 0; } gdbmi_value_ptr append_gdbmi_value(gdbmi_value_ptr list, gdbmi_value_ptr item) { if (!item) return NULL; if (!list) list = item; else { gdbmi_value_ptr cur = list; while (cur->next) cur = cur->next; cur->next = item; } return list; } int print_gdbmi_value(gdbmi_value_ptr param) { gdbmi_value_ptr cur = param; int result; while (cur) { result = print_gdbmi_value_choice(cur->value_choice); if (result == -1) return -1; if (cur->value_choice == GDBMI_CSTRING) { printf("cstring->(%s)\n", cur->option.cstring); } else if (cur->value_choice == GDBMI_TUPLE) { result = print_gdbmi_tuple(cur->option.tuple); if (result == -1) return -1; } else if (cur->value_choice == GDBMI_LIST) { result = print_gdbmi_list(cur->option.list); if (result == -1) return -1; } else return -1; cur = cur->next; } return 0; } /* Creating, Destroying and printing tuple */ gdbmi_tuple_ptr create_gdbmi_tuple(void) { return calloc(1, sizeof (struct gdbmi_tuple)); } int destroy_gdbmi_tuple(gdbmi_tuple_ptr param) { if (!param) return 0; if (destroy_gdbmi_result(param->result) == -1) return -1; param->result = NULL; if (destroy_gdbmi_tuple(param->next) == -1) return -1; param->next = NULL; free(param); param = NULL; return 0; } int print_gdbmi_tuple(gdbmi_tuple_ptr param) { gdbmi_tuple_ptr cur = param; int result; while (cur) { result = print_gdbmi_result(cur->result); if (result == -1) return -1; cur = cur->next; } return 0; } int print_gdbmi_list_choice(enum gdbmi_list_choice param) { switch (param) { case GDBMI_VALUE: printf("GDBMI_VALUE\n"); break; case GDBMI_RESULT: printf("GDBMI_RESULT\n"); break; default: return -1; }; return 0; } /* Creating, Destroying and printing list */ gdbmi_list_ptr create_gdbmi_list(void) { return calloc(1, sizeof (struct gdbmi_list)); } int destroy_gdbmi_list(gdbmi_list_ptr param) { if (!param) return 0; if (param->list_choice == GDBMI_VALUE) { if (destroy_gdbmi_value(param->option.value) == -1) return -1; param->option.value = NULL; } else if (param->list_choice == GDBMI_RESULT) { if (destroy_gdbmi_result(param->option.result) == -1) return -1; param->option.result = NULL; } else return -1; if (destroy_gdbmi_list(param->next) == -1) return -1; param->next = NULL; free(param); param = NULL; return 0; } gdbmi_list_ptr append_gdbmi_list(gdbmi_list_ptr list, gdbmi_list_ptr item) { if (!item) return NULL; if (!list) list = item; else { gdbmi_list_ptr cur = list; while (cur->next) cur = cur->next; cur->next = item; } return list; } int print_gdbmi_list(gdbmi_list_ptr param) { gdbmi_list_ptr cur = param; int result; while (cur) { result = print_gdbmi_list_choice(cur->list_choice); if (result == -1) return -1; if (cur->list_choice == GDBMI_VALUE) { result = print_gdbmi_value(cur->option.value); if (result == -1) return -1; } else if (cur->list_choice == GDBMI_RESULT) { result = print_gdbmi_result(cur->option.result); if (result == -1) return -1; } else return -1; cur = cur->next; } return 0; } /* Creating, Destroying and printing stream_record */ gdbmi_stream_record_ptr create_gdbmi_stream_record(void) { return calloc(1, sizeof (struct gdbmi_stream_record)); } int destroy_gdbmi_stream_record(gdbmi_stream_record_ptr param) { if (!param) return 0; if (param->cstring) { free(param->cstring); param->cstring = NULL; } free(param); param = NULL; return 0; } int print_gdbmi_stream_record(gdbmi_stream_record_ptr param) { int result; result = print_gdbmi_stream_record_choice(param->stream_record); if (result == -1) return -1; printf("cstring->(%s)\n", param->cstring); return 0; } cgdb-0.6.7/lib/gdbmi/gdbmi_pt.h000644 000765 000024 00000017755 12074441140 017212 0ustar00mmuellerstaff000000 000000 #ifndef __GDBMI_PT_H__ #define __GDBMI_PT_H__ typedef struct gdbmi_output *gdbmi_output_ptr; typedef struct gdbmi_oob_record *gdbmi_oob_record_ptr; typedef struct gdbmi_result_record *gdbmi_result_record_ptr; typedef long gdbmi_token_t; typedef struct gdbmi_result *gdbmi_result_ptr; typedef struct gdbmi_async_record *gdbmi_async_record_ptr; typedef struct gdbmi_stream_record *gdbmi_stream_record_ptr; typedef struct gdbmi_value *gdbmi_value_ptr; typedef struct gdbmi_tuple *gdbmi_tuple_ptr; typedef struct gdbmi_list *gdbmi_list_ptr; typedef struct gdbmi_pdata *gdbmi_pdata_ptr; struct gdbmi_pdata { int parsed_one; gdbmi_output_ptr tree; }; /* A choice of result's that GDB is capable of producing */ enum gdbmi_result_class { GDBMI_DONE, GDBMI_RUNNING, GDBMI_CONNECTED, GDBMI_ERROR, GDBMI_EXIT }; /* This is the root of a parsed GDB/MI Output command. */ struct gdbmi_output { /* Every output command has a list of optional oob_record's. This will be the head of the list, otherwise NULL. */ gdbmi_oob_record_ptr oob_record; /* Every output command has an optional result_record list, or NULL. */ gdbmi_result_record_ptr result_record; /* A pointer to the next output */ gdbmi_output_ptr next; }; /* A result record represents the result of a command sent to GDB. */ struct gdbmi_result_record { /* This is the unique identifier that was passed to GDB when asking for a command to be done on behalf of the front end */ gdbmi_token_t token; /* The choice of result that this class represents */ enum gdbmi_result_class result_class; /* The results of the command */ gdbmi_result_ptr result; }; /* There are several kinds of output that GDB can send */ enum gdbmi_oob_record_choice { /* GDBMI_ASYNC I believe that the asyncronous records contain data that was not asked for by the front end. An asyncronous event occured within the inferior or GDB and GDB needs to update the front end. For instance, I believe this is useful for when breakpoints are modified, instead of having the front end ask if the breakpoints were modified every time. */ GDBMI_ASYNC, /* GDBMI_STREAM This is the result of normal output from the console, target or GDB. */ GDBMI_STREAM }; /* This is an out of band record. */ struct gdbmi_oob_record { /* This is the choice of oob_record */ enum gdbmi_oob_record_choice record; union { /* If it's an GDBMI_ASYNC record */ gdbmi_async_record_ptr async_record; /* If it's an GDBMI_STREAM record */ gdbmi_stream_record_ptr stream_record; } option; /* A pointer to the next oob_record */ gdbmi_oob_record_ptr next; }; /* This represents each choice of asyncronous record GDB is capable of sending. */ enum gdbmi_async_record_choice { /* Contains on-going status information about the progress of a slow operation. It can be discarded. */ GDBMI_STATUS, /* Contains asynchronous state change on the target (stopped, started, disappeared). */ GDBMI_EXEC, /* Contains supplementary information that the client should handle (e.g., a new breakpoint information). */ GDBMI_NOTIFY }; /* This represents each choice of stream record GDB is capable of sending. */ enum gdbmi_stream_record_choice { /* Output that should be displayed as is in the console. It is the textual response to a CLI command. */ GDBMI_CONSOLE, /* Output produced by the target program. */ GDBMI_TARGET, /* Output text coming from GDB's internals, for instance messages * that should be displayed as part of an error log. */ GDBMI_LOG }; enum gdbmi_async_class { GDBMI_STOPPED }; /* An asyncronous record */ struct gdbmi_async_record { /* This is the unique identifier that was passed to GDB when asking for a command to be done on behalf of the front end. */ gdbmi_token_t token; /* The choice of asyncronous record this represents */ enum gdbmi_async_record_choice async_record; enum gdbmi_async_class async_class; gdbmi_result_ptr result; }; /* The result from GDB. This is a linked list. If the result is a key/value pair, then 'variable' is the key and 'value' is the value. */ struct gdbmi_result { /* Key */ char *variable; /* Value */ gdbmi_value_ptr value; /* Pointer to the next result */ gdbmi_result_ptr next; }; enum gdbmi_value_choice { GDBMI_CSTRING, GDBMI_TUPLE, GDBMI_LIST }; struct gdbmi_value { enum gdbmi_value_choice value_choice; union { char *cstring; gdbmi_tuple_ptr tuple; gdbmi_list_ptr list; } option; gdbmi_value_ptr next; }; struct gdbmi_tuple { gdbmi_result_ptr result; gdbmi_tuple_ptr next; }; enum gdbmi_list_choice { GDBMI_VALUE, GDBMI_RESULT }; struct gdbmi_list { enum gdbmi_list_choice list_choice; union { gdbmi_value_ptr value; gdbmi_result_ptr result; } option; gdbmi_list_ptr next; }; struct gdbmi_stream_record { enum gdbmi_stream_record_choice stream_record; char *cstring; }; /* Print result class */ int print_gdbmi_result_class(enum gdbmi_result_class param); /* Creating and Destroying */ gdbmi_pdata_ptr create_gdbmi_pdata(void); int destroy_gdbmi_pdata(gdbmi_pdata_ptr param); /* Creating, Destroying and printing output */ gdbmi_output_ptr create_gdbmi_output(void); int destroy_gdbmi_output(gdbmi_output_ptr param); gdbmi_output_ptr append_gdbmi_output(gdbmi_output_ptr list, gdbmi_output_ptr item); int print_gdbmi_output(gdbmi_output_ptr param); /* Creating, Destroying and printing record */ gdbmi_result_record_ptr create_gdbmi_result_record(void); int destroy_gdbmi_result_record(gdbmi_result_record_ptr param); int print_gdbmi_result_record(gdbmi_result_record_ptr param); /* Creating, Destroying and printing result */ gdbmi_result_ptr create_gdbmi_result(void); int destroy_gdbmi_result(gdbmi_result_ptr param); gdbmi_result_ptr append_gdbmi_result(gdbmi_result_ptr list, gdbmi_result_ptr item); int print_gdbmi_result(gdbmi_result_ptr param); int print_gdbmi_oob_record_choice(enum gdbmi_oob_record_choice param); /* Creating, Destroying and printing oob_record */ gdbmi_oob_record_ptr create_gdbmi_oob_record(void); int destroy_gdbmi_oob_record(gdbmi_oob_record_ptr param); gdbmi_oob_record_ptr append_gdbmi_oob_record(gdbmi_oob_record_ptr list, gdbmi_oob_record_ptr item); int print_gdbmi_oob_record(gdbmi_oob_record_ptr param); int print_gdbmi_async_record_choice(enum gdbmi_async_record_choice param); int print_gdbmi_stream_record_choice(enum gdbmi_stream_record_choice param); /* Creating, Destroying and printing async_record */ gdbmi_async_record_ptr create_gdbmi_async_record(void); int destroy_gdbmi_async_record(gdbmi_async_record_ptr param); int print_gdbmi_async_record(gdbmi_async_record_ptr param); int print_gdbmi_async_class(enum gdbmi_async_class param); int print_gdbmi_value_choice(enum gdbmi_value_choice param); /* Creating, Destroying and printing value */ gdbmi_value_ptr create_gdbmi_value(void); int destroy_gdbmi_value(gdbmi_value_ptr param); gdbmi_value_ptr append_gdbmi_value(gdbmi_value_ptr list, gdbmi_value_ptr item); int print_gdbmi_value(gdbmi_value_ptr param); /* Creating, Destroying and printing tuple */ gdbmi_tuple_ptr create_gdbmi_tuple(void); int destroy_gdbmi_tuple(gdbmi_tuple_ptr param); int print_gdbmi_tuple(gdbmi_tuple_ptr param); int print_gdbmi_list_choice(enum gdbmi_list_choice param); /* Creating, Destroying and printing list */ gdbmi_list_ptr create_gdbmi_list(void); int destroy_gdbmi_list(gdbmi_list_ptr param); gdbmi_list_ptr append_gdbmi_list(gdbmi_list_ptr list, gdbmi_list_ptr item); int print_gdbmi_list(gdbmi_list_ptr param); /* Creating, Destroying and printing stream_record */ gdbmi_stream_record_ptr create_gdbmi_stream_record(void); int destroy_gdbmi_stream_record(gdbmi_stream_record_ptr param); int print_gdbmi_stream_record(gdbmi_stream_record_ptr param); #endif cgdb-0.6.7/lib/gdbmi/Makefile.am000644 000765 000024 00000000553 12074441140 017274 0ustar00mmuellerstaff000000 000000 noinst_LIBRARIES=libgdbmi.a libgdbmi_a_SOURCES= \ gdbmi_grammar.y \ gdbmi_lexer.l \ gdbmi_oc.c \ gdbmi_parser.c \ gdbmi_pt.c EXTRA_DIST = \ gdbmi_grammar.h \ gdbmi_oc.h \ gdbmi_parser.h \ gdbmi_pt.h # gdbmi driver program noinst_PROGRAMS = gdbmi_driver gdbmi_driver_LDADD = libgdbmi.a gdbmi_driver_SOURCES = gdbmi_driver.c cgdb-0.6.7/lib/gdbmi/Makefile.in000644 000765 000024 00000041160 12074766253 017323 0ustar00mmuellerstaff000000 000000 # Makefile.in generated by automake 1.13.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ noinst_PROGRAMS = gdbmi_driver$(EXEEXT) subdir = lib/gdbmi DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ gdbmi_grammar.c gdbmi_lexer.c $(top_srcdir)/config/depcomp \ $(top_srcdir)/config/ylwrap README ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/config/readline_check_version.m4 \ $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LIBRARIES = $(noinst_LIBRARIES) AR = ar ARFLAGS = cru AM_V_AR = $(am__v_AR_@AM_V@) am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@) am__v_AR_0 = @echo " AR " $@; am__v_AR_1 = libgdbmi_a_AR = $(AR) $(ARFLAGS) libgdbmi_a_LIBADD = am_libgdbmi_a_OBJECTS = gdbmi_grammar.$(OBJEXT) gdbmi_lexer.$(OBJEXT) \ gdbmi_oc.$(OBJEXT) gdbmi_parser.$(OBJEXT) gdbmi_pt.$(OBJEXT) libgdbmi_a_OBJECTS = $(am_libgdbmi_a_OBJECTS) PROGRAMS = $(noinst_PROGRAMS) am_gdbmi_driver_OBJECTS = gdbmi_driver.$(OBJEXT) gdbmi_driver_OBJECTS = $(am_gdbmi_driver_OBJECTS) gdbmi_driver_DEPENDENCIES = libgdbmi.a AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = LEXCOMPILE = $(LEX) $(AM_LFLAGS) $(LFLAGS) AM_V_LEX = $(am__v_LEX_@AM_V@) am__v_LEX_ = $(am__v_LEX_@AM_DEFAULT_V@) am__v_LEX_0 = @echo " LEX " $@; am__v_LEX_1 = YLWRAP = $(top_srcdir)/config/ylwrap am__yacc_c2h = sed -e s/cc$$/hh/ -e s/cpp$$/hpp/ -e s/cxx$$/hxx/ \ -e s/c++$$/h++/ -e s/c$$/h/ YACCCOMPILE = $(YACC) $(AM_YFLAGS) $(YFLAGS) AM_V_YACC = $(am__v_YACC_@AM_V@) am__v_YACC_ = $(am__v_YACC_@AM_DEFAULT_V@) am__v_YACC_0 = @echo " YACC " $@; am__v_YACC_1 = SOURCES = $(libgdbmi_a_SOURCES) $(gdbmi_driver_SOURCES) DIST_SOURCES = $(libgdbmi_a_SOURCES) $(gdbmi_driver_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ RL_MAJOR = @RL_MAJOR@ RL_MINOR = @RL_MINOR@ RL_VERSION = @RL_VERSION@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ YACC = @YACC@ YFLAGS = @YFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_LIBRARIES = libgdbmi.a libgdbmi_a_SOURCES = \ gdbmi_grammar.y \ gdbmi_lexer.l \ gdbmi_oc.c \ gdbmi_parser.c \ gdbmi_pt.c EXTRA_DIST = \ gdbmi_grammar.h \ gdbmi_oc.h \ gdbmi_parser.h \ gdbmi_pt.h gdbmi_driver_LDADD = libgdbmi.a gdbmi_driver_SOURCES = gdbmi_driver.c all: all-am .SUFFIXES: .SUFFIXES: .c .l .o .obj .y $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu lib/gdbmi/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu lib/gdbmi/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) libgdbmi.a: $(libgdbmi_a_OBJECTS) $(libgdbmi_a_DEPENDENCIES) $(EXTRA_libgdbmi_a_DEPENDENCIES) $(AM_V_at)-rm -f libgdbmi.a $(AM_V_AR)$(libgdbmi_a_AR) libgdbmi.a $(libgdbmi_a_OBJECTS) $(libgdbmi_a_LIBADD) $(AM_V_at)$(RANLIB) libgdbmi.a clean-noinstPROGRAMS: -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) gdbmi_driver$(EXEEXT): $(gdbmi_driver_OBJECTS) $(gdbmi_driver_DEPENDENCIES) $(EXTRA_gdbmi_driver_DEPENDENCIES) @rm -f gdbmi_driver$(EXEEXT) $(AM_V_CCLD)$(LINK) $(gdbmi_driver_OBJECTS) $(gdbmi_driver_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gdbmi_driver.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gdbmi_grammar.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gdbmi_lexer.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gdbmi_oc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gdbmi_parser.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gdbmi_pt.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .l.c: $(AM_V_LEX)$(am__skiplex) $(SHELL) $(YLWRAP) $< $(LEX_OUTPUT_ROOT).c $@ -- $(LEXCOMPILE) .y.c: $(AM_V_YACC)$(am__skipyacc) $(SHELL) $(YLWRAP) $< y.tab.c $@ y.tab.h `echo $@ | $(am__yacc_c2h)` y.output $*.output -- $(YACCCOMPILE) ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LIBRARIES) $(PROGRAMS) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -rm -f gdbmi_grammar.c -rm -f gdbmi_lexer.c clean: clean-am clean-am: clean-generic clean-noinstLIBRARIES clean-noinstPROGRAMS \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ clean-noinstLIBRARIES clean-noinstPROGRAMS cscopelist-am ctags \ ctags-am distclean distclean-compile distclean-generic \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: cgdb-0.6.7/lib/gdbmi/README000644 000765 000024 00000000160 12074441140 016112 0ustar00mmuellerstaff000000 000000 This library implements the gdbmi protocol. Currently, it simply parses an MI output command into a parse tree. cgdb-0.6.7/lib/adt/ibuf.c000644 000765 000024 00000005463 12074441140 016024 0ustar00mmuellerstaff000000 000000 #include "ibuf.h" #include "sys_util.h" #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #if HAVE_CTYPE_H #include #endif /* HAVE_CTYPE_H */ struct ibuf { char *buf; unsigned long cur_buf_pos; unsigned long cur_block_size; unsigned long BLOCK_SIZE; }; struct ibuf *ibuf_init(void) { struct ibuf *s = (struct ibuf *) cgdb_malloc(sizeof (struct ibuf)); s->BLOCK_SIZE = 4096; s->cur_block_size = 1; s->cur_buf_pos = 0; s->buf = (char *) cgdb_malloc(sizeof (char) * (s->BLOCK_SIZE)); s->buf[s->cur_buf_pos] = '\0'; return s; } void ibuf_free(struct ibuf *s) { if (!s) return; free(s->buf); free(s); s = NULL; } void ibuf_clear(struct ibuf *s) { if (!s) return; s->cur_block_size = 1; s->cur_buf_pos = 0; s->buf[s->cur_buf_pos] = '\0'; } void ibuf_addchar(struct ibuf *s, char c) { if (!s) return; /* the '+1' is for the null-terminated char */ if (s->cur_buf_pos + 1 == ((s->cur_block_size) * s->BLOCK_SIZE)) { /* NOTE: s->cur_block_size *= 2 would double the buffer size * however, I didn't think it was necesary since it should rarly go * above 1 block. */ s->cur_block_size += 1; s->buf = (char *) realloc(s->buf, s->cur_block_size * s->BLOCK_SIZE); } /* Add the new char and null terminate */ s->buf[(s->cur_buf_pos)++] = c; s->buf[(s->cur_buf_pos)] = '\0'; } void ibuf_add(struct ibuf *s, const char *d) { int length = strlen(d), i; for (i = 0; i < length; i++) ibuf_addchar(s, d[i]); } void ibuf_delchar(struct ibuf *s) { if (!s) return; if (s->cur_buf_pos > 0) { --(s->cur_buf_pos); s->buf[(s->cur_buf_pos)] = '\0'; } } char *ibuf_get(struct ibuf *s) { if (!s) return NULL; return s->buf; } unsigned long ibuf_length(struct ibuf *s) { if (!s) return 0; return s->cur_buf_pos; } struct ibuf *ibuf_dup(struct ibuf *s) { struct ibuf *ns = ibuf_init(); ibuf_add(ns, ibuf_get(s)); return ns; } void ibuf_trim(struct ibuf *s) { int i, j = 0; if (!s) return; /* Find the first non-space character */ for (i = 0; i < s->cur_buf_pos && isspace(s->buf[i]); i++); /* If spaces were found, shift string leftward to overwrite them */ if (i > 0) { for (j = 0; i < s->cur_buf_pos; j++, i++) { s->buf[j] = s->buf[i]; } /* Update buf pos and null terminate */ s->cur_buf_pos = j; s->buf[s->cur_buf_pos] = '\0'; if (s->cur_buf_pos == 0) { return; } } /* Loop from the end, looking for spaces */ for (i = s->cur_buf_pos - 1; i > 0 && isspace(s->buf[i]); i--); s->cur_buf_pos = i + 1; s->buf[s->cur_buf_pos] = '\0'; } cgdb-0.6.7/lib/adt/ibuf.h000644 000765 000024 00000002667 12074441140 016034 0ustar00mmuellerstaff000000 000000 #ifndef __IBUF_H__ #define __IBUF_H__ #if HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ /* A simple interface to an infinate string */ struct ibuf; /* ibuf_init: Returns a new infinate string. */ struct ibuf *ibuf_init(void); /* ibuf_free: free a string */ void ibuf_free(struct ibuf *s); /* clears the string s */ void ibuf_clear(struct ibuf *s); /* ibuf_addchar: Adds a char to the infinate buffer * s - the infinate string to modify * c - the char to add */ void ibuf_addchar(struct ibuf *s, char c); /* ibuf_add: Adds a char to the infinate buffer * s - the infinate string to modify * d - the string to add */ void ibuf_add(struct ibuf *s, const char *d); /* ibuf_delchar: Delete the last char put in */ void ibuf_delchar(struct ibuf *s); /* ibuf_get: returns the string * return - the string returned is valid until ibuf_free is called * NOTE: This function adds a '\0' to the end of the string if it is not * the last char */ char *ibuf_get(struct ibuf *s); /* ibuf_length: Returns the length of string s */ unsigned long ibuf_length(struct ibuf *s); /* * This will return a valid string that is equal to s. * * Returns * New string on success, NULL on error. */ struct ibuf *ibuf_dup(struct ibuf *s); /** * Trim whitespace from the head and tail of the string. */ void ibuf_trim(struct ibuf *s); #endif /* HAVE_CONFIG_H */ cgdb-0.6.7/lib/adt/ibuf_driver.c000644 000765 000024 00000011640 12074441140 017371 0ustar00mmuellerstaff000000 000000 /* * ibuf_driver: A test driver for the infinite string structure. * * Copyright (c) 2006, Mike Mueller & Bob Rossi * Subject to the terms of the GNU General Public Licence */ /* Standard Includes */ #if HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #if HAVE_STDIO_H #include #endif /* HAVE_STDIO_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ /* Local Includes */ #include "ibuf.h" /* * Macros */ #define DEBUG 1 #ifdef DEBUG #define debug(args...) fprintf(stderr, args) #else #define debug(args...) #endif typedef struct ibuf *ibuf; /* * Local function prototypes */ /* Tests */ static int test_add(ibuf s); static int test_addchar(ibuf s); static int test_delchar(ibuf s); static int test_dup(ibuf s); static int test_trim(ibuf s); /* main: * * Description of test procedure here. */ int main(int argc, char *argv[]) { ibuf s = NULL; int result = 0; /* Create a tree */ debug("Creating string... "); s = ibuf_init(); if (s == NULL) { printf("FAILED\n"); return 1; } debug("Succeeded.\n"); /* Run tests */ result |= test_add(s); result |= test_addchar(s); result |= test_delchar(s); result |= test_dup(s); result |= test_trim(s); debug("Destroying string...\n"); ibuf_free(s); if (result) { printf("FAILED\n"); return 2; } printf("PASSED\n"); return 0; } /* * Local function implementations */ static int test_add(ibuf s) { /* Add the strings "hello" and " world" to the ibuf */ ibuf_add(s, "hello"); ibuf_add(s, " world"); /* Make sure that's what got added */ if (strcmp(ibuf_get(s), "hello world") != 0) { debug("test_add: Mismatch, expected \"hello world\", got: %s\n", ibuf_get(s)); return 1; } debug("test_add: Succeeded.\n"); return 0; } static int test_addchar(ibuf s) { /* Add an exclamation to the hello world string. */ ibuf_addchar(s, '!'); /* Make sure it was added correctly. */ if (strcmp(ibuf_get(s), "hello world!") != 0) { debug("test_addchar: Mismatch, expected \"hello world!\", got: %s\n", ibuf_get(s)); return 1; } debug("test_addchar: Succeeded.\n"); return 0; } static int test_delchar(ibuf s) { /* Delete the last '!' from the string. */ ibuf_delchar(s); /* Make sure it was deleted correctly. */ if (strcmp(ibuf_get(s), "hello world") != 0) { debug("test_delchar: Mismatch, expected \"hello world\", got: %s\n", ibuf_get(s)); return 1; } /* Wipe the string via delchar, testing ibuf_length simultaneously */ while (ibuf_length(s) > 0) { ibuf_delchar(s); } /* Make sure s is now an empty string. */ if (strcmp(ibuf_get(s), "") != 0) { debug("test_delchar: Expected empty string, got: %s\n", ibuf_get(s)); return 2; } debug("test_delchar: Succeeded.\n"); return 0; } static int test_dup(ibuf s) { ibuf t; /* Test duplicating a string. */ ibuf_add(s, "test string 1"); t = ibuf_dup(s); if (t == NULL) { debug("test_dup: ibuf_dup (attempt #1) returned NULL\n"); return 1; } if (strcmp(ibuf_get(s), ibuf_get(t)) != 0) { debug("test_dup: Strings mismatched: \"%s\" != \"%s\"\n", ibuf_get(s), ibuf_get(t)); return 1; } ibuf_free(t); /* Corner case: duplicate an empty string */ ibuf_clear(s); t = ibuf_dup(s); if (t == NULL) { debug("test_dup: ibuf_dup (attempt #2) returned NULL\n"); return 1; } if (strcmp(ibuf_get(t), "") != 0) { debug("test_dup: Expected empty string, got: %s\n", ibuf_get(t)); return 1; } ibuf_free(t); debug("test_dup: Succeeded.\n"); return 0; } static int test_trim(ibuf s) { /* Test #1: Empty string. */ ibuf_clear(s); ibuf_trim(s); if (strcmp(ibuf_get(s), "") != 0) { debug("test_trim: 1: expected empty string, got: %s\n", ibuf_get(s)); return 1; } /* Test #2: Single space. */ ibuf_clear(s); ibuf_addchar(s, ' '); ibuf_trim(s); if (strcmp(ibuf_get(s), "") != 0) { debug("test_trim: 2: expected empty string, got: %s\n", ibuf_get(s)); return 2; } /* Test #3: "hello world" (no leading or trailing spaces) */ ibuf_clear(s); ibuf_add(s, "hello world"); ibuf_trim(s); if (strcmp(ibuf_get(s), "hello world") != 0) { debug("test_trim: 3: expected \"hello world\", got: %s\n", ibuf_get(s)); return 3; } /* Test #4: " hello world \t" (leading and trailing spaces) */ ibuf_clear(s); ibuf_add(s, " hello world \t"); ibuf_trim(s); if (strcmp(ibuf_get(s), "hello world") != 0) { debug("test_trim: 4: expected \"hello world\", got: %s\n", ibuf_get(s)); return 3; } debug("test_trim: Succeeded.\n"); return 0; } cgdb-0.6.7/lib/adt/Makefile.am000644 000765 000024 00000003277 12074441140 016770 0ustar00mmuellerstaff000000 000000 AM_CFLAGS = -I$(top_srcdir)/lib/util noinst_LIBRARIES = libadt.a libadt_a_SOURCES = \ ibuf.c \ ibuf.h \ queue.c \ queue.h \ tgdb_list.c \ tgdb_list.h \ std_bbtree.c \ std_bbtree.h \ std_btree.c \ std_btree.h \ std_hash.c \ std_hash.h \ std_list.c \ std_list.h \ std_types.h # Installs the driver programs into progs directory noinst_PROGRAMS = ibuf_driver std_hash_driver std_list_driver \ std_btree_driver std_bbtree_driver # This is the ibuf driver ibuf_driver_LDFLAGS = -L. -L$(top_builddir)/lib/util ibuf_driver_LDADD = \ libadt.a \ $(top_builddir)/lib/util/libutil.a ibuf_driver_SOURCES = ibuf_driver.c ibuf_driver_CFLAGS = $(AM_CFLAGS) # This is the hash table driver std_hash_driver_LDFLAGS = -L. -L$(top_builddir)/lib/util std_hash_driver_LDADD = \ libadt.a \ $(top_builddir)/lib/util/libutil.a std_hash_driver_SOURCES = std_hash_driver.c std_hash_driver_CFLAGS = $(AM_CFLAGS) # This is the linked list driver std_list_driver_LDFLAGS = -L. -L$(top_builddir)/lib/util std_list_driver_LDADD = \ libadt.a \ $(top_builddir)/lib/util/libutil.a std_list_driver_SOURCES = std_list_driver.c std_list_driver_CFLAGS = $(AM_CFLAGS) # This is the binary tree driver std_btree_driver_LDFLAGS = -L. -L$(top_builddir)/lib/util std_btree_driver_LDADD = \ libadt.a \ $(top_builddir)/lib/util/libutil.a std_btree_driver_SOURCES = std_btree_driver.c std_btree_driver_CFLAGS = $(AM_CFLAGS) # This is the balanced binary tree driver std_bbtree_driver_LDFLAGS = -L. -L$(top_builddir)/lib/util std_bbtree_driver_LDADD = \ libadt.a \ $(top_builddir)/lib/util/libutil.a std_bbtree_driver_SOURCES = std_bbtree_driver.c std_bbtree_driver_CFLAGS = $(AM_CFLAGS) cgdb-0.6.7/lib/adt/Makefile.in000644 000765 000024 00000075715 12074766253 017026 0ustar00mmuellerstaff000000 000000 # Makefile.in generated by automake 1.13.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ noinst_PROGRAMS = ibuf_driver$(EXEEXT) std_hash_driver$(EXEEXT) \ std_list_driver$(EXEEXT) std_btree_driver$(EXEEXT) \ std_bbtree_driver$(EXEEXT) subdir = lib/adt DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/config/depcomp ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/config/readline_check_version.m4 \ $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LIBRARIES = $(noinst_LIBRARIES) AR = ar ARFLAGS = cru AM_V_AR = $(am__v_AR_@AM_V@) am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@) am__v_AR_0 = @echo " AR " $@; am__v_AR_1 = libadt_a_AR = $(AR) $(ARFLAGS) libadt_a_LIBADD = am_libadt_a_OBJECTS = ibuf.$(OBJEXT) queue.$(OBJEXT) \ tgdb_list.$(OBJEXT) std_bbtree.$(OBJEXT) std_btree.$(OBJEXT) \ std_hash.$(OBJEXT) std_list.$(OBJEXT) libadt_a_OBJECTS = $(am_libadt_a_OBJECTS) PROGRAMS = $(noinst_PROGRAMS) am_ibuf_driver_OBJECTS = ibuf_driver-ibuf_driver.$(OBJEXT) ibuf_driver_OBJECTS = $(am_ibuf_driver_OBJECTS) ibuf_driver_DEPENDENCIES = libadt.a $(top_builddir)/lib/util/libutil.a ibuf_driver_LINK = $(CCLD) $(ibuf_driver_CFLAGS) $(CFLAGS) \ $(ibuf_driver_LDFLAGS) $(LDFLAGS) -o $@ am_std_bbtree_driver_OBJECTS = \ std_bbtree_driver-std_bbtree_driver.$(OBJEXT) std_bbtree_driver_OBJECTS = $(am_std_bbtree_driver_OBJECTS) std_bbtree_driver_DEPENDENCIES = libadt.a \ $(top_builddir)/lib/util/libutil.a std_bbtree_driver_LINK = $(CCLD) $(std_bbtree_driver_CFLAGS) $(CFLAGS) \ $(std_bbtree_driver_LDFLAGS) $(LDFLAGS) -o $@ am_std_btree_driver_OBJECTS = \ std_btree_driver-std_btree_driver.$(OBJEXT) std_btree_driver_OBJECTS = $(am_std_btree_driver_OBJECTS) std_btree_driver_DEPENDENCIES = libadt.a \ $(top_builddir)/lib/util/libutil.a std_btree_driver_LINK = $(CCLD) $(std_btree_driver_CFLAGS) $(CFLAGS) \ $(std_btree_driver_LDFLAGS) $(LDFLAGS) -o $@ am_std_hash_driver_OBJECTS = \ std_hash_driver-std_hash_driver.$(OBJEXT) std_hash_driver_OBJECTS = $(am_std_hash_driver_OBJECTS) std_hash_driver_DEPENDENCIES = libadt.a \ $(top_builddir)/lib/util/libutil.a std_hash_driver_LINK = $(CCLD) $(std_hash_driver_CFLAGS) $(CFLAGS) \ $(std_hash_driver_LDFLAGS) $(LDFLAGS) -o $@ am_std_list_driver_OBJECTS = \ std_list_driver-std_list_driver.$(OBJEXT) std_list_driver_OBJECTS = $(am_std_list_driver_OBJECTS) std_list_driver_DEPENDENCIES = libadt.a \ $(top_builddir)/lib/util/libutil.a std_list_driver_LINK = $(CCLD) $(std_list_driver_CFLAGS) $(CFLAGS) \ $(std_list_driver_LDFLAGS) $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__depfiles_maybe = depfiles am__mv = mv -f AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libadt_a_SOURCES) $(ibuf_driver_SOURCES) \ $(std_bbtree_driver_SOURCES) $(std_btree_driver_SOURCES) \ $(std_hash_driver_SOURCES) $(std_list_driver_SOURCES) DIST_SOURCES = $(libadt_a_SOURCES) $(ibuf_driver_SOURCES) \ $(std_bbtree_driver_SOURCES) $(std_btree_driver_SOURCES) \ $(std_hash_driver_SOURCES) $(std_list_driver_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ RL_MAJOR = @RL_MAJOR@ RL_MINOR = @RL_MINOR@ RL_VERSION = @RL_VERSION@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ YACC = @YACC@ YFLAGS = @YFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CFLAGS = -I$(top_srcdir)/lib/util noinst_LIBRARIES = libadt.a libadt_a_SOURCES = \ ibuf.c \ ibuf.h \ queue.c \ queue.h \ tgdb_list.c \ tgdb_list.h \ std_bbtree.c \ std_bbtree.h \ std_btree.c \ std_btree.h \ std_hash.c \ std_hash.h \ std_list.c \ std_list.h \ std_types.h # This is the ibuf driver ibuf_driver_LDFLAGS = -L. -L$(top_builddir)/lib/util ibuf_driver_LDADD = \ libadt.a \ $(top_builddir)/lib/util/libutil.a ibuf_driver_SOURCES = ibuf_driver.c ibuf_driver_CFLAGS = $(AM_CFLAGS) # This is the hash table driver std_hash_driver_LDFLAGS = -L. -L$(top_builddir)/lib/util std_hash_driver_LDADD = \ libadt.a \ $(top_builddir)/lib/util/libutil.a std_hash_driver_SOURCES = std_hash_driver.c std_hash_driver_CFLAGS = $(AM_CFLAGS) # This is the linked list driver std_list_driver_LDFLAGS = -L. -L$(top_builddir)/lib/util std_list_driver_LDADD = \ libadt.a \ $(top_builddir)/lib/util/libutil.a std_list_driver_SOURCES = std_list_driver.c std_list_driver_CFLAGS = $(AM_CFLAGS) # This is the binary tree driver std_btree_driver_LDFLAGS = -L. -L$(top_builddir)/lib/util std_btree_driver_LDADD = \ libadt.a \ $(top_builddir)/lib/util/libutil.a std_btree_driver_SOURCES = std_btree_driver.c std_btree_driver_CFLAGS = $(AM_CFLAGS) # This is the balanced binary tree driver std_bbtree_driver_LDFLAGS = -L. -L$(top_builddir)/lib/util std_bbtree_driver_LDADD = \ libadt.a \ $(top_builddir)/lib/util/libutil.a std_bbtree_driver_SOURCES = std_bbtree_driver.c std_bbtree_driver_CFLAGS = $(AM_CFLAGS) all: all-am .SUFFIXES: .SUFFIXES: .c .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu lib/adt/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu lib/adt/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) libadt.a: $(libadt_a_OBJECTS) $(libadt_a_DEPENDENCIES) $(EXTRA_libadt_a_DEPENDENCIES) $(AM_V_at)-rm -f libadt.a $(AM_V_AR)$(libadt_a_AR) libadt.a $(libadt_a_OBJECTS) $(libadt_a_LIBADD) $(AM_V_at)$(RANLIB) libadt.a clean-noinstPROGRAMS: -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) ibuf_driver$(EXEEXT): $(ibuf_driver_OBJECTS) $(ibuf_driver_DEPENDENCIES) $(EXTRA_ibuf_driver_DEPENDENCIES) @rm -f ibuf_driver$(EXEEXT) $(AM_V_CCLD)$(ibuf_driver_LINK) $(ibuf_driver_OBJECTS) $(ibuf_driver_LDADD) $(LIBS) std_bbtree_driver$(EXEEXT): $(std_bbtree_driver_OBJECTS) $(std_bbtree_driver_DEPENDENCIES) $(EXTRA_std_bbtree_driver_DEPENDENCIES) @rm -f std_bbtree_driver$(EXEEXT) $(AM_V_CCLD)$(std_bbtree_driver_LINK) $(std_bbtree_driver_OBJECTS) $(std_bbtree_driver_LDADD) $(LIBS) std_btree_driver$(EXEEXT): $(std_btree_driver_OBJECTS) $(std_btree_driver_DEPENDENCIES) $(EXTRA_std_btree_driver_DEPENDENCIES) @rm -f std_btree_driver$(EXEEXT) $(AM_V_CCLD)$(std_btree_driver_LINK) $(std_btree_driver_OBJECTS) $(std_btree_driver_LDADD) $(LIBS) std_hash_driver$(EXEEXT): $(std_hash_driver_OBJECTS) $(std_hash_driver_DEPENDENCIES) $(EXTRA_std_hash_driver_DEPENDENCIES) @rm -f std_hash_driver$(EXEEXT) $(AM_V_CCLD)$(std_hash_driver_LINK) $(std_hash_driver_OBJECTS) $(std_hash_driver_LDADD) $(LIBS) std_list_driver$(EXEEXT): $(std_list_driver_OBJECTS) $(std_list_driver_DEPENDENCIES) $(EXTRA_std_list_driver_DEPENDENCIES) @rm -f std_list_driver$(EXEEXT) $(AM_V_CCLD)$(std_list_driver_LINK) $(std_list_driver_OBJECTS) $(std_list_driver_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ibuf.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ibuf_driver-ibuf_driver.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/queue.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/std_bbtree.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/std_bbtree_driver-std_bbtree_driver.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/std_btree.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/std_btree_driver-std_btree_driver.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/std_hash.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/std_hash_driver-std_hash_driver.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/std_list.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/std_list_driver-std_list_driver.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tgdb_list.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` ibuf_driver-ibuf_driver.o: ibuf_driver.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ibuf_driver_CFLAGS) $(CFLAGS) -MT ibuf_driver-ibuf_driver.o -MD -MP -MF $(DEPDIR)/ibuf_driver-ibuf_driver.Tpo -c -o ibuf_driver-ibuf_driver.o `test -f 'ibuf_driver.c' || echo '$(srcdir)/'`ibuf_driver.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/ibuf_driver-ibuf_driver.Tpo $(DEPDIR)/ibuf_driver-ibuf_driver.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ibuf_driver.c' object='ibuf_driver-ibuf_driver.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ibuf_driver_CFLAGS) $(CFLAGS) -c -o ibuf_driver-ibuf_driver.o `test -f 'ibuf_driver.c' || echo '$(srcdir)/'`ibuf_driver.c ibuf_driver-ibuf_driver.obj: ibuf_driver.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ibuf_driver_CFLAGS) $(CFLAGS) -MT ibuf_driver-ibuf_driver.obj -MD -MP -MF $(DEPDIR)/ibuf_driver-ibuf_driver.Tpo -c -o ibuf_driver-ibuf_driver.obj `if test -f 'ibuf_driver.c'; then $(CYGPATH_W) 'ibuf_driver.c'; else $(CYGPATH_W) '$(srcdir)/ibuf_driver.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/ibuf_driver-ibuf_driver.Tpo $(DEPDIR)/ibuf_driver-ibuf_driver.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ibuf_driver.c' object='ibuf_driver-ibuf_driver.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ibuf_driver_CFLAGS) $(CFLAGS) -c -o ibuf_driver-ibuf_driver.obj `if test -f 'ibuf_driver.c'; then $(CYGPATH_W) 'ibuf_driver.c'; else $(CYGPATH_W) '$(srcdir)/ibuf_driver.c'; fi` std_bbtree_driver-std_bbtree_driver.o: std_bbtree_driver.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(std_bbtree_driver_CFLAGS) $(CFLAGS) -MT std_bbtree_driver-std_bbtree_driver.o -MD -MP -MF $(DEPDIR)/std_bbtree_driver-std_bbtree_driver.Tpo -c -o std_bbtree_driver-std_bbtree_driver.o `test -f 'std_bbtree_driver.c' || echo '$(srcdir)/'`std_bbtree_driver.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/std_bbtree_driver-std_bbtree_driver.Tpo $(DEPDIR)/std_bbtree_driver-std_bbtree_driver.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='std_bbtree_driver.c' object='std_bbtree_driver-std_bbtree_driver.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(std_bbtree_driver_CFLAGS) $(CFLAGS) -c -o std_bbtree_driver-std_bbtree_driver.o `test -f 'std_bbtree_driver.c' || echo '$(srcdir)/'`std_bbtree_driver.c std_bbtree_driver-std_bbtree_driver.obj: std_bbtree_driver.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(std_bbtree_driver_CFLAGS) $(CFLAGS) -MT std_bbtree_driver-std_bbtree_driver.obj -MD -MP -MF $(DEPDIR)/std_bbtree_driver-std_bbtree_driver.Tpo -c -o std_bbtree_driver-std_bbtree_driver.obj `if test -f 'std_bbtree_driver.c'; then $(CYGPATH_W) 'std_bbtree_driver.c'; else $(CYGPATH_W) '$(srcdir)/std_bbtree_driver.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/std_bbtree_driver-std_bbtree_driver.Tpo $(DEPDIR)/std_bbtree_driver-std_bbtree_driver.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='std_bbtree_driver.c' object='std_bbtree_driver-std_bbtree_driver.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(std_bbtree_driver_CFLAGS) $(CFLAGS) -c -o std_bbtree_driver-std_bbtree_driver.obj `if test -f 'std_bbtree_driver.c'; then $(CYGPATH_W) 'std_bbtree_driver.c'; else $(CYGPATH_W) '$(srcdir)/std_bbtree_driver.c'; fi` std_btree_driver-std_btree_driver.o: std_btree_driver.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(std_btree_driver_CFLAGS) $(CFLAGS) -MT std_btree_driver-std_btree_driver.o -MD -MP -MF $(DEPDIR)/std_btree_driver-std_btree_driver.Tpo -c -o std_btree_driver-std_btree_driver.o `test -f 'std_btree_driver.c' || echo '$(srcdir)/'`std_btree_driver.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/std_btree_driver-std_btree_driver.Tpo $(DEPDIR)/std_btree_driver-std_btree_driver.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='std_btree_driver.c' object='std_btree_driver-std_btree_driver.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(std_btree_driver_CFLAGS) $(CFLAGS) -c -o std_btree_driver-std_btree_driver.o `test -f 'std_btree_driver.c' || echo '$(srcdir)/'`std_btree_driver.c std_btree_driver-std_btree_driver.obj: std_btree_driver.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(std_btree_driver_CFLAGS) $(CFLAGS) -MT std_btree_driver-std_btree_driver.obj -MD -MP -MF $(DEPDIR)/std_btree_driver-std_btree_driver.Tpo -c -o std_btree_driver-std_btree_driver.obj `if test -f 'std_btree_driver.c'; then $(CYGPATH_W) 'std_btree_driver.c'; else $(CYGPATH_W) '$(srcdir)/std_btree_driver.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/std_btree_driver-std_btree_driver.Tpo $(DEPDIR)/std_btree_driver-std_btree_driver.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='std_btree_driver.c' object='std_btree_driver-std_btree_driver.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(std_btree_driver_CFLAGS) $(CFLAGS) -c -o std_btree_driver-std_btree_driver.obj `if test -f 'std_btree_driver.c'; then $(CYGPATH_W) 'std_btree_driver.c'; else $(CYGPATH_W) '$(srcdir)/std_btree_driver.c'; fi` std_hash_driver-std_hash_driver.o: std_hash_driver.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(std_hash_driver_CFLAGS) $(CFLAGS) -MT std_hash_driver-std_hash_driver.o -MD -MP -MF $(DEPDIR)/std_hash_driver-std_hash_driver.Tpo -c -o std_hash_driver-std_hash_driver.o `test -f 'std_hash_driver.c' || echo '$(srcdir)/'`std_hash_driver.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/std_hash_driver-std_hash_driver.Tpo $(DEPDIR)/std_hash_driver-std_hash_driver.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='std_hash_driver.c' object='std_hash_driver-std_hash_driver.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(std_hash_driver_CFLAGS) $(CFLAGS) -c -o std_hash_driver-std_hash_driver.o `test -f 'std_hash_driver.c' || echo '$(srcdir)/'`std_hash_driver.c std_hash_driver-std_hash_driver.obj: std_hash_driver.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(std_hash_driver_CFLAGS) $(CFLAGS) -MT std_hash_driver-std_hash_driver.obj -MD -MP -MF $(DEPDIR)/std_hash_driver-std_hash_driver.Tpo -c -o std_hash_driver-std_hash_driver.obj `if test -f 'std_hash_driver.c'; then $(CYGPATH_W) 'std_hash_driver.c'; else $(CYGPATH_W) '$(srcdir)/std_hash_driver.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/std_hash_driver-std_hash_driver.Tpo $(DEPDIR)/std_hash_driver-std_hash_driver.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='std_hash_driver.c' object='std_hash_driver-std_hash_driver.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(std_hash_driver_CFLAGS) $(CFLAGS) -c -o std_hash_driver-std_hash_driver.obj `if test -f 'std_hash_driver.c'; then $(CYGPATH_W) 'std_hash_driver.c'; else $(CYGPATH_W) '$(srcdir)/std_hash_driver.c'; fi` std_list_driver-std_list_driver.o: std_list_driver.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(std_list_driver_CFLAGS) $(CFLAGS) -MT std_list_driver-std_list_driver.o -MD -MP -MF $(DEPDIR)/std_list_driver-std_list_driver.Tpo -c -o std_list_driver-std_list_driver.o `test -f 'std_list_driver.c' || echo '$(srcdir)/'`std_list_driver.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/std_list_driver-std_list_driver.Tpo $(DEPDIR)/std_list_driver-std_list_driver.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='std_list_driver.c' object='std_list_driver-std_list_driver.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(std_list_driver_CFLAGS) $(CFLAGS) -c -o std_list_driver-std_list_driver.o `test -f 'std_list_driver.c' || echo '$(srcdir)/'`std_list_driver.c std_list_driver-std_list_driver.obj: std_list_driver.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(std_list_driver_CFLAGS) $(CFLAGS) -MT std_list_driver-std_list_driver.obj -MD -MP -MF $(DEPDIR)/std_list_driver-std_list_driver.Tpo -c -o std_list_driver-std_list_driver.obj `if test -f 'std_list_driver.c'; then $(CYGPATH_W) 'std_list_driver.c'; else $(CYGPATH_W) '$(srcdir)/std_list_driver.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/std_list_driver-std_list_driver.Tpo $(DEPDIR)/std_list_driver-std_list_driver.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='std_list_driver.c' object='std_list_driver-std_list_driver.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(std_list_driver_CFLAGS) $(CFLAGS) -c -o std_list_driver-std_list_driver.obj `if test -f 'std_list_driver.c'; then $(CYGPATH_W) 'std_list_driver.c'; else $(CYGPATH_W) '$(srcdir)/std_list_driver.c'; fi` ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LIBRARIES) $(PROGRAMS) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-noinstLIBRARIES clean-noinstPROGRAMS \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ clean-noinstLIBRARIES clean-noinstPROGRAMS cscopelist-am ctags \ ctags-am distclean distclean-compile distclean-generic \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: cgdb-0.6.7/lib/adt/queue.c000644 000765 000024 00000003555 12074441140 016223 0ustar00mmuellerstaff000000 000000 #include "queue.h" #include "sys_util.h" struct node { void *data; struct node *next; }; struct queue { int size; struct node *head; }; struct queue *queue_init(void) { struct queue *q = (struct queue *) cgdb_malloc(sizeof (struct queue)); q->size = 0; q->head = NULL; return q; } void queue_append(struct queue *q, void *item) { struct node *cur = q->head, *node; /* Allocate the new node */ node = (struct node *) cgdb_malloc(sizeof (struct node)); node->data = item; node->next = NULL; if (q->head == NULL) q->head = node; else { while (cur->next != NULL) cur = cur->next; cur->next = node; } q->size = q->size + 1; } void *queue_pop(struct queue *q) { struct node *cur; void *d; if (!q) return (void *) NULL; cur = q->head; if (cur == NULL) return (void *) NULL; /* Move the head of the queue forward */ q->head = q->head->next; /* Assertion: cur is the leftover node that needs to be freed */ d = cur->data; cur->next = NULL; free(cur); cur = NULL; q->size = q->size - 1; return d; } void queue_free_list(struct queue *q, item_func func) { struct node *prev, *cur = q->head; if (cur == NULL || (!func)) return; while (cur != NULL) { prev = cur; cur = cur->next; /* Remove the previous node */ func(prev->data); free(prev); prev = NULL; } q->size = 0; q->head = NULL; } void queue_traverse_list(struct queue *q, item_func func) { struct node *cur = q->head; if (!func) return; while (cur != NULL) { func(cur->data); cur = cur->next; } } int queue_size(struct queue *q) { /* This list is empty */ if (q->head == NULL) return 0; else return q->size; } cgdb-0.6.7/lib/adt/queue.h000644 000765 000024 00000003115 12074441140 016220 0ustar00mmuellerstaff000000 000000 #ifndef __QUEUE_H__ #define __QUEUE_H__ #if HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #if HAVE_SYS_TYPES_H #include #endif /* HAVE_SYS_TYPES_H */ struct queue; typedef void (*item_func) (void *item); /* queue_init: Initializes a new empty queue. * returns - The new head of the queue */ struct queue *queue_init(void); /* queue_append: Appends new_node to the queue. * q - The queue to modify * item - The item to add to the queue * * Return: The new queue. */ void queue_append(struct queue *q, void *item); /* queue_pop: Returns the first element and removes it from the list. * q - The queue to modify * returns - The item requested, Null if no items in queue * * NOTE: This function only returns the item, it will not free it. * If the caller does not free it, it is a memory leak. */ void *queue_pop(struct queue *q); /* queue_free_list: Free's list item by calling func on each element * q - The queue to modify * func - The function to free an item */ void queue_free_list(struct queue *q, item_func func); /* queue_traverse_list: Traverses list passing each element to func * q - The queue to traverse * func - The function to call on each item */ void queue_traverse_list(struct queue *q, item_func func); /* buffers_size: Gets the size of the queue. * q - The queue to modify * Returns - The size of the list, 0 if head is NULL */ int queue_size(struct queue *q); #endif /* __QUEUE_H__ */ cgdb-0.6.7/lib/adt/std_bbtree.c000644 000765 000024 00000045224 12074441140 017213 0ustar00mmuellerstaff000000 000000 /* GLIB - Library of useful routines for C programming * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #include /* For debug only */ #include "std_bbtree.h" #define MAX(a, b) (((a) > (b)) ? (a) : (b)) struct std_bbtreenode; struct std_bbtree { struct std_bbtreenode *root; STDCompareDataFunc key_compare; STDDestroyNotify key_destroy_func; STDDestroyNotify value_destroy_func; void *key_compare_data; }; struct std_bbtreenode { int balance; /* height (left) - height (right) */ struct std_bbtreenode *left; /* left subtree */ struct std_bbtreenode *right; /* right subtree */ void *key; /* key for this node */ void *value; /* value stored at this node */ }; static struct std_bbtreenode *std_bbtree_node_new(void *key, void *value); static void std_bbtree_node_destroy(struct std_bbtreenode *node, STDDestroyNotify key_destroy_func, STDDestroyNotify value_destroy_func); static struct std_bbtreenode *std_bbtree_node_insert(struct std_bbtree *tree, struct std_bbtreenode *node, void *key, void *value, int replace, int *inserted); static struct std_bbtreenode *std_bbtree_node_remove(struct std_bbtree *tree, struct std_bbtreenode *node, const void *key, int notify); static struct std_bbtreenode *std_bbtree_node_balance(struct std_bbtreenode *node); static struct std_bbtreenode *std_bbtree_node_remove_leftmost(struct std_bbtreenode *node, struct std_bbtreenode **leftmost); static struct std_bbtreenode *std_bbtree_node_restore_left_balance(struct std_bbtreenode *node, int old_balance); static struct std_bbtreenode *std_bbtree_node_restore_right_balance(struct std_bbtreenode *node, int old_balance); static struct std_bbtreenode *std_bbtree_node_lookup(struct std_bbtreenode *node, STDCompareDataFunc compare, void *comp_data, const void *key); static int std_bbtree_node_count(struct std_bbtreenode *node); static int std_bbtree_node_pre_order(struct std_bbtreenode *node, STDTraverseFunc traverse_func, void *data); static int std_bbtree_node_in_order(struct std_bbtreenode *node, STDTraverseFunc traverse_func, void *data); static int std_bbtree_node_post_order(struct std_bbtreenode *node, STDTraverseFunc traverse_func, void *data); static void *std_bbtree_node_search(struct std_bbtreenode *node, STDCompareFunc search_func, const void *data); static int std_bbtree_node_height(struct std_bbtreenode *node); static struct std_bbtreenode *std_bbtree_node_rotate_left(struct std_bbtreenode *node); static struct std_bbtreenode *std_bbtree_node_rotate_right(struct std_bbtreenode *node); static void std_bbtree_node_check(struct std_bbtreenode *node); static struct std_bbtreenode *std_bbtree_node_new(void *key, void *value) { struct std_bbtreenode *node; node = malloc(sizeof (struct std_bbtreenode)); node->balance = 0; node->left = NULL; node->right = NULL; node->key = key; node->value = value; return node; } static void std_bbtree_node_destroy(struct std_bbtreenode *node, STDDestroyNotify key_destroy_func, STDDestroyNotify value_destroy_func) { if (node) { std_bbtree_node_destroy(node->right, key_destroy_func, value_destroy_func); std_bbtree_node_destroy(node->left, key_destroy_func, value_destroy_func); if (key_destroy_func) key_destroy_func(node->key); if (value_destroy_func) value_destroy_func(node->value); node->left = NULL; node->key = NULL; node->value = NULL; node->right = NULL; free(node); node = NULL; } } struct std_bbtree *std_bbtree_new(STDCompareFunc key_compare_func) { if (!key_compare_func) return NULL; return std_bbtree_new_full((STDCompareDataFunc) key_compare_func, NULL, NULL, NULL); } struct std_bbtree *std_bbtree_new_with_data(STDCompareDataFunc key_compare_func, void *key_compare_data) { if (!key_compare_func) return NULL; return std_bbtree_new_full(key_compare_func, key_compare_data, NULL, NULL); } struct std_bbtree *std_bbtree_new_full(STDCompareDataFunc key_compare_func, void *key_compare_data, STDDestroyNotify key_destroy_func, STDDestroyNotify value_destroy_func) { struct std_bbtree *tree; if (!key_compare_func) return NULL; tree = malloc(sizeof (struct std_bbtree)); tree->root = NULL; tree->key_compare = key_compare_func; tree->key_destroy_func = key_destroy_func; tree->value_destroy_func = value_destroy_func; tree->key_compare_data = key_compare_data; return tree; } int std_bbtree_destroy(struct std_bbtree *tree) { if (!tree) return -1; std_bbtree_node_destroy(tree->root, tree->key_destroy_func, tree->value_destroy_func); free(tree); return 0; } int std_bbtree_insert(struct std_bbtree *tree, void *key, void *value) { int inserted; if (!tree) return -1; inserted = 0; tree->root = std_bbtree_node_insert(tree, tree->root, key, value, 0, &inserted); return 0; } int std_bbtree_replace(struct std_bbtree *tree, void *key, void *value) { int inserted; if (!tree) return -1; inserted = 0; tree->root = std_bbtree_node_insert(tree, tree->root, key, value, 1, &inserted); return 0; } int std_bbtree_remove(struct std_bbtree *tree, const void *key) { if (!tree) return -1; tree->root = std_bbtree_node_remove(tree, tree->root, key, 1); return 0; } int std_bbtree_steal(struct std_bbtree *tree, const void *key) { if (!tree) return -1; tree->root = std_bbtree_node_remove(tree, tree->root, key, 0); return 0; } void *std_bbtree_lookup(struct std_bbtree *tree, const void *key) { struct std_bbtreenode *node; if (!tree) return NULL; node = std_bbtree_node_lookup(tree->root, tree->key_compare, tree->key_compare_data, key); return node ? node->value : NULL; } int std_bbtree_lookup_extended(struct std_bbtree *tree, const void *lookup_key, void * *orig_key, void * *value) { struct std_bbtreenode *node; if (!tree) return 0; node = std_bbtree_node_lookup(tree->root, tree->key_compare, tree->key_compare_data, lookup_key); if (node) { if (orig_key) *orig_key = node->key; if (value) *value = node->value; return 1; } else return 0; } int std_bbtree_foreach(struct std_bbtree *tree, STDTraverseFunc func, void *user_data) { if (!tree) return -1; if (!tree->root) return -1; std_bbtree_node_in_order(tree->root, func, user_data); return 0; } void *std_bbtree_search(struct std_bbtree *tree, STDCompareFunc search_func, const void *user_data) { if (!tree) return NULL; if (tree->root) return std_bbtree_node_search(tree->root, search_func, user_data); else return NULL; } int std_bbtree_height(struct std_bbtree *tree) { if (!tree) return 0; if (tree->root) return std_bbtree_node_height(tree->root); else return 0; } int std_bbtree_nnodes(struct std_bbtree *tree) { if (!tree) return 0; if (tree->root) return std_bbtree_node_count(tree->root); else return 0; } static struct std_bbtreenode *std_bbtree_node_insert(struct std_bbtree *tree, struct std_bbtreenode *node, void *key, void *value, int replace, int *inserted) { int old_balance; int cmp; if (!node) { *inserted = 1; return std_bbtree_node_new(key, value); } cmp = tree->key_compare(key, node->key, tree->key_compare_data); if (cmp == 0) { *inserted = 0; if (tree->value_destroy_func) tree->value_destroy_func(node->value); node->value = value; if (replace) { if (tree->key_destroy_func) tree->key_destroy_func(node->key); node->key = key; } else { /* free the passed key */ if (tree->key_destroy_func) tree->key_destroy_func(key); } return node; } if (cmp < 0) { if (node->left) { old_balance = node->left->balance; node->left = std_bbtree_node_insert(tree, node->left, key, value, replace, inserted); if ((old_balance != node->left->balance) && node->left->balance) node->balance -= 1; } else { *inserted = 1; node->left = std_bbtree_node_new(key, value); node->balance -= 1; } } else if (cmp > 0) { if (node->right) { old_balance = node->right->balance; node->right = std_bbtree_node_insert(tree, node->right, key, value, replace, inserted); if ((old_balance != node->right->balance) && node->right->balance) node->balance += 1; } else { *inserted = 1; node->right = std_bbtree_node_new(key, value); node->balance += 1; } } if (*inserted) { if ((node->balance < -1) || (node->balance > 1)) node = std_bbtree_node_balance(node); } return node; } static struct std_bbtreenode *std_bbtree_node_remove(struct std_bbtree *tree, struct std_bbtreenode *node, const void *key, int notify) { struct std_bbtreenode *new_root; int old_balance; int cmp; if (!node) return NULL; cmp = tree->key_compare(key, node->key, tree->key_compare_data); if (cmp == 0) { struct std_bbtreenode *garbage; garbage = node; if (!node->right) { node = node->left; } else { old_balance = node->right->balance; node->right = std_bbtree_node_remove_leftmost(node->right, &new_root); new_root->left = node->left; new_root->right = node->right; new_root->balance = node->balance; node = std_bbtree_node_restore_right_balance(new_root, old_balance); } if (notify) { if (tree->key_destroy_func) tree->key_destroy_func(garbage->key); if (tree->value_destroy_func) tree->value_destroy_func(garbage->value); } garbage->left = NULL; garbage->key = NULL; garbage->value = NULL; garbage->right = NULL; free(garbage); garbage = NULL; } else if (cmp < 0) { if (node->left) { old_balance = node->left->balance; node->left = std_bbtree_node_remove(tree, node->left, key, notify); node = std_bbtree_node_restore_left_balance(node, old_balance); } } else if (cmp > 0) { if (node->right) { old_balance = node->right->balance; node->right = std_bbtree_node_remove(tree, node->right, key, notify); node = std_bbtree_node_restore_right_balance(node, old_balance); } } return node; } static struct std_bbtreenode *std_bbtree_node_balance(struct std_bbtreenode *node) { if (node->balance < -1) { if (node->left->balance > 0) node->left = std_bbtree_node_rotate_left(node->left); node = std_bbtree_node_rotate_right(node); } else if (node->balance > 1) { if (node->right->balance < 0) node->right = std_bbtree_node_rotate_right(node->right); node = std_bbtree_node_rotate_left(node); } return node; } static struct std_bbtreenode *std_bbtree_node_remove_leftmost(struct std_bbtreenode *node, struct std_bbtreenode **leftmost) { int old_balance; if (!node->left) { *leftmost = node; return node->right; } old_balance = node->left->balance; node->left = std_bbtree_node_remove_leftmost(node->left, leftmost); return std_bbtree_node_restore_left_balance(node, old_balance); } static struct std_bbtreenode *std_bbtree_node_restore_left_balance(struct std_bbtreenode *node, int old_balance) { if (!node->left) node->balance += 1; else if ((node->left->balance != old_balance) && (node->left->balance == 0)) node->balance += 1; if (node->balance > 1) return std_bbtree_node_balance(node); return node; } static struct std_bbtreenode *std_bbtree_node_restore_right_balance(struct std_bbtreenode *node, int old_balance) { if (!node->right) node->balance -= 1; else if ((node->right->balance != old_balance) && (node->right->balance == 0)) node->balance -= 1; if (node->balance < -1) return std_bbtree_node_balance(node); return node; } static struct std_bbtreenode *std_bbtree_node_lookup(struct std_bbtreenode *node, STDCompareDataFunc compare, void *compare_data, const void *key) { int cmp; if (!node) return NULL; cmp = (*compare) (key, node->key, compare_data); if (cmp == 0) return node; if (cmp < 0) { if (node->left) return std_bbtree_node_lookup(node->left, compare, compare_data, key); } else if (cmp > 0) { if (node->right) return std_bbtree_node_lookup(node->right, compare, compare_data, key); } return NULL; } static int std_bbtree_node_count(struct std_bbtreenode *node) { int count; count = 1; if (node->left) count += std_bbtree_node_count(node->left); if (node->right) count += std_bbtree_node_count(node->right); return count; } static int std_bbtree_node_pre_order(struct std_bbtreenode *node, STDTraverseFunc traverse_func, void *data) { if ((*traverse_func) (node->key, node->value, data)) return 1; if (node->left) { if (std_bbtree_node_pre_order(node->left, traverse_func, data)) return 1; } if (node->right) { if (std_bbtree_node_pre_order(node->right, traverse_func, data)) return 1; } return 0; } static int std_bbtree_node_in_order(struct std_bbtreenode *node, STDTraverseFunc traverse_func, void *data) { if (node->left) { if (std_bbtree_node_in_order(node->left, traverse_func, data)) return 1; } if ((*traverse_func) (node->key, node->value, data)) return 1; if (node->right) { if (std_bbtree_node_in_order(node->right, traverse_func, data)) return 1; } return 0; } static int std_bbtree_node_post_order(struct std_bbtreenode *node, STDTraverseFunc traverse_func, void *data) { if (node->left) { if (std_bbtree_node_post_order(node->left, traverse_func, data)) return 1; } if (node->right) { if (std_bbtree_node_post_order(node->right, traverse_func, data)) return 1; } if ((*traverse_func) (node->key, node->value, data)) return 1; return 0; } static void *std_bbtree_node_search(struct std_bbtreenode *node, STDCompareFunc search_func, const void *data) { int dir; if (!node) return NULL; do { dir = (*search_func) (node->key, data); if (dir == 0) return node->value; if (dir < 0) node = node->left; else if (dir > 0) node = node->right; } while (node); return NULL; } static int std_bbtree_node_height(struct std_bbtreenode *node) { int left_height; int right_height; if (node) { left_height = 0; right_height = 0; if (node->left) left_height = std_bbtree_node_height(node->left); if (node->right) right_height = std_bbtree_node_height(node->right); return MAX(left_height, right_height) + 1; } return 0; } static struct std_bbtreenode *std_bbtree_node_rotate_left(struct std_bbtreenode *node) { struct std_bbtreenode *right; int a_bal; int b_bal; right = node->right; node->right = right->left; right->left = node; a_bal = node->balance; b_bal = right->balance; if (b_bal <= 0) { if (a_bal >= 1) right->balance = b_bal - 1; else right->balance = a_bal + b_bal - 2; node->balance = a_bal - 1; } else { if (a_bal <= b_bal) right->balance = a_bal - 2; else right->balance = b_bal - 1; node->balance = a_bal - b_bal - 1; } return right; } static struct std_bbtreenode *std_bbtree_node_rotate_right(struct std_bbtreenode *node) { struct std_bbtreenode *left; int a_bal; int b_bal; left = node->left; node->left = left->right; left->right = node; a_bal = node->balance; b_bal = left->balance; if (b_bal <= 0) { if (b_bal > a_bal) left->balance = b_bal + 1; else left->balance = a_bal + 2; node->balance = a_bal - b_bal + 1; } else { if (a_bal <= -1) left->balance = b_bal + 1; else left->balance = a_bal + b_bal + 2; node->balance = a_bal + 1; } return left; } static void std_bbtree_node_check(struct std_bbtreenode *node) { int left_height; int right_height; int balance; if (node) { left_height = 0; right_height = 0; if (node->left) left_height = std_bbtree_node_height(node->left); if (node->right) right_height = std_bbtree_node_height(node->right); balance = right_height - left_height; if (balance != node->balance) printf("std_bbtree_node_check: failed: %d ( %d )\n", balance, node->balance); if (node->left) std_bbtree_node_check(node->left); if (node->right) std_bbtree_node_check(node->right); } } cgdb-0.6.7/lib/adt/std_bbtree.h000644 000765 000024 00000022161 12074441140 017213 0ustar00mmuellerstaff000000 000000 /* GLIB - Library of useful routines for C programming * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef __STD_BBTREE_H__ #define __STD_BBTREE_H__ #include "std_types.h" /** * The balanced binary tree context. */ struct std_bbtree; typedef int (*STDTraverseFunc) (void *key, void *value, void *data); /** * Create a new tree. * * \param key_compare_func * The function used to order the nodes in the list. * It should return values similar to the standard strcmp() function - * 0 if the two arguments are equal, * a negative value if the first argument comes before the second, * or a positive value if the first argument comes after the second. * * @return * A new tree on success, or NULL on error. */ struct std_bbtree *std_bbtree_new(STDCompareFunc key_compare_func); /** * Creates a new std_bbtree with a comparison function that accepts user data. * See std_bbtree_new() for more details. * * \param key_compare_func * Same as above. * * \param key_compare_data * This data should be passed along as the last argument to key_compare_func * * @return * A new tree on success, or NULL on error. */ struct std_bbtree *std_bbtree_new_with_data(STDCompareDataFunc key_compare_func, void *key_compare_data); /** * Creates a new std_bbtree like std_bbtree_new() and allows to specify functions * to free the memory allocated for the key and value that get called when * removing the entry from the std_bbtree. * * \param key_compare_data * Same as above. * * \param key_destroy_func * A function to free the memory allocated for the key used when removing the * entry from the std_bbtree or NULL if you don't want to supply such a function. * * \param value_destroy_func * A function to free the memory allocated for the value used when removing the * entry from the std_bbtree or NULL if you don't want to supply such a function. * * @return * A new tree on success, or NULL on error. */ struct std_bbtree *std_bbtree_new_full(STDCompareDataFunc key_compare_func, void *key_compare_data, STDDestroyNotify key_destroy_func, STDDestroyNotify value_destroy_func); /** * Destroys the tree. If keys and/or values are dynamically allocated, you * should either free them first or create the tree using std_bbtree_new_full(). * In the latter case the destroy functions you supplied will be called on * all keys and values before destroying the tree. * * \param tree * The tree to destroy. * * @return * 0 on success, or -1 on error. */ int std_bbtree_destroy(struct std_bbtree *tree); /** * Inserts a key/value pair into a std_bbtree. If the given key already exists * in the std_bbtree its corresponding value is set to the new value. If you * supplied a value_destroy_func when creating the std_bbtree, the old value is * freed using that function. If you supplied a key_destroy_func when * creating the std_bbtree, the passed key is freed using that function. * * The tree is automatically 'balanced' as new key/value pairs are added, * so that the distance from the root to every leaf is as small as possible. * * \param tree * The tree to insert into. * * \param key * The key to insert. * * \param value * The value to insert. * * @return * 0 on success, or -1 on error. */ int std_bbtree_insert(struct std_bbtree *tree, void *key, void *value); /** * Inserts a new key and value into a std_bbtree similar to std_bbtree_insert(). * The difference is that if the key already exists in the std_bbtree, it gets * replaced by the new key. If you supplied a value_destroy_func when * creating the struct std_bbtree, the old value is freed using that function. If you * supplied a key_destroy_func when creating the #struct std_bbtree, the old key is * freed using that function. * * The tree is automatically 'balanced' as new key/value pairs are added, * so that the distance from the root to every leaf is as small as possible. * * \param tree * The tree to insert into. * * \param key * The key to insert. * * \param value * The value to insert. * * @return * 0 on success, or -1 on error. */ int std_bbtree_replace(struct std_bbtree *tree, void *key, void *value); /** * Removes a key/value pair from a std_bbtree. * * If the std_bbtree was created using std_bbtree_new_full(), the key and value * are freed using the supplied destroy functions, otherwise you have to * make sure that any dynamically allocated values are freed yourself. * * \param tree * The tree to remove a key from. * * \param key * The key to remove. * * @return * 0 on success, or -1 on error. */ int std_bbtree_remove(struct std_bbtree *tree, const void *key); /** * Removes a key and its associated value from a std_bbtree without calling * the key and value destroy functions. * * \param tree * The tree to remove a key from. * * \param key * The key to remove. * * @return * 0 on success, or -1 on error. */ int std_bbtree_steal(struct std_bbtree *tree, const void *key); /** * Gets the value corresponding to the given key. Since a std_bbtree is * automatically balanced as key/value pairs are added, key lookup is very * fast. * * \param tree * The tree to lookup a key from. * * \param key * The key to lookup. * * @return * The value corresponding to the key, or NULL on error. */ void *std_bbtree_lookup(struct std_bbtree *tree, const void *key); /** * Looks up a key in the std_bbtree, returning the original key and the * associated value and a int which is 1 if the key was found. This * is useful if you need to free the memory allocated for the original key, * for example before calling std_bbtree_remove(). * * \param tree * The tree to lookup a key from. * * \parm lookup_key * The key to look up. * * \param orig_key * Returns the original key. * * \param value * Returns the value associated with the original key. * * @return * 1 if the key was found in the std_bbtree, otherwise 0. */ int std_bbtree_lookup_extended(struct std_bbtree *tree, const void *lookup_key, void **orig_key, void **value); /** * Calls the given function for each of the key/value pairs in the std_bbtree. * The function is passed the key and value of each pair, and the given * data parameter. The tree is traversed in sorted order. * * The tree may not be modified while iterating over it (you can't * add/remove items). To remove all items matching a predicate, you need * to add each item to a list in your STDTraverseFunc as you walk over * the tree, then walk the list and remove each item. * * \param tree * The tree to traverse. * * \param func * The function to call for each node visited. If this function * returns 1, the traversal is stopped, otherwise it keeps going. * * \param user_data * The user data to pass to the function. * * @return * 0 on success, or -1 on error. */ int std_bbtree_foreach(struct std_bbtree *tree, STDTraverseFunc func, void *user_data); /** * Searches a std_bbtree using search_func. * * The search_func is called with a pointer to the key of a key/value pair in * the tree, and the passed in user_data. If search_func returns 0 for a * key/value pair, then std_bbtree_search_func() will return the value of that * pair. If search_func returns -1, searching will proceed among the * key/value pairs that have a smaller key; if search_func returns 1, * searching will proceed among the key/value pairs that have a larger key. * * \param tree * The tree to search. * * \param search_func * A function used to search the std_bbtree. * * \param user_data * The data passed as the second argument to the @search_func function. * * @return * The value corresponding to the found key, or NULL if the key was not found. */ void *std_bbtree_search(struct std_bbtree *tree, STDCompareFunc search_func, const void *user_data); /** * Gets the height of a std_bbtree. * * If the std_bbtree contains no nodes, the height is 0. * If the std_bbtree contains only one root node the height is 1. * If the root node has children the height is 2, etc. * * \param tree * The tree to get the height of. * * @return * The height of the std_bbtree. */ int std_bbtree_height(struct std_bbtree *tree); /** * Gets the number of nodes in a std_bbtree. * * \param tree * The tree to get the number of nodes in. * * @return * The number of nodes in the tree. */ int std_bbtree_nnodes(struct std_bbtree *tree); #endif /* __G_TREE_H__ */ cgdb-0.6.7/lib/adt/std_bbtree_driver.c000644 000765 000024 00000005722 12074441140 020565 0ustar00mmuellerstaff000000 000000 /* GLIB - Library of useful routines for C programming * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ /* * Modified by the GLib Team and others 1997-2000. See the AUTHORS * file for a list of people on the GLib Team. See the ChangeLog * files for a list of changes. These files are distributed with * GLib at ftp://ftp.gtk.org/pub/gtk/. */ #include #include #include #include "std_bbtree.h" int array[10000]; int failed = 0; #define TEST(m,cond) G_STMT_START { failed = !(cond); \ if (failed) \ { if (!m) \ g_print ("\n(%s:%d) failed for: %s\n", __FILE__, __LINE__, ( # cond )); \ else \ g_print ("\n(%s:%d) failed for: %s: (%s)\n", __FILE__, __LINE__, ( # cond ), (char*)m); \ } \ else \ g_print ("."); fflush (stdout); \ } G_STMT_END #define C2P(c) ((void*) ((long) (c))) #define P2C(p) ((char) ((long) (p))) #define GLIB_TEST_STRING "el dorado " #define GLIB_TEST_STRING_5 "el do" typedef struct { unsigned int age; char name[40]; } GlibTestInfo; static int my_compare(const void *a, const void *b) { const char *cha = a; const char *chb = b; return *cha - *chb; } static int my_traverse(void *key, void *value, void *data) { char *ch = key; assert((*ch) > 0); return 0; } int runtreetest(struct std_bbtree *tree) { int i, j; char chars[62]; tree = std_bbtree_new(my_compare); i = 0; for (j = 0; j < 10; j++, i++) { chars[i] = '0' + j; std_bbtree_insert(tree, &chars[i], &chars[i]); } for (j = 0; j < 26; j++, i++) { chars[i] = 'A' + j; std_bbtree_insert(tree, &chars[i], &chars[i]); } for (j = 0; j < 26; j++, i++) { chars[i] = 'a' + j; std_bbtree_insert(tree, &chars[i], &chars[i]); } std_bbtree_foreach(tree, my_traverse, NULL); assert(std_bbtree_nnodes(tree) == (10 + 26 + 26)); for (i = 0; i < 10; i++) std_bbtree_remove(tree, &chars[i]); std_bbtree_foreach(tree, my_traverse, NULL); std_bbtree_destroy(tree); return 0; } int main(int argc, char *argv[]) { struct std_bbtree *tree = NULL; int i; for (i = 0; i < 10000; i++) runtreetest(tree); printf("PASSED\n"); return 0; } cgdb-0.6.7/lib/adt/std_btree.c000644 000765 000024 00000013711 12074441140 017045 0ustar00mmuellerstaff000000 000000 /* * std_btree: A basic binary tree implementation. * * Copyright (c) 2004, Mike Mueller & Bob Rossi * Subject to the terms of the GNU General Public Licence */ /* Standard Includes */ #include #include /* Local Includes */ #include "std_btree.h" #include "std_types.h" /** * The binary tree structure. */ struct std_btree { /** * A pointer to the root node of the tree. */ std_btree_node root; /** * A pointer to the destructor for data elements in this tree. */ STDDestroyNotify destructor; }; /** * The node structure, the items that make up the binary tree. */ struct std_btree_node { /** * A pointer back to the tree that contains us. This will be needed * if the root changes, for example if someone calls remove() on the * root node. */ std_btree tree; /** * The parent of this node. */ std_btree_node parent; /** * The children of this node. */ std_btree_node children[2]; /** * The data stored in this node. */ void *data; }; /* * Local Function Prototypes */ /* std_btree_destroy_data: * * Destroys the data at the specified node, if a destructor method has * been defined. */ static void std_btree_destroy_data(std_btree_node node); /* std_btree_unlink: * * Unlinks the given node from the rest of the tree so that it can be * destroyed without any dangling references left behind. */ static void std_btree_unlink(std_btree_node node); /* * Exported Functions */ /* std_btree_create */ std_btree std_btree_create(const STDDestroyNotify destroy_func) { std_btree tree = (std_btree) malloc(sizeof (struct std_btree)); /* Be extra paranoid */ if (tree) { tree->destructor = destroy_func; tree->root = NULL; } return tree; } /* std_btree_destroy */ int std_btree_destroy(std_btree tree) { if (tree) { std_btree_remove(tree->root); free(tree); } return 0; } /* std_btree_root */ std_btree_iterator std_btree_root(const std_btree tree) { /* Bounds check */ assert(tree != NULL); return tree->root; } /* std_btree_get_data */ int std_btree_get_data(std_btree_iterator iter, void *data) { /* Bounds check */ assert(iter != NULL); assert(data != NULL); *(void **) data = iter->data; return 0; } /* std_btree_child */ std_btree_iterator std_btree_child(const std_btree_iterator iter, enum std_btree_child child) { /* Bounds check */ assert(iter != NULL); assert(child == STD_BTREE_LEFT || child == STD_BTREE_RIGHT); return iter->children[child]; } /* std_btree_parent */ std_btree_iterator std_btree_parent(const std_btree_iterator iter) { /* Bounds check */ assert(iter != NULL); return iter->parent; } /* std_btree_add */ int std_btree_add(std_btree tree, std_btree_iterator iter, enum std_btree_child child, void *data) { /* Declarations */ std_btree_node new_node = NULL; /* Bounds check */ assert(tree != NULL); assert(child == STD_BTREE_LEFT || child == STD_BTREE_RIGHT); /* Verify the child doesn't already exist */ if (iter && iter->children[child] != NULL) { return 1; } /* Create the new node */ new_node = (std_btree_node) malloc(sizeof (struct std_btree_node)); new_node->tree = tree; new_node->parent = iter; new_node->children[STD_BTREE_LEFT] = NULL; new_node->children[STD_BTREE_RIGHT] = NULL; new_node->data = data; /* Link it to the parent */ if (iter == NULL) { tree->root = new_node; } else { iter->children[child] = new_node; } return 0; } /* std_btree_remove: * * This method recursively deletes the subtree starting at the given position. * It first destroys the left and right subtrees (this is the recursive part), * then deletes the given node. * * The base case is when iter == NULL, in which case the method just returns. */ int std_btree_remove(std_btree_iterator iter) { if (iter != NULL) { /* Destroy the left and right subtrees */ std_btree_remove(iter->children[STD_BTREE_LEFT]); std_btree_remove(iter->children[STD_BTREE_RIGHT]); /* Unlink this node from anyone who might reference it */ std_btree_unlink(iter); /* Destroy the user data */ std_btree_destroy_data(iter); /* Destroy the node */ free(iter); } return 0; } /* std_btree_replace */ int std_btree_replace(std_btree_iterator iter, void *data) { /* Bounds check */ assert(iter != NULL); /* Destroy original data */ std_btree_destroy_data(iter); /* Replace with new data */ iter->data = data; return 0; } /* std_btree_isroot */ int std_btree_isroot(std_btree_iterator iter) { /* Bounds check */ assert(iter != NULL); return iter->parent == NULL; } /* std_btree_isleaf */ int std_btree_isleaf(std_btree_iterator iter) { /* Bounds check */ assert(iter != NULL); return (iter->children[STD_BTREE_LEFT] == NULL && iter->children[STD_BTREE_RIGHT] == NULL); } /* * Local Function Implementations */ /* std_btree_destroy_data */ static void std_btree_destroy_data(std_btree_node node) { if (node->tree->destructor != NULL) { node->tree->destructor(node->data); } } /* std_btree_unlink: */ static void std_btree_unlink(std_btree_node node) { if (std_btree_isroot(node)) { /* This is the root of the tree, this means we're blasting the * entire tree, and the root node should be set back to NULL. */ node->tree->root = NULL; } else { /* This is not the root node, update the parent to tell it the child * has been removed (set appropriate child pointer to NULL). */ int i; for (i = STD_BTREE_LEFT; i <= STD_BTREE_RIGHT; i++) { if (node->parent->children[i] == node) { node->parent->children[i] = NULL; } break; } } } cgdb-0.6.7/lib/adt/std_btree.h000644 000765 000024 00000011660 12074441140 017053 0ustar00mmuellerstaff000000 000000 /* * std_btree: A basic binary tree implementation. * * Copyright (c) 2004, Mike Mueller & Bob Rossi * Subject to the terms of the GNU General Public License */ #ifndef __STD_BTREE_H__ #define __STD_BTREE_H__ #include "std_types.h" /** * @file * std_btree.h * * @brief * An STL-style binary tree data type. */ /** * @name Standard Binary Tree * * This is a basic binary tree implementation. This tree is not automatically * balanced, the user can add and remove nodes from any part of the tree at * will. * * Properties of this tree: * Every node has a parent pointer * The root node has no parent * It is not sorted in any particular manner */ /** * The standard binary tree type. Declare an instance of std_btree in your * code and initialize it with std_btree_create. */ typedef struct std_btree *std_btree; /** * A reference to a node in the binary tree. */ typedef struct std_btree_node *std_btree_node, *std_btree_iterator; /** * Enumeration used to identify left/right children in accessor methods. */ enum std_btree_child { STD_BTREE_LEFT, STD_BTREE_RIGHT }; /** * Standard binary tree constructor. * * @param destroy_func * This method will be called on the data when the tree is destroyed. Set to * NULL if no data destructor is needed. * * @return * A new (empty) binary tree on success, NULL on failure. */ std_btree std_btree_create(const STDDestroyNotify destroy_func); /** * Standard binary tree destructor. Releases all memory associated with the * given binary tree. The data destructor method, if specified, will be * called on every element. * * @param tree * The tree to destroy. * * @return * Zero on success, non-zero on failure. */ int std_btree_destroy(std_btree tree); /** * Get an iterator for this tree. * * @param tree * The tree to access. * * @return * An iterator pointing to the root node of this tree, NULL if tree is empty. */ std_btree_iterator std_btree_root(const std_btree tree); /** * Get the data for the node referenced by the specified iterator. * * @param iter * Iterator pointing to the desired node. * * @param data * The address of a pointer which will be set to point to the data. * (This is an "in out" parameter.) Your data can be accessed after this call * by: * (my_type *) data * * @return * Zero on success, non-zero on failure. */ int std_btree_get_data(std_btree_iterator iter, void *data); /** * Access the child of the current node. * * @param iter * Iterator to use as a starting point. * * @param child * One of STD_BTREE_LEFT or STD_BTREE_RIGHT, specifies which child iterator * to return. * * @return * An iterator pointing to the specified child node, NULL if no child exists. */ std_btree_iterator std_btree_child(const std_btree_iterator iter, enum std_btree_child child); /** * Access the parent of the current node. * * @param iter * Iterator to use as a starting point. * * @return * An iterator pointing to the parent of this node, or NULL for the root node. */ std_btree_iterator std_btree_parent(const std_btree_iterator iter); /** * Adds a node to the tree. * * @param tree * The tree to add to. * * @param iter * Iterator to use as a starting point. Use NULL if the tree is currently * empty, add will create the root node. * * @param child * One of STD_BTREE_LEFT or STD_BTREE_RIGHT, specifies which child to add to * the current node. If specified child already exists, add will fail. * * @param data * The data to store at the specified location. * * @return * Zero on success, non-zero on failure. */ int std_btree_add(std_btree tree, std_btree_iterator iter, enum std_btree_child child, void *data); /** * Removes a subtree from the tree. * * @param iter * Iterator pointing to the node to destroy. The tree will be pruned at this * point, including all children. The destroy_func, if specified, will be * called on any destroyed nodes. * * @return * Zero on success, non-zero on failure (always succeeds). */ int std_btree_remove(std_btree_iterator iter); /** * Replaces the data at the specified node of the tree with the new data * provided. The data previously occupying this location will be destroyed * with destroy_func, if it was specified. * * @param iter * Iterator pointing to the node to replace. * * @param data * The data to store at the specified location. * * @return * Zero on success, non-zero on failure. */ int std_btree_replace(std_btree_iterator iter, void *data); /* * Utility methods */ /** * Identifies whether the given node is the root node. * * @param iter * Iterator pointing to the desired node. * * @return * Non-zero if node is root, zero otherwise. */ int std_btree_isroot(std_btree_iterator iter); /** * Identifies the given node as a leaf. * * @param iter * Iterator pointing to the desired node. * * @return * Non-zero for a leaf node, zero for a non-leaf node. */ int std_btree_isleaf(std_btree_iterator iter); #endif cgdb-0.6.7/lib/adt/std_btree_driver.c000644 000765 000024 00000011101 12074441140 020407 0ustar00mmuellerstaff000000 000000 /* * std_btree_driver: A test driver for the binary tree structure. * * Copyright (c) 2004, Mike Mueller & Bob Rossi * Subject to the terms of the GNU General Public Licence */ /* Standard Includes */ #include /* Local Includes */ #include "std_btree.h" /* * Macros */ #ifdef DEBUG #define debug(args...) fprintf(stderr, args) #else #define debug(args...) #endif /* * Local function prototypes */ /* Tests */ static int test_add(std_btree tree); static int test_remove(std_btree tree); static int test_replace(std_btree tree); static int test_isroot(std_btree tree); static int test_isleaf(std_btree tree); /* Destructor method used by tree */ static int destructor(char *string); /* main: * * Description of test procedure here. */ int main(int argc, char *argv[]) { std_btree tree = NULL; int result = 0; /* Create a tree */ debug("Creating tree... "); tree = std_btree_create((STDDestroyNotify) destructor); if (tree == NULL) { printf("FAILED\n"); return 1; } debug("Succeeded.\n"); /* Run tests */ result |= test_add(tree); result |= test_remove(tree); result |= test_replace(tree); result |= test_isroot(tree); result |= test_isleaf(tree); debug("Destroying tree...\n"); result |= std_btree_destroy(tree); if (result) { printf("FAILED\n"); return 2; } printf("PASSED\n"); return 0; } /* * Local function implementations */ static int test_add(std_btree tree) { std_btree_iterator i = NULL; debug("Test starting: Add\n"); if (std_btree_add(tree, NULL, STD_BTREE_LEFT, "First string")) { debug("Add \"First string\" as root node failed\n"); return 1; } i = std_btree_root(tree); if (i == NULL) { debug("Added root node, but root came back as NULL\n"); return 2; } if (std_btree_add(tree, i, STD_BTREE_RIGHT, "Right of root")) { debug("Add \"Right of root\" failed\n"); return 3; } if (std_btree_add(tree, std_btree_child(i, STD_BTREE_RIGHT), STD_BTREE_LEFT, "Left of 2nd node (right of root)")) { debug("Add \"Left of 2nd node\" failed\n"); return 4; } /* Child already exists, expect to fail */ if (std_btree_add(tree, i, STD_BTREE_RIGHT, "New right of root") == 0) { debug("Add \"New right of root\" didn't fail, but it should have\n"); return 5; } debug("Test complete: Add\n"); return 0; } static int test_remove(std_btree tree) { std_btree_iterator i = std_btree_root(tree); debug("Test starting: Remove\n"); std_btree_add(tree, i, STD_BTREE_LEFT, "Left of root"); i = std_btree_child(i, STD_BTREE_LEFT); std_btree_add(tree, i, STD_BTREE_LEFT, "Left of left of root"); std_btree_add(tree, i, STD_BTREE_RIGHT, "Right of left of root"); if (std_btree_remove(std_btree_child(i, STD_BTREE_LEFT))) { debug("Remove \"Left of left of roof\" failed\n"); return 1; } if (std_btree_remove(i)) { debug("Remove \"Left of root\" (and its right child) failed\n"); return 2; } debug("Test complete: Remove\n"); return 0; } static int test_replace(std_btree tree) { std_btree_iterator i = std_btree_root(tree); debug("Test starting: Replace\n"); if (std_btree_replace(i, "New root in town, baby!")) { debug("Replace root node with new data failed\n"); return 1; } debug("Test complete: Replace\n"); return 0; } static int test_isroot(std_btree tree) { std_btree_iterator i = std_btree_root(tree); debug("Test starting: Isroot\n"); if (!std_btree_isroot(i)) { debug("Isroot returned false when it's clearly true\n"); return 1; } if (std_btree_isroot(std_btree_child(i, STD_BTREE_RIGHT))) { debug("Isroot returned true when it's clearly false\n"); return 2; } debug("Test complete: Isroot\n"); return 0; } static int test_isleaf(std_btree tree) { std_btree_iterator i = std_btree_root(tree); debug("Test starting: Isleaf\n"); if (std_btree_isleaf(i)) { debug("Isleaf returned true when it's clearly false\n"); return 1; } /* Get to an actual leaf */ i = std_btree_child(i, STD_BTREE_RIGHT); i = std_btree_child(i, STD_BTREE_LEFT); if (!std_btree_isleaf(i)) { debug("Isleaf returned false when it's clearly true\n"); return 2; } debug("Test complete: Isleaf\n"); return 0; } static int destructor(char *string) { debug("Destructor called on: %s\n", string); return 0; } cgdb-0.6.7/lib/adt/std_hash.c000644 000765 000024 00000050264 12074441140 016673 0ustar00mmuellerstaff000000 000000 /* GLIB - Library of useful routines for C programming * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include "std_hash.h" #define HASH_TABLE_MIN_SIZE 11 #define HASH_TABLE_MAX_SIZE 13845163 struct ghashnode { void *key; void *value; struct ghashnode *next; }; struct std_hashtable { int size; int nnodes; struct ghashnode **nodes; STDHashFunc hash_func; STDEqualFunc key_equal_func; STDDestroyNotify key_destroy_func; STDDestroyNotify value_destroy_func; }; static const unsigned int std_primes[] = { 11, 19, 37, 73, 109, 163, 251, 367, 557, 823, 1237, 1861, 2777, 4177, 6247, 9371, 14057, 21089, 31627, 47431, 71143, 106721, 160073, 240101, 360163, 540217, 810343, 1215497, 1823231, 2734867, 4102283, 6153409, 9230113, 13845163, }; static const unsigned int std_nprimes = sizeof (std_primes) / sizeof (std_primes[0]); unsigned int std_spaced_primes_closest(unsigned int num) { int i; for (i = 0; i < std_nprimes; i++) if (std_primes[i] > num) return std_primes[i]; return std_primes[std_nprimes - 1]; } #define CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x))) static void std_hash_table_resize(struct std_hashtable *hash_table); void G_HASH_TABLE_RESIZE(struct std_hashtable *hash_table) { if ((hash_table->size >= 3 * hash_table->nnodes && hash_table->size > HASH_TABLE_MIN_SIZE) || (3 * hash_table->size <= hash_table->nnodes && hash_table->size < HASH_TABLE_MAX_SIZE)) std_hash_table_resize(hash_table); } static struct ghashnode **std_hash_table_lookup_node(struct std_hashtable *hash_table, const void *key); static struct ghashnode *std_hash_node_new(void *key, void *value); static void std_hash_node_destroy(struct ghashnode *hash_node, STDDestroyNotify key_destroy_func, STDDestroyNotify value_destroy_func); static int std_hash_nodes_destroy(struct ghashnode *hash_node, STDFreeFunc key_destroy_func, STDFreeFunc value_destroy_func); static unsigned int std_hash_table_foreach_remove_or_steal(struct std_hashtable *hash_table, STDHRFunc func, void *user_data, int notify); /** * std_hash_table_new: * @hash_func: a function to create a hash value from a key. * Hash values are used to determine where keys are stored within the * #struct std_hashtable data structure. The std_direct_hash(), std_int_hash() and * std_str_hash() functions are provided for some common types of keys. * If hash_func is %NULL, std_direct_hash() is used. * @key_equal_func: a function to check two keys for equality. This is * used when looking up keys in the #struct std_hashtable. The std_direct_equal(), * std_int_equal() and std_str_equal() functions are provided for the most * common types of keys. If @key_equal_func is %NULL, keys are compared * directly in a similar fashion to std_direct_equal(), but without the * overhead of a function call. * * Creates a new #struct std_hashtable. * * Return value: a new #struct std_hashtable. **/ struct std_hashtable *std_hash_table_new(STDHashFunc hash_func, STDEqualFunc key_equal_func) { return std_hash_table_new_full(hash_func, key_equal_func, NULL, NULL); } /** * std_hash_table_new_full: * @hash_func: a function to create a hash value from a key. * @key_equal_func: a function to check two keys for equality. * @key_destroy_func: a function to free the memory allocated for the key * used when removing the entry from the #struct std_hashtable or %NULL if you * don't want to supply such a function. * @value_destroy_func: a function to free the memory allocated for the * value used when removing the entry from the #struct std_hashtable or %NULL if * you don't want to supply such a function. * * Creates a new #struct std_hashtable like std_hash_table_new() and allows to specify * functions to free the memory allocated for the key and value that get * called when removing the entry from the #struct std_hashtable. * * Return value: a new #struct std_hashtable. **/ struct std_hashtable *std_hash_table_new_full(STDHashFunc hash_func, STDEqualFunc key_equal_func, STDDestroyNotify key_destroy_func, STDDestroyNotify value_destroy_func) { struct std_hashtable *hash_table; unsigned int i; hash_table = malloc(sizeof (struct std_hashtable)); hash_table->size = HASH_TABLE_MIN_SIZE; hash_table->nnodes = 0; hash_table->hash_func = hash_func ? hash_func : std_direct_hash; hash_table->key_equal_func = key_equal_func; hash_table->key_destroy_func = key_destroy_func; hash_table->value_destroy_func = value_destroy_func; hash_table->nodes = malloc(sizeof (struct ghashnode *) * hash_table->size); for (i = 0; i < hash_table->size; i++) hash_table->nodes[i] = NULL; return hash_table; } /** * std_hash_table_destroy: * @hash_table: a #struct std_hashtable. * * Destroys the #struct std_hashtable. If keys and/or values are dynamically * allocated, you should either free them first or create the #struct std_hashtable * using std_hash_table_new_full(). In the latter case the destroy functions * you supplied will be called on all keys and values before destroying * the #struct std_hashtable. **/ void std_hash_table_destroy(struct std_hashtable *hash_table) { unsigned int i; if (!hash_table) return; for (i = 0; i < hash_table->size; i++) std_hash_nodes_destroy(hash_table->nodes[i], hash_table->key_destroy_func, hash_table->value_destroy_func); free(hash_table->nodes); free(hash_table); } static struct ghashnode **std_hash_table_lookup_node(struct std_hashtable *hash_table, const void *key) { struct ghashnode **node; node = &hash_table->nodes [(*hash_table->hash_func) (key) % hash_table->size]; /* Hash table lookup needs to be fast. * We therefore remove the extra conditional of testing * whether to call the key_equal_func or not from * the inner loop. */ if (hash_table->key_equal_func) while (*node && !(*hash_table->key_equal_func) ((*node)->key, key)) node = &(*node)->next; else while (*node && (*node)->key != key) node = &(*node)->next; return node; } /** * std_hash_table_lookup: * @hash_table: a #struct std_hashtable. * @key: the key to look up. * * Looks up a key in a #struct std_hashtable. * * Return value: the associated value, or %NULL if the key is not found. **/ void *std_hash_table_lookup(struct std_hashtable *hash_table, const void *key) { struct ghashnode *node; if (!hash_table) return NULL; node = *std_hash_table_lookup_node(hash_table, key); return node ? node->value : NULL; } /** * std_hash_table_lookup_extended: * @hash_table: a #struct std_hashtable. * @lookup_key: the key to look up. * @oristd_key: returns the original key. * @value: returns the value associated with the key. * * Looks up a key in the #struct std_hashtable, returning the original key and the * associated value and a #int which is %TRUE if the key was found. This * is useful if you need to free the memory allocated for the original key, * for example before calling std_hash_table_remove(). * * Return value: %TRUE if the key was found in the #struct std_hashtable. **/ int std_hash_table_lookup_extended(struct std_hashtable *hash_table, const void *lookup_key, void * *oristd_key, void * *value) { struct ghashnode *node; if (!hash_table) return 0; node = *std_hash_table_lookup_node(hash_table, lookup_key); if (node) { if (oristd_key) *oristd_key = node->key; if (value) *value = node->value; return 1; } else return 0; } /** * std_hash_table_insert: * @hash_table: a #struct std_hashtable. * @key: a key to insert. * @value: the value to associate with the key. * * Inserts a new key and value into a #struct std_hashtable. * * If the key already exists in the #struct std_hashtable its current value is replaced * with the new value. If you supplied a @value_destroy_func when creating the * #struct std_hashtable, the old value is freed using that function. If you supplied * a @key_destroy_func when creating the #struct std_hashtable, the passed key is freed * using that function. **/ void std_hash_table_insert(struct std_hashtable *hash_table, void *key, void *value) { struct ghashnode **node; if (!hash_table) return; node = std_hash_table_lookup_node(hash_table, key); if (*node) { /* do not reset node->key in this place, keeping * the old key is the intended behaviour. * std_hash_table_replace() can be used instead. */ /* free the passed key */ if (hash_table->key_destroy_func) hash_table->key_destroy_func(key); if (hash_table->value_destroy_func) hash_table->value_destroy_func((*node)->value); (*node)->value = value; } else { *node = std_hash_node_new(key, value); hash_table->nnodes++; G_HASH_TABLE_RESIZE(hash_table); } } /** * std_hash_table_replace: * @hash_table: a #struct std_hashtable. * @key: a key to insert. * @value: the value to associate with the key. * * Inserts a new key and value into a #struct std_hashtable similar to * std_hash_table_insert(). The difference is that if the key already exists * in the #struct std_hashtable, it gets replaced by the new key. If you supplied a * @value_destroy_func when creating the #struct std_hashtable, the old value is freed * using that function. If you supplied a @key_destroy_func when creating the * #struct std_hashtable, the old key is freed using that function. **/ void std_hash_table_replace(struct std_hashtable *hash_table, void *key, void *value) { struct ghashnode **node; if (!hash_table) return; node = std_hash_table_lookup_node(hash_table, key); if (*node) { if (hash_table->key_destroy_func) hash_table->key_destroy_func((*node)->key); if (hash_table->value_destroy_func) hash_table->value_destroy_func((*node)->value); (*node)->key = key; (*node)->value = value; } else { *node = std_hash_node_new(key, value); hash_table->nnodes++; G_HASH_TABLE_RESIZE(hash_table); } } /** * std_hash_table_remove: * @hash_table: a #struct std_hashtable. * @key: the key to remove. * * Removes a key and its associated value from a #struct std_hashtable. * * If the #struct std_hashtable was created using std_hash_table_new_full(), the * key and value are freed using the supplied destroy functions, otherwise * you have to make sure that any dynamically allocated values are freed * yourself. * * Return value: %TRUE if the key was found and removed from the #struct std_hashtable. **/ int std_hash_table_remove(struct std_hashtable *hash_table, const void *key) { struct ghashnode **node, *dest; if (!hash_table) return 0; node = std_hash_table_lookup_node(hash_table, key); if (*node) { dest = *node; (*node) = dest->next; std_hash_node_destroy(dest, hash_table->key_destroy_func, hash_table->value_destroy_func); hash_table->nnodes--; G_HASH_TABLE_RESIZE(hash_table); return 1; } return 0; } /** * std_hash_table_steal: * @hash_table: a #struct std_hashtable. * @key: the key to remove. * * Removes a key and its associated value from a #struct std_hashtable without * calling the key and value destroy functions. * * Return value: %TRUE if the key was found and removed from the #struct std_hashtable. **/ int std_hash_table_steal(struct std_hashtable *hash_table, const void *key) { struct ghashnode **node, *dest; if (!hash_table) return 0; node = std_hash_table_lookup_node(hash_table, key); if (*node) { dest = *node; (*node) = dest->next; std_hash_node_destroy(dest, NULL, NULL); hash_table->nnodes--; G_HASH_TABLE_RESIZE(hash_table); return 1; } return 0; } /** * std_hash_table_foreach_remove: * @hash_table: a #struct std_hashtable. * @func: the function to call for each key/value pair. * @user_data: user data to pass to the function. * * Calls the given function for each key/value pair in the #struct std_hashtable. * If the function returns %TRUE, then the key/value pair is removed from the * #struct std_hashtable. If you supplied key or value destroy functions when creating * the #struct std_hashtable, they are used to free the memory allocated for the removed * keys and values. * * Return value: the number of key/value pairs removed. **/ unsigned int std_hash_table_foreach_remove(struct std_hashtable *hash_table, STDHRFunc func, void *user_data) { if (!hash_table) return 0; if (!func) return 0; return std_hash_table_foreach_remove_or_steal(hash_table, func, user_data, 1); } /** * std_hash_table_foreach_steal: * @hash_table: a #struct std_hashtable. * @func: the function to call for each key/value pair. * @user_data: user data to pass to the function. * * Calls the given function for each key/value pair in the #struct std_hashtable. * If the function returns %TRUE, then the key/value pair is removed from the * #struct std_hashtable, but no key or value destroy functions are called. * * Return value: the number of key/value pairs removed. **/ unsigned int std_hash_table_foreach_steal(struct std_hashtable *hash_table, STDHRFunc func, void *user_data) { if (!hash_table) return 0; if (!func) return 0; return std_hash_table_foreach_remove_or_steal(hash_table, func, user_data, 0); } static unsigned int std_hash_table_foreach_remove_or_steal(struct std_hashtable *hash_table, STDHRFunc func, void *user_data, int notify) { struct ghashnode *node, *prev; unsigned int i; unsigned int deleted = 0; for (i = 0; i < hash_table->size; i++) { restart: prev = NULL; for (node = hash_table->nodes[i]; node; prev = node, node = node->next) { if ((*func) (node->key, node->value, user_data)) { deleted += 1; hash_table->nnodes -= 1; if (prev) { prev->next = node->next; std_hash_node_destroy(node, notify ? hash_table->key_destroy_func : NULL, notify ? hash_table->value_destroy_func : NULL); node = prev; } else { hash_table->nodes[i] = node->next; std_hash_node_destroy(node, notify ? hash_table->key_destroy_func : NULL, notify ? hash_table->value_destroy_func : NULL); goto restart; } } } } G_HASH_TABLE_RESIZE(hash_table); return deleted; } /** * std_hash_table_foreach: * @hash_table: a #struct std_hashtable. * @func: the function to call for each key/value pair. * @user_data: user data to pass to the function. * * Calls the given function for each of the key/value pairs in the * #struct std_hashtable. The function is passed the key and value of each * pair, and the given @user_data parameter. The hash table may not * be modified while iterating over it (you can't add/remove * items). To remove all items matching a predicate, use * std_hash_table_remove(). **/ void std_hash_table_foreach(struct std_hashtable *hash_table, STDHFunc func, void *user_data) { struct ghashnode *node; int i; if (!hash_table) return; if (!func) return; for (i = 0; i < hash_table->size; i++) for (node = hash_table->nodes[i]; node; node = node->next) (*func) (node->key, node->value, user_data); } /** * std_hash_table_find: * @hash_table: a #struct std_hashtable. * @predicate: function to test the key/value pairs for a certain property. * @user_data: user data to pass to the function. * * Calls the given function for key/value pairs in the #struct std_hashtable until * @predicate returns %TRUE. The function is passed the key and value of * each pair, and the given @user_data parameter. The hash table may not * be modified while iterating over it (you can't add/remove items). * * Return value: The value of the first key/value pair is returned, for which * func evaluates to %TRUE. If no pair with the requested property is found, * %NULL is returned. * * Since: 2.4 **/ void *std_hash_table_find(struct std_hashtable *hash_table, STDHRFunc predicate, void *user_data) { struct ghashnode *node; int i; if (!hash_table) return NULL; if (!predicate) return NULL; for (i = 0; i < hash_table->size; i++) for (node = hash_table->nodes[i]; node; node = node->next) if (predicate(node->key, node->value, user_data)) return node->value; return NULL; } /** * std_hash_table_size: * @hash_table: a #struct std_hashtable. * * Returns the number of elements contained in the #struct std_hashtable. * * Return value: the number of key/value pairs in the #struct std_hashtable. **/ unsigned int std_hash_table_size(struct std_hashtable *hash_table) { if (!hash_table) return 0; return hash_table->nnodes; } static void std_hash_table_resize(struct std_hashtable *hash_table) { struct ghashnode **new_nodes; struct ghashnode *node; struct ghashnode *next; unsigned int hash_val; int new_size; int i; new_size = std_spaced_primes_closest(hash_table->nnodes); new_size = CLAMP(new_size, HASH_TABLE_MIN_SIZE, HASH_TABLE_MAX_SIZE); new_nodes = malloc(sizeof (struct ghashnode *) * new_size); for (i = 0; i < hash_table->size; i++) for (node = hash_table->nodes[i]; node; node = next) { next = node->next; hash_val = (*hash_table->hash_func) (node->key) % new_size; node->next = new_nodes[hash_val]; new_nodes[hash_val] = node; } free(hash_table->nodes); hash_table->nodes = new_nodes; hash_table->size = new_size; } static struct ghashnode *std_hash_node_new(void *key, void *value) { struct ghashnode *hash_node; hash_node = malloc(sizeof (struct ghashnode)); hash_node->key = key; hash_node->value = value; hash_node->next = NULL; return hash_node; } static void std_hash_node_destroy(struct ghashnode *hash_node, STDDestroyNotify key_destroy_func, STDDestroyNotify value_destroy_func) { if (key_destroy_func) key_destroy_func(hash_node->key); if (value_destroy_func) value_destroy_func(hash_node->value); hash_node->key = NULL; hash_node->value = NULL; free(hash_node); } static int std_hash_nodes_destroy(struct ghashnode *hash_node, STDFreeFunc key_destroy_func, STDFreeFunc value_destroy_func) { while (hash_node) { struct ghashnode *next = hash_node->next; if (key_destroy_func) key_destroy_func(hash_node->key); if (value_destroy_func) value_destroy_func(hash_node->value); free(hash_node); hash_node = next; } return 0; } unsigned int std_direct_hash(const void *v) { return (size_t) v; } cgdb-0.6.7/lib/adt/std_hash.h000644 000765 000024 00000025175 12074441140 016703 0ustar00mmuellerstaff000000 000000 /* GLIB - Library of useful routines for C programming * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef __STD_HASH_H__ #define __STD_HASH_H__ #include #include "std_types.h" /** * Associations between keys and values so that given a key the value can be * found quickly. */ struct std_hashtable; typedef int (*STDHRFunc) (void *key, void *value, void *user_data); /** * Creates a new hash table. * * \param hash_func * A function to create a hash value from a key. * * Hash values are used to determine where keys are stored within the hash * table data structure. The std_direct_hash(), std_int_hash() and * std_str_hash() functions are provided for some common types of keys. If * hash_func is NULL, std_direct_hash() is used. * * \param key_equal_func * A function to check two keys for equality. * * This is used when looking up keys in the hash table. * The std_direct_equal(), std_int_equal() and std_str_equal() functions are * provided for the most common types of keys. If key_equal_func is NULL, keys * are compared directly in a similar fashion to std_direct_equal(), but * without the overhead of a function call. * * @return * A new hash table */ struct std_hashtable *std_hash_table_new(STDHashFunc hash_func, STDEqualFunc key_equal_func); /** * Creates a new hash table like std_hash_table_new() and allows to specify * functions to free the memory allocated for the key and value that get * called when removing the entry from the hash table. * * \param hash_func * A function to create a hash value from a key * * \param key_equal_func * A function to check two keys for equality. * * \param key_destroy_func * A function to free the memory allocated for the key used when removing * the entry from the hash table or NULL if you don't want to supply such * a function. * * \param value_destroy_func * A function to free the memory allocated for the value used when removing * the entry from the hash table or NULL if you don't want to supply such a * function. * * @return * A new hash table */ struct std_hashtable *std_hash_table_new_full(STDHashFunc hash_func, STDEqualFunc key_equal_func, STDDestroyNotify key_destroy_func, STDDestroyNotify value_destroy_func); /** * Destroys the hash table. If keys and/or values are dynamically allocated, * you should either free them first or create the hash table using * std_hash_table_new_full(). In the latter case the destroy functions you * supplied will be called on all keys and values before destroying the * hash table. * * \param hash_table * The hash table to destroy */ void std_hash_table_destroy(struct std_hashtable *hash_table); /** * Inserts a new key and value into a hash table. * * If the key already exists in the hash table its current value is replaced * with the new value. If you supplied a value_destroy_func when creating the * hash table, the old value is freed using that function. If you supplied a * key_destroy_func when creating the hash table, the passed key is freed * using that function. * * \param hash_table * The hash table to insert into * * \param key * A key to insert * * \param value * The value to associate with the key. */ void std_hash_table_insert(struct std_hashtable *hash_table, void *key, void *value); /** * Inserts a new key and value into a hash table similar to * std_hash_table_insert(). The difference is that if the key already exists * in the hash table, it gets replaced by the new key. If you supplied a * value_destroy_func when creating the hash table, the old value is freed * using that function. If you supplied a key_destroy_func when creating the * hash table, the old key is freed using that function. * * \param hash_table * The hash table to insert into * * \param key * A key to insert * * \param value * The value to associate with the key. */ void std_hash_table_replace(struct std_hashtable *hash_table, void *key, void *value); /** * Removes a key and its associated value from a hash table. * * If the hash table was created using std_hash_table_new_full(), the key and * value are freed using the supplied destroy functions, otherwise you have to * make sure that any dynamically allocated values are freed yourself. * * \param hash_table * The hash table to remove from. * * \param key * The key to remove * * @return * 1 if the key was found and removed from the hash table. */ int std_hash_table_remove(struct std_hashtable *hash_table, const void *key); /** * Removes a key and its associated value from a hash table without calling * the key and value destroy functions. * * \param hash_table * The hash to steal from * * \param key * The key to remove * * @return * 1 if the key was found and removed from the hash table. */ int std_hash_table_steal(struct std_hashtable *hash_table, const void *key); /** * Looks up a key in a hash table. * * \param hash_table * The hash table to look a key up in * * \param key * The key to lookup * * @return * The associated value, or NULL if the key is not found. */ void *std_hash_table_lookup(struct std_hashtable *hash_table, const void *key); /** * Looks up a key in the hash table, returning the original key and the * associated value and a int which is 1 if the key was found. This is * useful if you need to free the memory allocated for the original key, * for example before calling std_hash_table_remove(). * * \param hash_table * The hash to lookup data in * * \param lookup_key * The key to look up. * * \param oristd_key * returns the original key. * * \param value * returns the value associated with the key. * * @return * 1 if the key was found in the hash table. */ int std_hash_table_lookup_extended(struct std_hashtable *hash_table, const void *lookup_key, void **oristd_key, void **value); /** * Calls the given function for each of the key/value pairs in the hash table. * The function is passed the key and value of each pair, and the given * user_data parameter. The hash table may not be modified while iterating * over it (you can't add/remove items). * * To remove all items matching a predicate, use std_hash_table_remove(). * * \param hash_table * The hash to iterate over * * \param func * The function to call for each key/value pair. * * \param user_data * user data to pass to the function. */ void std_hash_table_foreach(struct std_hashtable *hash_table, STDHFunc func, void *user_data); /** * Calls the given function for key/value pairs in the hash table until * predicate returns 1. The function is passed the key and value of each pair, * and the given user_data parameter. The hash table may not be modified * while iterating over it (you can't add/remove items). * * \param hash_table * The hash table * * \param predicate * function to test the key/value pairs for a certain property. * * \param user_data * user data to pass to the function. * * @return * The value of the first key/value pair is returned, for which func * evaluates to 1. If no pair with the requested property is found, * NULL is returned. */ void *std_hash_table_find(struct std_hashtable *hash_table, STDHRFunc predicate, void *user_data); /** * Calls the given function for each key/value pair in the hash table. If the * function returns 1, then the key/value pair is removed from the hash table. * If you supplied key or value destroy functions when creating the hash table, * they are used to free the memory allocated for the removed keys and values. * * \param hash_table * The hash table * * \param func * The function to call for each key/value pair. * * \param user_data * user data to pass to the function. * * @return * The number of key/value pairs removed. */ unsigned int std_hash_table_foreach_remove(struct std_hashtable *hash_table, STDHRFunc func, void *user_data); /** * Calls the given function for each key/value pair in the hash table. If the * function returns 1, then the key/value pair is removed from the hash table, * but no key or value destroy functions are called. * * \param hash_table * The hash table * * \param func * The function to call for each key/value pair. * * \param user_data * user data to pass to the function. * * @return * the number of key/value pairs removed. */ unsigned int std_hash_table_foreach_steal(struct std_hashtable *hash_table, STDHRFunc func, void *user_data); /** * Returns the number of elements contained in the hash table. * * \param hash_table * The hash table * * @return * The number of key/value pairs in the hash table. */ unsigned int std_hash_table_size(struct std_hashtable *hash_table); /* * Some standard hash functions * TODO: These are unimplemented. Please implement them when needed. */ int std_str_equal(const void *v, const void *v2); unsigned int std_str_hash(const void *v); int std_int_equal(const void *v, const void *v2); unsigned int std_int_hash(const void *v); /** * This "hash" function will just return the key's address as an * unsigned integer. Useful for hashing on plain addresses or * simple integer values. * * Passing NULL into std_hash_table_new() as STDHashFunc has the * same effect as passing std_direct_hash(). * * Converts a void* to a hash value. It can be passed to std_hash_table_new() * as the hash_func parameter, when using pointers as keys in a hash table. * * \param v * a void* key * * @return * A hash value corresponding to the key. */ unsigned int std_direct_hash(const void *v); /** * Compares two void* arguments and returns 1 if they are equal. It can be * passed to std_hash_table_new() as the key_equal_func parameter, when * using pointers as keys in a hash table. * * \param v * a key * * \param v2 * a key to compare with * * @return * 1 if the two keys match */ int std_direct_equal(const void *v, const void *v2); #endif /* __STD_HASH_H__ */ cgdb-0.6.7/lib/adt/std_hash_driver.c000644 000765 000024 00000020143 12074441140 020237 0ustar00mmuellerstaff000000 000000 /* GLIB - Library of useful routines for C programming * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald * Copyright (C) 1999 The Free Software Foundation * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #include #include #include #include "std_hash.h" int array[10000]; static int my_hash_callback_remove(void *key, void *value, void *user_data) { int *d = value; if ((*d) % 2) return 1; return 0; } static void my_hash_callback_remove_test(void *key, void *value, void *user_data) { int *d = value; if ((*d) % 2) fprintf(stderr, "%s:%d should not be reached\n", __FILE__, __LINE__); } static void my_hash_callback(void *key, void *value, void *user_data) { int *d = value; *d = 1; } static unsigned int my_hash(const void *key) { return (unsigned int) *((const int *) key); } static int my_hash_equal(const void *a, const void *b) { return *((const int *) a) == *((const int *) b); } /* * This is a simplified version of the pathalias hashing function. * Thanks to Steve Belovin and Peter Honeyman * * hash a string into a long int. 31 bit crc (from andrew appel). * the crc table is computed at run time by crcinit() -- we could * precompute, but it takes 1 clock tick on a 750. * * This fast table calculation works only if POLY is a prime polynomial * in the field of integers modulo 2. Since the coefficients of a * 32-bit polynomial won't fit in a 32-bit word, the high-order bit is * implicit. IT MUST ALSO BE THE CASE that the coefficients of orders * 31 down to 25 are zero. Happily, we have candidates, from * E. J. Watson, "Primitive Polynomials (Mod 2)", Math. Comp. 16 (1962): * x^32 + x^7 + x^5 + x^3 + x^2 + x^1 + x^0 * x^31 + x^3 + x^0 * * We reverse the bits to get: * 111101010000000000000000000000001 but drop the last 1 * f 5 0 0 0 0 0 0 * 010010000000000000000000000000001 ditto, for 31-bit crc * 4 8 0 0 0 0 0 0 */ #define POLY 0x48000000L /* 31-bit polynomial (avoids sign problems) */ static unsigned int CrcTable[128]; /* - crcinit - initialize tables for hash function */ static void crcinit(void) { int i, j; unsigned int sum; for (i = 0; i < 128; ++i) { sum = 0L; for (j = 7 - 1; j >= 0; --j) if (i & (1 << j)) sum ^= POLY >> j; CrcTable[i] = sum; } } /* - hash - Honeyman's nice hashing function */ static unsigned int honeyman_hash(const void *key) { const char *name = (const char *) key; int size; unsigned int sum = 0; assert(name != NULL); assert(*name != 0); size = strlen(name); while (size--) { sum = (sum >> 7) ^ CrcTable[(sum ^ (*name++)) & 0x7f]; } return (sum); } static int second_hash_cmp(const void *a, const void *b) { return (strcmp(a, b) == 0); } static unsigned int one_hash(const void *key) { return 1; } static void not_even_foreach(void *key, void *value, void *user_data) { const char *_key = (const char *) key; const char *_value = (const char *) value; int i; char val[20]; assert(_key != NULL); assert(*_key != 0); assert(_value != NULL); assert(*_value != 0); i = atoi(_key); sprintf(val, "%d value", i); assert(strcmp(_value, val) == 0); assert((i % 2) != 0); assert(i != 3); } static int remove_even_foreach(void *key, void *value, void *user_data) { const char *_key = (const char *) key; const char *_value = (const char *) value; int i; char val[20]; assert(_key != NULL); assert(*_key != 0); assert(_value != NULL); assert(*_value != 0); i = atoi(_key); sprintf(val, "%d value", i); assert(strcmp(_value, val) == 0); return ((i % 2) == 0) ? 1 : 0; } static void second_hash_test(int simple_hash) { int i; char key[20] = "", val[20] = "", *v, *orig_key, *orig_val; struct std_hashtable *h; int found; crcinit(); h = std_hash_table_new(simple_hash ? one_hash : honeyman_hash, second_hash_cmp); assert(h != NULL); for (i = 0; i < 20; i++) { sprintf(key, "%d", i); assert(atoi(key) == i); sprintf(val, "%d value", i); assert(atoi(val) == i); std_hash_table_insert(h, strdup(key), strdup(val)); } assert(std_hash_table_size(h) == 20); for (i = 0; i < 20; i++) { sprintf(key, "%d", i); assert(atoi(key) == i); v = (char *) std_hash_table_lookup(h, key); assert(v != NULL); assert(*v != 0); assert(atoi(v) == i); } sprintf(key, "%d", 3); std_hash_table_remove(h, key); std_hash_table_foreach_remove(h, remove_even_foreach, NULL); std_hash_table_foreach(h, not_even_foreach, NULL); for (i = 0; i < 20; i++) { if ((i % 2) == 0 || i == 3) continue; sprintf(key, "%d", i); assert(atoi(key) == i); sprintf(val, "%d value", i); assert(atoi(val) == i); orig_key = orig_val = NULL; found = std_hash_table_lookup_extended(h, key, (void *) &orig_key, (void *) &orig_val); assert(found); std_hash_table_remove(h, key); assert(orig_key != NULL); assert(strcmp(key, orig_key) == 0); free(orig_key); assert(orig_val != NULL); assert(strcmp(val, orig_val) == 0); free(orig_val); } std_hash_table_destroy(h); } static int find_first(void *key, void *value, void *user_data) { int *v = value; int *test = user_data; return (*v == *test); } static void direct_hash_test(void) { long i, rc; struct std_hashtable *h; h = std_hash_table_new(NULL, NULL); assert(h != NULL); for (i = 1; i <= 20; i++) { std_hash_table_insert(h, ((void *) (i)), (void *) (i + 42)); } assert(std_hash_table_size(h) == 20); for (i = 1; i <= 20; i++) { rc = ((long) (std_hash_table_lookup(h, ((void *) (i))))); assert(rc != 0); assert((rc - 42) == i); } std_hash_table_destroy(h); } int main(int argc, char *argv[]) { struct std_hashtable *hash_table; int i; int value = 120; int *pvalue; hash_table = std_hash_table_new(my_hash, my_hash_equal); for (i = 0; i < 10000; i++) { array[i] = i; std_hash_table_insert(hash_table, &array[i], &array[i]); } pvalue = std_hash_table_find(hash_table, find_first, &value); if (!pvalue || *pvalue != value) fprintf(stderr, "%s:%d should not be reached\n", __FILE__, __LINE__); std_hash_table_foreach(hash_table, my_hash_callback, NULL); for (i = 0; i < 10000; i++) if (array[i] == 0) fprintf(stderr, "%s:%d should not be reached\n", __FILE__, __LINE__); for (i = 0; i < 10000; i++) std_hash_table_remove(hash_table, &array[i]); for (i = 0; i < 10000; i++) { array[i] = i; std_hash_table_insert(hash_table, &array[i], &array[i]); } if (std_hash_table_foreach_remove(hash_table, my_hash_callback_remove, NULL) != 5000 || std_hash_table_size(hash_table) != 5000) fprintf(stderr, "%s:%d should not be reached\n", __FILE__, __LINE__); std_hash_table_foreach(hash_table, my_hash_callback_remove_test, NULL); std_hash_table_destroy(hash_table); second_hash_test(1); second_hash_test(0); direct_hash_test(); printf("PASSED\n"); return 0; } cgdb-0.6.7/lib/adt/std_list.c000644 000765 000024 00000017570 12074441140 016726 0ustar00mmuellerstaff000000 000000 /* Standard Includes */ #include /* Local Includes */ #include "std_list.h" /** * A node in the linked list. */ struct std_list_node { /** * The data stored in the node. */ void *data; /** * The next node in the list, or NULL. */ struct std_list_node *next; /** * The previous node in the list, or NULL. */ struct std_list_node *prev; }; /** * The doubly linked list context. * * This stores the begin and end (one past last node) of the list, * and can store any state data associated with a list context. */ struct std_list { /** * A pointer to the first node in the list. * * If the list is empty, this points to end. */ struct std_list_node *begin; /** * A pointer to the node after the last node in the list. * If the list is empty, this points to an empty node. */ struct std_list_node *end; /** * The size of the list. */ int length; /** * A destroy function used to free the user's data before a list * item is free'd. */ STDDestroyNotify destroy_func; }; /* Functions */ /* --------- */ /** * Allocate a single std_list_node. * * @return * A new list on success, or NULL on error */ static struct std_list_node *std_list_node_create(void) { struct std_list_node *list_node; list_node = malloc(sizeof (struct std_list_node)); if (!list_node) return NULL; list_node->data = NULL; list_node->next = NULL; list_node->prev = NULL; return list_node; } /** * Destroy a single std_list_node. * * @return * 0 on success, or -1 on error. */ static int std_list_node_destroy(struct std_list_node *list_node, STDDestroyNotify destroy_func) { if (!list_node) return -1; if (destroy_func) destroy_func(list_node->data); list_node->data = NULL; list_node->next = NULL; list_node->prev = NULL; free(list_node); list_node = NULL; return 0; } /** * Allocate for a new list. * * @return * A new list on success, or NULL on error */ struct std_list *std_list_create(STDDestroyNotify destroy_func) { struct std_list *list; list = malloc(sizeof (struct std_list)); if (!list) return NULL; list->begin = std_list_node_create(); if (!list->begin) return NULL; list->end = list->begin; list->length = 0; list->destroy_func = destroy_func; return list; } int std_list_remove_all(struct std_list *list) { std_list_iterator iter; /* Traverse the list and free the data members */ for (iter = std_list_begin(list); iter != std_list_end(list);) { iter = std_list_remove(list, iter); if (!iter) return -1; } return 0; } int std_list_destroy(struct std_list *list) { if (!list) return -1; if (std_list_remove_all(list) == -1) return -1; /* Free the dummy node (remove won't do this) */ std_list_node_destroy(list->end, list->destroy_func); /* Free the list structure */ free(list); return 0; } int std_list_append(struct std_list *list, void *data) { if (!list) return -1; if (std_list_insert(list, list->end, data) == -1) return -1; return 0; } int std_list_prepend(struct std_list *list, void *data) { if (!list) return -1; if (std_list_insert(list, list->begin, data) == -1) return -1; return 0; } int std_list_insert(struct std_list *list, const std_list_iterator iter, void *data) { std_list_iterator new_node; if (!list) return -1; if (!iter) return -1; new_node = std_list_node_create(); if (!new_node) return -1; new_node->data = data; if (iter == list->begin) { new_node->next = iter; iter->prev = new_node; list->begin = new_node; } else { std_list_iterator before; before = iter->prev; new_node->next = iter; before->next = new_node; new_node->prev = before; iter->prev = new_node; } list->length = list->length + 1; return 0; } int std_list_insert_sorted(struct std_list *list, void *data, const STDCompareFunc func) { std_list_iterator current; void *current_data; if (!list) return -1; if (!func) return -1; /* Seek to the corrent position to insert new item */ for (current = std_list_begin(list); current != std_list_end(list); current = std_list_next(current)) { if (std_list_get_data(current, ¤t_data) != 0) { return -2; } /* If the new data is <= data at this node, stop looping and * insert the data into the list before the current. */ if (func(data, current_data) <= 0) { break; } } /* Insert the item before the current iterator now. */ return std_list_insert(list, current, data); } std_list_iterator std_list_remove(struct std_list * list, std_list_iterator iter) { std_list_iterator after; if (!list) return NULL; if (!iter) return NULL; /* remove the iterator */ if (iter == list->end) return NULL; if (iter == list->begin) { after = iter->next; list->begin = after; list->begin->prev = NULL; } else { std_list_iterator before; before = iter->prev; after = iter->next; before->next = after; after->prev = before; } if (std_list_node_destroy(iter, list->destroy_func) == -1) return NULL; list->length -= 1; return after; } std_list_iterator std_list_find(const struct std_list * list, const void *data, const STDCompareFunc func) { std_list_iterator iter; std_list_iterator found; if (!list) return NULL; if (!func) return NULL; found = std_list_end(list); /* Find the item */ for (iter = std_list_begin(list); iter != std_list_end(list); iter = std_list_next(iter)) { void *iter_data; if (std_list_get_data(iter, &iter_data) == -1) return NULL; if (func(iter_data, data) == 0) { found = iter; break; } } return iter; } std_list_iterator std_list_begin(const struct std_list * list) { if (!list) return NULL; return list->begin; } std_list_iterator std_list_end(const struct std_list * list) { if (!list) return NULL; return list->end; } std_list_iterator std_list_next(const std_list_iterator iter) { if (!iter) return NULL; return iter->next; } std_list_iterator std_list_previous(const std_list_iterator iter) { if (!iter) return NULL; return iter->prev; } int std_list_length(struct std_list *list) { if (!list) return -1; return list->length; } int std_list_foreach(const struct std_list *list, const STDFunc func, void *user_data) { std_list_iterator iter; if (!list) return -1; if (!func) return -1; /* do the foreach */ for (iter = std_list_begin(list); iter != std_list_end(list); iter = std_list_next(iter)) { void *data; if (std_list_get_data(iter, &data) == -1) return -1; if (func(data, user_data) == 0) break; } return 0; } int std_list_sort(struct std_list *list, STDCompareFunc compare_func) { if (!list) return -1; if (!compare_func) return -1; /* sort the list */ return 0; } int std_list_sort_with_data(struct std_list *list, STDCompareDataFunc compare_func, void *user_data) { if (!list) return -1; if (!compare_func) return -1; /* sort the list */ return 0; } int std_list_get_data(std_list_iterator iter, void *data) { if (!iter) return -1; /* Copy the pointer */ memcpy(data, &iter->data, sizeof (void *)); return 0; } cgdb-0.6.7/lib/adt/std_list.h000644 000765 000024 00000014125 12074441140 016724 0ustar00mmuellerstaff000000 000000 #ifndef __STD_LIST_H__ #define __STD_LIST_H__ #include #include "std_types.h" /*! * \file * std_list.h * * \brief * An STL style doubly linked list. */ /** * The doubly linked list context. */ struct std_list; /** * A typedef for an std_list. * This is what the programmer should declare. */ typedef struct std_list *std_list; /** * A forward declaration, only around to satisfy the iterator typedef. */ struct std_list_node; /** * A std_list_iterator. This is used to iterator over a std_list. */ typedef struct std_list_node *std_list_iterator; /** * Create a list. * * \param destroy_func * DestroyFunc will be called on the data, before it is removed. * * @return * A new list on success, or NULL on error. */ struct std_list *std_list_create(STDDestroyNotify destroy_func); /** * Destroy a list. * * Do not attempt to use this list after it is destroyed. * * If list elements contain dynamically-allocated memory, * they should be freed first. * * @return * 0 on success, or -1 on error. */ int std_list_destroy(struct std_list *list); /** * Append the item to the end of the list. * * \param list * The list to append to. * * \param data. * The new data. * * @return * 0 on success, or -1 on error. */ int std_list_append(struct std_list *list, void *data); /** * Prepend the item to the end of the list. * * \param list * The list to prepend to. * * \param data. * The new data. * * @return * 0 on success, or -1 on error. */ int std_list_prepend(struct std_list *list, void *data); /** * Inserts a new element into the list before the iterator. * * \param list * The list to insert into * * \param iter * The iterator to insert before. * * \param data * The data to insert * * @return * 0 on success, or -1 on error. */ int std_list_insert(struct std_list *list, const std_list_iterator iter, void *data); /** * Inserts a new element into the list, using the given comparison * function to determine its position. * * \param list * the list to insert into * * \param data * The data to insert * * \param func * The function used to sort the data * It should return a number > 0 if the first parameter comes after * the second parameter in the sort order. * * @return * 0 on success, or -1 on error. */ int std_list_insert_sorted(struct std_list *list, void *data, const STDCompareFunc func); /** * Like std_list_sort(), but the comparison function accepts a user data argument. * * \param list * The list to sort * * \param compare_func * comparison function * * \param user_data * user data to pass to comparison function. * * @return * 0 on success, or -1 on error. */ /* * int std_list_sort ( * struct std_list *list, * STDCompareDataFunc compare_func, * void *user_data ); */ /** * Removes an element from a list. If two elements contain the same data, * only the first is removed. If none of the elements contain the data, * the list is unchanged. * * \param list * The list to remove an item from. * * \param iter * The iterator to remove the data at. The iterator will be moved * to the next position in the list. * * @return * The iterator after the one being removed, or NULL on error. */ std_list_iterator std_list_remove(struct std_list *list, std_list_iterator iter); /** * Removes all the elements from a list. * * \param list * The list to remove an item from. * * @return * 0 on success, or -1 on error. */ int std_list_remove_all(struct std_list *list); /** * Finds an element in a list, using a supplied function to find the * desired element. It iterates over the list, calling the given function * which should return 0 when the desired element is found. The function * takes two void* arguments, the list element's data and the * given user data. * * \param list * The list to search. * * \param data * user data passed to the function. * * \param func * The function to call for each element. * It should return 0 when the desired element is found. * * @return * the found iterator on success, * std_list_end if not found, * NULL on error */ std_list_iterator std_list_find(const struct std_list *list, const void *data, const STDCompareFunc func); /** * Gets the first element in a list. * * \param list * The list to get the element from. * * @return * The first iterator, or NULL on error. */ std_list_iterator std_list_begin(const struct std_list *list); /** * Gets the position after the last element. * * \param list * The list to get the element from. * * @return * The last iterator, or NULL on error. */ std_list_iterator std_list_end(const struct std_list *list); /** * Gets the next iterator. * * \param iter * The iterator to get the next position of. * * @return * The next iterator, or NULL on error. */ std_list_iterator std_list_next(const std_list_iterator iter); /** * Gets the previous iterator. * * \param iter * The iterator to get the previous position of. * * @return * The previous iterator, or NULL on error. */ std_list_iterator std_list_previous(const std_list_iterator iter); /** * Gets the number of elements in a list. * * \param list * The list to get the length of. * * @return * The number of elements in the list, or -1 on error. */ int std_list_length(struct std_list *list); /** * Calls a function for each element of a list. * * \param list * The list to traverse * * \param func * The function to call with each element's data. * If func returns 0, the traversing will stop. * * \param user_data * User data to pass to the function * * @return * 0 on success, or -1 on error. */ int std_list_foreach(const struct std_list *list, const STDFunc func, void *user_data); /** * Get's the data at the specified list position. * * \param iter * The iterator to get the data from. * * \param data * Pass in the address of a pointer, and the pointer will be set to point at * the data for this element. Will be set to NULL on error. * * @return * 0 on success, or -1 on error. */ int std_list_get_data(std_list_iterator iter, void *data); #endif /* __STD_LIST_H__ */ cgdb-0.6.7/lib/adt/std_list_driver.c000644 000765 000024 00000005673 12074441140 020302 0ustar00mmuellerstaff000000 000000 #include #include "std_list.h" int printType(void *data, void *user_data) { int i = *(int *) data; printf("FUNCTION:%d\n", i); return 1; } int destroy(void *data) { int *a = (int *) data; free(a); a = NULL; return 0; } /* Used for the sorted list test */ int sorted_test(); int compare_ints(const void *a, const void *b); int main(int argc, char **argv) { std_list l; std_list_iterator iter; int i; l = std_list_create(destroy); if (!l) { printf("creation failed\n"); return -1; } /* Add 1000 items */ for (i = 0; i < 1000; ++i) { int *data = malloc(sizeof (int)); *data = i; if (std_list_append(l, data) == -1) { printf("append failed\n"); return -1; } } /* traverse them */ for (iter = std_list_begin(l); iter != std_list_end(l); iter = std_list_next(iter)) { int *data; if (std_list_get_data(iter, (void *) &data) == -1) { printf("get data failed\n"); return -1; } printf("ITEM(%d)\n", *data); } if (std_list_foreach(l, printType, NULL) == -1) { printf("foreach failed\n"); return -1; } /* destroy list */ if (std_list_destroy(l) == -1) { printf("deletion failed\n"); return -1; } return sorted_test(); } int sorted_test() { int data_array[10] = { 5, 3, 2, 5, 1, -50, 0, 100, -1, 99 }; std_list l = std_list_create(NULL); std_list_iterator iter; int *current = 0, *previous = 0; int sorted = 1; int i; /* Insert the data from the array into the 'sorted' list */ printf("-- Sorted list test starting...\n"); printf(" Inserting: "); for (i = 0; i < 10; i++) { printf("%d ", data_array[i]); std_list_insert_sorted(l, &data_array[i], compare_ints); } printf("\n"); /* Read it back and verify it's sorted */ printf(" Reading: "); for (iter = std_list_begin(l); iter != std_list_end(l); iter = std_list_next(iter)) { if (std_list_get_data(iter, ¤t)) { printf("\nFailed to read data"); return -1; } printf("%d ", *current); /* Compare to previous item if this is not the first */ if (iter != std_list_begin(l) && *current < *previous) { sorted = 0; } previous = current; } printf("\n"); /* Destroy list */ std_list_destroy(l); /* Display result */ if (sorted) { printf(" Status: List sorted successfully!\n"); } else { printf(" Status: List is not sorted.\n"); } printf("-- Sorted list test end\n"); return !sorted; } int compare_ints(const void *a, const void *b) { int int_a = *(int *) a; int int_b = *(int *) b; if (int_a < int_b) { return -1; } else if (int_a == int_b) { return 0; } return 1; } cgdb-0.6.7/lib/adt/std_types.h000644 000765 000024 00000002774 12074441140 017124 0ustar00mmuellerstaff000000 000000 /* GLIB - Library of useful routines for C programming * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef __STD_TYPES_H__ #define __STD_TYPES_H__ /* Return value < 0 if a < b, * = 0 if a == b, * > 0 if a > b */ typedef int (*STDCompareFunc) (const void *a, const void *b); typedef int (*STDFunc) (void *data, void *user_data); typedef int (*STDCompareDataFunc) (const void *a, const void *b, void *user_data); typedef unsigned int (*STDHashFunc) (const void *key); typedef int (*STDEqualFunc) (const void *a, const void *b); typedef int (*STDDestroyNotify) (void *data); typedef void (*STDHFunc) (void *key, void *value, void *user_data); typedef int (*STDFreeFunc) (void *data); #endif /* __STD_TYPES_H__ */ cgdb-0.6.7/lib/adt/tgdb_list.c000644 000765 000024 00000016221 12074441140 017044 0ustar00mmuellerstaff000000 000000 #include "tgdb_list.h" #include "sys_util.h" struct tgdb_list_node { struct tgdb_list_node *next; struct tgdb_list_node *prev; void *data; }; struct tgdb_list { int size; struct tgdb_list_node *head; struct tgdb_list_node *tail; }; struct tgdb_list *tgdb_list_init(void) { struct tgdb_list *list; list = (struct tgdb_list *) cgdb_malloc(sizeof (struct tgdb_list)); /* Initialize all data members */ list->size = 0; list->head = NULL; list->tail = NULL; return list; } int tgdb_list_destroy(struct tgdb_list *list) { if (!list) return -1; free(list); list = NULL; return 0; } /* * Can insert any node between 2 other nodes. * * list * This is the current list we are inserting into. * * before * The node we want to insert after. * * after * The node to insert before. * * new_node * The node to insert into the list. */ static void tgdb_list_insert(struct tgdb_list *list, struct tgdb_list_node *before, struct tgdb_list_node *after, struct tgdb_list_node *new_node) { /* Do nothing if node or list is NULL */ if (!new_node || !list) return; /* Special case, insert into tail with list size 1 */ if (before == NULL && after == NULL && list->size == 1) { new_node->next = NULL; new_node->prev = list->head; list->head->next = new_node; list->tail = new_node; /* Inserting first item into list */ } else if (before == NULL && after == NULL) { list->head = new_node; new_node->next = NULL; new_node->prev = NULL; /* Insert at beggining of list */ } else if (before == NULL) { new_node->next = list->head; new_node->prev = NULL; list->head->prev = new_node; list->head = new_node; /* Insert at end of list */ } else if (after == NULL) { new_node->next = NULL; new_node->prev = list->tail; list->tail->next = new_node; list->tail = new_node; /* Insert into middle of list */ } else { new_node->next = before->next; new_node->prev = after->prev; before->next = new_node; before->prev = new_node; } list->size++; } /* * Can delete any node out of the tree * * list * This is the current list we are deleting from * * node * The node to delete */ static void tgdb_list_delete(struct tgdb_list *list, struct tgdb_list_node *node) { /* Do nothing if node or list is NULL */ if (!node || !list) return; /* Deleting from an empty list */ if (tgdb_list_size(list) == 0) { node->next = NULL; node->prev = NULL; node = NULL; list->head = NULL; list->tail = NULL; /* Deleting last element in the list */ } else if (tgdb_list_size(list) == 1) { /* Only the head is populated, free it */ node->next = NULL; node->prev = NULL; node = NULL; list->head = NULL; list->tail = NULL; /* Deleting from beggining of list */ } else if (node->prev == NULL) { node->next->prev = NULL; list->head = node->next; node->next = NULL; node->prev = NULL; node = NULL; /* If the list is size 2, remove the tail and set only the head */ if (tgdb_list_size(list) == 2) list->tail = NULL; /* Delete from end of list */ } else if (node->next == NULL) { node->prev->next = NULL; list->tail = node->prev; node->next = NULL; node->prev = NULL; node = NULL; /* Delete from middle of list */ } else { node->prev->next = node->next; node->next->prev = node->prev; node->next = NULL; node->prev = NULL; node = NULL; } list->size--; } static struct tgdb_list_node *tgdb_list_new_node(void) { struct tgdb_list_node *node; node = (struct tgdb_list_node *) cgdb_malloc(sizeof (struct tgdb_list_node)); node->data = (void *) NULL; node->next = NULL; node->prev = NULL; return node; } int tgdb_list_append(struct tgdb_list *tlist, void *item) { struct tgdb_list_node *node; if (!tlist) return -1; if ((node = tgdb_list_new_node()) == NULL) return -1; node->data = item; tgdb_list_insert(tlist, tlist->tail, NULL, node); return 0; } int tgdb_list_prepend(struct tgdb_list *tlist, void *item) { struct tgdb_list_node *node; if (!tlist) return -1; if ((node = tgdb_list_new_node()) == NULL) return -1; node->data = item; tgdb_list_insert(tlist, NULL, tlist->head, node); return 0; } int tgdb_list_insert_after(struct tgdb_list *tlist, tgdb_list_iterator * i, void *item) { struct tgdb_list_node *node; if (!tlist) return -1; if ((node = tgdb_list_new_node()) == NULL) return -1; node->data = item; tgdb_list_insert(tlist, i, i->next, node); return 0; } int tgdb_list_insert_before(struct tgdb_list *tlist, tgdb_list_iterator * i, void *item) { struct tgdb_list_node *node; if (!tlist) return -1; if ((node = tgdb_list_new_node()) == NULL) return -1; node->data = item; tgdb_list_insert(tlist, i->prev, i, node); return 0; } int tgdb_list_foreach(struct tgdb_list *tlist, tgdb_list_func func) { tgdb_list_iterator *i = tgdb_list_get_first(tlist); while (i) { if (func(i->data) == -1) return -1; i = tgdb_list_next(i); } return 0; } int tgdb_list_free(struct tgdb_list *tlist, tgdb_list_func func) { tgdb_list_iterator *i = tgdb_list_get_first(tlist); while (i) { if (func(i->data) == -1) return -1; tgdb_list_delete(tlist, i); /* Can't call tgdb_list_next () here on the iterator. * This is because the iterator was just deleted. */ i = tgdb_list_get_first(tlist); } return 0; } int tgdb_list_clear(struct tgdb_list *tlist) { tgdb_list_iterator *i = tgdb_list_get_first(tlist); while (i) { tgdb_list_delete(tlist, i); /* Can't call tgdb_list_next () here on the iterator. * This is because the iterator was just deleted. */ i = tgdb_list_get_first(tlist); } return 0; } int tgdb_list_size(struct tgdb_list *tlist) { if (tlist) return tlist->size; return 0; } tgdb_list_iterator *tgdb_list_get_first(struct tgdb_list * tlist) { if (tlist) { return tlist->head; } return NULL; } tgdb_list_iterator *tgdb_list_get_last(struct tgdb_list * tlist) { if (tlist) { if (tlist->size == 1) return tlist->head; else return tlist->tail; } return NULL; } tgdb_list_iterator *tgdb_list_next(tgdb_list_iterator * i) { if (i) { return i->next; } return NULL; } tgdb_list_iterator *tgdb_list_previous(tgdb_list_iterator * i) { if (i) { return i->prev; } return NULL; } void *tgdb_list_get_item(tgdb_list_iterator * i) { if (i) return i->data; return (void *) NULL; } cgdb-0.6.7/lib/adt/tgdb_list.h000644 000765 000024 00000010164 12074441140 017051 0ustar00mmuellerstaff000000 000000 #ifndef __TGDB_LIST_H__ #define __TGDB_LIST_H__ struct tgdb_list; struct tgdb_list_node; typedef struct tgdb_list_node tgdb_list_iterator; typedef int (*tgdb_list_func) (void *item); /* * Initializes a new empty list. * * Returns * The new list, or NULL on error. */ struct tgdb_list *tgdb_list_init(void); /* * Destory a list * * \param list * The list to destroy * * \return * 0 on success or -1 on error. */ int tgdb_list_destroy(struct tgdb_list *list); /* * Appends item to the end of the list. * * tlist * The list to append an item to. * * item * The item to add to the list * * returns * 0 on success, or -1 on error */ int tgdb_list_append(struct tgdb_list *tlist, void *item); /* * Prepends item to the beggining of the list. * * tlist * The list to prepend an item to. * * item * The item to add to the list * * returns * 0 on success, or -1 on error */ int tgdb_list_prepend(struct tgdb_list *tlist, void *item); /* * appends the item after the position of the iterator. * * tlist * The list to add an item to * * i * The iterator to insert after. * * item * The item to add to the list * * returns * 0 on success, or -1 on error */ int tgdb_list_insert_after(struct tgdb_list *tlist, tgdb_list_iterator * i, void *item); /* * prepands the item before the position of the iterator. * * tlist * The list to add an item to * * i * The iterator to insert before. * * item * The item to add to the list * * returns * 0 on success, or -1 on error */ int tgdb_list_insert_before(struct tgdb_list *tlist, tgdb_list_iterator * i, void *item); /* Traversing the tree */ /* * Traverses each item in the list, passing each element to func * * tlist * The list to traverse * * func * The function to call on each item * * returns * -1 on error, 0 on success. If func returns -1, then the list will stop * traversing and return -1. */ int tgdb_list_foreach(struct tgdb_list *tlist, tgdb_list_func func); /* Freeing the tree */ /* * Free's list item by calling func on each element * * After this function is called, the list is empty. * * tlist * The list to free * * func * The function to free an item * * returns * -1 on error, 0 on success. If func returns -1, then the list will stop * traversing and return -1. */ int tgdb_list_free(struct tgdb_list *tlist, tgdb_list_func func); /* * This will clear a list. * * tlist * The list to free * * returns * -1 on error, 0 on success. */ int tgdb_list_clear(struct tgdb_list *tlist); /* * Gets the size of the list. * * tlist * The list context to get the size of. * * Returns * The size of the list, 0 if empty, -1 on error. */ int tgdb_list_size(struct tgdb_list *tlist); /* Moving through the list */ /* * Gets a hold of the first iterator in the list * * tlist * The list to get the beggining of * * i * The iterator to assign at the first position of the list * * Returns * the iterator on success, or NULL on error */ tgdb_list_iterator *tgdb_list_get_first(struct tgdb_list *tlist); /* * Gets a hold of the last iterator in the list * * tlist * The list to get the last iterator. * * i * The iterator to assign at the last position of the list * * Returns * the iterator on success, or NULL on error */ tgdb_list_iterator *tgdb_list_get_last(struct tgdb_list *tlist); /* * Moves the iterator one step forward through the list * * i * The iterator to advance. * * Returns * the iterator on success, or NULL on error */ tgdb_list_iterator *tgdb_list_next(tgdb_list_iterator * i); /* * Moves the iterator one step backwards through the list * * i * The iterator to move backwards. * * Returns * the iterator on success, or NULL on error */ tgdb_list_iterator *tgdb_list_previous(tgdb_list_iterator * i); /* * Gets the data at the iterator's position. * * i * The iterator to get the item at. * * return * The item at the iterator, or NULL on error */ void *tgdb_list_get_item(tgdb_list_iterator * i); #endif /* __TGDB_LIST_H__ */ cgdb-0.6.7/doc/cgdb.1000644 000765 000024 00000001717 12074756401 015152 0ustar00mmuellerstaff000000 000000 .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.41.1. .TH CGDB "1" "January 2013" "CGDB 0.6.7 " "User Commands" .SH NAME CGDB \- manual page for CGDB 0.6.7 .SH DESCRIPTION .SS "CGDB Usage:" .IP cgdb [cgdb options] [\-\-] [gdb options] .SS "CGDB Options:" .TP \fB\-\-version\fR Print version information and then exit. .TP \fB\-\-help\fR Print help (this message) and then exit. .TP \fB\-d\fR Set debugger to use. .TP \fB\-\-\fR Marks the end of CGDB's options. .SH COPYRIGHT Copyright 2002\-2010 Bob Rossi and Mike Mueller. CGDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. There is absolutely no warranty for CGDB. .SH "SEE ALSO" The full documentation for .B CGDB is maintained as a Texinfo manual. If the .B info and .B CGDB programs are properly installed at your site, the command .IP .B info CGDB .PP should give you access to the complete manual. cgdb-0.6.7/doc/cgdb.info000644 000765 000024 00000211256 12074766264 015756 0ustar00mmuellerstaff000000 000000 This is /Users/mmueller/mike/dev/cgdb/doc/cgdb.info, produced by makeinfo version 4.13 from /Users/mmueller/mike/dev/cgdb/doc/cgdb.texinfo. This manual is for GNU CGDB (version 0.6.7, 14 January 2013), the GNU ncurses based front end to GDB. Copyright (C) 2013 CGDB Team This document is part of a free software program; 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 of the License, 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; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston MA 02111-1307 USA INFO-DIR-SECTION Software development START-INFO-DIR-ENTRY * CGDB: (CGDB). GNU Ncurses front end to GDB. END-INFO-DIR-ENTRY  File: cgdb.info, Node: Top, Next: Summary, Up: (dir) CGDB **** This manual is for GNU CGDB (version 0.6.7, 14 January 2013), the GNU ncurses based front end to GDB. Copyright (C) 2013 CGDB Team This document is part of a free software program; 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 of the License, 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; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston MA 02111-1307 USA * Menu: * Summary:: Summary of CGDB * Invocation:: Getting in and out of CGDB * Understanding CGDB:: Understanding the core concepts of CGDB * Controlling CGDB:: CGDB commands * Configuring CGDB:: CGDB configuration commands * Highlighting Groups:: CGDB highlighting groups * Key User Interface:: CGDB key user interface * Sending I/O to Inferior:: Sending I/O to the program being debugged * Terminal Control Flow:: Allowing terminal control flow in CGDB * Building CGDB:: Building CGDB from source * Copying This Manual:: * Index::  File: cgdb.info, Node: Summary, Next: Invocation, Prev: Top, Up: Top Summary of CGDB *************** CGDB is a curses-based interface to the GNU Debugger (GDB). The goal of CGDB is to be lightweight and responsive; not encumbered with unnecessary features. The interface is designed to deliver the familiar GDB text interface, with a split screen showing the source as it executes. The UI is modeled on the classic Unix text editor, vi. Those familiar with vi should feel right at home using CGDB. The library responsible for communicating with GDB is called Trivial GDB (tgdb, or more accurately, libtgdb). This abstraction allows the UI code to be independent of the debugger, as well as greatly simplifying its implementation. Those wanting to develop other interfaces to GDB are welcome to use libtgdb as the basis for their program. Many of the headaches of parsing GDB's output and annotations can be avoided by using it. Some features offered by CGDB are: * Syntax-highlighted source window * Visual breakpoint setting * Keyboard shortcuts for common functions * Searching source window (using regexp)  File: cgdb.info, Node: Invocation, Next: Understanding CGDB, Prev: Summary, Up: Top 1 Getting In and Out of CGDB **************************** This chapter discusses how to start CGDB, and how to get out of it. The essentials are: * type `cgdb' to start CGDB. * type `quit' or `C-d' in the GDB window to exit. * type `:quit' in the source window to exit. This even works if GDB is currently hanging, or operating a long command.  File: cgdb.info, Node: Understanding CGDB, Next: Controlling CGDB, Prev: Invocation, Up: Top 2 Understanding the core concepts of CGDB ***************************************** The CGDB user interface currently consists of two windows and a status bar. The source window is currently on the top and the GDB window is on the bottom. The "status bar" currently separates the two windows. The interface has several modes depending on which window is focused. "CGDB mode" is when the source window is focused, "GDB mode" is when the GDB window is focused and "TTY mode" is when the TTY window is focused. Beginning with CGDB version 1.0, the windows are movable, and the user will be able to create as many or as few that is desired. Currently however, all of my time is spent developing the interface between CGDB and GDB. Once this is complete, the UI of CGDB will become much more polished. If you are a ncurses developer, and have spare time to work on this task, please contact me. * Menu: * Source Window:: Understanding the source window. * GDB Window:: Understanding the GDB window. * File Dialog Window:: Understanding the file dialog window. * TTY Window:: Understanding the TTY window. * Status Bar:: Understanding the status bar. * Switching Windows:: Switching between windows.  File: cgdb.info, Node: Source Window, Next: GDB Window, Up: Understanding CGDB 2.1 Understanding the source window. ==================================== The "source window" is the window that provides you a view of the source code that the debugged program is made up of. It will display to the user a single source file at a time. While the user is debugging, via `next' and `step', CGDB will update the source file and line number to keep you informed as to where GDB is debugging. CGDB has several features that make debugging easier than using plain old GDB. One feature you will notice right away while debugging a C, C++ or ADA program, is that the source files are syntax highlighted. This allows the user to easily navigate through the source file to look for certain places in the source code. If you would like to see another source language highlighted, contact us. To understanding how to navigate through the source window look at the commands in *note CGDB Mode::. In addition to showing the source code, CGDB also displays to the user the currently executing line. The line number will be highlighted green, to represent that the particular line, is the current line being debugged by GDB. Also, CGDB will display an arrow extending from the line number, to the source line. You can configure what type of arrow CGDB uses with the `:set arrowstyle' configuration option. By default, the `short' arrow is used. However, my personal favorite is the `long' arrow. As you navigate through the source window, the current line the cursor is on will be highlighted white. This simply helps you keep track of where you are in the file. Also, you can set or delete breakpoints in CGDB from the source window. Simply navigate to the line that you are interested in setting a breakpoint, and hit the space bar. This will set a breakpoint on the line if one did not already exist. The line number should turn red to indicate that a breakpoint has been set. Hitting the space bar again will delete the breakpoint. If you disable the breakpoint, the line number will turn yellow, to represent the disabled breakpoint. CGDB also supports regular expression searching within the source window. If you type `/' or `?' you can search in the source window for a string of interest. The C library regular expression functions are used to perform this search, which honors things like `*' or `+'. The full list of commands that are available in the source window is in *note CGDB Mode::.  File: cgdb.info, Node: GDB Window, Next: File Dialog Window, Prev: Source Window, Up: Understanding CGDB 2.2 Understanding the GDB window. ================================= The "GDB window" is how CGDB allows the user to interface with the GNU debugger. If you wish to pass a command to GDB, simply type it into this window and GDB will receive the command. This interface is intended to be 100% identical to using GDB on a terminal. There is a limited set of keys that can be typed into this window that CGDB interprets and handles, instead of sending to GDB. They are all available in *note GDB Mode::. CGDB attempts to buffer commands the same way they would be if you typed them at the terminal. So, if you type several commands before a single one finishes, they will each be run in order. There will be no way to stop these commands from being run besides from typing `Ctrl-C', like you would at any normal terminal when working with GDB.  File: cgdb.info, Node: File Dialog Window, Next: TTY Window, Prev: GDB Window, Up: Understanding CGDB 2.3 Understanding the file dialog window. ========================================= The "file dialog window" is available to help the user view and select which file they would like to view. It provides the user with a list of all the files that make up the program being debugged. If there are no files available, because there is no program being debugged or because there is no debug symbols, then the file dialog will not open and a message will be displayed at the status bar. You can get to the file dialog by hitting `o' when you are at the source window. Once you enter the file dialog, it is possible to leave it by hitting `q'. You can navigate the file dialog using the standard direction keys and you can even use regular expression to find your file. This can save a lot of time as the number of files grow. The full list of commands that are available in the source window is in *note File Dialog Mode::.  File: cgdb.info, Node: TTY Window, Next: Status Bar, Prev: File Dialog Window, Up: Understanding CGDB 2.4 Understanding the TTY window. ================================= The "TTY window" is available to allow the user to pass input to the program being debugged. This window will act similar to the GDB window, except that the data you type will get sent to the program being debugged. *Note Sending I/O to Inferior::. You will notice that the TTY window has a terminal device between it and the program being debugged. So, if the program being debugged uses say readline, which allows command line editing, the same interface will be provided via the TTY window as at the terminal. You can see the name of the terminal device in the TTY status bar. The full list of commands that are available in the source window is in *note TTY Mode::. Sending I/O to the program being debugged can be confusing. It is described better in *note Sending I/O to Inferior::. Unless the I/O with the program being debugged is simple, I usually prefer starting the application on a separate terminal and attaching to it with CGDB.  File: cgdb.info, Node: Status Bar, Next: Switching Windows, Prev: TTY Window, Up: Understanding CGDB 2.5 Understanding the status bar. ================================= The "status bar" is the general purpose way for CGDB to show the user which commands they are currently typing or report errors to the user when they occur. CGDB does not use popup's or other forms of I/O to alert the user of information or problems. While CGDB is running, you can configure it with any of the commands that are valid in CGDB's configuration file. Simply type `:' in the source window, and you will see the colon, and the rest of the command you type appear in the status bar. When you are finished typing the command that you are interested in, type `enter'. This will alert CGDB to execute the command. If at any point you would like to cancel the current command typed so far, type the cgdb mode key. This will put you back into CGDB mode. For a description of the cgdb mode key, see *note Switching Windows::. The full list of commands that are available in the source window is in *note Configuring CGDB::.  File: cgdb.info, Node: Switching Windows, Prev: Status Bar, Up: Understanding CGDB 2.6 Switch between windows ========================== When CGDB is invoked, the interface is in "GDB mode". A `*' at the right of the status bar indicates that input will be passed to GDB. To change the focus to the source window, hit the key. The "cgdb mode key" is the key that is responsible for switching the user into "CGDB mode" from a different mode. The cgdb mode key is defaulted to the key. To change this value, look at the configuration options for CGDB. *Note Configuring CGDB::. The interface is now in "CGDB mode". To switch back into "GDB mode", press `i'. This syntax is based on the popular Unix text-editor, vi.  File: cgdb.info, Node: Controlling CGDB, Next: Configuring CGDB, Prev: Understanding CGDB, Up: Top 3 CGDB commands *************** CGDB can be controlled in a variety of different ways. Each mode that CGDB is in acts differently. Currently CGDB implicitly changes modes depending on which window is active. The following information will help you determine what commands are accessible during which modes. * Menu: * CGDB Mode:: Commands available during CGDB mode * GDB Mode:: Commands available during GDB mode * File Dialog Mode:: Commands available during the file dialog mode * TTY Mode:: Commands available during TTY mode  File: cgdb.info, Node: CGDB Mode, Next: GDB Mode, Up: Controlling CGDB 3.1 Commands available during CGDB mode ======================================= When you are in the source window, you are implicitly in "CGDB mode". All of the below commands are available during this mode. This mode is primarily available for the user to view the current source file, search it, or switch to a different mode. `cgdbmodekey' Puts the user into command mode. However, you are already in this mode. This is defaulted to the key. `i' Puts the user into "GDB mode". `I' Puts the user into "TTY mode". `T' Opens a window to give input to the debugged program. `Ctrl-T' Opens a new tty for the debugged program. `k' `up arrow' Move up a line. `j' `down arrow' Move down a line. `h' `left arrow' Move left a line. `l' `right arrow' Move right a line. `Ctrl-b' `page up' Move up a page. `Ctrl-u' Move up 1/2 a page. `Ctrl-f' `page down' Move down a page. `Ctrl-d' Move down 1/2 a page. `gg' Move to the top of file. `G' Move to the bottom of file. `/' search from current cursor position. `?' reverse search from current cursor position. `n' next forward search. `N' next reverse search. `o' open the file dialog. `spacebar' Sets a breakpoint at the current line number. `t' Sets a temporary breakpoint at the current line number. `-' Shrink source window 1 line. `=' Grow source window 1 line. `_' Shrink source window 25% (or, shrink tty window 1 line, if visible). `+' Grow source window 25% (or, grow tty window 1 line, if visible). `Ctrl-l' Clear and redraw the screen. `F5' Send a run command to GDB. `F6' Send a continue command to GDB. `F7' Send a finish command to GDB. `F8' Send a next command to GDB. `F10' Send a step command to GDB.  File: cgdb.info, Node: GDB Mode, Next: File Dialog Mode, Prev: CGDB Mode, Up: Controlling CGDB 3.2 Commands available during GDB mode ====================================== When in "GDB mode", the user is mostly interested in working with the GDB console. That is, sending commands to GDB and receiving data back from GDB. Almost all data passed into this window is directly sent to readline and then to GDB. It is important to understand that CGDB parses the keys entered in the GDB window and has the first chance at dealing with them. If it is interested in the keys, it will handle them. Below is a list of keys that CGDB is interested in, and does not pass along any further. `cgdbmodekey' Switch back to source window. This is defaulted to the key. `page up' Move up a page. `page down' Move down a page. `F11' Go to the beginning of the GDB buffer. `F12' Go to the end of the GDB buffer. Any other keys, besides the ones above, CGDB is currently not interested in. CGDB will pass along these keys to the readline library. When readline has determined that a command has been received, it alerts CGDB, and a command is then sent to GDB. This is the same method used when invoking GDB directly.  File: cgdb.info, Node: File Dialog Mode, Next: TTY Mode, Prev: GDB Mode, Up: Controlling CGDB 3.3 Commands available during the file dialog mode ================================================== The file dialog is primarily used to allow the user to find and open a source file that the program they are debugging is made up of. The file dialog will be full screen, and will list each file that the debugged program is made up of. A usual instance of the file dialog would be to open it up from the source window using the `o' key, and then to search for the file of interest. If you are looking for foo.c type `/foo.c', press `enter' once to finish the regular expression and again to select the file. The commands available in the file dialog are: `q' Will exit the file dialog, and return to the source window. `k' `up arrow' Move up a line. `j' `down arrow' Move down a line. `h' `left arrow' Move left a line. `l' `right arrow' Move right a line. `Ctrl-b' `page up' Move up a page. `Ctrl-f' `page down' Move down a page. `/' search from current cursor position. `?' reverse search from current cursor position. `n' next forward search. `N' next reverse search. `enter' Select the current file.  File: cgdb.info, Node: TTY Mode, Prev: File Dialog Mode, Up: Controlling CGDB 3.4 Commands available during TTY mode ====================================== `cgdbmodekey' Switch back to source window. This is defaulted to the key. `page up' Move up a page. `page down' Move down a page. `F11' Go to the beginning of the GDB buffer. `F12' Go to the end of the GDB buffer.  File: cgdb.info, Node: Configuring CGDB, Next: Highlighting Groups, Prev: Controlling CGDB, Up: Top 4 CGDB configuration commands ***************************** There may be several features that you find useful in CGDB. CGDB is capable of automating any of these commands through the use of the config file called `cgdbrc'. It looks in `$HOME'`/.cgdb/' for that file. If it exists, CGDB executes each line in the file in order. It is as if the user typed in all the commands into the status bar after the tui was initialized. The following variables change the behavior of some aspect of CGDB. Many of these commands may be abbreviated in some way, and all boolean commands my be negated by appending `no' to the front. For example: `:set ignorecase' turns on case-insensitive searching; while `:set noignorecase' turns on case-sensitive searching. `:set as=STYLE' `:set arrowstyle=STYLE' Set the arrow style to STYLE. Possible values for STYLE are `short', `long', and `highlight'. Changes the style of the arrow that is used to indicate the currently executing line in the source viewer. The default value is short. A longer arrow is available, for easier readability. Finally, the `highlight' option draws no arrow at all, instead drawing the entire line in inverse video. `:set asr' `:set autosourcereload' If this is on, CGDB will automatically reload a source file if it has changed since CGDB has opened it. If it is off, the file will never be reloaded, until you start CGDB again. The default is on. This feature is useful when you are debugging a program, then you modify a source file, recompile, and type `r' in GDB's CLI window. The file in this case will be updated to show the new version. Note, CGDB only looks at the timestamp of the source file to determine if it has changed. So if you modify the source file, and didn't recompile yet, CGDB will still pick up on the changes. `:set cgdbmodekey=KEY' This option is used to determine what key puts CGDB into "CGDB Mode". By default, the `ESC' key is used. KEY can be any normal key on the keyboard. It can also be any keycode, as long as the keycode notation is used. This option is especially useful when the user wants to use readline in vi mode. If the user types `set cgdbmodekey=' then the `Page Up' key will put CGDB into CGDB mode and the `ESC' key will flow through to readline. `:set ic' `:set ignorecase' Sets searching case insensitive. The default is off. `:set stc' `:set showtgdbcommands' If this is on, CGDB will show all of the commands that it sends to GDB. If it is off, CGDB will not show the commands that it gives to GDB. The default is off. `:set syn=STYLE' `:set syntax=STYLE' Sets the current highlighting mode of the current file to have the syntax STYLE. Possible values for SYNTAX are `c', `ada', and `off'. Normally, the user will never have to do this, since CGDB automatically detects what syntax a file should be based on its file extension. However, this feature can currently be useful for debugging purposes. `:set to' `:set timeout' This option is used along with the TTIMEOUT option to determine the behavior CGDB should have when it receives part of a mapped key sequence or a keyboard code sequence. If this option is on, CGDB will time out on both user defined mappings and on key codes from the keyboard. If this option is off, user defined mappings will not be timed out on. In this case, CGDB will determine if it should time out on key codes from the keyboard by examining the TTIMEOUT option. To determine how CGDB will time out on mappings and key codes, and what time out lengths CGDB will use, please refer to the chart in *note Key User Interface::. The default value for this option is on. `:set tm=DELAY' `:set timeoutlen=DELAY' This option is used along with the TTIMEOUTLEN option. It represents the number of milliseconds that CGDB should wait for a key code from the keyboard or for a mapped key sequence to complete. If DELAY is 0, CGDB immediately accepts each character it receives. This will prevent any mappings or key codes to complete. DELAY may be any value between 0 and 10000, inclusive. The default setting for the DELAY variable is 1000 (one second). `:set ttimeout' This option is used along with the TIMEOUT option to determine the behavior CGDB should have when it receives part of keyboard code sequence. If this option is on, CGDB will time out on key codes from the keyboard. If this option is off, CGDB will determine if it should time out on key codes from the keyboard by examining the TIMEOUT option. To determine how CGDB will time out on key codes, what what time length it will use, please refer to the chart in *note Key User Interface::. The default value for this option is on. `:set ttm=DELAY' `:set ttimeoutlen=DELAY' This option is used along with the TTIMEOUTLEN option. It represents the number of milliseconds that CGDB should wait for a key code from the keyboard. If DELAY is 0, CGDB immediately accepts each character it receives. This will prevent any key codes to complete. DELAY may be any value between 0 and 10000, inclusive. The default setting for the DELAY variable is 100 (one tenth of a second). `:set ts=NUMBER' `:set tabstop=NUMBER' Sets the number of spaces that should be rendered on the screen for characters. The default value for NUMBER is 8. `:set wmh=NUMBER' `:set winminheight=NUMBER' The minimal height of a window. Windows will never become smaller than this value. The default value for NUMBER is 0. `:set winsplit=STYLE' Set the split point between source and GDB window. This is especially useful as an init setting in your `cgdbrc' file. *Note Configuring CGDB::. The possible values for STYLE are `top_full', `top_big', `even', `bottom_big', and `bottom_full'. `:set ws' `:set wrapscan' Searches wrap around the end of file. The default is on. `:c' `:continue' Send a continue command to GDB. `:down' Send a down command to GDB. `:e' `:edit' reloads the file in the source window. this can be useful if the file has changed since it was opened by cgdb. `:f' `:finish' Send a finish command to GDB. `:help' This will display the current manual in text format, in the "source window". `:hi GROUP cterm=ATTRIBUTES ctermfg=COLOR ctermbg=COLOR term=ATTRIBUTES' `:highlight GROUP cterm=ATTRIBUTES ctermfg=COLOR ctermbg=COLOR term=ATTRIBUTES' Set the COLOR and ATTRIBUTES for a highlighting group. The syntax mimics vim's "highlight" command. Possible values for GROUP, ATTRIBUTES and COLOR are available in *note Highlighting Groups::. You can give as many or as few of the name=value pairs as you wish, in any order. `ctermfg' and `ctermbg' set the foreground and background colors. These can be specified by color number or by using the same color names that vim uses. When CGDB is linked with ncurses, the number you use to represent the color can be between -1 and COLORS. When CGDB is linked against curses, it must be between 0 and COLORS. `cterm' sets the video attributes for color terminals. `term' sets the video attributes for monochrome terminals. Some examples are, :highlight Logo cterm=bold,underline ctermfg=Red ctermbg=Black :highlight Normal cterm=reverse ctermfg=White ctermbg=Black :hi Normal term=bold `:insert' Move focus to the GDB window. `:n' `:next' Send a next command to GDB. `:q' `:quit' Quit CGDB. `:r' `:run' Send a run command to GDB. `:start' Send a start command to GDB. `:k' `:kill' Send a kill command to GDB. `:s' `:step' Send a step command to GDB. `:syntax' Turn the syntax on or off. `:up' Send an up command to GDB. `:map LHS RHS' Create a new mapping or overwrite an existing mapping in CGDB mode. After the command is run, if LHS is typed, CGDB will get RHS instead. For more details on how to use the map command look in *note Using Maps::. `:unm LHS' `:unmap LHS' Delete an existing mapping from CGDB mode. LHS is what was typed in the left hand side when the user created the mapping. For example, if the user typed `:map ab foo' then the user could delete the existing mapping with `:unmap ab'. `:im LHS RHS' `:imap LHS RHS' Create a new mapping or overwrite an existing mapping in GDB mode. After the command is run, if LHS is typed, CGDB will get RHS instead. For more details on how to use the map command look in *note Using Maps::. `:iu LHS' `:iunmap LHS' Delete an existing mapping from GDB mode. LHS is what was typed in the left hand side when the user created the mapping. For example, if the user typed `:imap ab foo' then the user could delete the existing mapping with `:iunmap ab'.  File: cgdb.info, Node: Highlighting Groups, Next: Key User Interface, Prev: Configuring CGDB, Up: Top 5 CGDB highlighting groups ************************** CGDB is capable of using colors if the terminal it is run in supports them. Until version 0.6.1, CGDB did not allow the user to configure these colors in any way. CGDB color use is now fully configurable. CGDB's modeled its use of color highlighting after vim. Any data that will be colored in the terminal is represented by a highlighting group. A "highlighting group" represents data that should be formatted using foreground colors, background colors and attributes. There are currently several types of highlighting groups in CGDB. There are syntax highlighting groups, which represent syntax highlighting of sources files. There are also User Interface groups, which represent things like CGDB's logo, or the status bar. Each highlighting group has a default set of attributes and colors associated with it. You can modify a highlighting groups properties by using the highlight command. *Note Configuring CGDB::. Note that CGDB currently supports using the same background color the terminal was using before CGDB was started. However, this only works when CGDB was linked with ncurses. If you link CGDB with curses, then CGDB will force the background to Black. * Menu: * Available Highlighting Groups:: The different highlighting groups. * Available Attributes:: The different attributes. * Available Colors:: The different colors.  File: cgdb.info, Node: Available Highlighting Groups, Next: Available Attributes, Up: Highlighting Groups 5.1 The different highlighting groups ===================================== Below is a list of all the highlighting groups that CDGB will use when syntax highlighting source files. `Statement' This represents the keywords a language defines. `Type' This represents the types a language defines. `Constant' This represents either a string or numeric value. `Comment' This represents the comments in a source file. `PreProc' This represents the C/C++ preprocessor commands. `Normal' This represents all normal text. Below is a list of all the highlighting groups that CGDB will use when it is displaying it's User Interface. `StatusLine' This represents the "status bar" in CGDB. The file dialog's status bar also uses this group. `IncSearch' This represents the group used when the user is searching in either the source window, or the "file dialog window". `Arrow' This represents the arrow that CGDB draws to point to the currently viewed line. `LineHighlight' This represents the group used when the user has the `arrowstyle' option set to `highlight'. `Breakpoint' This represents the group that is used when CGDB displays a line that has a breakpoint set. `DisabledBreakpoint' This represents the group that is used when CGDB displays a line that has a disabled breakpoint set. `SelectedLineNr' This represents the group that is used when CGDB is displaying the currently selected line. This is the line that the cursor is on. `Logo' This is the group CGDB uses to display its logo on startup when no source file can be auto detected.  File: cgdb.info, Node: Available Attributes, Next: Available Colors, Prev: Available Highlighting Groups, Up: Highlighting Groups 5.2 The different attributes ============================ CGDB supports many of the attributes that curses provides. It will apply the attributes to the output window, but it is up to the terminal you are using to support such features. The list of attributes that CGDB currently supports is below. `normal' `NONE' This will leave the text normal. Uses A_NORMAL curses attribute. `bold' This will make the text appear bold. Uses A_BOLD curses attribute. `underline' This will underline the text. Uses A_UNDERLINE curses attribute. `reverse' `inverse' This will reverse the foreground and background colors. Uses A_REVERSE curses attribute. `standout' This is the best highlighting mode of the terminal. Uses A_STANDOUT curses attribute. `blink' This will cause the text to blink. Uses A_BLINK curses attribute. `dim' This will cause the text to be 1/2 bright. Uses A_DIM curses attribute.  File: cgdb.info, Node: Available Colors, Prev: Available Attributes, Up: Highlighting Groups 5.3 The different colors ======================== CGDB supports several colors, depending on how many colors your terminal supports. Below is a chart of the colors that CGDB provides. The heading NR-16 is used to represent terminals that support at least 16 colors. The heading NR-8 is used to represent terminals that support at least 8 colors. The integer values for each color represent the values passed to the curses function init_pair() to ask curses to create a new color. `COLOR NAME' `NR-16' `NR-8' `NR-8 bold attribute' Black 0 0 No DarkBlue 1 4 No DarkGreen 2 2 No DarkCyan 3 6 No DarkRed 4 1 No DarkMagenta 5 5 No Brown, DarkYellow 6 3 No LightGray, LightGrey, Gray, 7 7 No Grey DarkGray, DarkGrey 8 0 Yes Blue, LightBlue 9 4 Yes Green, LightGreen 10 2 Yes Cyan, LightCyan 11 6 Yes Red, LightRed 12 1 Yes Magenta, LightMagenta 13 5 Yes Yellow, LightYellow 14 3 Yes White 15 7 Yes  File: cgdb.info, Node: Key User Interface, Next: Sending I/O to Inferior, Prev: Highlighting Groups, Up: Top 6 CGDB key user interface ************************* The Key User Interface is how CGDB receives input from the user. It is usually referred to as the "KUI". CGDB simply asks the KUI for the next key the user typed and the KUI will provide it. The KUI has 2 major responsibilities besides reading normal user input and providing it to CGDB. It needs to detect when the user has typed a user defined map or when the user has hit a special key on the keyboard. A user defined map, or simply "map", is used to change the meaning of typed keys. Some users may refer to this type of functionality as a "macro". An example would be `map a b'. If the user then typed the character, the KUI would detect that it was mapped to and return to CGDB. When the user types a special key on the keyboard, a "key code" is sent to CGDB. Typically, keys like `HOME', `DEL', , etc, when pressed will send several characters to the application instead of just one character like a normal key does. These characters combined are called a "key sequence". The KUI is responsible for assembling the key sequences back together and reporting to CGDB that a particular key was typed by the user. The `ESC' key is special because typically most key codes start with that key. This usually gives all key codes a common first key in its key sequence. The KUI uses the terminfo database to determine what key sequences are sent by which keycodes. There are a few commonly used key sequences that are hard coded into CGDB. A major challenge the KUI has to overcome is determining when a map or a key sequence is received. The KUI sometimes will need to read more than one character to determine this. For example, if the user has 2 maps, `map abc def' and `map abd def', the KUI would have to buffer at least the characters and before it could determine if the user was going to type a map. After the next key press, if the user types or then a map was received and the KUI will return `d e f' to CGDB. Otherwise, no map was received and the KUI must return `a b' to CGDB. The options TIMEOUT, TTIMEOUT, TIMEOUTLEN and TTIMEOUTLEN can be used to tell the KUI if it should timeout on partial mappings or key sequences, and if so, how long it should wait before timing out. * Menu: * Configuring the KUI Time Out Options:: The KUI's time out options * Using Maps:: Using maps * Understanding Keycodes:: Understanding keycodes  File: cgdb.info, Node: Configuring the KUI Time Out Options, Next: Using Maps, Up: Key User Interface 6.1 The KUI's time out options ============================== The KUI may be configured to time out on either maps or key sequences. When the KUI is matching a partial map or key sequence it is capable of timing out. This means it will simply accepts the keys it has received so far if a certain amount of time elapses between key presses. This is obvious when the user is typing a map because the user must press each key individually. For partial key sequences, this is less obvious. That is because the user only presses a single key, but multiple characters are sent to CGDB. The table below describes how the user can configure the KUI to time out on key codes or maps. The TIMEOUT and TTIMEOUT options control this functionality. timeout ttimeout action --------------------------------------------------------- off off do not time out on on or off time out on maps and key codes off on time out on key codes It is also possible to tell the KUI how long to wait before timing out on a partial match. If TIMEOUT is on, then the KUI will wait a certain amount of time for the next character, when matching a map, before it decides a match is no longer possible. If TIMEOUT or TTIMEOUT is on, then the KUI will wait a certain amount of time for the next character, when matching a key sequence, before it decides a match is no longer possible. The TIMEOUTLEN and TTIMEOUTLEN options can be configured by the user to tell the KUI how long to wait before timing out. The table below describes when the KUI uses which option. timeoutlen mapping delay key code delay ------------------------------------------ < 0 TIMEOUTLEN TIMEOUTLEN >= 0 TIMEOUTLEN TTIMEOUTLEN A value of 0 means that the KUI will time out right away. It will not be possible to match a map or key code in this circumstance. A common problem could be that when the user types a special key like the left or right arrows, CGDB will go into the source mode and not perform the action requested by the user. This typically means that the key code delay is to small. If you try setting the option `set ttimeoutlen=1000' CGDB should start acting like the user expects. If not, please report this to the CGDB mailing list.  File: cgdb.info, Node: Using Maps, Next: Understanding Keycodes, Prev: Configuring the KUI Time Out Options, Up: Key User Interface 6.2 Using maps ============== CGDB fully supports the use of maps. It allows the user to change the meaning of typed keys. For example, you could have the following map `:map ipargc'. When the user is in CGDB mode and they hit , the value of the map will be used instead. The `i' key will first be received by CGDB, and it will put the user into insert mode. Next, CGDB will get `p argc' followed by the key. CGDB currently supports two mapping lists. Any mapping that was added with the MAP command will be used by CGDB when it is in CGDB mode. You can delete a mapping that you have created with the MAP command with the UNMAP command. If you want to have mappings in GDB mode, you can use the IMAP command. Similarly, IUNMAP will delete a mapping in the IMAP set. Some examples of this would be map ab foo unmap ab imap ab foo iunmap ab  File: cgdb.info, Node: Understanding Keycodes, Prev: Using Maps, Up: Key User Interface 6.3 Understanding keycodes ========================== The above example could use a little more explaining for people unfamiliar with vim maps. The map takes a key and a value. They are separated by a space. Neither the key or value can have a space in them, or it is considered to be the separator between the key and value. If the user desires to have a space in either the key or value part of a map, they can use the keycode notation . Below is a table of the keycodes in "keycode notation" form. The keycode notation can be used in any mapping command. notation meaning ------------------------------------------ escape key cursor up key cursor down key cursor left key cursor right key home key end key page up key page down key delete key insert key zero backspace key tab key linefeed formfeed carriage return space less-than backslash vertical bar - function keys 1 to 12 control keys shift keys  File: cgdb.info, Node: Sending I/O to Inferior, Next: Terminal Control Flow, Prev: Key User Interface, Up: Top 7 Sending I/O to the program being debugged ******************************************* If the program being debugged takes input on the terminal it is recommended that the user start the program on one terminal, and attach to it with CGDB from another terminal. This is the easiest way to pass input to the debugged program. However, if the user wishes to pass input to the program being debugged from within CGDB, there is a mechanism available for doing so. As of this writing, the technique described below does not work on windows, using a natively compiled GDB. It may work when using the GDB that comes with Cygwin. This technique is similar to getting in and out of "GDB mode". The tty window is not visible by default. This is because it is only needed if the user wishes to send data to the program being debugged. To display the tty window, hit `T' while in command mode. After hitting `T' you will notice that there is another window in the middle of the "source window" and the "gdb window". This is called the "tty window". You will also see a new status bar called the tty status bar. There will be a `*' on the tty status bar after the `T' was hit. This is because when the window is opened with the `T' command, CGDB automatically puts the user into "TTY mode". To get out of this window hit the cgdb mode key. This will put you back into command mode. To make the tty window appear and disappear hit the `T' key while in command mode. It is a toggle. Once the tty window is already open, the user can then hit `I' in command mode to get into "TTY mode". The user can then hit the cgdb mode key in the "TTY mode" to get back into command mode. When the tty window is open, all data that comes from the program, goes there. Any data typed into the tty window will ONLY go to the program being debugged. It will not go to GDB. When the tty window is closed, all output from the debugged program will go to the "GDB window" AND to the "tty window" (for viewing later when the tty window is opened). If the user wishes to get a new tty for the program being debugged then they can type `Ctrl-T'. This will delete all the buffered data waiting to be read into the debugged program. This might be useful when you rerun or start a new program.  File: cgdb.info, Node: Terminal Control Flow, Next: Building CGDB, Prev: Sending I/O to Inferior, Up: Top 8 Allowing terminal control flow in CGDB **************************************** A user can typically set there control flow behavior by using the stty command like so `stty -ixon -ixoff'. This will disable control flow on the terminal where CGDB is started. If you want to turn control flow back on you can type `stty ixon ixoff'. If flow control is on, when the user types `Ctrl-s', the terminal stops. When the user types `Ctrl-q', the terminal restarts. When using readline, the `Ctrl-s' character usually does a forward search. So, if you want to get this, or other functionality out of readline, simply turn off control flow and start CGDB.  File: cgdb.info, Node: Building CGDB, Next: Copying This Manual, Prev: Terminal Control Flow, Up: Top 9 Building CGDB from source *************************** Building CGDB from source requires several packages. First, CGDB is hosted at http://sf.net/projects/cgdb. You can determine how to get CGDB from source by looking here: http://sourceforge.net/svn/?group_id=72581. Once you have the source to CGDB, now you can begin to build it. You will of course need many packages to build CGDB. Below is a list of all of them that are required to build CGDB. `GNU Make' I have successfully used version 3.79.1, however, older versions probably will work. `GNU GCC' The GNU C compiler. I've compiled CGDB with versions as old as 2.9.5, and as new as 4.0.2. `GNU Readline' The GNU readline library version 5.1. CGDB will not work with versions before 5.1. Readline was modified specifically to work with CGDB. `GNU Ncurses' I have successfully used libncurses.so.5 successfully. However, older versions probably will work. Below is a list of optional packages you will need, if modifying certain files in CGDB. `GNU Flex' If you modify any files with an extension of `.l', you will have to have flex installed. I have used flex 2.5.4 to build CGDB. `GNU Texinfo' If you modify `doc/cgdb.texinfo', then you will be required to have this package installed. I have used version 4.7 to build the documentation for CGDB. `help2man' If you are doing a release, then you will be required to have this package installed. In the `doc/' build directory, you can execute the command `make cgdb.1', and the CGDB man page will be generated. CGDB uses autoconf/automake to build its configure scripts and makefiles. So, if you change any of the autoconf/automake files, you will need this software installed. `GNU Automake' This has the program aclocal, and must be version Version 1.9.5. `GNU Autoconf' This has the program autoconf, and must be version 2.59. `GNU m4' This has the program m4, and must be version 1.4.3.  File: cgdb.info, Node: Copying This Manual, Next: Index, Prev: Building CGDB, Up: Top Appendix A Copying This Manual ****************************** Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble ======== The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION =============================================================== 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a. You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b. You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c. If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a. Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b. Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c. Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs ======================================================= If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. ONE LINE TO GIVE THE PROGRAM'S NAME AND A BRIEF IDEA OF WHAT IT DOES. Copyright (C) YYYY NAME OF AUTHOR 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 of the License, 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; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) YEAR NAME OF AUTHOR Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. SIGNATURE OF TY COON, 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License.  File: cgdb.info, Node: Index, Prev: Copying This Manual, Up: Top Index ***** [index] * Menu: * attributes: Available Attributes. (line 6) * building CGDB: Building CGDB. (line 6) * CGDB key user interface: Key User Interface. (line 6) * CGDB mode: Understanding CGDB. (line 6) * colors: Available Colors. (line 6) * commands, in CGDB mode: CGDB Mode. (line 6) * commands, in File Dialog mode: File Dialog Mode. (line 6) * commands, in GDB mode: GDB Mode. (line 6) * commands, in TTY mode: TTY Mode. (line 6) * configuring CGDB: Configuring CGDB. (line 6) * controlling CGDB: Controlling CGDB. (line 6) * file dialog window: File Dialog Window. (line 6) * GDB mode: Understanding CGDB. (line 6) * GDB window: GDB Window. (line 6) * highlighting groups <1>: Highlighting Groups. (line 6) * highlighting groups: Available Highlighting Groups. (line 6) * invocation CGDB: Invocation. (line 6) * regular expression search: Source Window. (line 42) * sending I/O to inferior: Sending I/O to Inferior. (line 6) * source window: Source Window. (line 6) * status bar <1>: Status Bar. (line 6) * status bar: Understanding CGDB. (line 6) * switch between windows: Switching Windows. (line 6) * terminal control flow: Terminal Control Flow. (line 6) * timeout: Configuring the KUI Time Out Options. (line 6) * timeoutlen: Configuring the KUI Time Out Options. (line 6) * ttimeout: Configuring the KUI Time Out Options. (line 6) * ttimeoutlen: Configuring the KUI Time Out Options. (line 6) * TTY mode: Understanding CGDB. (line 6) * tty window: TTY Window. (line 6) * TTY window: TTY Window. (line 6) * understanding CGDB: Understanding CGDB. (line 6)  Tag Table: Node: Top1178 Node: Summary2791 Node: Invocation3946 Node: Understanding CGDB4400 Node: Source Window5793 Node: GDB Window8324 Node: File Dialog Window9291 Node: TTY Window10334 Node: Status Bar11473 Node: Switching Windows12595 Node: Controlling CGDB13341 Node: CGDB Mode14049 Node: GDB Mode15994 Node: File Dialog Mode17252 Node: TTY Mode18539 Node: Configuring CGDB18952 Node: Highlighting Groups28252 Node: Available Highlighting Groups29828 Node: Available Attributes31611 Node: Available Colors32708 Node: Key User Interface34513 Node: Configuring the KUI Time Out Options37155 Node: Using Maps39560 Node: Understanding Keycodes40627 Node: Sending I/O to Inferior41945 Node: Terminal Control Flow44354 Node: Building CGDB45123 Node: Copying This Manual47261 Node: Index66518  End Tag Table cgdb-0.6.7/doc/cgdb.texinfo000644 000765 000024 00000131263 12074766251 016472 0ustar00mmuellerstaff000000 000000 \input texinfo @c -*-texinfo-*- @comment $Id$ @comment %**start of header @setfilename cgdb.info @include version.texi @settitle CGDB Manual @value{VERSION} @syncodeindex pg cp @comment %**end of header @copying This manual is for @acronym{GNU} CGDB (version @value{VERSION}, @value{UPDATED}), the @acronym{GNU} ncurses based front end to GDB. Copyright @copyright{} 2013 CGDB Team @quotation This document is part of a free software program; 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 of the License, 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; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston MA 02111-1307 USA @end quotation @end copying @dircategory Software development @direntry * CGDB: (CGDB). GNU Ncurses front end to GDB. @end direntry @titlepage @title CGDB @subtitle for version @value{VERSION}, @value{UPDATED} @author Bob Rossi (@email{bob@@brasko.net}) @page @vskip 0pt plus 1filll @insertcopying @end titlepage @contents @ifnottex @node Top @top CGDB @insertcopying @end ifnottex @menu * Summary:: Summary of CGDB * Invocation:: Getting in and out of CGDB * Understanding CGDB:: Understanding the core concepts of CGDB * Controlling CGDB:: CGDB commands * Configuring CGDB:: CGDB configuration commands * Highlighting Groups:: CGDB highlighting groups * Key User Interface:: CGDB key user interface * Sending I/O to Inferior:: Sending I/O to the program being debugged * Terminal Control Flow:: Allowing terminal control flow in CGDB * Building CGDB:: Building CGDB from source * Copying This Manual:: * Index:: @end menu @node Summary @unnumbered Summary of CGDB CGDB is a curses-based interface to the GNU Debugger (GDB). The goal of CGDB is to be lightweight and responsive; not encumbered with unnecessary features. The interface is designed to deliver the familiar GDB text interface, with a split screen showing the source as it executes. The UI is modeled on the classic Unix text editor, vi. Those familiar with vi should feel right at home using CGDB. The library responsible for communicating with GDB is called Trivial GDB (tgdb, or more accurately, libtgdb). This abstraction allows the UI code to be independent of the debugger, as well as greatly simplifying its implementation. Those wanting to develop other interfaces to GDB are welcome to use libtgdb as the basis for their program. Many of the headaches of parsing GDB's output and annotations can be avoided by using it. Some features offered by CGDB are: @itemize @bullet @item Syntax-highlighted source window @item Visual breakpoint setting @item Keyboard shortcuts for common functions @item Searching source window (using regexp) @end itemize @node Invocation @chapter Getting In and Out of CGDB @cindex invocation CGDB This chapter discusses how to start CGDB, and how to get out of it. The essentials are: @itemize @bullet @item type @samp{cgdb} to start CGDB. @item type @kbd{quit} or @kbd{C-d} in the GDB window to exit. @item type @kbd{:quit} in the source window to exit. This even works if GDB is currently hanging, or operating a long command. @end itemize @node Understanding CGDB @chapter Understanding the core concepts of CGDB @cindex understanding CGDB @cindex status bar @cindex CGDB mode @cindex GDB mode @cindex TTY mode The CGDB user interface currently consists of two windows and a status bar. The source window is currently on the top and the GDB window is on the bottom. The @dfn{status bar} currently separates the two windows. The interface has several modes depending on which window is focused. @dfn{CGDB mode} is when the source window is focused, @dfn{GDB mode} is when the GDB window is focused and @dfn{TTY mode} is when the TTY window is focused. Beginning with CGDB version 1.0, the windows are movable, and the user will be able to create as many or as few that is desired. Currently however, all of my time is spent developing the interface between CGDB and GDB. Once this is complete, the UI of CGDB will become much more polished. If you are a ncurses developer, and have spare time to work on this task, please contact me. @menu * Source Window:: Understanding the source window. * GDB Window:: Understanding the GDB window. * File Dialog Window:: Understanding the file dialog window. * TTY Window:: Understanding the TTY window. * Status Bar:: Understanding the status bar. * Switching Windows:: Switching between windows. @end menu @node Source Window @section Understanding the source window. @cindex source window The @dfn{source window} is the window that provides you a view of the source code that the debugged program is made up of. It will display to the user a single source file at a time. While the user is debugging, via @code{next} and @code{step}, CGDB will update the source file and line number to keep you informed as to where GDB is debugging. CGDB has several features that make debugging easier than using plain old GDB. One feature you will notice right away while debugging a C, C++ or ADA program, is that the source files are syntax highlighted. This allows the user to easily navigate through the source file to look for certain places in the source code. If you would like to see another source language highlighted, contact us. To understanding how to navigate through the source window look at the commands in @ref{CGDB Mode}. In addition to showing the source code, CGDB also displays to the user the currently executing line. The line number will be highlighted green, to represent that the particular line, is the current line being debugged by GDB. Also, CGDB will display an arrow extending from the line number, to the source line. You can configure what type of arrow CGDB uses with the @code{:set arrowstyle} configuration option. By default, the @code{short} arrow is used. However, my personal favorite is the @code{long} arrow. As you navigate through the source window, the current line the cursor is on will be highlighted white. This simply helps you keep track of where you are in the file. Also, you can set or delete breakpoints in CGDB from the source window. Simply navigate to the line that you are interested in setting a breakpoint, and hit the space bar. This will set a breakpoint on the line if one did not already exist. The line number should turn red to indicate that a breakpoint has been set. Hitting the space bar again will delete the breakpoint. If you disable the breakpoint, the line number will turn yellow, to represent the disabled breakpoint. @cindex regular expression search CGDB also supports regular expression searching within the source window. If you type @kbd{/} or @kbd{?} you can search in the source window for a string of interest. The C library regular expression functions are used to perform this search, which honors things like @samp{*} or @samp{+}. The full list of commands that are available in the source window is in @ref{CGDB Mode}. @node GDB Window @section Understanding the GDB window. @cindex GDB window @cindex GDB window The @dfn{GDB window} is how CGDB allows the user to interface with the GNU debugger. If you wish to pass a command to GDB, simply type it into this window and GDB will receive the command. This interface is intended to be 100% identical to using GDB on a terminal. There is a limited set of keys that can be typed into this window that CGDB interprets and handles, instead of sending to GDB. They are all available in @ref{GDB Mode}. CGDB attempts to buffer commands the same way they would be if you typed them at the terminal. So, if you type several commands before a single one finishes, they will each be run in order. There will be no way to stop these commands from being run besides from typing @kbd{Ctrl-C}, like you would at any normal terminal when working with GDB. @node File Dialog Window @section Understanding the file dialog window. @cindex file dialog window @cindex file dialog window The @dfn{file dialog window} is available to help the user view and select which file they would like to view. It provides the user with a list of all the files that make up the program being debugged. If there are no files available, because there is no program being debugged or because there is no debug symbols, then the file dialog will not open and a message will be displayed at the status bar. You can get to the file dialog by hitting @code{o} when you are at the source window. Once you enter the file dialog, it is possible to leave it by hitting @code{q}. You can navigate the file dialog using the standard direction keys and you can even use regular expression to find your file. This can save a lot of time as the number of files grow. The full list of commands that are available in the source window is in @ref{File Dialog Mode}. @node TTY Window @section Understanding the TTY window. @cindex tty window @cindex TTY window The @dfn{TTY window} is available to allow the user to pass input to the program being debugged. This window will act similar to the GDB window, except that the data you type will get sent to the program being debugged. @xref{Sending I/O to Inferior}. You will notice that the TTY window has a terminal device between it and the program being debugged. So, if the program being debugged uses say readline, which allows command line editing, the same interface will be provided via the TTY window as at the terminal. You can see the name of the terminal device in the TTY status bar. The full list of commands that are available in the source window is in @ref{TTY Mode}. Sending I/O to the program being debugged can be confusing. It is described better in @ref{Sending I/O to Inferior}. Unless the I/O with the program being debugged is simple, I usually prefer starting the application on a separate terminal and attaching to it with CGDB. @node Status Bar @section Understanding the status bar. @cindex status bar @cindex status bar The @dfn{status bar} is the general purpose way for CGDB to show the user which commands they are currently typing or report errors to the user when they occur. CGDB does not use popup's or other forms of I/O to alert the user of information or problems. While CGDB is running, you can configure it with any of the commands that are valid in CGDB's configuration file. Simply type @kbd{:} in the source window, and you will see the colon, and the rest of the command you type appear in the status bar. When you are finished typing the command that you are interested in, type @code{enter}. This will alert CGDB to execute the command. If at any point you would like to cancel the current command typed so far, type the cgdb mode key. This will put you back into CGDB mode. For a description of the cgdb mode key, see @ref{Switching Windows}. The full list of commands that are available in the source window is in @ref{Configuring CGDB}. @node Switching Windows @section Switch between windows @cindex switch between windows When CGDB is invoked, the interface is in @dfn{GDB mode}. A @samp{*} at the right of the status bar indicates that input will be passed to GDB. To change the focus to the source window, hit the @key{ESC} key. The @dfn{cgdb mode key} is the key that is responsible for switching the user into @dfn{CGDB mode} from a different mode. The cgdb mode key is defaulted to the @key{ESC} key. To change this value, look at the configuration options for CGDB. @xref{Configuring CGDB}. The interface is now in @dfn{CGDB mode}. To switch back into @dfn{GDB mode}, press @kbd{i}. This syntax is based on the popular Unix text-editor, vi. @node Controlling CGDB @chapter CGDB commands @cindex controlling CGDB CGDB can be controlled in a variety of different ways. Each mode that CGDB is in acts differently. Currently CGDB implicitly changes modes depending on which window is active. The following information will help you determine what commands are accessible during which modes. @menu * CGDB Mode:: Commands available during CGDB mode * GDB Mode:: Commands available during GDB mode * File Dialog Mode:: Commands available during the file dialog mode * TTY Mode:: Commands available during TTY mode @end menu @node CGDB Mode @section Commands available during CGDB mode @cindex commands, in CGDB mode When you are in the source window, you are implicitly in @dfn{CGDB mode}. All of the below commands are available during this mode. This mode is primarily available for the user to view the current source file, search it, or switch to a different mode. @table @kbd @item cgdbmodekey Puts the user into command mode. However, you are already in this mode. This is defaulted to the @key{ESC} key. @item i Puts the user into @dfn{GDB mode}. @item I Puts the user into @dfn{TTY mode}. @item T Opens a window to give input to the debugged program. @item Ctrl-T Opens a new tty for the debugged program. @item k @itemx up arrow Move up a line. @item j @itemx down arrow Move down a line. @item h @itemx left arrow Move left a line. @item l @itemx right arrow Move right a line. @item Ctrl-b @itemx page up Move up a page. @item Ctrl-u Move up 1/2 a page. @item Ctrl-f @itemx page down Move down a page. @item Ctrl-d Move down 1/2 a page. @item gg Move to the top of file. @item G Move to the bottom of file. @item / search from current cursor position. @item ? reverse search from current cursor position. @item n next forward search. @item N next reverse search. @item o open the file dialog. @item spacebar Sets a breakpoint at the current line number. @item t Sets a temporary breakpoint at the current line number. @item - Shrink source window 1 line. @item = Grow source window 1 line. @item _ Shrink source window 25% (or, shrink tty window 1 line, if visible). @item + Grow source window 25% (or, grow tty window 1 line, if visible). @item Ctrl-l Clear and redraw the screen. @item F5 Send a run command to GDB. @item F6 Send a continue command to GDB. @item F7 Send a finish command to GDB. @item F8 Send a next command to GDB. @item F10 Send a step command to GDB. @end table @node GDB Mode @section Commands available during GDB mode @cindex commands, in GDB mode When in @dfn{GDB mode}, the user is mostly interested in working with the GDB console. That is, sending commands to GDB and receiving data back from GDB. Almost all data passed into this window is directly sent to readline and then to GDB. It is important to understand that CGDB parses the keys entered in the GDB window and has the first chance at dealing with them. If it is interested in the keys, it will handle them. Below is a list of keys that CGDB is interested in, and does not pass along any further. @table @kbd @item cgdbmodekey Switch back to source window. This is defaulted to the @key{ESC} key. @item page up Move up a page. @item page down Move down a page. @item F11 Go to the beginning of the GDB buffer. @item F12 Go to the end of the GDB buffer. @end table Any other keys, besides the ones above, CGDB is currently not interested in. CGDB will pass along these keys to the readline library. When readline has determined that a command has been received, it alerts CGDB, and a command is then sent to GDB. This is the same method used when invoking GDB directly. @node File Dialog Mode @section Commands available during the file dialog mode @cindex commands, in File Dialog mode The file dialog is primarily used to allow the user to find and open a source file that the program they are debugging is made up of. The file dialog will be full screen, and will list each file that the debugged program is made up of. A usual instance of the file dialog would be to open it up from the source window using the @kbd{o} key, and then to search for the file of interest. If you are looking for foo.c type @code{/foo.c}, press @kbd{enter} once to finish the regular expression and again to select the file. The commands available in the file dialog are: @table @kbd @item q Will exit the file dialog, and return to the source window. @item k @itemx up arrow Move up a line. @item j @itemx down arrow Move down a line. @item h @itemx left arrow Move left a line. @item l @itemx right arrow Move right a line. @item Ctrl-b @itemx page up Move up a page. @item Ctrl-f @itemx page down Move down a page. @item / search from current cursor position. @item ? reverse search from current cursor position. @item n next forward search. @item N next reverse search. @item enter Select the current file. @end table @node TTY Mode @section Commands available during TTY mode @cindex commands, in TTY mode @table @kbd @item cgdbmodekey Switch back to source window. This is defaulted to the @key{ESC} key. @item page up Move up a page. @item page down Move down a page. @item F11 Go to the beginning of the GDB buffer. @item F12 Go to the end of the GDB buffer. @end table @node Configuring CGDB @chapter CGDB configuration commands @cindex configuring CGDB There may be several features that you find useful in CGDB. CGDB is capable of automating any of these commands through the use of the config file called @file{cgdbrc}. It looks in @env{$HOME}@file{/.cgdb/} for that file. If it exists, CGDB executes each line in the file in order. It is as if the user typed in all the commands into the status bar after the tui was initialized. The following variables change the behavior of some aspect of CGDB. Many of these commands may be abbreviated in some way, and all boolean commands my be negated by appending @samp{no} to the front. For example: @kbd{:set ignorecase} turns on case-insensitive searching; while @kbd{:set noignorecase} turns on case-sensitive searching. @table @kbd @item :set as=@var{style} @itemx :set arrowstyle=@var{style} Set the arrow style to @var{style}. Possible values for @var{style} are @samp{short}, @samp{long}, and @samp{highlight}. Changes the style of the arrow that is used to indicate the currently executing line in the source viewer. The default value is short. A longer arrow is available, for easier readability. Finally, the @samp{highlight} option draws no arrow at all, instead drawing the entire line in inverse video. @item :set asr @itemx :set autosourcereload If this is on, CGDB will automatically reload a source file if it has changed since CGDB has opened it. If it is off, the file will never be reloaded, until you start CGDB again. The default is on. This feature is useful when you are debugging a program, then you modify a source file, recompile, and type @kbd{r} in GDB's CLI window. The file in this case will be updated to show the new version. Note, CGDB only looks at the timestamp of the source file to determine if it has changed. So if you modify the source file, and didn't recompile yet, CGDB will still pick up on the changes. @item :set cgdbmodekey=@var{key} This option is used to determine what key puts CGDB into @dfn{CGDB Mode}. By default, the @kbd{ESC} key is used. @var{key} can be any normal key on the keyboard. It can also be any keycode, as long as the keycode notation is used. This option is especially useful when the user wants to use readline in vi mode. If the user types @code{set cgdbmodekey=} then the @kbd{Page Up} key will put CGDB into CGDB mode and the @kbd{ESC} key will flow through to readline. @item :set ic @itemx :set ignorecase Sets searching case insensitive. The default is off. @item :set stc @itemx :set showtgdbcommands If this is on, CGDB will show all of the commands that it sends to GDB. If it is off, CGDB will not show the commands that it gives to GDB. The default is off. @item :set syn=@var{style} @itemx :set syntax=@var{style} Sets the current highlighting mode of the current file to have the syntax @var{style}. Possible values for @var{syntax} are @samp{c}, @samp{ada}, and @samp{off}. Normally, the user will never have to do this, since CGDB automatically detects what syntax a file should be based on its file extension. However, this feature can currently be useful for debugging purposes. @item :set to @itemx :set timeout This option is used along with the @var{ttimeout} option to determine the behavior CGDB should have when it receives part of a mapped key sequence or a keyboard code sequence. If this option is on, CGDB will time out on both user defined mappings and on key codes from the keyboard. If this option is off, user defined mappings will not be timed out on. In this case, CGDB will determine if it should time out on key codes from the keyboard by examining the @var{ttimeout} option. To determine how CGDB will time out on mappings and key codes, and what time out lengths CGDB will use, please refer to the chart in @ref{Key User Interface}. The default value for this option is on. @item :set tm=@var{delay} @itemx :set timeoutlen=@var{delay} This option is used along with the @var{ttimeoutlen} option. It represents the number of milliseconds that CGDB should wait for a key code from the keyboard or for a mapped key sequence to complete. If @var{delay} is 0, CGDB immediately accepts each character it receives. This will prevent any mappings or key codes to complete. @var{delay} may be any value between 0 and 10000, inclusive. The default setting for the @var{delay} variable is 1000 (one second). @item :set ttimeout This option is used along with the @var{timeout} option to determine the behavior CGDB should have when it receives part of keyboard code sequence. If this option is on, CGDB will time out on key codes from the keyboard. If this option is off, CGDB will determine if it should time out on key codes from the keyboard by examining the @var{timeout} option. To determine how CGDB will time out on key codes, what what time length it will use, please refer to the chart in @ref{Key User Interface}. The default value for this option is on. @item :set ttm=@var{delay} @itemx :set ttimeoutlen=@var{delay} This option is used along with the @var{ttimeoutlen} option. It represents the number of milliseconds that CGDB should wait for a key code from the keyboard. If @var{delay} is 0, CGDB immediately accepts each character it receives. This will prevent any key codes to complete. @var{delay} may be any value between 0 and 10000, inclusive. The default setting for the @var{delay} variable is 100 (one tenth of a second). @item :set ts=@var{number} @itemx :set tabstop=@var{number} Sets the number of spaces that should be rendered on the screen for @key{TAB} characters. The default value for @var{number} is 8. @item :set wmh=@var{number} @itemx :set winminheight=@var{number} The minimal height of a window. Windows will never become smaller than this value. The default value for @var{number} is 0. @item :set winsplit=@var{style} Set the split point between source and GDB window. This is especially useful as an init setting in your @file{cgdbrc} file. @xref{Configuring CGDB}. The possible values for @var{style} are @samp{top_full}, @samp{top_big}, @samp{even}, @samp{bottom_big}, and @samp{bottom_full}. @item :set ws @itemx :set wrapscan Searches wrap around the end of file. The default is on. @item :c @itemx :continue Send a continue command to GDB. @itemx :down Send a down command to GDB. @item :e @itemx :edit reloads the file in the source window. this can be useful if the file has changed since it was opened by cgdb. @item :f @itemx :finish Send a finish command to GDB. @item :help This will display the current manual in text format, in the @dfn{source window}. @item :hi @var{group} cterm=@var{attributes} ctermfg=@var{color} ctermbg=@var{color} term=@var{attributes} @itemx :highlight @var{group} cterm=@var{attributes} ctermfg=@var{color} ctermbg=@var{color} term=@var{attributes} Set the @var{color} and @var{attributes} for a highlighting group. The syntax mimics vim's ``highlight'' command. Possible values for @var{group}, @var{attributes} and @var{color} are available in @ref{Highlighting Groups}. You can give as many or as few of the name=value pairs as you wish, in any order. @samp{ctermfg} and @samp{ctermbg} set the foreground and background colors. These can be specified by color number or by using the same color names that vim uses. When CGDB is linked with ncurses, the number you use to represent the color can be between -1 and COLORS. When CGDB is linked against curses, it must be between 0 and COLORS. @samp{cterm} sets the video attributes for color terminals. @samp{term} sets the video attributes for monochrome terminals. Some examples are, @smallexample :highlight Logo cterm=bold,underline ctermfg=Red ctermbg=Black :highlight Normal cterm=reverse ctermfg=White ctermbg=Black :hi Normal term=bold @end smallexample @item :insert Move focus to the GDB window. @item :n @itemx :next Send a next command to GDB. @item :q @itemx :quit Quit CGDB. @item :r @itemx :run Send a run command to GDB. @item :start Send a start command to GDB. @item :k @itemx :kill Send a kill command to GDB. @item :s @itemx :step Send a step command to GDB. @item :syntax Turn the syntax on or off. @itemx :up Send an up command to GDB. @item :map @var{lhs} @var{rhs} Create a new mapping or overwrite an existing mapping in CGDB mode. After the command is run, if @var{lhs} is typed, CGDB will get @var{rhs} instead. For more details on how to use the map command look in @ref{Using Maps}. @item :unm @var{lhs} @item :unmap @var{lhs} Delete an existing mapping from CGDB mode. @var{lhs} is what was typed in the left hand side when the user created the mapping. For example, if the user typed @code{:map ab foo} then the user could delete the existing mapping with @code{:unmap ab}. @item :im @var{lhs} @var{rhs} @itemx :imap @var{lhs} @var{rhs} Create a new mapping or overwrite an existing mapping in GDB mode. After the command is run, if @var{lhs} is typed, CGDB will get @var{rhs} instead. For more details on how to use the map command look in @ref{Using Maps}. @item :iu @var{lhs} @item :iunmap @var{lhs} Delete an existing mapping from GDB mode. @var{lhs} is what was typed in the left hand side when the user created the mapping. For example, if the user typed @code{:imap ab foo} then the user could delete the existing mapping with @code{:iunmap ab}. @end table @node Highlighting Groups @chapter CGDB highlighting groups @cindex highlighting groups CGDB is capable of using colors if the terminal it is run in supports them. Until version 0.6.1, CGDB did not allow the user to configure these colors in any way. CGDB color use is now fully configurable. CGDB's modeled its use of color highlighting after vim. Any data that will be colored in the terminal is represented by a highlighting group. A @dfn{highlighting group} represents data that should be formatted using foreground colors, background colors and attributes. There are currently several types of highlighting groups in CGDB. There are syntax highlighting groups, which represent syntax highlighting of sources files. There are also User Interface groups, which represent things like CGDB's logo, or the status bar. Each highlighting group has a default set of attributes and colors associated with it. You can modify a highlighting groups properties by using the highlight command. @xref{Configuring CGDB}. Note that CGDB currently supports using the same background color the terminal was using before CGDB was started. However, this only works when CGDB was linked with ncurses. If you link CGDB with curses, then CGDB will force the background to Black. @menu * Available Highlighting Groups:: The different highlighting groups. * Available Attributes:: The different attributes. * Available Colors:: The different colors. @end menu @node Available Highlighting Groups @section The different highlighting groups @cindex highlighting groups Below is a list of all the highlighting groups that CDGB will use when syntax highlighting source files. @table @code @item Statement This represents the keywords a language defines. @item Type This represents the types a language defines. @item Constant This represents either a string or numeric value. @item Comment This represents the comments in a source file. @item PreProc This represents the C/C++ preprocessor commands. @item Normal This represents all normal text. @end table Below is a list of all the highlighting groups that CGDB will use when it is displaying it's User Interface. @table @code @item StatusLine This represents the @dfn{status bar} in CGDB. The file dialog's status bar also uses this group. @item IncSearch This represents the group used when the user is searching in either the source window, or the @dfn{file dialog window}. @item Arrow This represents the arrow that CGDB draws to point to the currently viewed line. @item LineHighlight This represents the group used when the user has the @code{arrowstyle} option set to @code{highlight}. @item Breakpoint This represents the group that is used when CGDB displays a line that has a breakpoint set. @item DisabledBreakpoint This represents the group that is used when CGDB displays a line that has a disabled breakpoint set. @item SelectedLineNr This represents the group that is used when CGDB is displaying the currently selected line. This is the line that the cursor is on. @item Logo This is the group CGDB uses to display its logo on startup when no source file can be auto detected. @end table @node Available Attributes @section The different attributes @cindex attributes CGDB supports many of the attributes that curses provides. It will apply the attributes to the output window, but it is up to the terminal you are using to support such features. The list of attributes that CGDB currently supports is below. @table @code @item normal @itemx NONE This will leave the text normal. Uses A_NORMAL curses attribute. @item bold This will make the text appear bold. Uses A_BOLD curses attribute. @item underline This will underline the text. Uses A_UNDERLINE curses attribute. @item reverse @itemx inverse This will reverse the foreground and background colors. Uses A_REVERSE curses attribute. @item standout This is the best highlighting mode of the terminal. Uses A_STANDOUT curses attribute. @item blink This will cause the text to blink. Uses A_BLINK curses attribute. @item dim This will cause the text to be 1/2 bright. Uses A_DIM curses attribute. @end table @node Available Colors @section The different colors @cindex colors CGDB supports several colors, depending on how many colors your terminal supports. Below is a chart of the colors that CGDB provides. The heading NR-16 is used to represent terminals that support at least 16 colors. The heading NR-8 is used to represent terminals that support at least 8 colors. The integer values for each color represent the values passed to the curses function init_pair() to ask curses to create a new color. @multitable @columnfractions .4 .2 .2 .2 @item @code{COLOR NAME} @tab @code{NR-16} @tab @code{NR-8} @tab @code{NR-8 bold attribute} @item Black @tab 0 @tab 0 @tab No @item DarkBlue @tab 1 @tab 4 @tab No @item DarkGreen @tab 2 @tab 2 @tab No @item DarkCyan @tab 3 @tab 6 @tab No @item DarkRed @tab 4 @tab 1 @tab No @item DarkMagenta @tab 5 @tab 5 @tab No @item Brown, DarkYellow @tab 6 @tab 3 @tab No @item LightGray, LightGrey, Gray, Grey @tab 7 @tab 7 @tab No @item DarkGray, DarkGrey @tab 8 @tab 0 @tab Yes @item Blue, LightBlue @tab 9 @tab 4 @tab Yes @item Green, LightGreen @tab 10 @tab 2 @tab Yes @item Cyan, LightCyan @tab 11 @tab 6 @tab Yes @item Red, LightRed @tab 12 @tab 1 @tab Yes @item Magenta, LightMagenta @tab 13 @tab 5 @tab Yes @item Yellow, LightYellow @tab 14 @tab 3 @tab Yes @item White @tab 15 @tab 7 @tab Yes @end multitable @node Key User Interface @chapter CGDB key user interface @cindex CGDB key user interface The Key User Interface is how CGDB receives input from the user. It is usually referred to as the @dfn{KUI}. CGDB simply asks the KUI for the next key the user typed and the KUI will provide it. The KUI has 2 major responsibilities besides reading normal user input and providing it to CGDB. It needs to detect when the user has typed a user defined map or when the user has hit a special key on the keyboard. A user defined map, or simply @dfn{map}, is used to change the meaning of typed keys. Some users may refer to this type of functionality as a @dfn{macro}. An example would be @code{map a b}. If the user then typed the @key{a} character, the KUI would detect that it was mapped to @key{b} and return @key{b} to CGDB. When the user types a special key on the keyboard, a @dfn{key code} is sent to CGDB. Typically, keys like @kbd{HOME}, @kbd{DEL}, @key{F1}, etc, when pressed will send several characters to the application instead of just one character like a normal key does. These characters combined are called a @dfn{key sequence}. The KUI is responsible for assembling the key sequences back together and reporting to CGDB that a particular key was typed by the user. The @kbd{ESC} key is special because typically most key codes start with that key. This usually gives all key codes a common first key in its key sequence. The KUI uses the terminfo database to determine what key sequences are sent by which keycodes. There are a few commonly used key sequences that are hard coded into CGDB. A major challenge the KUI has to overcome is determining when a map or a key sequence is received. The KUI sometimes will need to read more than one character to determine this. For example, if the user has 2 maps, @code{map abc def} and @code{map abd def}, the KUI would have to buffer at least the characters @key{a} and @key{b} before it could determine if the user was going to type a map. After the next key press, if the user types @key{c} or @key{d} then a map was received and the KUI will return @kbd{d e f} to CGDB. Otherwise, no map was received and the KUI must return @kbd{a b} to CGDB. The options @var{timeout}, @var{ttimeout}, @var{timeoutlen} and @var{ttimeoutlen} can be used to tell the KUI if it should timeout on partial mappings or key sequences, and if so, how long it should wait before timing out. @menu * Configuring the KUI Time Out Options:: The KUI's time out options * Using Maps:: Using maps * Understanding Keycodes:: Understanding keycodes @end menu @node Configuring the KUI Time Out Options @section The KUI's time out options @cindex timeout @cindex ttimeout @cindex timeoutlen @cindex ttimeoutlen The KUI may be configured to time out on either maps or key sequences. When the KUI is matching a partial map or key sequence it is capable of timing out. This means it will simply accepts the keys it has received so far if a certain amount of time elapses between key presses. This is obvious when the user is typing a map because the user must press each key individually. For partial key sequences, this is less obvious. That is because the user only presses a single key, but multiple characters are sent to CGDB. The table below describes how the user can configure the KUI to time out on key codes or maps. The @var{timeout} and @var{ttimeout} options control this functionality. @multitable @columnfractions .15 .15 .45 @headitem timeout @tab ttimeout @tab action @item off @tab off @tab do not time out @item on @tab on or off @tab time out on maps and key codes @item off @tab on @tab time out on key codes @end multitable It is also possible to tell the KUI how long to wait before timing out on a partial match. If @var{timeout} is on, then the KUI will wait a certain amount of time for the next character, when matching a map, before it decides a match is no longer possible. If @var{timeout} or @var{ttimeout} is on, then the KUI will wait a certain amount of time for the next character, when matching a key sequence, before it decides a match is no longer possible. The @var{timeoutlen} and @var{ttimeoutlen} options can be configured by the user to tell the KUI how long to wait before timing out. The table below describes when the KUI uses which option. @multitable @columnfractions .15 .2 .2 @headitem timeoutlen @tab mapping delay @tab key code delay @item < 0 @tab @var{timeoutlen} @tab @var{timeoutlen} @item >= 0 @tab @var{timeoutlen} @tab @var{ttimeoutlen} @end multitable A value of 0 means that the KUI will time out right away. It will not be possible to match a map or key code in this circumstance. A common problem could be that when the user types a special key like the left or right arrows, CGDB will go into the source mode and not perform the action requested by the user. This typically means that the key code delay is to small. If you try setting the option @code{set ttimeoutlen=1000} CGDB should start acting like the user expects. If not, please report this to the CGDB mailing list. @node Using Maps @section Using maps CGDB fully supports the use of maps. It allows the user to change the meaning of typed keys. For example, you could have the following map @code{:map ipargc}. When the user is in CGDB mode and they hit @key{F2}, the value of the map will be used instead. The @kbd{i} key will first be received by CGDB, and it will put the user into insert mode. Next, CGDB will get @kbd{p argc} followed by the @key{Enter} key. CGDB currently supports two mapping lists. Any mapping that was added with the @var{map} command will be used by CGDB when it is in CGDB mode. You can delete a mapping that you have created with the @var{map} command with the @var{unmap} command. If you want to have mappings in GDB mode, you can use the @var{imap} command. Similarly, @var{iunmap} will delete a mapping in the @var{imap} set. Some examples of this would be @example map ab foo unmap ab imap ab foo iunmap ab @end example @node Understanding Keycodes @section Understanding keycodes The above example could use a little more explaining for people unfamiliar with vim maps. The map takes a key and a value. They are separated by a space. Neither the key or value can have a space in them, or it is considered to be the separator between the key and value. If the user desires to have a space in either the key or value part of a map, they can use the keycode notation . Below is a table of the keycodes in @dfn{keycode notation} form. The keycode notation can be used in any mapping command. @multitable @columnfractions .15 .4 @headitem notation @tab meaning @item @tab escape key @item @tab cursor up key @item @tab cursor down key @item @tab cursor left key @item @tab cursor right key @item @tab home key @item @tab end key @item @tab page up key @item @tab page down key @item @tab delete key @item @tab insert key @item @tab zero @item @tab backspace key @item @tab tab key @item @tab linefeed @item @tab formfeed @item @tab carriage return @item @tab space @item @tab less-than @item @tab backslash @item @tab vertical bar @item - @tab function keys 1 to 12 @item @tab control keys @item @tab shift keys @end multitable @node Sending I/O to Inferior @chapter Sending I/O to the program being debugged @cindex sending I/O to inferior If the program being debugged takes input on the terminal it is recommended that the user start the program on one terminal, and attach to it with CGDB from another terminal. This is the easiest way to pass input to the debugged program. However, if the user wishes to pass input to the program being debugged from within CGDB, there is a mechanism available for doing so. As of this writing, the technique described below does not work on windows, using a natively compiled GDB. It may work when using the GDB that comes with Cygwin. This technique is similar to getting in and out of @dfn{GDB mode}. The tty window is not visible by default. This is because it is only needed if the user wishes to send data to the program being debugged. To display the tty window, hit @kbd{T} while in command mode. After hitting @kbd{T} you will notice that there is another window in the middle of the @dfn{source window} and the @dfn{gdb window}. This is called the @dfn{tty window}. You will also see a new status bar called the tty status bar. There will be a @samp{*} on the tty status bar after the @kbd{T} was hit. This is because when the window is opened with the @kbd{T} command, CGDB automatically puts the user into @dfn{TTY mode}. To get out of this window hit the cgdb mode key. This will put you back into command mode. To make the tty window appear and disappear hit the @kbd{T} key while in command mode. It is a toggle. Once the tty window is already open, the user can then hit @kbd{I} in command mode to get into @dfn{TTY mode}. The user can then hit the cgdb mode key in the @dfn{TTY mode} to get back into command mode. When the tty window is open, all data that comes from the program, goes there. Any data typed into the tty window will ONLY go to the program being debugged. It will not go to GDB. When the tty window is closed, all output from the debugged program will go to the @dfn{GDB window} AND to the @dfn{tty window} (for viewing later when the tty window is opened). If the user wishes to get a new tty for the program being debugged then they can type @kbd{Ctrl-T}. This will delete all the buffered data waiting to be read into the debugged program. This might be useful when you rerun or start a new program. @node Terminal Control Flow @chapter Allowing terminal control flow in CGDB @cindex terminal control flow A user can typically set there control flow behavior by using the stty command like so @code{stty -ixon -ixoff}. This will disable control flow on the terminal where CGDB is started. If you want to turn control flow back on you can type @code{stty ixon ixoff}. If flow control is on, when the user types @kbd{Ctrl-s}, the terminal stops. When the user types @kbd{Ctrl-q}, the terminal restarts. When using readline, the @kbd{Ctrl-s} character usually does a forward search. So, if you want to get this, or other functionality out of readline, simply turn off control flow and start CGDB. @node Building CGDB @chapter Building CGDB from source @cindex building CGDB Building CGDB from source requires several packages. First, CGDB is hosted at http://sf.net/projects/cgdb. You can determine how to get CGDB from source by looking here: http://sourceforge.net/svn/?group_id=72581. Once you have the source to CGDB, now you can begin to build it. You will of course need many packages to build CGDB. Below is a list of all of them that are required to build CGDB. @table @code @item GNU Make I have successfully used version 3.79.1, however, older versions probably will work. @item GNU GCC The GNU C compiler. I've compiled CGDB with versions as old as 2.9.5, and as new as 4.0.2. @item GNU Readline The GNU readline library version 5.1. CGDB will not work with versions before 5.1. Readline was modified specifically to work with CGDB. @item GNU Ncurses I have successfully used libncurses.so.5 successfully. However, older versions probably will work. @end table Below is a list of optional packages you will need, if modifying certain files in CGDB. @table @code @item GNU Flex If you modify any files with an extension of @code{.l}, you will have to have flex installed. I have used flex 2.5.4 to build CGDB. @item GNU Texinfo If you modify @file{doc/cgdb.texinfo}, then you will be required to have this package installed. I have used version 4.7 to build the documentation for CGDB. @item help2man If you are doing a release, then you will be required to have this package installed. In the @file{doc/} build directory, you can execute the command @code{make cgdb.1}, and the CGDB man page will be generated. @end table CGDB uses autoconf/automake to build its configure scripts and makefiles. So, if you change any of the autoconf/automake files, you will need this software installed. @table @code @item GNU Automake This has the program aclocal, and must be version Version 1.9.5. @item GNU Autoconf This has the program autoconf, and must be version 2.59. @item GNU m4 This has the program m4, and must be version 1.4.3. @end table @node Copying This Manual @appendix Copying This Manual @c @menu @c * GNU General Public License:: License for copying this manual. @c @end menu @include gpl.texi @node Index @unnumbered Index @printindex cp @bye cgdb-0.6.7/doc/cgdb.txt000644 000765 000024 00000175021 12074766276 015644 0ustar00mmuellerstaff000000 000000 Table of Contents ***************** CGDB Summary of CGDB 1 Getting In and Out of CGDB 2 Understanding the core concepts of CGDB 2.1 Understanding the source window. 2.2 Understanding the GDB window. 2.3 Understanding the file dialog window. 2.4 Understanding the TTY window. 2.5 Understanding the status bar. 2.6 Switch between windows 3 CGDB commands 3.1 Commands available during CGDB mode 3.2 Commands available during GDB mode 3.3 Commands available during the file dialog mode 3.4 Commands available during TTY mode 4 CGDB configuration commands 5 CGDB highlighting groups 5.1 The different highlighting groups 5.2 The different attributes 5.3 The different colors 6 CGDB key user interface 6.1 The KUI's time out options 6.2 Using maps 6.3 Understanding keycodes 7 Sending I/O to the program being debugged 8 Allowing terminal control flow in CGDB 9 Building CGDB from source Appendix A Copying This Manual Index CGDB **** This manual is for GNU CGDB (version 0.6.7, 14 January 2013), the GNU ncurses based front end to GDB. Copyright (C) 2013 CGDB Team This document is part of a free software program; 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 of the License, 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; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston MA 02111-1307 USA Summary of CGDB *************** CGDB is a curses-based interface to the GNU Debugger (GDB). The goal of CGDB is to be lightweight and responsive; not encumbered with unnecessary features. The interface is designed to deliver the familiar GDB text interface, with a split screen showing the source as it executes. The UI is modeled on the classic Unix text editor, vi. Those familiar with vi should feel right at home using CGDB. The library responsible for communicating with GDB is called Trivial GDB (tgdb, or more accurately, libtgdb). This abstraction allows the UI code to be independent of the debugger, as well as greatly simplifying its implementation. Those wanting to develop other interfaces to GDB are welcome to use libtgdb as the basis for their program. Many of the headaches of parsing GDB's output and annotations can be avoided by using it. Some features offered by CGDB are: * Syntax-highlighted source window * Visual breakpoint setting * Keyboard shortcuts for common functions * Searching source window (using regexp) 1 Getting In and Out of CGDB **************************** This chapter discusses how to start CGDB, and how to get out of it. The essentials are: * type `cgdb' to start CGDB. * type `quit' or `C-d' in the GDB window to exit. * type `:quit' in the source window to exit. This even works if GDB is currently hanging, or operating a long command. 2 Understanding the core concepts of CGDB ***************************************** The CGDB user interface currently consists of two windows and a status bar. The source window is currently on the top and the GDB window is on the bottom. The "status bar" currently separates the two windows. The interface has several modes depending on which window is focused. "CGDB mode" is when the source window is focused, "GDB mode" is when the GDB window is focused and "TTY mode" is when the TTY window is focused. Beginning with CGDB version 1.0, the windows are movable, and the user will be able to create as many or as few that is desired. Currently however, all of my time is spent developing the interface between CGDB and GDB. Once this is complete, the UI of CGDB will become much more polished. If you are a ncurses developer, and have spare time to work on this task, please contact me. 2.1 Understanding the source window. ==================================== The "source window" is the window that provides you a view of the source code that the debugged program is made up of. It will display to the user a single source file at a time. While the user is debugging, via `next' and `step', CGDB will update the source file and line number to keep you informed as to where GDB is debugging. CGDB has several features that make debugging easier than using plain old GDB. One feature you will notice right away while debugging a C, C++ or ADA program, is that the source files are syntax highlighted. This allows the user to easily navigate through the source file to look for certain places in the source code. If you would like to see another source language highlighted, contact us. To understanding how to navigate through the source window look at the commands in *note CGDB Mode::. In addition to showing the source code, CGDB also displays to the user the currently executing line. The line number will be highlighted green, to represent that the particular line, is the current line being debugged by GDB. Also, CGDB will display an arrow extending from the line number, to the source line. You can configure what type of arrow CGDB uses with the `:set arrowstyle' configuration option. By default, the `short' arrow is used. However, my personal favorite is the `long' arrow. As you navigate through the source window, the current line the cursor is on will be highlighted white. This simply helps you keep track of where you are in the file. Also, you can set or delete breakpoints in CGDB from the source window. Simply navigate to the line that you are interested in setting a breakpoint, and hit the space bar. This will set a breakpoint on the line if one did not already exist. The line number should turn red to indicate that a breakpoint has been set. Hitting the space bar again will delete the breakpoint. If you disable the breakpoint, the line number will turn yellow, to represent the disabled breakpoint. CGDB also supports regular expression searching within the source window. If you type `/' or `?' you can search in the source window for a string of interest. The C library regular expression functions are used to perform this search, which honors things like `*' or `+'. The full list of commands that are available in the source window is in *note CGDB Mode::. 2.2 Understanding the GDB window. ================================= The "GDB window" is how CGDB allows the user to interface with the GNU debugger. If you wish to pass a command to GDB, simply type it into this window and GDB will receive the command. This interface is intended to be 100% identical to using GDB on a terminal. There is a limited set of keys that can be typed into this window that CGDB interprets and handles, instead of sending to GDB. They are all available in *note GDB Mode::. CGDB attempts to buffer commands the same way they would be if you typed them at the terminal. So, if you type several commands before a single one finishes, they will each be run in order. There will be no way to stop these commands from being run besides from typing `Ctrl-C', like you would at any normal terminal when working with GDB. 2.3 Understanding the file dialog window. ========================================= The "file dialog window" is available to help the user view and select which file they would like to view. It provides the user with a list of all the files that make up the program being debugged. If there are no files available, because there is no program being debugged or because there is no debug symbols, then the file dialog will not open and a message will be displayed at the status bar. You can get to the file dialog by hitting `o' when you are at the source window. Once you enter the file dialog, it is possible to leave it by hitting `q'. You can navigate the file dialog using the standard direction keys and you can even use regular expression to find your file. This can save a lot of time as the number of files grow. The full list of commands that are available in the source window is in *note File Dialog Mode::. 2.4 Understanding the TTY window. ================================= The "TTY window" is available to allow the user to pass input to the program being debugged. This window will act similar to the GDB window, except that the data you type will get sent to the program being debugged. *Note Sending I/O to Inferior::. You will notice that the TTY window has a terminal device between it and the program being debugged. So, if the program being debugged uses say readline, which allows command line editing, the same interface will be provided via the TTY window as at the terminal. You can see the name of the terminal device in the TTY status bar. The full list of commands that are available in the source window is in *note TTY Mode::. Sending I/O to the program being debugged can be confusing. It is described better in *note Sending I/O to Inferior::. Unless the I/O with the program being debugged is simple, I usually prefer starting the application on a separate terminal and attaching to it with CGDB. 2.5 Understanding the status bar. ================================= The "status bar" is the general purpose way for CGDB to show the user which commands they are currently typing or report errors to the user when they occur. CGDB does not use popup's or other forms of I/O to alert the user of information or problems. While CGDB is running, you can configure it with any of the commands that are valid in CGDB's configuration file. Simply type `:' in the source window, and you will see the colon, and the rest of the command you type appear in the status bar. When you are finished typing the command that you are interested in, type `enter'. This will alert CGDB to execute the command. If at any point you would like to cancel the current command typed so far, type the cgdb mode key. This will put you back into CGDB mode. For a description of the cgdb mode key, see *note Switching Windows::. The full list of commands that are available in the source window is in *note Configuring CGDB::. 2.6 Switch between windows ========================== When CGDB is invoked, the interface is in "GDB mode". A `*' at the right of the status bar indicates that input will be passed to GDB. To change the focus to the source window, hit the key. The "cgdb mode key" is the key that is responsible for switching the user into "CGDB mode" from a different mode. The cgdb mode key is defaulted to the key. To change this value, look at the configuration options for CGDB. *Note Configuring CGDB::. The interface is now in "CGDB mode". To switch back into "GDB mode", press `i'. This syntax is based on the popular Unix text-editor, vi. 3 CGDB commands *************** CGDB can be controlled in a variety of different ways. Each mode that CGDB is in acts differently. Currently CGDB implicitly changes modes depending on which window is active. The following information will help you determine what commands are accessible during which modes. 3.1 Commands available during CGDB mode ======================================= When you are in the source window, you are implicitly in "CGDB mode". All of the below commands are available during this mode. This mode is primarily available for the user to view the current source file, search it, or switch to a different mode. `cgdbmodekey' Puts the user into command mode. However, you are already in this mode. This is defaulted to the key. `i' Puts the user into "GDB mode". `I' Puts the user into "TTY mode". `T' Opens a window to give input to the debugged program. `Ctrl-T' Opens a new tty for the debugged program. `k' `up arrow' Move up a line. `j' `down arrow' Move down a line. `h' `left arrow' Move left a line. `l' `right arrow' Move right a line. `Ctrl-b' `page up' Move up a page. `Ctrl-u' Move up 1/2 a page. `Ctrl-f' `page down' Move down a page. `Ctrl-d' Move down 1/2 a page. `gg' Move to the top of file. `G' Move to the bottom of file. `/' search from current cursor position. `?' reverse search from current cursor position. `n' next forward search. `N' next reverse search. `o' open the file dialog. `spacebar' Sets a breakpoint at the current line number. `t' Sets a temporary breakpoint at the current line number. `-' Shrink source window 1 line. `=' Grow source window 1 line. `_' Shrink source window 25% (or, shrink tty window 1 line, if visible). `+' Grow source window 25% (or, grow tty window 1 line, if visible). `Ctrl-l' Clear and redraw the screen. `F5' Send a run command to GDB. `F6' Send a continue command to GDB. `F7' Send a finish command to GDB. `F8' Send a next command to GDB. `F10' Send a step command to GDB. 3.2 Commands available during GDB mode ====================================== When in "GDB mode", the user is mostly interested in working with the GDB console. That is, sending commands to GDB and receiving data back from GDB. Almost all data passed into this window is directly sent to readline and then to GDB. It is important to understand that CGDB parses the keys entered in the GDB window and has the first chance at dealing with them. If it is interested in the keys, it will handle them. Below is a list of keys that CGDB is interested in, and does not pass along any further. `cgdbmodekey' Switch back to source window. This is defaulted to the key. `page up' Move up a page. `page down' Move down a page. `F11' Go to the beginning of the GDB buffer. `F12' Go to the end of the GDB buffer. Any other keys, besides the ones above, CGDB is currently not interested in. CGDB will pass along these keys to the readline library. When readline has determined that a command has been received, it alerts CGDB, and a command is then sent to GDB. This is the same method used when invoking GDB directly. 3.3 Commands available during the file dialog mode ================================================== The file dialog is primarily used to allow the user to find and open a source file that the program they are debugging is made up of. The file dialog will be full screen, and will list each file that the debugged program is made up of. A usual instance of the file dialog would be to open it up from the source window using the `o' key, and then to search for the file of interest. If you are looking for foo.c type `/foo.c', press `enter' once to finish the regular expression and again to select the file. The commands available in the file dialog are: `q' Will exit the file dialog, and return to the source window. `k' `up arrow' Move up a line. `j' `down arrow' Move down a line. `h' `left arrow' Move left a line. `l' `right arrow' Move right a line. `Ctrl-b' `page up' Move up a page. `Ctrl-f' `page down' Move down a page. `/' search from current cursor position. `?' reverse search from current cursor position. `n' next forward search. `N' next reverse search. `enter' Select the current file. 3.4 Commands available during TTY mode ====================================== `cgdbmodekey' Switch back to source window. This is defaulted to the key. `page up' Move up a page. `page down' Move down a page. `F11' Go to the beginning of the GDB buffer. `F12' Go to the end of the GDB buffer. 4 CGDB configuration commands ***************************** There may be several features that you find useful in CGDB. CGDB is capable of automating any of these commands through the use of the config file called `cgdbrc'. It looks in `$HOME'`/.cgdb/' for that file. If it exists, CGDB executes each line in the file in order. It is as if the user typed in all the commands into the status bar after the tui was initialized. The following variables change the behavior of some aspect of CGDB. Many of these commands may be abbreviated in some way, and all boolean commands my be negated by appending `no' to the front. For example: `:set ignorecase' turns on case-insensitive searching; while `:set noignorecase' turns on case-sensitive searching. `:set as=STYLE' `:set arrowstyle=STYLE' Set the arrow style to STYLE. Possible values for STYLE are `short', `long', and `highlight'. Changes the style of the arrow that is used to indicate the currently executing line in the source viewer. The default value is short. A longer arrow is available, for easier readability. Finally, the `highlight' option draws no arrow at all, instead drawing the entire line in inverse video. `:set asr' `:set autosourcereload' If this is on, CGDB will automatically reload a source file if it has changed since CGDB has opened it. If it is off, the file will never be reloaded, until you start CGDB again. The default is on. This feature is useful when you are debugging a program, then you modify a source file, recompile, and type `r' in GDB's CLI window. The file in this case will be updated to show the new version. Note, CGDB only looks at the timestamp of the source file to determine if it has changed. So if you modify the source file, and didn't recompile yet, CGDB will still pick up on the changes. `:set cgdbmodekey=KEY' This option is used to determine what key puts CGDB into "CGDB Mode". By default, the `ESC' key is used. KEY can be any normal key on the keyboard. It can also be any keycode, as long as the keycode notation is used. This option is especially useful when the user wants to use readline in vi mode. If the user types `set cgdbmodekey=' then the `Page Up' key will put CGDB into CGDB mode and the `ESC' key will flow through to readline. `:set ic' `:set ignorecase' Sets searching case insensitive. The default is off. `:set stc' `:set showtgdbcommands' If this is on, CGDB will show all of the commands that it sends to GDB. If it is off, CGDB will not show the commands that it gives to GDB. The default is off. `:set syn=STYLE' `:set syntax=STYLE' Sets the current highlighting mode of the current file to have the syntax STYLE. Possible values for SYNTAX are `c', `ada', and `off'. Normally, the user will never have to do this, since CGDB automatically detects what syntax a file should be based on its file extension. However, this feature can currently be useful for debugging purposes. `:set to' `:set timeout' This option is used along with the TTIMEOUT option to determine the behavior CGDB should have when it receives part of a mapped key sequence or a keyboard code sequence. If this option is on, CGDB will time out on both user defined mappings and on key codes from the keyboard. If this option is off, user defined mappings will not be timed out on. In this case, CGDB will determine if it should time out on key codes from the keyboard by examining the TTIMEOUT option. To determine how CGDB will time out on mappings and key codes, and what time out lengths CGDB will use, please refer to the chart in *note Key User Interface::. The default value for this option is on. `:set tm=DELAY' `:set timeoutlen=DELAY' This option is used along with the TTIMEOUTLEN option. It represents the number of milliseconds that CGDB should wait for a key code from the keyboard or for a mapped key sequence to complete. If DELAY is 0, CGDB immediately accepts each character it receives. This will prevent any mappings or key codes to complete. DELAY may be any value between 0 and 10000, inclusive. The default setting for the DELAY variable is 1000 (one second). `:set ttimeout' This option is used along with the TIMEOUT option to determine the behavior CGDB should have when it receives part of keyboard code sequence. If this option is on, CGDB will time out on key codes from the keyboard. If this option is off, CGDB will determine if it should time out on key codes from the keyboard by examining the TIMEOUT option. To determine how CGDB will time out on key codes, what what time length it will use, please refer to the chart in *note Key User Interface::. The default value for this option is on. `:set ttm=DELAY' `:set ttimeoutlen=DELAY' This option is used along with the TTIMEOUTLEN option. It represents the number of milliseconds that CGDB should wait for a key code from the keyboard. If DELAY is 0, CGDB immediately accepts each character it receives. This will prevent any key codes to complete. DELAY may be any value between 0 and 10000, inclusive. The default setting for the DELAY variable is 100 (one tenth of a second). `:set ts=NUMBER' `:set tabstop=NUMBER' Sets the number of spaces that should be rendered on the screen for characters. The default value for NUMBER is 8. `:set wmh=NUMBER' `:set winminheight=NUMBER' The minimal height of a window. Windows will never become smaller than this value. The default value for NUMBER is 0. `:set winsplit=STYLE' Set the split point between source and GDB window. This is especially useful as an init setting in your `cgdbrc' file. *Note Configuring CGDB::. The possible values for STYLE are `top_full', `top_big', `even', `bottom_big', and `bottom_full'. `:set ws' `:set wrapscan' Searches wrap around the end of file. The default is on. `:c' `:continue' Send a continue command to GDB. `:down' Send a down command to GDB. `:e' `:edit' reloads the file in the source window. this can be useful if the file has changed since it was opened by cgdb. `:f' `:finish' Send a finish command to GDB. `:help' This will display the current manual in text format, in the "source window". `:hi GROUP cterm=ATTRIBUTES ctermfg=COLOR ctermbg=COLOR term=ATTRIBUTES' `:highlight GROUP cterm=ATTRIBUTES ctermfg=COLOR ctermbg=COLOR term=ATTRIBUTES' Set the COLOR and ATTRIBUTES for a highlighting group. The syntax mimics vim's "highlight" command. Possible values for GROUP, ATTRIBUTES and COLOR are available in *note Highlighting Groups::. You can give as many or as few of the name=value pairs as you wish, in any order. `ctermfg' and `ctermbg' set the foreground and background colors. These can be specified by color number or by using the same color names that vim uses. When CGDB is linked with ncurses, the number you use to represent the color can be between -1 and COLORS. When CGDB is linked against curses, it must be between 0 and COLORS. `cterm' sets the video attributes for color terminals. `term' sets the video attributes for monochrome terminals. Some examples are, :highlight Logo cterm=bold,underline ctermfg=Red ctermbg=Black :highlight Normal cterm=reverse ctermfg=White ctermbg=Black :hi Normal term=bold `:insert' Move focus to the GDB window. `:n' `:next' Send a next command to GDB. `:q' `:quit' Quit CGDB. `:r' `:run' Send a run command to GDB. `:start' Send a start command to GDB. `:k' `:kill' Send a kill command to GDB. `:s' `:step' Send a step command to GDB. `:syntax' Turn the syntax on or off. `:up' Send an up command to GDB. `:map LHS RHS' Create a new mapping or overwrite an existing mapping in CGDB mode. After the command is run, if LHS is typed, CGDB will get RHS instead. For more details on how to use the map command look in *note Using Maps::. `:unm LHS' `:unmap LHS' Delete an existing mapping from CGDB mode. LHS is what was typed in the left hand side when the user created the mapping. For example, if the user typed `:map ab foo' then the user could delete the existing mapping with `:unmap ab'. `:im LHS RHS' `:imap LHS RHS' Create a new mapping or overwrite an existing mapping in GDB mode. After the command is run, if LHS is typed, CGDB will get RHS instead. For more details on how to use the map command look in *note Using Maps::. `:iu LHS' `:iunmap LHS' Delete an existing mapping from GDB mode. LHS is what was typed in the left hand side when the user created the mapping. For example, if the user typed `:imap ab foo' then the user could delete the existing mapping with `:iunmap ab'. 5 CGDB highlighting groups ************************** CGDB is capable of using colors if the terminal it is run in supports them. Until version 0.6.1, CGDB did not allow the user to configure these colors in any way. CGDB color use is now fully configurable. CGDB's modeled its use of color highlighting after vim. Any data that will be colored in the terminal is represented by a highlighting group. A "highlighting group" represents data that should be formatted using foreground colors, background colors and attributes. There are currently several types of highlighting groups in CGDB. There are syntax highlighting groups, which represent syntax highlighting of sources files. There are also User Interface groups, which represent things like CGDB's logo, or the status bar. Each highlighting group has a default set of attributes and colors associated with it. You can modify a highlighting groups properties by using the highlight command. *Note Configuring CGDB::. Note that CGDB currently supports using the same background color the terminal was using before CGDB was started. However, this only works when CGDB was linked with ncurses. If you link CGDB with curses, then CGDB will force the background to Black. 5.1 The different highlighting groups ===================================== Below is a list of all the highlighting groups that CDGB will use when syntax highlighting source files. `Statement' This represents the keywords a language defines. `Type' This represents the types a language defines. `Constant' This represents either a string or numeric value. `Comment' This represents the comments in a source file. `PreProc' This represents the C/C++ preprocessor commands. `Normal' This represents all normal text. Below is a list of all the highlighting groups that CGDB will use when it is displaying it's User Interface. `StatusLine' This represents the "status bar" in CGDB. The file dialog's status bar also uses this group. `IncSearch' This represents the group used when the user is searching in either the source window, or the "file dialog window". `Arrow' This represents the arrow that CGDB draws to point to the currently viewed line. `LineHighlight' This represents the group used when the user has the `arrowstyle' option set to `highlight'. `Breakpoint' This represents the group that is used when CGDB displays a line that has a breakpoint set. `DisabledBreakpoint' This represents the group that is used when CGDB displays a line that has a disabled breakpoint set. `SelectedLineNr' This represents the group that is used when CGDB is displaying the currently selected line. This is the line that the cursor is on. `Logo' This is the group CGDB uses to display its logo on startup when no source file can be auto detected. 5.2 The different attributes ============================ CGDB supports many of the attributes that curses provides. It will apply the attributes to the output window, but it is up to the terminal you are using to support such features. The list of attributes that CGDB currently supports is below. `normal' `NONE' This will leave the text normal. Uses A_NORMAL curses attribute. `bold' This will make the text appear bold. Uses A_BOLD curses attribute. `underline' This will underline the text. Uses A_UNDERLINE curses attribute. `reverse' `inverse' This will reverse the foreground and background colors. Uses A_REVERSE curses attribute. `standout' This is the best highlighting mode of the terminal. Uses A_STANDOUT curses attribute. `blink' This will cause the text to blink. Uses A_BLINK curses attribute. `dim' This will cause the text to be 1/2 bright. Uses A_DIM curses attribute. 5.3 The different colors ======================== CGDB supports several colors, depending on how many colors your terminal supports. Below is a chart of the colors that CGDB provides. The heading NR-16 is used to represent terminals that support at least 16 colors. The heading NR-8 is used to represent terminals that support at least 8 colors. The integer values for each color represent the values passed to the curses function init_pair() to ask curses to create a new color. `COLOR NAME' `NR-16' `NR-8' `NR-8 bold attribute' Black 0 0 No DarkBlue 1 4 No DarkGreen 2 2 No DarkCyan 3 6 No DarkRed 4 1 No DarkMagenta 5 5 No Brown, DarkYellow 6 3 No LightGray, LightGrey, Gray, 7 7 No Grey DarkGray, DarkGrey 8 0 Yes Blue, LightBlue 9 4 Yes Green, LightGreen 10 2 Yes Cyan, LightCyan 11 6 Yes Red, LightRed 12 1 Yes Magenta, LightMagenta 13 5 Yes Yellow, LightYellow 14 3 Yes White 15 7 Yes 6 CGDB key user interface ************************* The Key User Interface is how CGDB receives input from the user. It is usually referred to as the "KUI". CGDB simply asks the KUI for the next key the user typed and the KUI will provide it. The KUI has 2 major responsibilities besides reading normal user input and providing it to CGDB. It needs to detect when the user has typed a user defined map or when the user has hit a special key on the keyboard. A user defined map, or simply "map", is used to change the meaning of typed keys. Some users may refer to this type of functionality as a "macro". An example would be `map a b'. If the user then typed the character, the KUI would detect that it was mapped to and return to CGDB. When the user types a special key on the keyboard, a "key code" is sent to CGDB. Typically, keys like `HOME', `DEL', , etc, when pressed will send several characters to the application instead of just one character like a normal key does. These characters combined are called a "key sequence". The KUI is responsible for assembling the key sequences back together and reporting to CGDB that a particular key was typed by the user. The `ESC' key is special because typically most key codes start with that key. This usually gives all key codes a common first key in its key sequence. The KUI uses the terminfo database to determine what key sequences are sent by which keycodes. There are a few commonly used key sequences that are hard coded into CGDB. A major challenge the KUI has to overcome is determining when a map or a key sequence is received. The KUI sometimes will need to read more than one character to determine this. For example, if the user has 2 maps, `map abc def' and `map abd def', the KUI would have to buffer at least the characters and before it could determine if the user was going to type a map. After the next key press, if the user types or then a map was received and the KUI will return `d e f' to CGDB. Otherwise, no map was received and the KUI must return `a b' to CGDB. The options TIMEOUT, TTIMEOUT, TIMEOUTLEN and TTIMEOUTLEN can be used to tell the KUI if it should timeout on partial mappings or key sequences, and if so, how long it should wait before timing out. 6.1 The KUI's time out options ============================== The KUI may be configured to time out on either maps or key sequences. When the KUI is matching a partial map or key sequence it is capable of timing out. This means it will simply accepts the keys it has received so far if a certain amount of time elapses between key presses. This is obvious when the user is typing a map because the user must press each key individually. For partial key sequences, this is less obvious. That is because the user only presses a single key, but multiple characters are sent to CGDB. The table below describes how the user can configure the KUI to time out on key codes or maps. The TIMEOUT and TTIMEOUT options control this functionality. timeout ttimeout action --------------------------------------------------------- off off do not time out on on or off time out on maps and key codes off on time out on key codes It is also possible to tell the KUI how long to wait before timing out on a partial match. If TIMEOUT is on, then the KUI will wait a certain amount of time for the next character, when matching a map, before it decides a match is no longer possible. If TIMEOUT or TTIMEOUT is on, then the KUI will wait a certain amount of time for the next character, when matching a key sequence, before it decides a match is no longer possible. The TIMEOUTLEN and TTIMEOUTLEN options can be configured by the user to tell the KUI how long to wait before timing out. The table below describes when the KUI uses which option. timeoutlen mapping delay key code delay ------------------------------------------ < 0 TIMEOUTLEN TIMEOUTLEN >= 0 TIMEOUTLEN TTIMEOUTLEN A value of 0 means that the KUI will time out right away. It will not be possible to match a map or key code in this circumstance. A common problem could be that when the user types a special key like the left or right arrows, CGDB will go into the source mode and not perform the action requested by the user. This typically means that the key code delay is to small. If you try setting the option `set ttimeoutlen=1000' CGDB should start acting like the user expects. If not, please report this to the CGDB mailing list. 6.2 Using maps ============== CGDB fully supports the use of maps. It allows the user to change the meaning of typed keys. For example, you could have the following map `:map ipargc'. When the user is in CGDB mode and they hit , the value of the map will be used instead. The `i' key will first be received by CGDB, and it will put the user into insert mode. Next, CGDB will get `p argc' followed by the key. CGDB currently supports two mapping lists. Any mapping that was added with the MAP command will be used by CGDB when it is in CGDB mode. You can delete a mapping that you have created with the MAP command with the UNMAP command. If you want to have mappings in GDB mode, you can use the IMAP command. Similarly, IUNMAP will delete a mapping in the IMAP set. Some examples of this would be map ab foo unmap ab imap ab foo iunmap ab 6.3 Understanding keycodes ========================== The above example could use a little more explaining for people unfamiliar with vim maps. The map takes a key and a value. They are separated by a space. Neither the key or value can have a space in them, or it is considered to be the separator between the key and value. If the user desires to have a space in either the key or value part of a map, they can use the keycode notation . Below is a table of the keycodes in "keycode notation" form. The keycode notation can be used in any mapping command. notation meaning ------------------------------------------ escape key cursor up key cursor down key cursor left key cursor right key home key end key page up key page down key delete key insert key zero backspace key tab key linefeed formfeed carriage return space less-than backslash vertical bar - function keys 1 to 12 control keys shift keys 7 Sending I/O to the program being debugged ******************************************* If the program being debugged takes input on the terminal it is recommended that the user start the program on one terminal, and attach to it with CGDB from another terminal. This is the easiest way to pass input to the debugged program. However, if the user wishes to pass input to the program being debugged from within CGDB, there is a mechanism available for doing so. As of this writing, the technique described below does not work on windows, using a natively compiled GDB. It may work when using the GDB that comes with Cygwin. This technique is similar to getting in and out of "GDB mode". The tty window is not visible by default. This is because it is only needed if the user wishes to send data to the program being debugged. To display the tty window, hit `T' while in command mode. After hitting `T' you will notice that there is another window in the middle of the "source window" and the "gdb window". This is called the "tty window". You will also see a new status bar called the tty status bar. There will be a `*' on the tty status bar after the `T' was hit. This is because when the window is opened with the `T' command, CGDB automatically puts the user into "TTY mode". To get out of this window hit the cgdb mode key. This will put you back into command mode. To make the tty window appear and disappear hit the `T' key while in command mode. It is a toggle. Once the tty window is already open, the user can then hit `I' in command mode to get into "TTY mode". The user can then hit the cgdb mode key in the "TTY mode" to get back into command mode. When the tty window is open, all data that comes from the program, goes there. Any data typed into the tty window will ONLY go to the program being debugged. It will not go to GDB. When the tty window is closed, all output from the debugged program will go to the "GDB window" AND to the "tty window" (for viewing later when the tty window is opened). If the user wishes to get a new tty for the program being debugged then they can type `Ctrl-T'. This will delete all the buffered data waiting to be read into the debugged program. This might be useful when you rerun or start a new program. 8 Allowing terminal control flow in CGDB **************************************** A user can typically set there control flow behavior by using the stty command like so `stty -ixon -ixoff'. This will disable control flow on the terminal where CGDB is started. If you want to turn control flow back on you can type `stty ixon ixoff'. If flow control is on, when the user types `Ctrl-s', the terminal stops. When the user types `Ctrl-q', the terminal restarts. When using readline, the `Ctrl-s' character usually does a forward search. So, if you want to get this, or other functionality out of readline, simply turn off control flow and start CGDB. 9 Building CGDB from source *************************** Building CGDB from source requires several packages. First, CGDB is hosted at http://sf.net/projects/cgdb. You can determine how to get CGDB from source by looking here: http://sourceforge.net/svn/?group_id=72581. Once you have the source to CGDB, now you can begin to build it. You will of course need many packages to build CGDB. Below is a list of all of them that are required to build CGDB. `GNU Make' I have successfully used version 3.79.1, however, older versions probably will work. `GNU GCC' The GNU C compiler. I've compiled CGDB with versions as old as 2.9.5, and as new as 4.0.2. `GNU Readline' The GNU readline library version 5.1. CGDB will not work with versions before 5.1. Readline was modified specifically to work with CGDB. `GNU Ncurses' I have successfully used libncurses.so.5 successfully. However, older versions probably will work. Below is a list of optional packages you will need, if modifying certain files in CGDB. `GNU Flex' If you modify any files with an extension of `.l', you will have to have flex installed. I have used flex 2.5.4 to build CGDB. `GNU Texinfo' If you modify `doc/cgdb.texinfo', then you will be required to have this package installed. I have used version 4.7 to build the documentation for CGDB. `help2man' If you are doing a release, then you will be required to have this package installed. In the `doc/' build directory, you can execute the command `make cgdb.1', and the CGDB man page will be generated. CGDB uses autoconf/automake to build its configure scripts and makefiles. So, if you change any of the autoconf/automake files, you will need this software installed. `GNU Automake' This has the program aclocal, and must be version Version 1.9.5. `GNU Autoconf' This has the program autoconf, and must be version 2.59. `GNU m4' This has the program m4, and must be version 1.4.3. Appendix A Copying This Manual ****************************** Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble ======== The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION =============================================================== 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a. You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b. You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c. If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a. Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b. Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c. Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs ======================================================= If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. ONE LINE TO GIVE THE PROGRAM'S NAME AND A BRIEF IDEA OF WHAT IT DOES. Copyright (C) YYYY NAME OF AUTHOR 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 of the License, 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; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) YEAR NAME OF AUTHOR Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. SIGNATURE OF TY COON, 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. Index ***** attributes: See 5.2. (line 808) building CGDB: See 9. (line 1085) CGDB key user interface: See 6. (line 874) CGDB mode: See 2. (line 105) colors: See 5.3. (line 843) commands, in CGDB mode: See 3.1. (line 273) commands, in File Dialog mode: See 3.3. (line 419) commands, in GDB mode: See 3.2. (line 385) commands, in TTY mode: See 3.4. (line 475) configuring CGDB: See 4. (line 493) controlling CGDB: See 3. (line 265) file dialog window: See 2.3. (line 189) GDB mode: See 2. (line 105) GDB window: See 2.2. (line 171) highlighting groups <1>: See 5. (line 724) highlighting groups: See 5.1. (line 749) invocation CGDB: See 1. (line 93) regular expression search: See 2.1. (line 160) sending I/O to inferior: See 7. (line 1028) source window: See 2.1. (line 124) status bar <1>: See 2.5. (line 230) status bar: See 2. (line 105) switch between windows: See 2.6. (line 251) terminal control flow: See 8. (line 1072) timeout: See 6.1. (line 918) timeoutlen: See 6.1. (line 918) ttimeout: See 6.1. (line 918) ttimeoutlen: See 6.1. (line 918) TTY mode: See 2. (line 105) tty window: See 2.4. (line 208) TTY window: See 2.4. (line 208) understanding CGDB: See 2. (line 105) cgdb-0.6.7/doc/._gpl.texi000644 000765 000024 00000000660 12074726001 016050 0ustar00mmuellerstaff000000 000000 Mac OS X  2~°ATTR°ÈèÈž%com.apple.metadata:kMDItemWhereFromsfJcom.apple.quarantinebplist00¢_5http://www.gnu.org/licenses/old-licenses/gpl-2.0.texi_5http://www.gnu.org/licenses/old-licenses/gpl-2.0.html C{q/0041;50f39922;Google\x20Chrome.app;415DF4C1-76E5-4AB3-8C75-54CE5BEA4AB4cgdb-0.6.7/doc/gpl.texi000644 000765 000024 00000043645 12074726001 015645 0ustar00mmuellerstaff000000 000000 @c The GNU General Public License. @center Version 2, June 1991 @c This file is intended to be included within another document, @c hence no sectioning command or @node. @display Copyright @copyright{} 1989, 1991 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @end display @heading Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software---to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. @heading TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION @enumerate 0 @item This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The ``Program'', below, refers to any such program or work, and a ``work based on the Program'' means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term ``modification''.) Each licensee is addressed as ``you''. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. @item You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. @item You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: @enumerate a @item You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. @item You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. @item If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) @end enumerate These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. @item You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: @enumerate a @item Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, @item Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, @item Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) @end enumerate The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. @item You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. @item You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. @item Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. @item If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. @item If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. @item The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and ``any later version'', you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. @item If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. @c @iftex @c @heading NO WARRANTY @c @end iftex @c @ifinfo @center NO WARRANTY @c @end ifinfo @item BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM ``AS IS'' WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. @item IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. @end enumerate @iftex @heading END OF TERMS AND CONDITIONS @end iftex @ifinfo @center END OF TERMS AND CONDITIONS @end ifinfo @page @heading Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the ``copyright'' line and a pointer to where the full notice is found. @smallexample @var{one line to give the program's name and a brief idea of what it does.} Copyright (C) @var{yyyy} @var{name of author} 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 of the License, 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; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @end smallexample Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: @smallexample Gnomovision version 69, Copyright (C) @var{year} @var{name of author} Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. @end smallexample The hypothetical commands @samp{show w} and @samp{show c} should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than @samp{show w} and @samp{show c}; they could even be mouse-clicks or menu items---whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a ``copyright disclaimer'' for the program, if necessary. Here is a sample; alter the names: @example Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. @var{signature of Ty Coon}, 1 April 1989 Ty Coon, President of Vice @end example This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. cgdb-0.6.7/doc/Makefile.am000644 000765 000024 00000001635 12074713144 016221 0ustar00mmuellerstaff000000 000000 info_TEXINFOS = cgdb.texinfo cgdb_TEXINFOS = gpl.texi dist_man_MANS = cgdb.1 EXTRA_DIST = cgdb.txt dist_pkgdata_DATA = cgdb.txt # generate the man page using help2man. cgdb.1: help2man --output=$(top_srcdir)/doc/cgdb.1 $(top_builddir)/cgdb/cgdb$(EXEEXT) cgdb.txt: cgdb.texinfo $(srcdir)/version.texi $(cgdb_TEXINFOS) TEXTS = cgdb.txt text-am: $(TEXTS) MAKEINFOTXT = $(MAKEINFO) --plaintext AM_MAKEINFOTXTFLAGS = $(AM_MAKEINFOFLAGS) .texinfo.txt: rm -rf $(@:.txt=.htp) if $(MAKEINFOTXT) $(AM_MAKEINFOTXTFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \ -o $(@:.txt=.htp) $<; \ then \ rm -rf $@; \ if test ! -d $(@:.txt=.htp) && test -d $(@:.txt=); then \ mv $(@:.txt=) $@; else mv $(@:.txt=.htp) $@; fi; \ else \ if test ! -d $(@:.txt=.htp) && test -d $(@:.txt=); then \ rm -rf $(@:.txt=); else rm -Rf $(@:.txt=.htp) $@; fi; \ exit 1; \ fi cgdb-0.6.7/doc/Makefile.in000644 000765 000024 00000064534 12074766253 016252 0ustar00mmuellerstaff000000 000000 # Makefile.in generated by automake 1.13.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = doc DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(cgdb_TEXINFOS) $(top_srcdir)/config/mdate-sh \ $(srcdir)/version.texi $(srcdir)/stamp-vti \ $(top_srcdir)/config/texinfo.tex $(dist_man_MANS) \ $(dist_pkgdata_DATA) ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/config/readline_check_version.m4 \ $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = AM_V_DVIPS = $(am__v_DVIPS_@AM_V@) am__v_DVIPS_ = $(am__v_DVIPS_@AM_DEFAULT_V@) am__v_DVIPS_0 = @echo " DVIPS " $@; am__v_DVIPS_1 = AM_V_MAKEINFO = $(am__v_MAKEINFO_@AM_V@) am__v_MAKEINFO_ = $(am__v_MAKEINFO_@AM_DEFAULT_V@) am__v_MAKEINFO_0 = @echo " MAKEINFO" $@; am__v_MAKEINFO_1 = AM_V_INFOHTML = $(am__v_INFOHTML_@AM_V@) am__v_INFOHTML_ = $(am__v_INFOHTML_@AM_DEFAULT_V@) am__v_INFOHTML_0 = @echo " INFOHTML" $@; am__v_INFOHTML_1 = AM_V_TEXI2DVI = $(am__v_TEXI2DVI_@AM_V@) am__v_TEXI2DVI_ = $(am__v_TEXI2DVI_@AM_DEFAULT_V@) am__v_TEXI2DVI_0 = @echo " TEXI2DVI" $@; am__v_TEXI2DVI_1 = AM_V_TEXI2PDF = $(am__v_TEXI2PDF_@AM_V@) am__v_TEXI2PDF_ = $(am__v_TEXI2PDF_@AM_DEFAULT_V@) am__v_TEXI2PDF_0 = @echo " TEXI2PDF" $@; am__v_TEXI2PDF_1 = AM_V_texinfo = $(am__v_texinfo_@AM_V@) am__v_texinfo_ = $(am__v_texinfo_@AM_DEFAULT_V@) am__v_texinfo_0 = -q am__v_texinfo_1 = AM_V_texidevnull = $(am__v_texidevnull_@AM_V@) am__v_texidevnull_ = $(am__v_texidevnull_@AM_DEFAULT_V@) am__v_texidevnull_0 = > /dev/null am__v_texidevnull_1 = INFO_DEPS = $(srcdir)/cgdb.info TEXINFO_TEX = $(top_srcdir)/config/texinfo.tex am__TEXINFO_TEX_DIR = $(top_srcdir)/config DVIS = cgdb.dvi PDFS = cgdb.pdf PSS = cgdb.ps HTMLS = cgdb.html TEXINFOS = cgdb.texinfo TEXI2DVI = texi2dvi TEXI2PDF = $(TEXI2DVI) --pdf --batch MAKEINFOHTML = $(MAKEINFO) --html AM_MAKEINFOHTMLFLAGS = $(AM_MAKEINFOFLAGS) DVIPS = dvips am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__installdirs = "$(DESTDIR)$(infodir)" "$(DESTDIR)$(man1dir)" \ "$(DESTDIR)$(pkgdatadir)" am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } man1dir = $(mandir)/man1 NROFF = nroff MANS = $(dist_man_MANS) DATA = $(dist_pkgdata_DATA) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ RL_MAJOR = @RL_MAJOR@ RL_MINOR = @RL_MINOR@ RL_VERSION = @RL_VERSION@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ YACC = @YACC@ YFLAGS = @YFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ info_TEXINFOS = cgdb.texinfo cgdb_TEXINFOS = gpl.texi dist_man_MANS = cgdb.1 EXTRA_DIST = cgdb.txt dist_pkgdata_DATA = cgdb.txt TEXTS = cgdb.txt MAKEINFOTXT = $(MAKEINFO) --plaintext AM_MAKEINFOTXTFLAGS = $(AM_MAKEINFOFLAGS) all: all-am .SUFFIXES: .SUFFIXES: .dvi .html .info .pdf .ps .texinfo .txt $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu doc/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): .texinfo.info: $(AM_V_MAKEINFO)restore=: && backupdir="$(am__leading_dot)am$$$$" && \ am__cwd=`pwd` && $(am__cd) $(srcdir) && \ rm -rf $$backupdir && mkdir $$backupdir && \ if ($(MAKEINFO) --version) >/dev/null 2>&1; then \ for f in $@ $@-[0-9] $@-[0-9][0-9] $(@:.info=).i[0-9] $(@:.info=).i[0-9][0-9]; do \ if test -f $$f; then mv $$f $$backupdir; restore=mv; else :; fi; \ done; \ else :; fi && \ cd "$$am__cwd"; \ if $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \ -o $@ $<; \ then \ rc=0; \ $(am__cd) $(srcdir); \ else \ rc=$$?; \ $(am__cd) $(srcdir) && \ $$restore $$backupdir/* `echo "./$@" | sed 's|[^/]*$$||'`; \ fi; \ rm -rf $$backupdir; exit $$rc .texinfo.dvi: $(AM_V_TEXI2DVI)TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \ $(TEXI2DVI) $(AM_V_texinfo) --build-dir=$(@:.dvi=.t2d) -o $@ $(AM_V_texidevnull) \ $< .texinfo.pdf: $(AM_V_TEXI2PDF)TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \ $(TEXI2PDF) $(AM_V_texinfo) --build-dir=$(@:.pdf=.t2p) -o $@ $(AM_V_texidevnull) \ $< .texinfo.html: $(AM_V_MAKEINFO)rm -rf $(@:.html=.htp) $(AM_V_at)if $(MAKEINFOHTML) $(AM_MAKEINFOHTMLFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \ -o $(@:.html=.htp) $<; \ then \ rm -rf $@; \ if test ! -d $(@:.html=.htp) && test -d $(@:.html=); then \ mv $(@:.html=) $@; else mv $(@:.html=.htp) $@; fi; \ else \ if test ! -d $(@:.html=.htp) && test -d $(@:.html=); then \ rm -rf $(@:.html=); else rm -Rf $(@:.html=.htp) $@; fi; \ exit 1; \ fi $(srcdir)/cgdb.info: cgdb.texinfo $(srcdir)/version.texi $(cgdb_TEXINFOS) cgdb.dvi: cgdb.texinfo $(srcdir)/version.texi $(cgdb_TEXINFOS) cgdb.pdf: cgdb.texinfo $(srcdir)/version.texi $(cgdb_TEXINFOS) cgdb.html: cgdb.texinfo $(srcdir)/version.texi $(cgdb_TEXINFOS) $(srcdir)/version.texi: $(srcdir)/stamp-vti $(srcdir)/stamp-vti: cgdb.texinfo $(top_srcdir)/configure @(dir=.; test -f ./cgdb.texinfo || dir=$(srcdir); \ set `$(SHELL) $(top_srcdir)/config/mdate-sh $$dir/cgdb.texinfo`; \ echo "@set UPDATED $$1 $$2 $$3"; \ echo "@set UPDATED-MONTH $$2 $$3"; \ echo "@set EDITION $(VERSION)"; \ echo "@set VERSION $(VERSION)") > vti.tmp @cmp -s vti.tmp $(srcdir)/version.texi \ || (echo "Updating $(srcdir)/version.texi"; \ cp vti.tmp $(srcdir)/version.texi) -@rm -f vti.tmp @cp $(srcdir)/version.texi $@ mostlyclean-vti: -rm -f vti.tmp maintainer-clean-vti: -rm -f $(srcdir)/stamp-vti $(srcdir)/version.texi .dvi.ps: $(AM_V_DVIPS)TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ $(DVIPS) $(AM_V_texinfo) -o $@ $< uninstall-dvi-am: @$(NORMAL_UNINSTALL) @list='$(DVIS)'; test -n "$(dvidir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(dvidir)/$$f'"; \ rm -f "$(DESTDIR)$(dvidir)/$$f"; \ done uninstall-html-am: @$(NORMAL_UNINSTALL) @list='$(HTMLS)'; test -n "$(htmldir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " rm -rf '$(DESTDIR)$(htmldir)/$$f'"; \ rm -rf "$(DESTDIR)$(htmldir)/$$f"; \ done uninstall-info-am: @$(PRE_UNINSTALL) @if test -d '$(DESTDIR)$(infodir)' && $(am__can_run_installinfo); then \ list='$(INFO_DEPS)'; \ for file in $$list; do \ relfile=`echo "$$file" | sed 's|^.*/||'`; \ echo " install-info --info-dir='$(DESTDIR)$(infodir)' --remove '$(DESTDIR)$(infodir)/$$relfile'"; \ if install-info --info-dir="$(DESTDIR)$(infodir)" --remove "$(DESTDIR)$(infodir)/$$relfile"; \ then :; else test ! -f "$(DESTDIR)$(infodir)/$$relfile" || exit 1; fi; \ done; \ else :; fi @$(NORMAL_UNINSTALL) @list='$(INFO_DEPS)'; \ for file in $$list; do \ relfile=`echo "$$file" | sed 's|^.*/||'`; \ relfile_i=`echo "$$relfile" | sed 's|\.info$$||;s|$$|.i|'`; \ (if test -d "$(DESTDIR)$(infodir)" && cd "$(DESTDIR)$(infodir)"; then \ echo " cd '$(DESTDIR)$(infodir)' && rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]"; \ rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]; \ else :; fi); \ done uninstall-pdf-am: @$(NORMAL_UNINSTALL) @list='$(PDFS)'; test -n "$(pdfdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(pdfdir)/$$f'"; \ rm -f "$(DESTDIR)$(pdfdir)/$$f"; \ done uninstall-ps-am: @$(NORMAL_UNINSTALL) @list='$(PSS)'; test -n "$(psdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(psdir)/$$f'"; \ rm -f "$(DESTDIR)$(psdir)/$$f"; \ done dist-info: $(INFO_DEPS) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ list='$(INFO_DEPS)'; \ for base in $$list; do \ case $$base in \ $(srcdir)/*) base=`echo "$$base" | sed "s|^$$srcdirstrip/||"`;; \ esac; \ if test -f $$base; then d=.; else d=$(srcdir); fi; \ base_i=`echo "$$base" | sed 's|\.info$$||;s|$$|.i|'`; \ for file in $$d/$$base $$d/$$base-[0-9] $$d/$$base-[0-9][0-9] $$d/$$base_i[0-9] $$d/$$base_i[0-9][0-9]; do \ if test -f $$file; then \ relfile=`expr "$$file" : "$$d/\(.*\)"`; \ test -f "$(distdir)/$$relfile" || \ cp -p $$file "$(distdir)/$$relfile"; \ else :; fi; \ done; \ done mostlyclean-aminfo: -rm -rf cgdb.t2d cgdb.t2p clean-aminfo: -test -z "cgdb.dvi cgdb.pdf cgdb.ps cgdb.html" \ || rm -rf cgdb.dvi cgdb.pdf cgdb.ps cgdb.html maintainer-clean-aminfo: @list='$(INFO_DEPS)'; for i in $$list; do \ i_i=`echo "$$i" | sed 's|\.info$$||;s|$$|.i|'`; \ echo " rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]"; \ rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]; \ done install-man1: $(dist_man_MANS) @$(NORMAL_INSTALL) @list1=''; \ list2='$(dist_man_MANS)'; \ test -n "$(man1dir)" \ && test -n "`echo $$list1$$list2`" \ || exit 0; \ echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ { for i in $$list1; do echo "$$i"; done; \ if test -n "$$list2"; then \ for i in $$list2; do echo "$$i"; done \ | sed -n '/\.1[a-z]*$$/p'; \ fi; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ done; } uninstall-man1: @$(NORMAL_UNINSTALL) @list=''; test -n "$(man1dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ l2='$(dist_man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.1[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) install-dist_pkgdataDATA: $(dist_pkgdata_DATA) @$(NORMAL_INSTALL) @list='$(dist_pkgdata_DATA)'; test -n "$(pkgdatadir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(pkgdatadir)'"; \ $(MKDIR_P) "$(DESTDIR)$(pkgdatadir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgdatadir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgdatadir)" || exit $$?; \ done uninstall-dist_pkgdataDATA: @$(NORMAL_UNINSTALL) @list='$(dist_pkgdata_DATA)'; test -n "$(pkgdatadir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(pkgdatadir)'; $(am__uninstall_files_from_dir) tags TAGS: ctags CTAGS: cscope cscopelist: distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$(top_distdir)" distdir="$(distdir)" \ dist-info check-am: all-am check: check-am all-am: Makefile $(INFO_DEPS) $(MANS) $(DATA) installdirs: for dir in "$(DESTDIR)$(infodir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(pkgdatadir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-aminfo clean-generic mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: $(DVIS) html: html-am html-am: $(HTMLS) info: info-am info-am: $(INFO_DEPS) install-data-am: install-dist_pkgdataDATA install-info-am install-man install-dvi: install-dvi-am install-dvi-am: $(DVIS) @$(NORMAL_INSTALL) @list='$(DVIS)'; test -n "$(dvidir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(dvidir)'"; \ $(MKDIR_P) "$(DESTDIR)$(dvidir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(dvidir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(dvidir)" || exit $$?; \ done install-exec-am: install-html: install-html-am install-html-am: $(HTMLS) @$(NORMAL_INSTALL) @list='$(HTMLS)'; list2=; test -n "$(htmldir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(htmldir)'"; \ $(MKDIR_P) "$(DESTDIR)$(htmldir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p" || test -d "$$p"; then d=; else d="$(srcdir)/"; fi; \ $(am__strip_dir) \ d2=$$d$$p; \ if test -d "$$d2"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(htmldir)/$$f'"; \ $(MKDIR_P) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \ echo " $(INSTALL_DATA) '$$d2'/* '$(DESTDIR)$(htmldir)/$$f'"; \ $(INSTALL_DATA) "$$d2"/* "$(DESTDIR)$(htmldir)/$$f" || exit $$?; \ else \ list2="$$list2 $$d2"; \ fi; \ done; \ test -z "$$list2" || { echo "$$list2" | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(htmldir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(htmldir)" || exit $$?; \ done; } install-info: install-info-am install-info-am: $(INFO_DEPS) @$(NORMAL_INSTALL) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ list='$(INFO_DEPS)'; test -n "$(infodir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(infodir)'"; \ $(MKDIR_P) "$(DESTDIR)$(infodir)" || exit 1; \ fi; \ for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ esac; \ if test -f $$file; then d=.; else d=$(srcdir); fi; \ file_i=`echo "$$file" | sed 's|\.info$$||;s|$$|.i|'`; \ for ifile in $$d/$$file $$d/$$file-[0-9] $$d/$$file-[0-9][0-9] \ $$d/$$file_i[0-9] $$d/$$file_i[0-9][0-9] ; do \ if test -f $$ifile; then \ echo "$$ifile"; \ else : ; fi; \ done; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(infodir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(infodir)" || exit $$?; done @$(POST_INSTALL) @if $(am__can_run_installinfo); then \ list='$(INFO_DEPS)'; test -n "$(infodir)" || list=; \ for file in $$list; do \ relfile=`echo "$$file" | sed 's|^.*/||'`; \ echo " install-info --info-dir='$(DESTDIR)$(infodir)' '$(DESTDIR)$(infodir)/$$relfile'";\ install-info --info-dir="$(DESTDIR)$(infodir)" "$(DESTDIR)$(infodir)/$$relfile" || :;\ done; \ else : ; fi install-man: install-man1 install-pdf: install-pdf-am install-pdf-am: $(PDFS) @$(NORMAL_INSTALL) @list='$(PDFS)'; test -n "$(pdfdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(pdfdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(pdfdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pdfdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(pdfdir)" || exit $$?; done install-ps: install-ps-am install-ps-am: $(PSS) @$(NORMAL_INSTALL) @list='$(PSS)'; test -n "$(psdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(psdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(psdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(psdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(psdir)" || exit $$?; done installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-aminfo \ maintainer-clean-generic maintainer-clean-vti mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-aminfo mostlyclean-generic mostlyclean-vti pdf: pdf-am pdf-am: $(PDFS) ps: ps-am ps-am: $(PSS) uninstall-am: uninstall-dist_pkgdataDATA uninstall-dvi-am \ uninstall-html-am uninstall-info-am uninstall-man \ uninstall-pdf-am uninstall-ps-am uninstall-man: uninstall-man1 .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-aminfo clean-generic \ cscopelist-am ctags-am dist-info distclean distclean-generic \ distdir dvi dvi-am html html-am info info-am install \ install-am install-data install-data-am \ install-dist_pkgdataDATA install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-man1 \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-aminfo \ maintainer-clean-generic maintainer-clean-vti mostlyclean \ mostlyclean-aminfo mostlyclean-generic mostlyclean-vti pdf \ pdf-am ps ps-am tags-am uninstall uninstall-am \ uninstall-dist_pkgdataDATA uninstall-dvi-am uninstall-html-am \ uninstall-info-am uninstall-man uninstall-man1 \ uninstall-pdf-am uninstall-ps-am # generate the man page using help2man. cgdb.1: help2man --output=$(top_srcdir)/doc/cgdb.1 $(top_builddir)/cgdb/cgdb$(EXEEXT) cgdb.txt: cgdb.texinfo $(srcdir)/version.texi $(cgdb_TEXINFOS) text-am: $(TEXTS) .texinfo.txt: rm -rf $(@:.txt=.htp) if $(MAKEINFOTXT) $(AM_MAKEINFOTXTFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \ -o $(@:.txt=.htp) $<; \ then \ rm -rf $@; \ if test ! -d $(@:.txt=.htp) && test -d $(@:.txt=); then \ mv $(@:.txt=) $@; else mv $(@:.txt=.htp) $@; fi; \ else \ if test ! -d $(@:.txt=.htp) && test -d $(@:.txt=); then \ rm -rf $(@:.txt=); else rm -Rf $(@:.txt=.htp) $@; fi; \ exit 1; \ fi # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: cgdb-0.6.7/doc/stamp-vti000644 000765 000024 00000000143 12074766264 016040 0ustar00mmuellerstaff000000 000000 @set UPDATED 14 January 2013 @set UPDATED-MONTH January 2013 @set EDITION 0.6.7 @set VERSION 0.6.7 cgdb-0.6.7/doc/version.texi000644 000765 000024 00000000143 12074754711 016543 0ustar00mmuellerstaff000000 000000 @set UPDATED 14 January 2013 @set UPDATED-MONTH January 2013 @set EDITION 0.6.7 @set VERSION 0.6.7 cgdb-0.6.7/config/compile000755 000765 000120 00000016245 12072642155 016231 0ustar00mmuelleradmin000000 000000 #! /bin/sh # Wrapper for compilers which do not understand '-c -o'. scriptversion=2012-10-14.11; # UTC # Copyright (C) 1999-2013 Free Software Foundation, Inc. # Written by Tom Tromey . # # 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. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . nl=' ' # We need space, tab and new line, in precisely that order. Quoting is # there to prevent tools from complaining about whitespace usage. IFS=" "" $nl" file_conv= # func_file_conv build_file lazy # Convert a $build file to $host form and store it in $file # Currently only supports Windows hosts. If the determined conversion # type is listed in (the comma separated) LAZY, no conversion will # take place. func_file_conv () { file=$1 case $file in / | /[!/]*) # absolute file, and not a UNC file if test -z "$file_conv"; then # lazily determine how to convert abs files case `uname -s` in MINGW*) file_conv=mingw ;; CYGWIN*) file_conv=cygwin ;; *) file_conv=wine ;; esac fi case $file_conv/,$2, in *,$file_conv,*) ;; mingw/*) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; cygwin/*) file=`cygpath -m "$file" || echo "$file"` ;; wine/*) file=`winepath -w "$file" || echo "$file"` ;; esac ;; esac } # func_cl_dashL linkdir # Make cl look for libraries in LINKDIR func_cl_dashL () { func_file_conv "$1" if test -z "$lib_path"; then lib_path=$file else lib_path="$lib_path;$file" fi linker_opts="$linker_opts -LIBPATH:$file" } # func_cl_dashl library # Do a library search-path lookup for cl func_cl_dashl () { lib=$1 found=no save_IFS=$IFS IFS=';' for dir in $lib_path $LIB do IFS=$save_IFS if $shared && test -f "$dir/$lib.dll.lib"; then found=yes lib=$dir/$lib.dll.lib break fi if test -f "$dir/$lib.lib"; then found=yes lib=$dir/$lib.lib break fi if test -f "$dir/lib$lib.a"; then found=yes lib=$dir/lib$lib.a break fi done IFS=$save_IFS if test "$found" != yes; then lib=$lib.lib fi } # func_cl_wrapper cl arg... # Adjust compile command to suit cl func_cl_wrapper () { # Assume a capable shell lib_path= shared=: linker_opts= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. eat=1 case $2 in *.o | *.[oO][bB][jJ]) func_file_conv "$2" set x "$@" -Fo"$file" shift ;; *) func_file_conv "$2" set x "$@" -Fe"$file" shift ;; esac ;; -I) eat=1 func_file_conv "$2" mingw set x "$@" -I"$file" shift ;; -I*) func_file_conv "${1#-I}" mingw set x "$@" -I"$file" shift ;; -l) eat=1 func_cl_dashl "$2" set x "$@" "$lib" shift ;; -l*) func_cl_dashl "${1#-l}" set x "$@" "$lib" shift ;; -L) eat=1 func_cl_dashL "$2" ;; -L*) func_cl_dashL "${1#-L}" ;; -static) shared=false ;; -Wl,*) arg=${1#-Wl,} save_ifs="$IFS"; IFS=',' for flag in $arg; do IFS="$save_ifs" linker_opts="$linker_opts $flag" done IFS="$save_ifs" ;; -Xlinker) eat=1 linker_opts="$linker_opts $2" ;; -*) set x "$@" "$1" shift ;; *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) func_file_conv "$1" set x "$@" -Tp"$file" shift ;; *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) func_file_conv "$1" mingw set x "$@" "$file" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -n "$linker_opts"; then linker_opts="-link$linker_opts" fi exec "$@" $linker_opts exit 1 } eat= case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: compile [--help] [--version] PROGRAM [ARGS] Wrapper for compilers which do not understand '-c -o'. Remove '-o dest.o' from ARGS, run PROGRAM with the remaining arguments, and rename the output as expected. If you are trying to build a whole package this is not the right script to run: please start by reading the file 'INSTALL'. Report bugs to . EOF exit $? ;; -v | --v*) echo "compile $scriptversion" exit $? ;; cl | *[/\\]cl | cl.exe | *[/\\]cl.exe ) func_cl_wrapper "$@" # Doesn't return... ;; esac ofile= cfile= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. # So we strip '-o arg' only if arg is an object. eat=1 case $2 in *.o | *.obj) ofile=$2 ;; *) set x "$@" -o "$2" shift ;; esac ;; *.c) cfile=$1 set x "$@" "$1" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -z "$ofile" || test -z "$cfile"; then # If no '-o' option was seen then we might have been invoked from a # pattern rule where we don't need one. That is ok -- this is a # normal compilation that the losing compiler can handle. If no # '.c' file was seen then we are probably linking. That is also # ok. exec "$@" fi # Name of file we expect compiler to create. cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` # Create the lock directory. # Note: use '[/\\:.-]' here to ensure that we don't use the same name # that we are using for the .o file. Also, base the name on the expected # object file name, since that is what matters with a parallel build. lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d while true; do if mkdir "$lockdir" >/dev/null 2>&1; then break fi sleep 1 done # FIXME: race condition here if user kills between mkdir and trap. trap "rmdir '$lockdir'; exit 1" 1 2 15 # Run the compile. "$@" ret=$? if test -f "$cofile"; then test "$cofile" = "$ofile" || mv "$cofile" "$ofile" elif test -f "${cofile}bj"; then test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" fi rmdir "$lockdir" exit $ret # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: cgdb-0.6.7/config/config.guess000755 000765 000120 00000127463 12072642155 017200 0ustar00mmuelleradmin000000 000000 #! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, # 2011, 2012, 2013 Free Software Foundation, Inc. timestamp='2012-12-29' # This file 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. # # 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; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # # Originally written by Per Bothner. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD # # Please send patches with a ChangeLog entry to config-patches@gnu.org. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux${UNAME_RELEASE} exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH="x86_64" fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case ${UNAME_PROCESSOR} in amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW64*:*) echo ${UNAME_MACHINE}-pc-mingw64 exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:MSYS*:*) echo ${UNAME_MACHINE}-pc-msys exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; 8664:Windows_NT:*) echo x86_64-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; aarch64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo ${UNAME_MACHINE}-unknown-linux-gnu else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo ${UNAME_MACHINE}-unknown-linux-gnueabi else echo ${UNAME_MACHINE}-unknown-linux-gnueabihf fi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-gnu exit ;; crisv32:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-gnu exit ;; frv:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; hexagon:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:Linux:*:*) LIBC=gnu eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` echo "${UNAME_MACHINE}-pc-linux-${LIBC}" exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; or32:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; padre:Linux:*:*) echo sparc-unknown-linux-gnu exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; tile*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; x86_64:Haiku:*:*) echo x86_64-unknown-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in i386) eval $set_cc_for_build if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then UNAME_PROCESSOR="x86_64" fi fi ;; unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NEO-?:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk${UNAME_RELEASE} exit ;; NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; x86_64:VMkernel:*:*) echo ${UNAME_MACHINE}-unknown-esx exit ;; esac eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: cgdb-0.6.7/config/config.sub000755 000765 000120 00000105467 12072642155 016643 0ustar00mmuelleradmin000000 000000 #! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, # 2011, 2012, 2013 Free Software Foundation, Inc. timestamp='2012-12-29' # This file 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. # # 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; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # Please send patches with a ChangeLog entry to config-patches@gnu.org. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; android-linux) os=-linux-android basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray | -microblaze*) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*178) os=-lynxos178 ;; -lynx*5) os=-lynxos5 ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | avr | avr32 \ | be32 | be64 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | epiphany \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 \ | ns16k | ns32k \ | open8 \ | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; c54x) basic_machine=tic54x-unknown ;; c55x) basic_machine=tic55x-unknown ;; c6x) basic_machine=tic6x-unknown ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip) basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; strongarm | thumb | xscale) basic_machine=arm-unknown ;; xgate) basic_machine=$basic_machine-unknown os=-none ;; xscaleeb) basic_machine=armeb-unknown ;; xscaleel) basic_machine=armel-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ | microblaze-* | microblazeel-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pyramid-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c54x-*) basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c55x-*) basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c6x-*) basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16 | cr16-*) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze*) basic_machine=microblaze-xilinx ;; mingw64) basic_machine=x86_64-pc os=-mingw64 ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; msys) basic_machine=i386-pc os=-msys ;; mvs) basic_machine=i370-ibm os=-mvs ;; nacl) basic_machine=le32-unknown os=-nacl ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; neo-tandem) basic_machine=neo-tandem ;; nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc | ppcbe) basic_machine=powerpc-unknown ;; ppc-* | ppcbe-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos | rdos64) basic_machine=x86_64-pc os=-rdos ;; rdos32) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; strongarm-* | thumb-*) basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tile*) basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; xscale-* | xscalee[bl]-*) basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; z80-*-coff) basic_machine=z80-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -bitrig* | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -nacl*) ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; hexagon-*) os=-elf ;; tic54x-*) os=-coff ;; tic55x-*) os=-coff ;; tic6x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -cnk*|-aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: cgdb-0.6.7/config/depcomp000755 000765 000120 00000055703 12072642155 016232 0ustar00mmuelleradmin000000 000000 #! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2012-10-18.11; # UTC # Copyright (C) 1999-2013 Free Software Foundation, Inc. # 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. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by 'PROGRAMS ARGS'. object Object file output by 'PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputting dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac # Get the directory component of the given path, and save it in the # global variables '$dir'. Note that this directory component will # be either empty or ending with a '/' character. This is deliberate. set_dir_from () { case $1 in */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;; *) dir=;; esac } # Get the suffix-stripped basename of the given path, and save it the # global variable '$base'. set_base_from () { base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` } # If no dependency file was actually created by the compiler invocation, # we still have to create a dummy depfile, to avoid errors with the # Makefile "include basename.Plo" scheme. make_dummy_depfile () { echo "#dummy" > "$depfile" } # Factor out some common post-processing of the generated depfile. # Requires the auxiliary global variable '$tmpdepfile' to be set. aix_post_process_depfile () { # If the compiler actually managed to produce a dependency file, # post-process it. if test -f "$tmpdepfile"; then # Each line is of the form 'foo.o: dependency.h'. # Do two passes, one to just change these to # $object: dependency.h # and one to simply output # dependency.h: # which is needed to avoid the deleted-header problem. { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" } > "$depfile" rm -f "$tmpdepfile" else make_dummy_depfile fi } # A tabulation character. tab=' ' # A newline character. nl=' ' # Character ranges might be problematic outside the C locale. # These definitions help. upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ lower=abcdefghijklmnopqrstuvwxyz digits=0123456789 alpha=${upper}${lower} if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Avoid interferences from the environment. gccflag= dashmflag= # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi cygpath_u="cygpath -u -f -" if test "$depmode" = msvcmsys; then # This is just like msvisualcpp but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvisualcpp fi if test "$depmode" = msvc7msys; then # This is just like msvc7 but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvc7 fi if test "$depmode" = xlc; then # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information. gccflag=-qmakedep=gcc,-MF depmode=gcc fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. ## Unfortunately, FreeBSD c89 acceptance of flags depends upon ## the command line argument order; so add the flags where they ## appear in depend2.am. Note that the slowdown incurred here ## affects only configure: in makefiles, %FASTDEP% shortcuts this. for arg do case $arg in -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; *) set fnord "$@" "$arg" ;; esac shift # fnord shift # $arg done "$@" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## Note that this doesn't just cater to obsosete pre-3.x GCC compilers. ## but also to in-use compilers like IMB xlc/xlC and the HP C compiler. ## (see the conditional assignment to $gccflag above). ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). Also, it might not be ## supported by the other compilers which use the 'gcc' depmode. ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The second -e expression handles DOS-style file names with drive # letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the "deleted header file" problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. ## Some versions of gcc put a space before the ':'. On the theory ## that the space means something, we add a space to the output as ## well. hp depmode also adds that space, but also prefixes the VPATH ## to the object. Take care to not repeat it in the output. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like '#:fec' to the end of the # dependency line. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \ | tr "$nl" ' ' >> "$depfile" echo >> "$depfile" # The second pass generates a dummy entry for each header file. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" ;; xlc) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts '$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.u tmpdepfile2=$base.u tmpdepfile3=$dir.libs/$base.u "$@" -Wc,-M else tmpdepfile1=$dir$base.u tmpdepfile2=$dir$base.u tmpdepfile3=$dir$base.u "$@" -M fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done aix_post_process_depfile ;; tcc) # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26 # FIXME: That version still under development at the moment of writing. # Make that this statement remains true also for stable, released # versions. # It will wrap lines (doesn't matter whether long or short) with a # trailing '\', as in: # # foo.o : \ # foo.c \ # foo.h \ # # It will put a trailing '\' even on the last line, and will use leading # spaces rather than leading tabs (at least since its commit 0394caf7 # "Emit spaces for -MD"). "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'. # We have to change lines of the first kind to '$object: \'. sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile" # And for each line of the second kind, we have to emit a 'dep.h:' # dummy dependency, to avoid the deleted-header problem. sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile" rm -f "$tmpdepfile" ;; ## The order of this option in the case statement is important, since the ## shell code in configure will try each of these formats in the order ## listed in this file. A plain '-MD' option would be understood by many ## compilers, so we must ensure this comes after the gcc and icc options. pgcc) # Portland's C compiler understands '-MD'. # Will always output deps to 'file.d' where file is the root name of the # source file under compilation, even if file resides in a subdirectory. # The object file name does not affect the name of the '.d' file. # pgcc 10.2 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using '\' : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... set_dir_from "$object" # Use the source, not the object, to determine the base name, since # that's sadly what pgcc will do too. set_base_from "$source" tmpdepfile=$base.d # For projects that build the same source file twice into different object # files, the pgcc approach of using the *source* file root name can cause # problems in parallel builds. Use a locking strategy to avoid stomping on # the same $tmpdepfile. lockdir=$base.d-lock trap " echo '$0: caught signal, cleaning up...' >&2 rmdir '$lockdir' exit 1 " 1 2 13 15 numtries=100 i=$numtries while test $i -gt 0; do # mkdir is a portable test-and-set. if mkdir "$lockdir" 2>/dev/null; then # This process acquired the lock. "$@" -MD stat=$? # Release the lock. rmdir "$lockdir" break else # If the lock is being held by a different process, wait # until the winning process is done or we timeout. while test -d "$lockdir" && test $i -gt 0; do sleep 1 i=`expr $i - 1` done fi i=`expr $i - 1` done trap - 1 2 13 15 if test $i -le 0; then echo "$0: failed to acquire lock after $numtries attempts" >&2 echo "$0: check lockdir '$lockdir'" >&2 exit 1 fi if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp2) # The "hp" stanza above does not work with aCC (C++) and HP's ia64 # compilers, which have integrated preprocessors. The correct option # to use with these is +Maked; it writes dependencies to a file named # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile" # Add 'dependent.h:' lines. sed -ne '2,${ s/^ *// s/ \\*$// s/$/:/ p }' "$tmpdepfile" >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in 'foo.d' instead, so we check for that too. # Subdirectories are respected. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then # Libtool generates 2 separate objects for the 2 libraries. These # two compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir$base.o.d # libtool 1.5 tmpdepfile2=$dir.libs/$base.o.d # Likewise. tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d "$@" -MD fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done # Same post-processing that is required for AIX mode. aix_post_process_depfile ;; msvc7) if test "$libtool" = yes; then showIncludes=-Wc,-showIncludes else showIncludes=-showIncludes fi "$@" $showIncludes > "$tmpdepfile" stat=$? grep -v '^Note: including file: ' "$tmpdepfile" if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The first sed program below extracts the file names and escapes # backslashes for cygpath. The second sed program outputs the file # name when reading, but also accumulates all include files in the # hold buffer in order to output them again at the end. This only # works with sed implementations that can handle large buffers. sed < "$tmpdepfile" -n ' /^Note: including file: *\(.*\)/ { s//\1/ s/\\/\\\\/g p }' | $cygpath_u | sort -u | sed -n ' s/ /\\ /g s/\(.*\)/'"$tab"'\1 \\/p s/.\(.*\) \\/\1:/ H $ { s/.*/'"$tab"'/ G p }' >> "$depfile" rm -f "$tmpdepfile" ;; msvc7msys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for ':' # in the target name. This is to cope with DOS-style filenames: # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. "$@" $dashmflag | sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this sed invocation # correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # X makedepend shift cleared=no eat=no for arg do case $cleared in no) set ""; shift cleared=yes ;; esac if test $eat = yes; then eat=no continue fi case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -arch) eat=yes ;; -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix=`echo "$object" | sed 's/^.*\././'` touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" # makedepend may prepend the VPATH from the source file name to the object. # No need to regex-escape $object, excess matching of '.' is harmless. sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process the last invocation # correctly. Breaking it into two sed invocations is a workaround. sed '1,2d' "$tmpdepfile" \ | tr ' ' "$nl" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E \ | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi IFS=" " for arg do case "$arg" in -o) shift ;; $object) shift ;; "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E 2>/dev/null | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" echo "$tab" >> "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; msvcmsys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: cgdb-0.6.7/config/install-sh000755 000765 000120 00000033255 12072642155 016657 0ustar00mmuelleradmin000000 000000 #!/bin/sh # install - install a program, script, or datafile scriptversion=2011-11-20.07; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # 'make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. nl=' ' IFS=" "" $nl" # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit=${DOITPROG-} if test -z "$doit"; then doit_exec=exec else doit_exec=$doit fi # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_glob='?' initialize_posix_glob=' test "$posix_glob" != "?" || { if (set -f) 2>/dev/null; then posix_glob= else posix_glob=: fi } ' posix_mkdir= # Desired mode of installed file. mode=0755 chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false no_target_directory= usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve the last data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *' '* | *' '* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) dst_arg=$2 # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac shift;; -T) no_target_directory=true;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call 'install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then do_exit='(exit $ret); exit $ret' trap "ret=129; $do_exit" 1 trap "ret=130; $do_exit" 2 trap "ret=141; $do_exit" 13 trap "ret=143; $do_exit" 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names problematic for 'test' and other utilities. case $src in -* | [=\(\)!]) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dst=$dstdir/`basename "$src"` dstdir_status=0 else # Prefer dirname, but fall back on a substitute if dirname fails. dstdir=` (dirname "$dst") 2>/dev/null || expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$dst" : 'X\(//\)[^/]' \| \ X"$dst" : 'X\(//\)$' \| \ X"$dst" : 'X\(/\)' \| . 2>/dev/null || echo X"$dst" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q' ` test -d "$dstdir" dstdir_status=$? fi fi obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # Create intermediate dirs using mode 755 as modified by the umask. # This is like FreeBSD 'install' as of 1997-10-28. umask=`umask` case $stripcmd.$umask in # Optimize common cases. *[2367][2367]) mkdir_umask=$umask;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; *[0-7]) mkdir_umask=`expr $umask + 22 \ - $umask % 100 % 40 + $umask % 20 \ - $umask % 10 % 4 + $umask % 2 `;; *) mkdir_umask=$umask,go-w;; esac # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false case $umask in *[123567][0-7][0-7]) # POSIX mkdir -p sets u+wx bits regardless of umask, which # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 if (umask $mkdir_umask && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. ls_ld_tmpdir=`ls -ld "$tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/d" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null fi trap '' 0;; esac;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # The umask is ridiculous, or mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; [-=\(\)!]*) prefix='./';; *) prefix='';; esac eval "$initialize_posix_glob" oIFS=$IFS IFS=/ $posix_glob set -f set fnord $dstdir shift $posix_glob set +f IFS=$oIFS prefixes= for d do test X"$d" = X && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask=$mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && eval "$initialize_posix_glob" && $posix_glob set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && $posix_glob set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd -f "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: cgdb-0.6.7/config/mdate-sh000755 000765 000120 00000013637 12072642155 016305 0ustar00mmuelleradmin000000 000000 #!/bin/sh # Get modification time of a file or directory and pretty-print it. scriptversion=2010-08-21.06; # UTC # Copyright (C) 1995-2013 Free Software Foundation, Inc. # written by Ulrich Drepper , June 1995 # # 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. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST fi case $1 in '') echo "$0: No file. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: mdate-sh [--help] [--version] FILE Pretty-print the modification day of FILE, in the format: 1 January 1970 Report bugs to . EOF exit $? ;; -v | --v*) echo "mdate-sh $scriptversion" exit $? ;; esac error () { echo "$0: $1" >&2 exit 1 } # Prevent date giving response in another language. LANG=C export LANG LC_ALL=C export LC_ALL LC_TIME=C export LC_TIME # GNU ls changes its time format in response to the TIME_STYLE # variable. Since we cannot assume 'unset' works, revert this # variable to its documented default. if test "${TIME_STYLE+set}" = set; then TIME_STYLE=posix-long-iso export TIME_STYLE fi save_arg1=$1 # Find out how to get the extended ls output of a file or directory. if ls -L /dev/null 1>/dev/null 2>&1; then ls_command='ls -L -l -d' else ls_command='ls -l -d' fi # Avoid user/group names that might have spaces, when possible. if ls -n /dev/null 1>/dev/null 2>&1; then ls_command="$ls_command -n" fi # A 'ls -l' line looks as follows on OS/2. # drwxrwx--- 0 Aug 11 2001 foo # This differs from Unix, which adds ownership information. # drwxrwx--- 2 root root 4096 Aug 11 2001 foo # # To find the date, we split the line on spaces and iterate on words # until we find a month. This cannot work with files whose owner is a # user named "Jan", or "Feb", etc. However, it's unlikely that '/' # will be owned by a user whose name is a month. So we first look at # the extended ls output of the root directory to decide how many # words should be skipped to get the date. # On HPUX /bin/sh, "set" interprets "-rw-r--r--" as options, so the "x" below. set x`$ls_command /` # Find which argument is the month. month= command= until test $month do test $# -gt 0 || error "failed parsing '$ls_command /' output" shift # Add another shift to the command. command="$command shift;" case $1 in Jan) month=January; nummonth=1;; Feb) month=February; nummonth=2;; Mar) month=March; nummonth=3;; Apr) month=April; nummonth=4;; May) month=May; nummonth=5;; Jun) month=June; nummonth=6;; Jul) month=July; nummonth=7;; Aug) month=August; nummonth=8;; Sep) month=September; nummonth=9;; Oct) month=October; nummonth=10;; Nov) month=November; nummonth=11;; Dec) month=December; nummonth=12;; esac done test -n "$month" || error "failed parsing '$ls_command /' output" # Get the extended ls output of the file or directory. set dummy x`eval "$ls_command \"\\\$save_arg1\""` # Remove all preceding arguments eval $command # Because of the dummy argument above, month is in $2. # # On a POSIX system, we should have # # $# = 5 # $1 = file size # $2 = month # $3 = day # $4 = year or time # $5 = filename # # On Darwin 7.7.0 and 7.6.0, we have # # $# = 4 # $1 = day # $2 = month # $3 = year or time # $4 = filename # Get the month. case $2 in Jan) month=January; nummonth=1;; Feb) month=February; nummonth=2;; Mar) month=March; nummonth=3;; Apr) month=April; nummonth=4;; May) month=May; nummonth=5;; Jun) month=June; nummonth=6;; Jul) month=July; nummonth=7;; Aug) month=August; nummonth=8;; Sep) month=September; nummonth=9;; Oct) month=October; nummonth=10;; Nov) month=November; nummonth=11;; Dec) month=December; nummonth=12;; esac case $3 in ???*) day=$1;; *) day=$3; shift;; esac # Here we have to deal with the problem that the ls output gives either # the time of day or the year. case $3 in *:*) set `date`; eval year=\$$# case $2 in Jan) nummonthtod=1;; Feb) nummonthtod=2;; Mar) nummonthtod=3;; Apr) nummonthtod=4;; May) nummonthtod=5;; Jun) nummonthtod=6;; Jul) nummonthtod=7;; Aug) nummonthtod=8;; Sep) nummonthtod=9;; Oct) nummonthtod=10;; Nov) nummonthtod=11;; Dec) nummonthtod=12;; esac # For the first six month of the year the time notation can also # be used for files modified in the last year. if (expr $nummonth \> $nummonthtod) > /dev/null; then year=`expr $year - 1` fi;; *) year=$3;; esac # The result. echo $day $month $year # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: cgdb-0.6.7/config/missing000755 000765 000120 00000015331 12072642155 016245 0ustar00mmuelleradmin000000 000000 #! /bin/sh # Common wrapper for a few potentially missing GNU programs. scriptversion=2012-06-26.16; # UTC # Copyright (C) 1996-2013 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard , 1996. # 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. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try '$0 --help' for more information" exit 1 fi case $1 in --is-lightweight) # Used by our autoconf macros to check whether the available missing # script is modern enough. exit 0 ;; --run) # Back-compat with the calling convention used by older automake. shift ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due to PROGRAM being missing or too old. Options: -h, --help display this help and exit -v, --version output version information and exit Supported PROGRAM values: aclocal autoconf autoheader autom4te automake makeinfo bison yacc flex lex help2man Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 'g' are ignored when checking the name. Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: unknown '$1' option" echo 1>&2 "Try '$0 --help' for more information" exit 1 ;; esac # Run the given program, remember its exit status. "$@"; st=$? # If it succeeded, we are done. test $st -eq 0 && exit 0 # Also exit now if we it failed (or wasn't found), and '--version' was # passed; such an option is passed most likely to detect whether the # program is present and works. case $2 in --version|--help) exit $st;; esac # Exit code 63 means version mismatch. This often happens when the user # tries to use an ancient version of a tool on a file that requires a # minimum version. if test $st -eq 63; then msg="probably too old" elif test $st -eq 127; then # Program was missing. msg="missing on your system" else # Program was found and executed, but failed. Give up. exit $st fi perl_URL=http://www.perl.org/ flex_URL=http://flex.sourceforge.net/ gnu_software_URL=http://www.gnu.org/software program_details () { case $1 in aclocal|automake) echo "The '$1' program is part of the GNU Automake package:" echo "<$gnu_software_URL/automake>" echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/autoconf>" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; autoconf|autom4te|autoheader) echo "The '$1' program is part of the GNU Autoconf package:" echo "<$gnu_software_URL/autoconf/>" echo "It also requires GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; esac } give_advice () { # Normalize program name to check for. normalized_program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` printf '%s\n' "'$1' is $msg." configure_deps="'configure.ac' or m4 files included by 'configure.ac'" case $normalized_program in autoconf*) echo "You should only need it if you modified 'configure.ac'," echo "or m4 files included by it." program_details 'autoconf' ;; autoheader*) echo "You should only need it if you modified 'acconfig.h' or" echo "$configure_deps." program_details 'autoheader' ;; automake*) echo "You should only need it if you modified 'Makefile.am' or" echo "$configure_deps." program_details 'automake' ;; aclocal*) echo "You should only need it if you modified 'acinclude.m4' or" echo "$configure_deps." program_details 'aclocal' ;; autom4te*) echo "You might have modified some maintainer files that require" echo "the 'automa4te' program to be rebuilt." program_details 'autom4te' ;; bison*|yacc*) echo "You should only need it if you modified a '.y' file." echo "You may want to install the GNU Bison package:" echo "<$gnu_software_URL/bison/>" ;; lex*|flex*) echo "You should only need it if you modified a '.l' file." echo "You may want to install the Fast Lexical Analyzer package:" echo "<$flex_URL>" ;; help2man*) echo "You should only need it if you modified a dependency" \ "of a man page." echo "You may want to install the GNU Help2man package:" echo "<$gnu_software_URL/help2man/>" ;; makeinfo*) echo "You should only need it if you modified a '.texi' file, or" echo "any other file indirectly affecting the aspect of the manual." echo "You might want to install the Texinfo package:" echo "<$gnu_software_URL/texinfo/>" echo "The spurious makeinfo call might also be the consequence of" echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" echo "want to install GNU make:" echo "<$gnu_software_URL/make/>" ;; *) echo "You might have modified some files without having the proper" echo "tools for further handling them. Check the 'README' file, it" echo "often tells you about the needed prerequisites for installing" echo "this package. You may also peek at any GNU archive site, in" echo "case some other package contains this missing '$1' program." ;; esac } give_advice "$1" | sed -e '1s/^/WARNING: /' \ -e '2,$s/^/ /' >&2 # Propagate the correct exit status (expected to be 127 for a program # not found, 63 for a program that failed due to version mismatch). exit $st # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: cgdb-0.6.7/config/readline_check_version.m4000644 000765 000024 00000011463 12074441140 021606 0ustar00mmuellerstaff000000 000000 AC_DEFUN([BASH_CHECK_LIB_TERMCAP], [ if test "X$bash_cv_termcap_lib" = "X"; then _bash_needmsg=yes else AC_MSG_CHECKING(which library has the termcap functions) _bash_needmsg= fi AC_CACHE_VAL(bash_cv_termcap_lib, [AC_CHECK_LIB(]$curses_lib_name[, tgetent, bash_cv_termcap_lib=lib]$curses_lib_name[, [AC_CHECK_LIB(tinfo, tgetent, bash_cv_termcap_lib=libtinfo, [AC_CHECK_FUNC(tgetent, bash_cv_termcap_lib=libc, bash_cv_termcap_lib=gnutermcap)])])]) if test "X$_bash_needmsg" = "Xyes"; then AC_MSG_CHECKING(which library has the termcap functions) fi AC_MSG_RESULT(using $bash_cv_termcap_lib) if test $bash_cv_termcap_lib = gnutermcap && test -z "$prefer_curses"; then LDFLAGS="$LDFLAGS -L./lib/termcap" TERMCAP_LIB="./lib/termcap/libtermcap.a" TERMCAP_DEP="./lib/termcap/libtermcap.a" elif test $bash_cv_termcap_lib = libtinfo; then TERMCAP_LIB=-ltinfo TERMCAP_DEP= elif test $bash_cv_termcap_lib = lib$curses_lib_name; then TERMCAP_LIB=-l$curses_lib_name TERMCAP_DEP= elif test $bash_cv_termcap_lib = libc; then TERMCAP_LIB= TERMCAP_DEP= fi ]) dnl need: prefix exec_prefix libdir includedir CC TERMCAP_LIB dnl require: dnl AC_PROG_CC dnl BASH_CHECK_LIB_TERMCAP AC_DEFUN([RL_LIB_READLINE_VERSION], [ AC_REQUIRE([BASH_CHECK_LIB_TERMCAP]) AC_MSG_CHECKING([version of installed readline library]) # What a pain in the ass this is. # save cpp and ld options _save_CFLAGS="$CFLAGS" _save_LDFLAGS="$LDFLAGS" _save_LIBS="$LIBS" # Don't set ac_cv_rl_prefix if the caller has already assigned a value. This # allows the caller to do something like $_rl_prefix=$withval if the user # specifies --with-installed-readline=PREFIX as an argument to configure if test -z "$ac_cv_rl_prefix"; then test "x$prefix" = xNONE && ac_cv_rl_prefix=$ac_default_prefix || ac_cv_rl_prefix=${prefix} fi eval ac_cv_rl_includedir=${ac_cv_rl_prefix}/include eval ac_cv_rl_libdir=${ac_cv_rl_prefix}/lib LIBS="$LIBS -lreadline ${TERMCAP_LIB}" CFLAGS="$CFLAGS -I${ac_cv_rl_includedir}" LDFLAGS="$LDFLAGS -L${ac_cv_rl_libdir}" AC_CACHE_VAL(ac_cv_rl_version, [AC_TRY_RUN([ #include #include main() { FILE *fp; fp = fopen("conftest.rlv", "w"); if (fp == 0) exit(1); fprintf(fp, "%s\n", rl_library_version ? rl_library_version : "0.0"); fclose(fp); exit(0); } ], ac_cv_rl_version=`cat conftest.rlv`, ac_cv_rl_version='0.0', ac_cv_rl_version='4.2')]) CFLAGS="$_save_CFLAGS" LDFLAGS="$_save_LDFLAGS" LIBS="$_save_LIBS" RL_MAJOR=0 RL_MINOR=0 # ( case "$ac_cv_rl_version" in 2*|3*|4*|5*|6*|7*|8*|9*) RL_MAJOR=`echo $ac_cv_rl_version | sed 's:\..*$::'` RL_MINOR=`echo $ac_cv_rl_version | sed -e 's:^.*\.::' -e 's:[[a-zA-Z]]*$::'` ;; esac # ((( case $RL_MAJOR in [[0-9][0-9]]) _RL_MAJOR=$RL_MAJOR ;; [[0-9]]) _RL_MAJOR=0$RL_MAJOR ;; *) _RL_MAJOR=00 ;; esac # ((( case $RL_MINOR in [[0-9][0-9]]) _RL_MINOR=$RL_MINOR ;; [[0-9]]) _RL_MINOR=0$RL_MINOR ;; *) _RL_MINOR=00 ;; esac RL_VERSION="0x${_RL_MAJOR}${_RL_MINOR}" # Readline versions greater than 4.2 have these defines in readline.h if test "$ac_cv_rl_version" = '0.0' ; then AC_MSG_WARN([Could not test version of installed readline library.]) elif test $RL_MAJOR -gt 4 || { test $RL_MAJOR = 4 && test $RL_MINOR -gt 2 ; } ; then # set these for use by the caller RL_PREFIX=$ac_cv_rl_prefix RL_LIBDIR=$ac_cv_rl_libdir RL_INCLUDEDIR=$ac_cv_rl_includedir AC_MSG_RESULT($ac_cv_rl_version) else AC_DEFINE_UNQUOTED(RL_READLINE_VERSION, $RL_VERSION, [encoded version of the installed readline library]) AC_DEFINE_UNQUOTED(RL_VERSION_MAJOR, $RL_MAJOR, [major version of installed readline library]) AC_DEFINE_UNQUOTED(RL_VERSION_MINOR, $RL_MINOR, [minor version of installed readline library]) AC_SUBST(RL_VERSION) AC_SUBST(RL_MAJOR) AC_SUBST(RL_MINOR) # set these for use by the caller RL_PREFIX=$ac_cv_rl_prefix RL_LIBDIR=$ac_cv_rl_libdir RL_INCLUDEDIR=$ac_cv_rl_includedir AC_MSG_RESULT($ac_cv_rl_version) fi ]) dnl This checks to see where the include files for readline are located. dnl It also defines the readline and history libraries AC_DEFUN([RL_LIB_READLINE_INCLUDES], [ AC_DEFINE(HAVE_LIBREADLINE,1, [readline library available]) AC_CHECK_HEADERS([readline.h],is_readline_header_found="true",is_readline_header_found="false") if test "x$is_readline_header_found" = "xfalse"; then AC_CHECK_HEADERS([readline/readline.h],is_readline_header_found="true",is_readline_header_found="false") if test "x$is_readline_header_found" = "xfalse"; then AC_MSG_ERROR([cgdb needs readline.h or readline/readline.h to build]) fi fi AC_CHECK_HEADERS([history.h],is_history_header_found="true",is_history_header_found="false") if test "x$is_history_header_found" = "xfalse"; then AC_CHECK_HEADERS([readline/history.h],is_history_header_found="true",is_readline_header_found="false") if test "x$is_history_header_found" = "xfalse"; then AC_MSG_ERROR([cgdb needs history.h or readline/history.h to build]) fi fi ]) cgdb-0.6.7/config/texinfo.tex000644 000765 000120 00001166555 12072642155 017064 0ustar00mmuelleradmin000000 000000 % texinfo.tex -- TeX macros to handle Texinfo files. % % Load plain if necessary, i.e., if running under initex. \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi % \def\texinfoversion{2012-11-08.11} % % Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, % 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. % % This texinfo.tex file 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. % % This texinfo.tex file 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. If not, see . % % As a special exception, when this file is read by TeX when processing % a Texinfo source document, you may use the result without % restriction. (This has been our intent since Texinfo was invented.) % % Please try the latest version of texinfo.tex before submitting bug % reports; you can get the latest version from: % http://ftp.gnu.org/gnu/texinfo/ (the Texinfo release area), or % http://ftpmirror.gnu.org/texinfo/ (same, via a mirror), or % http://www.gnu.org/software/texinfo/ (the Texinfo home page) % The texinfo.tex in any given distribution could well be out % of date, so if that's what you're using, please check. % % Send bug reports to bug-texinfo@gnu.org. Please include including a % complete document in each bug report with which we can reproduce the % problem. Patches are, of course, greatly appreciated. % % To process a Texinfo manual with TeX, it's most reliable to use the % texi2dvi shell script that comes with the distribution. For a simple % manual foo.texi, however, you can get away with this: % tex foo.texi % texindex foo.?? % tex foo.texi % tex foo.texi % dvips foo.dvi -o # or whatever; this makes foo.ps. % The extra TeX runs get the cross-reference information correct. % Sometimes one run after texindex suffices, and sometimes you need more % than two; texi2dvi does it as many times as necessary. % % It is possible to adapt texinfo.tex for other languages, to some % extent. You can get the existing language-specific files from the % full Texinfo distribution. % % The GNU Texinfo home page is http://www.gnu.org/software/texinfo. \message{Loading texinfo [version \texinfoversion]:} % If in a .fmt file, print the version number % and turn on active characters that we couldn't do earlier because % they might have appeared in the input file name. \everyjob{\message{[Texinfo version \texinfoversion]}% \catcode`+=\active \catcode`\_=\active} \chardef\other=12 % We never want plain's \outer definition of \+ in Texinfo. % For @tex, we can use \tabalign. \let\+ = \relax % Save some plain tex macros whose names we will redefine. \let\ptexb=\b \let\ptexbullet=\bullet \let\ptexc=\c \let\ptexcomma=\, \let\ptexdot=\. \let\ptexdots=\dots \let\ptexend=\end \let\ptexequiv=\equiv \let\ptexexclam=\! \let\ptexfootnote=\footnote \let\ptexgtr=> \let\ptexhat=^ \let\ptexi=\i \let\ptexindent=\indent \let\ptexinsert=\insert \let\ptexlbrace=\{ \let\ptexless=< \let\ptexnewwrite\newwrite \let\ptexnoindent=\noindent \let\ptexplus=+ \let\ptexraggedright=\raggedright \let\ptexrbrace=\} \let\ptexslash=\/ \let\ptexstar=\* \let\ptext=\t \let\ptextop=\top {\catcode`\'=\active \global\let\ptexquoteright'}% active in plain's math mode % If this character appears in an error message or help string, it % starts a new line in the output. \newlinechar = `^^J % Use TeX 3.0's \inputlineno to get the line number, for better error % messages, but if we're using an old version of TeX, don't do anything. % \ifx\inputlineno\thisisundefined \let\linenumber = \empty % Pre-3.0. \else \def\linenumber{l.\the\inputlineno:\space} \fi % Set up fixed words for English if not already set. \ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi \ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi \ifx\putworderror\undefined \gdef\putworderror{error}\fi \ifx\putwordfile\undefined \gdef\putwordfile{file}\fi \ifx\putwordin\undefined \gdef\putwordin{in}\fi \ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty)}\fi \ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi \ifx\putwordInfo\undefined \gdef\putwordInfo{Info}\fi \ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi \ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi \ifx\putwordNoTitle\undefined \gdef\putwordNoTitle{No Title}\fi \ifx\putwordof\undefined \gdef\putwordof{of}\fi \ifx\putwordon\undefined \gdef\putwordon{on}\fi \ifx\putwordpage\undefined \gdef\putwordpage{page}\fi \ifx\putwordsection\undefined \gdef\putwordsection{section}\fi \ifx\putwordSection\undefined \gdef\putwordSection{Section}\fi \ifx\putwordsee\undefined \gdef\putwordsee{see}\fi \ifx\putwordSee\undefined \gdef\putwordSee{See}\fi \ifx\putwordShortTOC\undefined \gdef\putwordShortTOC{Short Contents}\fi \ifx\putwordTOC\undefined \gdef\putwordTOC{Table of Contents}\fi % \ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi \ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi \ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi \ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi \ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi \ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi \ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi \ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi \ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi \ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi \ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi \ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi % \ifx\putwordDefmac\undefined \gdef\putwordDefmac{Macro}\fi \ifx\putwordDefspec\undefined \gdef\putwordDefspec{Special Form}\fi \ifx\putwordDefvar\undefined \gdef\putwordDefvar{Variable}\fi \ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi \ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi % Since the category of space is not known, we have to be careful. \chardef\spacecat = 10 \def\spaceisspace{\catcode`\ =\spacecat} % sometimes characters are active, so we need control sequences. \chardef\ampChar = `\& \chardef\colonChar = `\: \chardef\commaChar = `\, \chardef\dashChar = `\- \chardef\dotChar = `\. \chardef\exclamChar= `\! \chardef\hashChar = `\# \chardef\lquoteChar= `\` \chardef\questChar = `\? \chardef\rquoteChar= `\' \chardef\semiChar = `\; \chardef\slashChar = `\/ \chardef\underChar = `\_ % Ignore a token. % \def\gobble#1{} % The following is used inside several \edef's. \def\makecsname#1{\expandafter\noexpand\csname#1\endcsname} % Hyphenation fixes. \hyphenation{ Flor-i-da Ghost-script Ghost-view Mac-OS Post-Script ap-pen-dix bit-map bit-maps data-base data-bases eshell fall-ing half-way long-est man-u-script man-u-scripts mini-buf-fer mini-buf-fers over-view par-a-digm par-a-digms rath-er rec-tan-gu-lar ro-bot-ics se-vere-ly set-up spa-ces spell-ing spell-ings stand-alone strong-est time-stamp time-stamps which-ever white-space wide-spread wrap-around } % Margin to add to right of even pages, to left of odd pages. \newdimen\bindingoffset \newdimen\normaloffset \newdimen\pagewidth \newdimen\pageheight % For a final copy, take out the rectangles % that mark overfull boxes (in case you have decided % that the text looks ok even though it passes the margin). % \def\finalout{\overfullrule=0pt } % Sometimes it is convenient to have everything in the transcript file % and nothing on the terminal. We don't just call \tracingall here, % since that produces some useless output on the terminal. We also make % some effort to order the tracing commands to reduce output in the log % file; cf. trace.sty in LaTeX. % \def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}% \def\loggingall{% \tracingstats2 \tracingpages1 \tracinglostchars2 % 2 gives us more in etex \tracingparagraphs1 \tracingoutput1 \tracingmacros2 \tracingrestores1 \showboxbreadth\maxdimen \showboxdepth\maxdimen \ifx\eTeXversion\thisisundefined\else % etex gives us more logging \tracingscantokens1 \tracingifs1 \tracinggroups1 \tracingnesting2 \tracingassigns1 \fi \tracingcommands3 % 3 gives us more in etex \errorcontextlines16 }% % @errormsg{MSG}. Do the index-like expansions on MSG, but if things % aren't perfect, it's not the end of the world, being an error message, % after all. % \def\errormsg{\begingroup \indexnofonts \doerrormsg} \def\doerrormsg#1{\errmessage{#1}} % add check for \lastpenalty to plain's definitions. If the last thing % we did was a \nobreak, we don't want to insert more space. % \def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount \removelastskip\penalty-50\smallskip\fi\fi} \def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount \removelastskip\penalty-100\medskip\fi\fi} \def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount \removelastskip\penalty-200\bigskip\fi\fi} % Do @cropmarks to get crop marks. % \newif\ifcropmarks \let\cropmarks = \cropmarkstrue % % Dimensions to add cropmarks at corners. % Added by P. A. MacKay, 12 Nov. 1986 % \newdimen\outerhsize \newdimen\outervsize % set by the paper size routines \newdimen\cornerlong \cornerlong=1pc \newdimen\cornerthick \cornerthick=.3pt \newdimen\topandbottommargin \topandbottommargin=.75in % Output a mark which sets \thischapter, \thissection and \thiscolor. % We dump everything together because we only have one kind of mark. % This works because we only use \botmark / \topmark, not \firstmark. % % A mark contains a subexpression of the \ifcase ... \fi construct. % \get*marks macros below extract the needed part using \ifcase. % % Another complication is to let the user choose whether \thischapter % (\thissection) refers to the chapter (section) in effect at the top % of a page, or that at the bottom of a page. The solution is % described on page 260 of The TeXbook. It involves outputting two % marks for the sectioning macros, one before the section break, and % one after. I won't pretend I can describe this better than DEK... \def\domark{% \toks0=\expandafter{\lastchapterdefs}% \toks2=\expandafter{\lastsectiondefs}% \toks4=\expandafter{\prevchapterdefs}% \toks6=\expandafter{\prevsectiondefs}% \toks8=\expandafter{\lastcolordefs}% \mark{% \the\toks0 \the\toks2 \noexpand\or \the\toks4 \the\toks6 \noexpand\else \the\toks8 }% } % \topmark doesn't work for the very first chapter (after the title % page or the contents), so we use \firstmark there -- this gets us % the mark with the chapter defs, unless the user sneaks in, e.g., % @setcolor (or @url, or @link, etc.) between @contents and the very % first @chapter. \def\gettopheadingmarks{% \ifcase0\topmark\fi \ifx\thischapter\empty \ifcase0\firstmark\fi \fi } \def\getbottomheadingmarks{\ifcase1\botmark\fi} \def\getcolormarks{\ifcase2\topmark\fi} % Avoid "undefined control sequence" errors. \def\lastchapterdefs{} \def\lastsectiondefs{} \def\prevchapterdefs{} \def\prevsectiondefs{} \def\lastcolordefs{} % Main output routine. \chardef\PAGE = 255 \output = {\onepageout{\pagecontents\PAGE}} \newbox\headlinebox \newbox\footlinebox % \onepageout takes a vbox as an argument. Note that \pagecontents % does insertions, but you have to call it yourself. \def\onepageout#1{% \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi % \ifodd\pageno \advance\hoffset by \bindingoffset \else \advance\hoffset by -\bindingoffset\fi % % Do this outside of the \shipout so @code etc. will be expanded in % the headline as they should be, not taken literally (outputting ''code). \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}% \ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}% % {% % Have to do this stuff outside the \shipout because we want it to % take effect in \write's, yet the group defined by the \vbox ends % before the \shipout runs. % \indexdummies % don't expand commands in the output. \normalturnoffactive % \ in index entries must not stay \, e.g., if % the page break happens to be in the middle of an example. % We don't want .vr (or whatever) entries like this: % \entry{{\tt \indexbackslash }acronym}{32}{\code {\acronym}} % "\acronym" won't work when it's read back in; % it needs to be % {\code {{\tt \backslashcurfont }acronym} \shipout\vbox{% % Do this early so pdf references go to the beginning of the page. \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi % \ifcropmarks \vbox to \outervsize\bgroup \hsize = \outerhsize \vskip-\topandbottommargin \vtop to0pt{% \line{\ewtop\hfil\ewtop}% \nointerlineskip \line{% \vbox{\moveleft\cornerthick\nstop}% \hfill \vbox{\moveright\cornerthick\nstop}% }% \vss}% \vskip\topandbottommargin \line\bgroup \hfil % center the page within the outer (page) hsize. \ifodd\pageno\hskip\bindingoffset\fi \vbox\bgroup \fi % \unvbox\headlinebox \pagebody{#1}% \ifdim\ht\footlinebox > 0pt % Only leave this space if the footline is nonempty. % (We lessened \vsize for it in \oddfootingyyy.) % The \baselineskip=24pt in plain's \makefootline has no effect. \vskip 24pt \unvbox\footlinebox \fi % \ifcropmarks \egroup % end of \vbox\bgroup \hfil\egroup % end of (centering) \line\bgroup \vskip\topandbottommargin plus1fill minus1fill \boxmaxdepth = \cornerthick \vbox to0pt{\vss \line{% \vbox{\moveleft\cornerthick\nsbot}% \hfill \vbox{\moveright\cornerthick\nsbot}% }% \nointerlineskip \line{\ewbot\hfil\ewbot}% }% \egroup % \vbox from first cropmarks clause \fi }% end of \shipout\vbox }% end of group with \indexdummies \advancepageno \ifnum\outputpenalty>-20000 \else\dosupereject\fi } \newinsert\margin \dimen\margin=\maxdimen \def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}} {\catcode`\@ =11 \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi % marginal hacks, juha@viisa.uucp (Juha Takala) \ifvoid\margin\else % marginal info is present \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi \dimen@=\dp#1\relax \unvbox#1\relax \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi \ifr@ggedbottom \kern-\dimen@ \vfil \fi} } % Here are the rules for the cropmarks. Note that they are % offset so that the space between them is truly \outerhsize or \outervsize % (P. A. MacKay, 12 November, 1986) % \def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong} \def\nstop{\vbox {\hrule height\cornerthick depth\cornerlong width\cornerthick}} \def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong} \def\nsbot{\vbox {\hrule height\cornerlong depth\cornerthick width\cornerthick}} % Parse an argument, then pass it to #1. The argument is the rest of % the input line (except we remove a trailing comment). #1 should be a % macro which expects an ordinary undelimited TeX argument. % \def\parsearg{\parseargusing{}} \def\parseargusing#1#2{% \def\argtorun{#2}% \begingroup \obeylines \spaceisspace #1% \parseargline\empty% Insert the \empty token, see \finishparsearg below. } {\obeylines % \gdef\parseargline#1^^M{% \endgroup % End of the group started in \parsearg. \argremovecomment #1\comment\ArgTerm% }% } % First remove any @comment, then any @c comment. \def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm} \def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm} % Each occurrence of `\^^M' or `\^^M' is replaced by a single space. % % \argremovec might leave us with trailing space, e.g., % @end itemize @c foo % This space token undergoes the same procedure and is eventually removed % by \finishparsearg. % \def\argcheckspaces#1\^^M{\argcheckspacesX#1\^^M \^^M} \def\argcheckspacesX#1 \^^M{\argcheckspacesY#1\^^M} \def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{% \def\temp{#3}% \ifx\temp\empty % Do not use \next, perhaps the caller of \parsearg uses it; reuse \temp: \let\temp\finishparsearg \else \let\temp\argcheckspaces \fi % Put the space token in: \temp#1 #3\ArgTerm } % If a _delimited_ argument is enclosed in braces, they get stripped; so % to get _exactly_ the rest of the line, we had to prevent such situation. % We prepended an \empty token at the very beginning and we expand it now, % just before passing the control to \argtorun. % (Similarly, we have to think about #3 of \argcheckspacesY above: it is % either the null string, or it ends with \^^M---thus there is no danger % that a pair of braces would be stripped. % % But first, we have to remove the trailing space token. % \def\finishparsearg#1 \ArgTerm{\expandafter\argtorun\expandafter{#1}} % \parseargdef\foo{...} % is roughly equivalent to % \def\foo{\parsearg\Xfoo} % \def\Xfoo#1{...} % % Actually, I use \csname\string\foo\endcsname, ie. \\foo, as it is my % favourite TeX trick. --kasal, 16nov03 \def\parseargdef#1{% \expandafter \doparseargdef \csname\string#1\endcsname #1% } \def\doparseargdef#1#2{% \def#2{\parsearg#1}% \def#1##1% } % Several utility definitions with active space: { \obeyspaces \gdef\obeyedspace{ } % Make each space character in the input produce a normal interword % space in the output. Don't allow a line break at this space, as this % is used only in environments like @example, where each line of input % should produce a line of output anyway. % \gdef\sepspaces{\obeyspaces\let =\tie} % If an index command is used in an @example environment, any spaces % therein should become regular spaces in the raw index file, not the % expansion of \tie (\leavevmode \penalty \@M \ ). \gdef\unsepspaces{\let =\space} } \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next} % Define the framework for environments in texinfo.tex. It's used like this: % % \envdef\foo{...} % \def\Efoo{...} % % It's the responsibility of \envdef to insert \begingroup before the % actual body; @end closes the group after calling \Efoo. \envdef also % defines \thisenv, so the current environment is known; @end checks % whether the environment name matches. The \checkenv macro can also be % used to check whether the current environment is the one expected. % % Non-false conditionals (@iftex, @ifset) don't fit into this, so they % are not treated as environments; they don't open a group. (The % implementation of @end takes care not to call \endgroup in this % special case.) % At run-time, environments start with this: \def\startenvironment#1{\begingroup\def\thisenv{#1}} % initialize \let\thisenv\empty % ... but they get defined via ``\envdef\foo{...}'': \long\def\envdef#1#2{\def#1{\startenvironment#1#2}} \def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}} % Check whether we're in the right environment: \def\checkenv#1{% \def\temp{#1}% \ifx\thisenv\temp \else \badenverr \fi } % Environment mismatch, #1 expected: \def\badenverr{% \errhelp = \EMsimple \errmessage{This command can appear only \inenvironment\temp, not \inenvironment\thisenv}% } \def\inenvironment#1{% \ifx#1\empty outside of any environment% \else in environment \expandafter\string#1% \fi } % @end foo executes the definition of \Efoo. % But first, it executes a specialized version of \checkenv % \parseargdef\end{% \if 1\csname iscond.#1\endcsname \else % The general wording of \badenverr may not be ideal. \expandafter\checkenv\csname#1\endcsname \csname E#1\endcsname \endgroup \fi } \newhelp\EMsimple{Press RETURN to continue.} % Be sure we're in horizontal mode when doing a tie, since we make space % equivalent to this in @example-like environments. Otherwise, a space % at the beginning of a line will start with \penalty -- and % since \penalty is valid in vertical mode, we'd end up putting the % penalty on the vertical list instead of in the new paragraph. {\catcode`@ = 11 % Avoid using \@M directly, because that causes trouble % if the definition is written into an index file. \global\let\tiepenalty = \@M \gdef\tie{\leavevmode\penalty\tiepenalty\ } } % @: forces normal size whitespace following. \def\:{\spacefactor=1000 } % @* forces a line break. \def\*{\unskip\hfil\break\hbox{}\ignorespaces} % @/ allows a line break. \let\/=\allowbreak % @. is an end-of-sentence period. \def\.{.\spacefactor=\endofsentencespacefactor\space} % @! is an end-of-sentence bang. \def\!{!\spacefactor=\endofsentencespacefactor\space} % @? is an end-of-sentence query. \def\?{?\spacefactor=\endofsentencespacefactor\space} % @frenchspacing on|off says whether to put extra space after punctuation. % \def\onword{on} \def\offword{off} % \parseargdef\frenchspacing{% \def\temp{#1}% \ifx\temp\onword \plainfrenchspacing \else\ifx\temp\offword \plainnonfrenchspacing \else \errhelp = \EMsimple \errmessage{Unknown @frenchspacing option `\temp', must be on|off}% \fi\fi } % @w prevents a word break. Without the \leavevmode, @w at the % beginning of a paragraph, when TeX is still in vertical mode, would % produce a whole line of output instead of starting the paragraph. \def\w#1{\leavevmode\hbox{#1}} % @group ... @end group forces ... to be all on one page, by enclosing % it in a TeX vbox. We use \vtop instead of \vbox to construct the box % to keep its height that of a normal line. According to the rules for % \topskip (p.114 of the TeXbook), the glue inserted is % max (\topskip - \ht (first item), 0). If that height is large, % therefore, no glue is inserted, and the space between the headline and % the text is small, which looks bad. % % Another complication is that the group might be very large. This can % cause the glue on the previous page to be unduly stretched, because it % does not have much material. In this case, it's better to add an % explicit \vfill so that the extra space is at the bottom. The % threshold for doing this is if the group is more than \vfilllimit % percent of a page (\vfilllimit can be changed inside of @tex). % \newbox\groupbox \def\vfilllimit{0.7} % \envdef\group{% \ifnum\catcode`\^^M=\active \else \errhelp = \groupinvalidhelp \errmessage{@group invalid in context where filling is enabled}% \fi \startsavinginserts % \setbox\groupbox = \vtop\bgroup % Do @comment since we are called inside an environment such as % @example, where each end-of-line in the input causes an % end-of-line in the output. We don't want the end-of-line after % the `@group' to put extra space in the output. Since @group % should appear on a line by itself (according to the Texinfo % manual), we don't worry about eating any user text. \comment } % % The \vtop produces a box with normal height and large depth; thus, TeX puts % \baselineskip glue before it, and (when the next line of text is done) % \lineskip glue after it. Thus, space below is not quite equal to space % above. But it's pretty close. \def\Egroup{% % To get correct interline space between the last line of the group % and the first line afterwards, we have to propagate \prevdepth. \endgraf % Not \par, as it may have been set to \lisppar. \global\dimen1 = \prevdepth \egroup % End the \vtop. % \dimen0 is the vertical size of the group's box. \dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox % \dimen2 is how much space is left on the page (more or less). \dimen2 = \pageheight \advance\dimen2 by -\pagetotal % if the group doesn't fit on the current page, and it's a big big % group, force a page break. \ifdim \dimen0 > \dimen2 \ifdim \pagetotal < \vfilllimit\pageheight \page \fi \fi \box\groupbox \prevdepth = \dimen1 \checkinserts } % % TeX puts in an \escapechar (i.e., `@') at the beginning of the help % message, so this ends up printing `@group can only ...'. % \newhelp\groupinvalidhelp{% group can only be used in environments such as @example,^^J% where each line of input produces a line of output.} % @need space-in-mils % forces a page break if there is not space-in-mils remaining. \newdimen\mil \mil=0.001in \parseargdef\need{% % Ensure vertical mode, so we don't make a big box in the middle of a % paragraph. \par % % If the @need value is less than one line space, it's useless. \dimen0 = #1\mil \dimen2 = \ht\strutbox \advance\dimen2 by \dp\strutbox \ifdim\dimen0 > \dimen2 % % Do a \strut just to make the height of this box be normal, so the % normal leading is inserted relative to the preceding line. % And a page break here is fine. \vtop to #1\mil{\strut\vfil}% % % TeX does not even consider page breaks if a penalty added to the % main vertical list is 10000 or more. But in order to see if the % empty box we just added fits on the page, we must make it consider % page breaks. On the other hand, we don't want to actually break the % page after the empty box. So we use a penalty of 9999. % % There is an extremely small chance that TeX will actually break the % page at this \penalty, if there are no other feasible breakpoints in % sight. (If the user is using lots of big @group commands, which % almost-but-not-quite fill up a page, TeX will have a hard time doing % good page breaking, for example.) However, I could not construct an % example where a page broke at this \penalty; if it happens in a real % document, then we can reconsider our strategy. \penalty9999 % % Back up by the size of the box, whether we did a page break or not. \kern -#1\mil % % Do not allow a page break right after this kern. \nobreak \fi } % @br forces paragraph break (and is undocumented). \let\br = \par % @page forces the start of a new page. % \def\page{\par\vfill\supereject} % @exdent text.... % outputs text on separate line in roman font, starting at standard page margin % This records the amount of indent in the innermost environment. % That's how much \exdent should take out. \newskip\exdentamount % This defn is used inside fill environments such as @defun. \parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break} % This defn is used inside nofill environments such as @example. \parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount \leftline{\hskip\leftskip{\rm#1}}}} % @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current % paragraph. For more general purposes, use the \margin insertion % class. WHICH is `l' or `r'. Not documented, written for gawk manual. % \newskip\inmarginspacing \inmarginspacing=1cm \def\strutdepth{\dp\strutbox} % \def\doinmargin#1#2{\strut\vadjust{% \nobreak \kern-\strutdepth \vtop to \strutdepth{% \baselineskip=\strutdepth \vss % if you have multiple lines of stuff to put here, you'll need to % make the vbox yourself of the appropriate size. \ifx#1l% \llap{\ignorespaces #2\hskip\inmarginspacing}% \else \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}% \fi \null }% }} \def\inleftmargin{\doinmargin l} \def\inrightmargin{\doinmargin r} % % @inmargin{TEXT [, RIGHT-TEXT]} % (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right; % else use TEXT for both). % \def\inmargin#1{\parseinmargin #1,,\finish} \def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing. \setbox0 = \hbox{\ignorespaces #2}% \ifdim\wd0 > 0pt \def\lefttext{#1}% have both texts \def\righttext{#2}% \else \def\lefttext{#1}% have only one text \def\righttext{#1}% \fi % \ifodd\pageno \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin \else \def\temp{\inleftmargin\lefttext}% \fi \temp } % @| inserts a changebar to the left of the current line. It should % surround any changed text. This approach does *not* work if the % change spans more than two lines of output. To handle that, we would % have adopt a much more difficult approach (putting marks into the main % vertical list for the beginning and end of each change). This command % is not documented, not supported, and doesn't work. % \def\|{% % \vadjust can only be used in horizontal mode. \leavevmode % % Append this vertical mode material after the current line in the output. \vadjust{% % We want to insert a rule with the height and depth of the current % leading; that is exactly what \strutbox is supposed to record. \vskip-\baselineskip % % \vadjust-items are inserted at the left edge of the type. So % the \llap here moves out into the left-hand margin. \llap{% % % For a thicker or thinner bar, change the `1pt'. \vrule height\baselineskip width1pt % % This is the space between the bar and the text. \hskip 12pt }% }% } % @include FILE -- \input text of FILE. % \def\include{\parseargusing\filenamecatcodes\includezzz} \def\includezzz#1{% \pushthisfilestack \def\thisfile{#1}% {% \makevalueexpandable % we want to expand any @value in FILE. \turnoffactive % and allow special characters in the expansion \indexnofonts % Allow `@@' and other weird things in file names. \wlog{texinfo.tex: doing @include of #1^^J}% \edef\temp{\noexpand\input #1 }% % % This trickery is to read FILE outside of a group, in case it makes % definitions, etc. \expandafter }\temp \popthisfilestack } \def\filenamecatcodes{% \catcode`\\=\other \catcode`~=\other \catcode`^=\other \catcode`_=\other \catcode`|=\other \catcode`<=\other \catcode`>=\other \catcode`+=\other \catcode`-=\other \catcode`\`=\other \catcode`\'=\other } \def\pushthisfilestack{% \expandafter\pushthisfilestackX\popthisfilestack\StackTerm } \def\pushthisfilestackX{% \expandafter\pushthisfilestackY\thisfile\StackTerm } \def\pushthisfilestackY #1\StackTerm #2\StackTerm {% \gdef\popthisfilestack{\gdef\thisfile{#1}\gdef\popthisfilestack{#2}}% } \def\popthisfilestack{\errthisfilestackempty} \def\errthisfilestackempty{\errmessage{Internal error: the stack of filenames is empty.}} % \def\thisfile{} % @center line % outputs that line, centered. % \parseargdef\center{% \ifhmode \let\centersub\centerH \else \let\centersub\centerV \fi \centersub{\hfil \ignorespaces#1\unskip \hfil}% \let\centersub\relax % don't let the definition persist, just in case } \def\centerH#1{{% \hfil\break \advance\hsize by -\leftskip \advance\hsize by -\rightskip \line{#1}% \break }} % \newcount\centerpenalty \def\centerV#1{% % The idea here is the same as in \startdefun, \cartouche, etc.: if % @center is the first thing after a section heading, we need to wipe % out the negative parskip inserted by \sectionheading, but still % prevent a page break here. \centerpenalty = \lastpenalty \ifnum\centerpenalty>10000 \vskip\parskip \fi \ifnum\centerpenalty>9999 \penalty\centerpenalty \fi \line{\kern\leftskip #1\kern\rightskip}% } % @sp n outputs n lines of vertical space % \parseargdef\sp{\vskip #1\baselineskip} % @comment ...line which is ignored... % @c is the same as @comment % @ignore ... @end ignore is another way to write a comment % \def\comment{\begingroup \catcode`\^^M=\other% \catcode`\@=\other \catcode`\{=\other \catcode`\}=\other% \commentxxx} {\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}} % \let\c=\comment % @paragraphindent NCHARS % We'll use ems for NCHARS, close enough. % NCHARS can also be the word `asis' or `none'. % We cannot feasibly implement @paragraphindent asis, though. % \def\asisword{asis} % no translation, these are keywords \def\noneword{none} % \parseargdef\paragraphindent{% \def\temp{#1}% \ifx\temp\asisword \else \ifx\temp\noneword \defaultparindent = 0pt \else \defaultparindent = #1em \fi \fi \parindent = \defaultparindent } % @exampleindent NCHARS % We'll use ems for NCHARS like @paragraphindent. % It seems @exampleindent asis isn't necessary, but % I preserve it to make it similar to @paragraphindent. \parseargdef\exampleindent{% \def\temp{#1}% \ifx\temp\asisword \else \ifx\temp\noneword \lispnarrowing = 0pt \else \lispnarrowing = #1em \fi \fi } % @firstparagraphindent WORD % If WORD is `none', then suppress indentation of the first paragraph % after a section heading. If WORD is `insert', then do indent at such % paragraphs. % % The paragraph indentation is suppressed or not by calling % \suppressfirstparagraphindent, which the sectioning commands do. % We switch the definition of this back and forth according to WORD. % By default, we suppress indentation. % \def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent} \def\insertword{insert} % \parseargdef\firstparagraphindent{% \def\temp{#1}% \ifx\temp\noneword \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent \else\ifx\temp\insertword \let\suppressfirstparagraphindent = \relax \else \errhelp = \EMsimple \errmessage{Unknown @firstparagraphindent option `\temp'}% \fi\fi } % Here is how we actually suppress indentation. Redefine \everypar to % \kern backwards by \parindent, and then reset itself to empty. % % We also make \indent itself not actually do anything until the next % paragraph. % \gdef\dosuppressfirstparagraphindent{% \gdef\indent{% \restorefirstparagraphindent \indent }% \gdef\noindent{% \restorefirstparagraphindent \noindent }% \global\everypar = {% \kern -\parindent \restorefirstparagraphindent }% } \gdef\restorefirstparagraphindent{% \global \let \indent = \ptexindent \global \let \noindent = \ptexnoindent \global \everypar = {}% } % @refill is a no-op. \let\refill=\relax % If working on a large document in chapters, it is convenient to % be able to disable indexing, cross-referencing, and contents, for test runs. % This is done with @novalidate (before @setfilename). % \newif\iflinks \linkstrue % by default we want the aux files. \let\novalidate = \linksfalse % @setfilename is done at the beginning of every texinfo file. % So open here the files we need to have open while reading the input. % This makes it possible to make a .fmt file for texinfo. \def\setfilename{% \fixbackslash % Turn off hack to swallow `\input texinfo'. \iflinks \tryauxfile % Open the new aux file. TeX will close it automatically at exit. \immediate\openout\auxfile=\jobname.aux \fi % \openindices needs to do some work in any case. \openindices \let\setfilename=\comment % Ignore extra @setfilename cmds. % % If texinfo.cnf is present on the system, read it. % Useful for site-wide @afourpaper, etc. \openin 1 texinfo.cnf \ifeof 1 \else \input texinfo.cnf \fi \closein 1 % \comment % Ignore the actual filename. } % Called from \setfilename. % \def\openindices{% \newindex{cp}% \newcodeindex{fn}% \newcodeindex{vr}% \newcodeindex{tp}% \newcodeindex{ky}% \newcodeindex{pg}% } % @bye. \outer\def\bye{\pagealignmacro\tracingstats=1\ptexend} \message{pdf,} % adobe `portable' document format \newcount\tempnum \newcount\lnkcount \newtoks\filename \newcount\filenamelength \newcount\pgn \newtoks\toksA \newtoks\toksB \newtoks\toksC \newtoks\toksD \newbox\boxA \newcount\countA \newif\ifpdf \newif\ifpdfmakepagedest % when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1 % can be set). So we test for \relax and 0 as well as being undefined. \ifx\pdfoutput\thisisundefined \else \ifx\pdfoutput\relax \else \ifcase\pdfoutput \else \pdftrue \fi \fi \fi % PDF uses PostScript string constants for the names of xref targets, % for display in the outlines, and in other places. Thus, we have to % double any backslashes. Otherwise, a name like "\node" will be % interpreted as a newline (\n), followed by o, d, e. Not good. % % See http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html and % related messages. The final outcome is that it is up to the TeX user % to double the backslashes and otherwise make the string valid, so % that's what we do. pdftex 1.30.0 (ca.2005) introduced a primitive to % do this reliably, so we use it. % #1 is a control sequence in which to do the replacements, % which we \xdef. \def\txiescapepdf#1{% \ifx\pdfescapestring\thisisundefined % No primitive available; should we give a warning or log? % Many times it won't matter. \else % The expandable \pdfescapestring primitive escapes parentheses, % backslashes, and other special chars. \xdef#1{\pdfescapestring{#1}}% \fi } \newhelp\nopdfimagehelp{Texinfo supports .png, .jpg, .jpeg, and .pdf images with PDF output, and none of those formats could be found. (.eps cannot be supported due to the design of the PDF format; use regular TeX (DVI output) for that.)} \ifpdf % % Color manipulation macros based on pdfcolor.tex, % except using rgb instead of cmyk; the latter is said to render as a % very dark gray on-screen and a very dark halftone in print, instead % of actual black. \def\rgbDarkRed{0.50 0.09 0.12} \def\rgbBlack{0 0 0} % % k sets the color for filling (usual text, etc.); % K sets the color for stroking (thin rules, e.g., normal _'s). \def\pdfsetcolor#1{\pdfliteral{#1 rg #1 RG}} % % Set color, and create a mark which defines \thiscolor accordingly, % so that \makeheadline knows which color to restore. \def\setcolor#1{% \xdef\lastcolordefs{\gdef\noexpand\thiscolor{#1}}% \domark \pdfsetcolor{#1}% } % \def\maincolor{\rgbBlack} \pdfsetcolor{\maincolor} \edef\thiscolor{\maincolor} \def\lastcolordefs{} % \def\makefootline{% \baselineskip24pt \line{\pdfsetcolor{\maincolor}\the\footline}% } % \def\makeheadline{% \vbox to 0pt{% \vskip-22.5pt \line{% \vbox to8.5pt{}% % Extract \thiscolor definition from the marks. \getcolormarks % Typeset the headline with \maincolor, then restore the color. \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}% }% \vss }% \nointerlineskip } % % \pdfcatalog{/PageMode /UseOutlines} % % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto). \def\dopdfimage#1#2#3{% \def\pdfimagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}% \def\pdfimageheight{#3}\setbox2 = \hbox{\ignorespaces #3}% % % pdftex (and the PDF format) support .pdf, .png, .jpg (among % others). Let's try in that order, PDF first since if % someone has a scalable image, presumably better to use that than a % bitmap. \let\pdfimgext=\empty \begingroup \openin 1 #1.pdf \ifeof 1 \openin 1 #1.PDF \ifeof 1 \openin 1 #1.png \ifeof 1 \openin 1 #1.jpg \ifeof 1 \openin 1 #1.jpeg \ifeof 1 \openin 1 #1.JPG \ifeof 1 \errhelp = \nopdfimagehelp \errmessage{Could not find image file #1 for pdf}% \else \gdef\pdfimgext{JPG}% \fi \else \gdef\pdfimgext{jpeg}% \fi \else \gdef\pdfimgext{jpg}% \fi \else \gdef\pdfimgext{png}% \fi \else \gdef\pdfimgext{PDF}% \fi \else \gdef\pdfimgext{pdf}% \fi \closein 1 \endgroup % % without \immediate, ancient pdftex seg faults when the same image is % included twice. (Version 3.14159-pre-1.0-unofficial-20010704.) \ifnum\pdftexversion < 14 \immediate\pdfimage \else \immediate\pdfximage \fi \ifdim \wd0 >0pt width \pdfimagewidth \fi \ifdim \wd2 >0pt height \pdfimageheight \fi \ifnum\pdftexversion<13 #1.\pdfimgext \else {#1.\pdfimgext}% \fi \ifnum\pdftexversion < 14 \else \pdfrefximage \pdflastximage \fi} % \def\pdfmkdest#1{{% % We have to set dummies so commands such as @code, and characters % such as \, aren't expanded when present in a section title. \indexnofonts \turnoffactive \makevalueexpandable \def\pdfdestname{#1}% \txiescapepdf\pdfdestname \safewhatsit{\pdfdest name{\pdfdestname} xyz}% }} % % used to mark target names; must be expandable. \def\pdfmkpgn#1{#1} % % by default, use a color that is dark enough to print on paper as % nearly black, but still distinguishable for online viewing. \def\urlcolor{\rgbDarkRed} \def\linkcolor{\rgbDarkRed} \def\endlink{\setcolor{\maincolor}\pdfendlink} % % Adding outlines to PDF; macros for calculating structure of outlines % come from Petr Olsak \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0% \else \csname#1\endcsname \fi} \def\advancenumber#1{\tempnum=\expnumber{#1}\relax \advance\tempnum by 1 \expandafter\xdef\csname#1\endcsname{\the\tempnum}} % % #1 is the section text, which is what will be displayed in the % outline by the pdf viewer. #2 is the pdf expression for the number % of subentries (or empty, for subsubsections). #3 is the node text, % which might be empty if this toc entry had no corresponding node. % #4 is the page number % \def\dopdfoutline#1#2#3#4{% % Generate a link to the node text if that exists; else, use the % page number. We could generate a destination for the section % text in the case where a section has no node, but it doesn't % seem worth the trouble, since most documents are normally structured. \edef\pdfoutlinedest{#3}% \ifx\pdfoutlinedest\empty \def\pdfoutlinedest{#4}% \else \txiescapepdf\pdfoutlinedest \fi % % Also escape PDF chars in the display string. \edef\pdfoutlinetext{#1}% \txiescapepdf\pdfoutlinetext % \pdfoutline goto name{\pdfmkpgn{\pdfoutlinedest}}#2{\pdfoutlinetext}% } % \def\pdfmakeoutlines{% \begingroup % Read toc silently, to get counts of subentries for \pdfoutline. \def\partentry##1##2##3##4{}% ignore parts in the outlines \def\numchapentry##1##2##3##4{% \def\thischapnum{##2}% \def\thissecnum{0}% \def\thissubsecnum{0}% }% \def\numsecentry##1##2##3##4{% \advancenumber{chap\thischapnum}% \def\thissecnum{##2}% \def\thissubsecnum{0}% }% \def\numsubsecentry##1##2##3##4{% \advancenumber{sec\thissecnum}% \def\thissubsecnum{##2}% }% \def\numsubsubsecentry##1##2##3##4{% \advancenumber{subsec\thissubsecnum}% }% \def\thischapnum{0}% \def\thissecnum{0}% \def\thissubsecnum{0}% % % use \def rather than \let here because we redefine \chapentry et % al. a second time, below. \def\appentry{\numchapentry}% \def\appsecentry{\numsecentry}% \def\appsubsecentry{\numsubsecentry}% \def\appsubsubsecentry{\numsubsubsecentry}% \def\unnchapentry{\numchapentry}% \def\unnsecentry{\numsecentry}% \def\unnsubsecentry{\numsubsecentry}% \def\unnsubsubsecentry{\numsubsubsecentry}% \readdatafile{toc}% % % Read toc second time, this time actually producing the outlines. % The `-' means take the \expnumber as the absolute number of % subentries, which we calculated on our first read of the .toc above. % % We use the node names as the destinations. \def\numchapentry##1##2##3##4{% \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}% \def\numsecentry##1##2##3##4{% \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}% \def\numsubsecentry##1##2##3##4{% \dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}% \def\numsubsubsecentry##1##2##3##4{% count is always zero \dopdfoutline{##1}{}{##3}{##4}}% % % PDF outlines are displayed using system fonts, instead of % document fonts. Therefore we cannot use special characters, % since the encoding is unknown. For example, the eogonek from % Latin 2 (0xea) gets translated to a | character. Info from % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100. % % TODO this right, we have to translate 8-bit characters to % their "best" equivalent, based on the @documentencoding. Too % much work for too little return. Just use the ASCII equivalents % we use for the index sort strings. % \indexnofonts \setupdatafile % We can have normal brace characters in the PDF outlines, unlike % Texinfo index files. So set that up. \def\{{\lbracecharliteral}% \def\}{\rbracecharliteral}% \catcode`\\=\active \otherbackslash \input \tocreadfilename \endgroup } {\catcode`[=1 \catcode`]=2 \catcode`{=\other \catcode`}=\other \gdef\lbracecharliteral[{]% \gdef\rbracecharliteral[}]% ] % \def\skipspaces#1{\def\PP{#1}\def\D{|}% \ifx\PP\D\let\nextsp\relax \else\let\nextsp\skipspaces \addtokens{\filename}{\PP}% \advance\filenamelength by 1 \fi \nextsp} \def\getfilename#1{% \filenamelength=0 % If we don't expand the argument now, \skipspaces will get % snagged on things like "@value{foo}". \edef\temp{#1}% \expandafter\skipspaces\temp|\relax } \ifnum\pdftexversion < 14 \let \startlink \pdfannotlink \else \let \startlink \pdfstartlink \fi % make a live url in pdf output. \def\pdfurl#1{% \begingroup % it seems we really need yet another set of dummies; have not % tried to figure out what each command should do in the context % of @url. for now, just make @/ a no-op, that's the only one % people have actually reported a problem with. % \normalturnoffactive \def\@{@}% \let\/=\empty \makevalueexpandable % do we want to go so far as to use \indexnofonts instead of just % special-casing \var here? \def\var##1{##1}% % \leavevmode\setcolor{\urlcolor}% \startlink attr{/Border [0 0 0]}% user{/Subtype /Link /A << /S /URI /URI (#1) >>}% \endgroup} \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}} \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks} \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks} \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}} \def\maketoks{% \expandafter\poptoks\the\toksA|ENDTOKS|\relax \ifx\first0\adn0 \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3 \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6 \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9 \else \ifnum0=\countA\else\makelink\fi \ifx\first.\let\next=\done\else \let\next=\maketoks \addtokens{\toksB}{\the\toksD} \ifx\first,\addtokens{\toksB}{\space}\fi \fi \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi \next} \def\makelink{\addtokens{\toksB}% {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0} \def\pdflink#1{% \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}} \setcolor{\linkcolor}#1\endlink} \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st} \else % non-pdf mode \let\pdfmkdest = \gobble \let\pdfurl = \gobble \let\endlink = \relax \let\setcolor = \gobble \let\pdfsetcolor = \gobble \let\pdfmakeoutlines = \relax \fi % \ifx\pdfoutput \message{fonts,} % Change the current font style to #1, remembering it in \curfontstyle. % For now, we do not accumulate font styles: @b{@i{foo}} prints foo in % italics, not bold italics. % \def\setfontstyle#1{% \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd. \csname ten#1\endcsname % change the current font } % Select #1 fonts with the current style. % \def\selectfonts#1{\csname #1fonts\endcsname \csname\curfontstyle\endcsname} \def\rm{\fam=0 \setfontstyle{rm}} \def\it{\fam=\itfam \setfontstyle{it}} \def\sl{\fam=\slfam \setfontstyle{sl}} \def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf} \def\tt{\fam=\ttfam \setfontstyle{tt}} % Unfortunately, we have to override this for titles and the like, since % in those cases "rm" is bold. Sigh. \def\rmisbold{\rm\def\curfontstyle{bf}} % Texinfo sort of supports the sans serif font style, which plain TeX does not. % So we set up a \sf. \newfam\sffam \def\sf{\fam=\sffam \setfontstyle{sf}} \let\li = \sf % Sometimes we call it \li, not \sf. % We don't need math for this font style. \def\ttsl{\setfontstyle{ttsl}} % Set the baselineskip to #1, and the lineskip and strut size % correspondingly. There is no deep meaning behind these magic numbers % used as factors; they just match (closely enough) what Knuth defined. % \def\lineskipfactor{.08333} \def\strutheightpercent{.70833} \def\strutdepthpercent {.29167} % % can get a sort of poor man's double spacing by redefining this. \def\baselinefactor{1} % \newdimen\textleading \def\setleading#1{% \dimen0 = #1\relax \normalbaselineskip = \baselinefactor\dimen0 \normallineskip = \lineskipfactor\normalbaselineskip \normalbaselines \setbox\strutbox =\hbox{% \vrule width0pt height\strutheightpercent\baselineskip depth \strutdepthpercent \baselineskip }% } % PDF CMaps. See also LaTeX's t1.cmap. % % do nothing with this by default. \expandafter\let\csname cmapOT1\endcsname\gobble \expandafter\let\csname cmapOT1IT\endcsname\gobble \expandafter\let\csname cmapOT1TT\endcsname\gobble % if we are producing pdf, and we have \pdffontattr, then define cmaps. % (\pdffontattr was introduced many years ago, but people still run % older pdftex's; it's easy to conditionalize, so we do.) \ifpdf \ifx\pdffontattr\thisisundefined \else \begingroup \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char. \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap %%DocumentNeededResources: ProcSet (CIDInit) %%IncludeResource: ProcSet (CIDInit) %%BeginResource: CMap (TeX-OT1-0) %%Title: (TeX-OT1-0 TeX OT1 0) %%Version: 1.000 %%EndComments /CIDInit /ProcSet findresource begin 12 dict begin begincmap /CIDSystemInfo << /Registry (TeX) /Ordering (OT1) /Supplement 0 >> def /CMapName /TeX-OT1-0 def /CMapType 2 def 1 begincodespacerange <00> <7F> endcodespacerange 8 beginbfrange <00> <01> <0393> <09> <0A> <03A8> <23> <26> <0023> <28> <3B> <0028> <3F> <5B> <003F> <5D> <5E> <005D> <61> <7A> <0061> <7B> <7C> <2013> endbfrange 40 beginbfchar <02> <0398> <03> <039B> <04> <039E> <05> <03A0> <06> <03A3> <07> <03D2> <08> <03A6> <0B> <00660066> <0C> <00660069> <0D> <0066006C> <0E> <006600660069> <0F> <00660066006C> <10> <0131> <11> <0237> <12> <0060> <13> <00B4> <14> <02C7> <15> <02D8> <16> <00AF> <17> <02DA> <18> <00B8> <19> <00DF> <1A> <00E6> <1B> <0153> <1C> <00F8> <1D> <00C6> <1E> <0152> <1F> <00D8> <21> <0021> <22> <201D> <27> <2019> <3C> <00A1> <3D> <003D> <3E> <00BF> <5C> <201C> <5F> <02D9> <60> <2018> <7D> <02DD> <7E> <007E> <7F> <00A8> endbfchar endcmap CMapName currentdict /CMap defineresource pop end end %%EndResource %%EOF }\endgroup \expandafter\edef\csname cmapOT1\endcsname#1{% \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}% }% % % \cmapOT1IT \begingroup \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char. \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap %%DocumentNeededResources: ProcSet (CIDInit) %%IncludeResource: ProcSet (CIDInit) %%BeginResource: CMap (TeX-OT1IT-0) %%Title: (TeX-OT1IT-0 TeX OT1IT 0) %%Version: 1.000 %%EndComments /CIDInit /ProcSet findresource begin 12 dict begin begincmap /CIDSystemInfo << /Registry (TeX) /Ordering (OT1IT) /Supplement 0 >> def /CMapName /TeX-OT1IT-0 def /CMapType 2 def 1 begincodespacerange <00> <7F> endcodespacerange 8 beginbfrange <00> <01> <0393> <09> <0A> <03A8> <25> <26> <0025> <28> <3B> <0028> <3F> <5B> <003F> <5D> <5E> <005D> <61> <7A> <0061> <7B> <7C> <2013> endbfrange 42 beginbfchar <02> <0398> <03> <039B> <04> <039E> <05> <03A0> <06> <03A3> <07> <03D2> <08> <03A6> <0B> <00660066> <0C> <00660069> <0D> <0066006C> <0E> <006600660069> <0F> <00660066006C> <10> <0131> <11> <0237> <12> <0060> <13> <00B4> <14> <02C7> <15> <02D8> <16> <00AF> <17> <02DA> <18> <00B8> <19> <00DF> <1A> <00E6> <1B> <0153> <1C> <00F8> <1D> <00C6> <1E> <0152> <1F> <00D8> <21> <0021> <22> <201D> <23> <0023> <24> <00A3> <27> <2019> <3C> <00A1> <3D> <003D> <3E> <00BF> <5C> <201C> <5F> <02D9> <60> <2018> <7D> <02DD> <7E> <007E> <7F> <00A8> endbfchar endcmap CMapName currentdict /CMap defineresource pop end end %%EndResource %%EOF }\endgroup \expandafter\edef\csname cmapOT1IT\endcsname#1{% \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}% }% % % \cmapOT1TT \begingroup \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char. \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap %%DocumentNeededResources: ProcSet (CIDInit) %%IncludeResource: ProcSet (CIDInit) %%BeginResource: CMap (TeX-OT1TT-0) %%Title: (TeX-OT1TT-0 TeX OT1TT 0) %%Version: 1.000 %%EndComments /CIDInit /ProcSet findresource begin 12 dict begin begincmap /CIDSystemInfo << /Registry (TeX) /Ordering (OT1TT) /Supplement 0 >> def /CMapName /TeX-OT1TT-0 def /CMapType 2 def 1 begincodespacerange <00> <7F> endcodespacerange 5 beginbfrange <00> <01> <0393> <09> <0A> <03A8> <21> <26> <0021> <28> <5F> <0028> <61> <7E> <0061> endbfrange 32 beginbfchar <02> <0398> <03> <039B> <04> <039E> <05> <03A0> <06> <03A3> <07> <03D2> <08> <03A6> <0B> <2191> <0C> <2193> <0D> <0027> <0E> <00A1> <0F> <00BF> <10> <0131> <11> <0237> <12> <0060> <13> <00B4> <14> <02C7> <15> <02D8> <16> <00AF> <17> <02DA> <18> <00B8> <19> <00DF> <1A> <00E6> <1B> <0153> <1C> <00F8> <1D> <00C6> <1E> <0152> <1F> <00D8> <20> <2423> <27> <2019> <60> <2018> <7F> <00A8> endbfchar endcmap CMapName currentdict /CMap defineresource pop end end %%EndResource %%EOF }\endgroup \expandafter\edef\csname cmapOT1TT\endcsname#1{% \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}% }% \fi\fi % Set the font macro #1 to the font named \fontprefix#2. % #3 is the font's design size, #4 is a scale factor, #5 is the CMap % encoding (only OT1, OT1IT and OT1TT are allowed, or empty to omit). % Example: % #1 = \textrm % #2 = \rmshape % #3 = 10 % #4 = \mainmagstep % #5 = OT1 % \def\setfont#1#2#3#4#5{% \font#1=\fontprefix#2#3 scaled #4 \csname cmap#5\endcsname#1% } % This is what gets called when #5 of \setfont is empty. \let\cmap\gobble % % (end of cmaps) % Use cm as the default font prefix. % To specify the font prefix, you must define \fontprefix % before you read in texinfo.tex. \ifx\fontprefix\thisisundefined \def\fontprefix{cm} \fi % Support font families that don't use the same naming scheme as CM. \def\rmshape{r} \def\rmbshape{bx} % where the normal face is bold \def\bfshape{b} \def\bxshape{bx} \def\ttshape{tt} \def\ttbshape{tt} \def\ttslshape{sltt} \def\itshape{ti} \def\itbshape{bxti} \def\slshape{sl} \def\slbshape{bxsl} \def\sfshape{ss} \def\sfbshape{ss} \def\scshape{csc} \def\scbshape{csc} % Definitions for a main text size of 11pt. (The default in Texinfo.) % \def\definetextfontsizexi{% % Text fonts (11.2pt, magstep1). \def\textnominalsize{11pt} \edef\mainmagstep{\magstephalf} \setfont\textrm\rmshape{10}{\mainmagstep}{OT1} \setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT} \setfont\textbf\bfshape{10}{\mainmagstep}{OT1} \setfont\textit\itshape{10}{\mainmagstep}{OT1IT} \setfont\textsl\slshape{10}{\mainmagstep}{OT1} \setfont\textsf\sfshape{10}{\mainmagstep}{OT1} \setfont\textsc\scshape{10}{\mainmagstep}{OT1} \setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT} \font\texti=cmmi10 scaled \mainmagstep \font\textsy=cmsy10 scaled \mainmagstep \def\textecsize{1095} % A few fonts for @defun names and args. \setfont\defbf\bfshape{10}{\magstep1}{OT1} \setfont\deftt\ttshape{10}{\magstep1}{OT1TT} \setfont\defttsl\ttslshape{10}{\magstep1}{OT1TT} \def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf} % Fonts for indices, footnotes, small examples (9pt). \def\smallnominalsize{9pt} \setfont\smallrm\rmshape{9}{1000}{OT1} \setfont\smalltt\ttshape{9}{1000}{OT1TT} \setfont\smallbf\bfshape{10}{900}{OT1} \setfont\smallit\itshape{9}{1000}{OT1IT} \setfont\smallsl\slshape{9}{1000}{OT1} \setfont\smallsf\sfshape{9}{1000}{OT1} \setfont\smallsc\scshape{10}{900}{OT1} \setfont\smallttsl\ttslshape{10}{900}{OT1TT} \font\smalli=cmmi9 \font\smallsy=cmsy9 \def\smallecsize{0900} % Fonts for small examples (8pt). \def\smallernominalsize{8pt} \setfont\smallerrm\rmshape{8}{1000}{OT1} \setfont\smallertt\ttshape{8}{1000}{OT1TT} \setfont\smallerbf\bfshape{10}{800}{OT1} \setfont\smallerit\itshape{8}{1000}{OT1IT} \setfont\smallersl\slshape{8}{1000}{OT1} \setfont\smallersf\sfshape{8}{1000}{OT1} \setfont\smallersc\scshape{10}{800}{OT1} \setfont\smallerttsl\ttslshape{10}{800}{OT1TT} \font\smalleri=cmmi8 \font\smallersy=cmsy8 \def\smallerecsize{0800} % Fonts for title page (20.4pt): \def\titlenominalsize{20pt} \setfont\titlerm\rmbshape{12}{\magstep3}{OT1} \setfont\titleit\itbshape{10}{\magstep4}{OT1IT} \setfont\titlesl\slbshape{10}{\magstep4}{OT1} \setfont\titlett\ttbshape{12}{\magstep3}{OT1TT} \setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT} \setfont\titlesf\sfbshape{17}{\magstep1}{OT1} \let\titlebf=\titlerm \setfont\titlesc\scbshape{10}{\magstep4}{OT1} \font\titlei=cmmi12 scaled \magstep3 \font\titlesy=cmsy10 scaled \magstep4 \def\titleecsize{2074} % Chapter (and unnumbered) fonts (17.28pt). \def\chapnominalsize{17pt} \setfont\chaprm\rmbshape{12}{\magstep2}{OT1} \setfont\chapit\itbshape{10}{\magstep3}{OT1IT} \setfont\chapsl\slbshape{10}{\magstep3}{OT1} \setfont\chaptt\ttbshape{12}{\magstep2}{OT1TT} \setfont\chapttsl\ttslshape{10}{\magstep3}{OT1TT} \setfont\chapsf\sfbshape{17}{1000}{OT1} \let\chapbf=\chaprm \setfont\chapsc\scbshape{10}{\magstep3}{OT1} \font\chapi=cmmi12 scaled \magstep2 \font\chapsy=cmsy10 scaled \magstep3 \def\chapecsize{1728} % Section fonts (14.4pt). \def\secnominalsize{14pt} \setfont\secrm\rmbshape{12}{\magstep1}{OT1} \setfont\secit\itbshape{10}{\magstep2}{OT1IT} \setfont\secsl\slbshape{10}{\magstep2}{OT1} \setfont\sectt\ttbshape{12}{\magstep1}{OT1TT} \setfont\secttsl\ttslshape{10}{\magstep2}{OT1TT} \setfont\secsf\sfbshape{12}{\magstep1}{OT1} \let\secbf\secrm \setfont\secsc\scbshape{10}{\magstep2}{OT1} \font\seci=cmmi12 scaled \magstep1 \font\secsy=cmsy10 scaled \magstep2 \def\sececsize{1440} % Subsection fonts (13.15pt). \def\ssecnominalsize{13pt} \setfont\ssecrm\rmbshape{12}{\magstephalf}{OT1} \setfont\ssecit\itbshape{10}{1315}{OT1IT} \setfont\ssecsl\slbshape{10}{1315}{OT1} \setfont\ssectt\ttbshape{12}{\magstephalf}{OT1TT} \setfont\ssecttsl\ttslshape{10}{1315}{OT1TT} \setfont\ssecsf\sfbshape{12}{\magstephalf}{OT1} \let\ssecbf\ssecrm \setfont\ssecsc\scbshape{10}{1315}{OT1} \font\sseci=cmmi12 scaled \magstephalf \font\ssecsy=cmsy10 scaled 1315 \def\ssececsize{1200} % Reduced fonts for @acro in text (10pt). \def\reducednominalsize{10pt} \setfont\reducedrm\rmshape{10}{1000}{OT1} \setfont\reducedtt\ttshape{10}{1000}{OT1TT} \setfont\reducedbf\bfshape{10}{1000}{OT1} \setfont\reducedit\itshape{10}{1000}{OT1IT} \setfont\reducedsl\slshape{10}{1000}{OT1} \setfont\reducedsf\sfshape{10}{1000}{OT1} \setfont\reducedsc\scshape{10}{1000}{OT1} \setfont\reducedttsl\ttslshape{10}{1000}{OT1TT} \font\reducedi=cmmi10 \font\reducedsy=cmsy10 \def\reducedecsize{1000} \textleading = 13.2pt % line spacing for 11pt CM \textfonts % reset the current fonts \rm } % end of 11pt text font size definitions, \definetextfontsizexi % Definitions to make the main text be 10pt Computer Modern, with % section, chapter, etc., sizes following suit. This is for the GNU % Press printing of the Emacs 22 manual. Maybe other manuals in the % future. Used with @smallbook, which sets the leading to 12pt. % \def\definetextfontsizex{% % Text fonts (10pt). \def\textnominalsize{10pt} \edef\mainmagstep{1000} \setfont\textrm\rmshape{10}{\mainmagstep}{OT1} \setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT} \setfont\textbf\bfshape{10}{\mainmagstep}{OT1} \setfont\textit\itshape{10}{\mainmagstep}{OT1IT} \setfont\textsl\slshape{10}{\mainmagstep}{OT1} \setfont\textsf\sfshape{10}{\mainmagstep}{OT1} \setfont\textsc\scshape{10}{\mainmagstep}{OT1} \setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT} \font\texti=cmmi10 scaled \mainmagstep \font\textsy=cmsy10 scaled \mainmagstep \def\textecsize{1000} % A few fonts for @defun names and args. \setfont\defbf\bfshape{10}{\magstephalf}{OT1} \setfont\deftt\ttshape{10}{\magstephalf}{OT1TT} \setfont\defttsl\ttslshape{10}{\magstephalf}{OT1TT} \def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf} % Fonts for indices, footnotes, small examples (9pt). \def\smallnominalsize{9pt} \setfont\smallrm\rmshape{9}{1000}{OT1} \setfont\smalltt\ttshape{9}{1000}{OT1TT} \setfont\smallbf\bfshape{10}{900}{OT1} \setfont\smallit\itshape{9}{1000}{OT1IT} \setfont\smallsl\slshape{9}{1000}{OT1} \setfont\smallsf\sfshape{9}{1000}{OT1} \setfont\smallsc\scshape{10}{900}{OT1} \setfont\smallttsl\ttslshape{10}{900}{OT1TT} \font\smalli=cmmi9 \font\smallsy=cmsy9 \def\smallecsize{0900} % Fonts for small examples (8pt). \def\smallernominalsize{8pt} \setfont\smallerrm\rmshape{8}{1000}{OT1} \setfont\smallertt\ttshape{8}{1000}{OT1TT} \setfont\smallerbf\bfshape{10}{800}{OT1} \setfont\smallerit\itshape{8}{1000}{OT1IT} \setfont\smallersl\slshape{8}{1000}{OT1} \setfont\smallersf\sfshape{8}{1000}{OT1} \setfont\smallersc\scshape{10}{800}{OT1} \setfont\smallerttsl\ttslshape{10}{800}{OT1TT} \font\smalleri=cmmi8 \font\smallersy=cmsy8 \def\smallerecsize{0800} % Fonts for title page (20.4pt): \def\titlenominalsize{20pt} \setfont\titlerm\rmbshape{12}{\magstep3}{OT1} \setfont\titleit\itbshape{10}{\magstep4}{OT1IT} \setfont\titlesl\slbshape{10}{\magstep4}{OT1} \setfont\titlett\ttbshape{12}{\magstep3}{OT1TT} \setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT} \setfont\titlesf\sfbshape{17}{\magstep1}{OT1} \let\titlebf=\titlerm \setfont\titlesc\scbshape{10}{\magstep4}{OT1} \font\titlei=cmmi12 scaled \magstep3 \font\titlesy=cmsy10 scaled \magstep4 \def\titleecsize{2074} % Chapter fonts (14.4pt). \def\chapnominalsize{14pt} \setfont\chaprm\rmbshape{12}{\magstep1}{OT1} \setfont\chapit\itbshape{10}{\magstep2}{OT1IT} \setfont\chapsl\slbshape{10}{\magstep2}{OT1} \setfont\chaptt\ttbshape{12}{\magstep1}{OT1TT} \setfont\chapttsl\ttslshape{10}{\magstep2}{OT1TT} \setfont\chapsf\sfbshape{12}{\magstep1}{OT1} \let\chapbf\chaprm \setfont\chapsc\scbshape{10}{\magstep2}{OT1} \font\chapi=cmmi12 scaled \magstep1 \font\chapsy=cmsy10 scaled \magstep2 \def\chapecsize{1440} % Section fonts (12pt). \def\secnominalsize{12pt} \setfont\secrm\rmbshape{12}{1000}{OT1} \setfont\secit\itbshape{10}{\magstep1}{OT1IT} \setfont\secsl\slbshape{10}{\magstep1}{OT1} \setfont\sectt\ttbshape{12}{1000}{OT1TT} \setfont\secttsl\ttslshape{10}{\magstep1}{OT1TT} \setfont\secsf\sfbshape{12}{1000}{OT1} \let\secbf\secrm \setfont\secsc\scbshape{10}{\magstep1}{OT1} \font\seci=cmmi12 \font\secsy=cmsy10 scaled \magstep1 \def\sececsize{1200} % Subsection fonts (10pt). \def\ssecnominalsize{10pt} \setfont\ssecrm\rmbshape{10}{1000}{OT1} \setfont\ssecit\itbshape{10}{1000}{OT1IT} \setfont\ssecsl\slbshape{10}{1000}{OT1} \setfont\ssectt\ttbshape{10}{1000}{OT1TT} \setfont\ssecttsl\ttslshape{10}{1000}{OT1TT} \setfont\ssecsf\sfbshape{10}{1000}{OT1} \let\ssecbf\ssecrm \setfont\ssecsc\scbshape{10}{1000}{OT1} \font\sseci=cmmi10 \font\ssecsy=cmsy10 \def\ssececsize{1000} % Reduced fonts for @acro in text (9pt). \def\reducednominalsize{9pt} \setfont\reducedrm\rmshape{9}{1000}{OT1} \setfont\reducedtt\ttshape{9}{1000}{OT1TT} \setfont\reducedbf\bfshape{10}{900}{OT1} \setfont\reducedit\itshape{9}{1000}{OT1IT} \setfont\reducedsl\slshape{9}{1000}{OT1} \setfont\reducedsf\sfshape{9}{1000}{OT1} \setfont\reducedsc\scshape{10}{900}{OT1} \setfont\reducedttsl\ttslshape{10}{900}{OT1TT} \font\reducedi=cmmi9 \font\reducedsy=cmsy9 \def\reducedecsize{0900} \divide\parskip by 2 % reduce space between paragraphs \textleading = 12pt % line spacing for 10pt CM \textfonts % reset the current fonts \rm } % end of 10pt text font size definitions, \definetextfontsizex % We provide the user-level command % @fonttextsize 10 % (or 11) to redefine the text font size. pt is assumed. % \def\xiword{11} \def\xword{10} \def\xwordpt{10pt} % \parseargdef\fonttextsize{% \def\textsizearg{#1}% %\wlog{doing @fonttextsize \textsizearg}% % % Set \globaldefs so that documents can use this inside @tex, since % makeinfo 4.8 does not support it, but we need it nonetheless. % \begingroup \globaldefs=1 \ifx\textsizearg\xword \definetextfontsizex \else \ifx\textsizearg\xiword \definetextfontsizexi \else \errhelp=\EMsimple \errmessage{@fonttextsize only supports `10' or `11', not `\textsizearg'} \fi\fi \endgroup } % In order for the font changes to affect most math symbols and letters, % we have to define the \textfont of the standard families. Since % texinfo doesn't allow for producing subscripts and superscripts except % in the main text, we don't bother to reset \scriptfont and % \scriptscriptfont (which would also require loading a lot more fonts). % \def\resetmathfonts{% \textfont0=\tenrm \textfont1=\teni \textfont2=\tensy \textfont\itfam=\tenit \textfont\slfam=\tensl \textfont\bffam=\tenbf \textfont\ttfam=\tentt \textfont\sffam=\tensf } % The font-changing commands redefine the meanings of \tenSTYLE, instead % of just \STYLE. We do this because \STYLE needs to also set the % current \fam for math mode. Our \STYLE (e.g., \rm) commands hardwire % \tenSTYLE to set the current font. % % Each font-changing command also sets the names \lsize (one size lower) % and \lllsize (three sizes lower). These relative commands are used in % the LaTeX logo and acronyms. % % This all needs generalizing, badly. % \def\textfonts{% \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy \let\tenttsl=\textttsl \def\curfontsize{text}% \def\lsize{reduced}\def\lllsize{smaller}% \resetmathfonts \setleading{\textleading}} \def\titlefonts{% \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy \let\tenttsl=\titlettsl \def\curfontsize{title}% \def\lsize{chap}\def\lllsize{subsec}% \resetmathfonts \setleading{27pt}} \def\titlefont#1{{\titlefonts\rmisbold #1}} \def\chapfonts{% \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy \let\tenttsl=\chapttsl \def\curfontsize{chap}% \def\lsize{sec}\def\lllsize{text}% \resetmathfonts \setleading{19pt}} \def\secfonts{% \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy \let\tenttsl=\secttsl \def\curfontsize{sec}% \def\lsize{subsec}\def\lllsize{reduced}% \resetmathfonts \setleading{16pt}} \def\subsecfonts{% \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy \let\tenttsl=\ssecttsl \def\curfontsize{ssec}% \def\lsize{text}\def\lllsize{small}% \resetmathfonts \setleading{15pt}} \let\subsubsecfonts = \subsecfonts \def\reducedfonts{% \let\tenrm=\reducedrm \let\tenit=\reducedit \let\tensl=\reducedsl \let\tenbf=\reducedbf \let\tentt=\reducedtt \let\reducedcaps=\reducedsc \let\tensf=\reducedsf \let\teni=\reducedi \let\tensy=\reducedsy \let\tenttsl=\reducedttsl \def\curfontsize{reduced}% \def\lsize{small}\def\lllsize{smaller}% \resetmathfonts \setleading{10.5pt}} \def\smallfonts{% \let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl \let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc \let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy \let\tenttsl=\smallttsl \def\curfontsize{small}% \def\lsize{smaller}\def\lllsize{smaller}% \resetmathfonts \setleading{10.5pt}} \def\smallerfonts{% \let\tenrm=\smallerrm \let\tenit=\smallerit \let\tensl=\smallersl \let\tenbf=\smallerbf \let\tentt=\smallertt \let\smallcaps=\smallersc \let\tensf=\smallersf \let\teni=\smalleri \let\tensy=\smallersy \let\tenttsl=\smallerttsl \def\curfontsize{smaller}% \def\lsize{smaller}\def\lllsize{smaller}% \resetmathfonts \setleading{9.5pt}} % Fonts for short table of contents. \setfont\shortcontrm\rmshape{12}{1000}{OT1} \setfont\shortcontbf\bfshape{10}{\magstep1}{OT1} % no cmb12 \setfont\shortcontsl\slshape{12}{1000}{OT1} \setfont\shortconttt\ttshape{12}{1000}{OT1TT} % Define these just so they can be easily changed for other fonts. \def\angleleft{$\langle$} \def\angleright{$\rangle$} % Set the fonts to use with the @small... environments. \let\smallexamplefonts = \smallfonts % About \smallexamplefonts. If we use \smallfonts (9pt), @smallexample % can fit this many characters: % 8.5x11=86 smallbook=72 a4=90 a5=69 % If we use \scriptfonts (8pt), then we can fit this many characters: % 8.5x11=90+ smallbook=80 a4=90+ a5=77 % For me, subjectively, the few extra characters that fit aren't worth % the additional smallness of 8pt. So I'm making the default 9pt. % % By the way, for comparison, here's what fits with @example (10pt): % 8.5x11=71 smallbook=60 a4=75 a5=58 % --karl, 24jan03. % Set up the default fonts, so we can use them for creating boxes. % \definetextfontsizexi \message{markup,} % Check if we are currently using a typewriter font. Since all the % Computer Modern typewriter fonts have zero interword stretch (and % shrink), and it is reasonable to expect all typewriter fonts to have % this property, we can check that font parameter. % \def\ifmonospace{\ifdim\fontdimen3\font=0pt } % Markup style infrastructure. \defmarkupstylesetup\INITMACRO will % define and register \INITMACRO to be called on markup style changes. % \INITMACRO can check \currentmarkupstyle for the innermost % style and the set of \ifmarkupSTYLE switches for all styles % currently in effect. \newif\ifmarkupvar \newif\ifmarkupsamp \newif\ifmarkupkey %\newif\ifmarkupfile % @file == @samp. %\newif\ifmarkupoption % @option == @samp. \newif\ifmarkupcode \newif\ifmarkupkbd %\newif\ifmarkupenv % @env == @code. %\newif\ifmarkupcommand % @command == @code. \newif\ifmarkuptex % @tex (and part of @math, for now). \newif\ifmarkupexample \newif\ifmarkupverb \newif\ifmarkupverbatim \let\currentmarkupstyle\empty \def\setupmarkupstyle#1{% \csname markup#1true\endcsname \def\currentmarkupstyle{#1}% \markupstylesetup } \let\markupstylesetup\empty \def\defmarkupstylesetup#1{% \expandafter\def\expandafter\markupstylesetup \expandafter{\markupstylesetup #1}% \def#1% } % Markup style setup for left and right quotes. \defmarkupstylesetup\markupsetuplq{% \expandafter\let\expandafter \temp \csname markupsetuplq\currentmarkupstyle\endcsname \ifx\temp\relax \markupsetuplqdefault \else \temp \fi } \defmarkupstylesetup\markupsetuprq{% \expandafter\let\expandafter \temp \csname markupsetuprq\currentmarkupstyle\endcsname \ifx\temp\relax \markupsetuprqdefault \else \temp \fi } { \catcode`\'=\active \catcode`\`=\active \gdef\markupsetuplqdefault{\let`\lq} \gdef\markupsetuprqdefault{\let'\rq} \gdef\markupsetcodequoteleft{\let`\codequoteleft} \gdef\markupsetcodequoteright{\let'\codequoteright} } \let\markupsetuplqcode \markupsetcodequoteleft \let\markupsetuprqcode \markupsetcodequoteright % \let\markupsetuplqexample \markupsetcodequoteleft \let\markupsetuprqexample \markupsetcodequoteright % \let\markupsetuplqkbd \markupsetcodequoteleft \let\markupsetuprqkbd \markupsetcodequoteright % \let\markupsetuplqsamp \markupsetcodequoteleft \let\markupsetuprqsamp \markupsetcodequoteright % \let\markupsetuplqverb \markupsetcodequoteleft \let\markupsetuprqverb \markupsetcodequoteright % \let\markupsetuplqverbatim \markupsetcodequoteleft \let\markupsetuprqverbatim \markupsetcodequoteright % Allow an option to not use regular directed right quote/apostrophe % (char 0x27), but instead the undirected quote from cmtt (char 0x0d). % The undirected quote is ugly, so don't make it the default, but it % works for pasting with more pdf viewers (at least evince), the % lilypond developers report. xpdf does work with the regular 0x27. % \def\codequoteright{% \expandafter\ifx\csname SETtxicodequoteundirected\endcsname\relax \expandafter\ifx\csname SETcodequoteundirected\endcsname\relax '% \else \char'15 \fi \else \char'15 \fi } % % and a similar option for the left quote char vs. a grave accent. % Modern fonts display ASCII 0x60 as a grave accent, so some people like % the code environments to do likewise. % \def\codequoteleft{% \expandafter\ifx\csname SETtxicodequotebacktick\endcsname\relax \expandafter\ifx\csname SETcodequotebacktick\endcsname\relax % [Knuth] pp. 380,381,391 % \relax disables Spanish ligatures ?` and !` of \tt font. \relax`% \else \char'22 \fi \else \char'22 \fi } % Commands to set the quote options. % \parseargdef\codequoteundirected{% \def\temp{#1}% \ifx\temp\onword \expandafter\let\csname SETtxicodequoteundirected\endcsname = t% \else\ifx\temp\offword \expandafter\let\csname SETtxicodequoteundirected\endcsname = \relax \else \errhelp = \EMsimple \errmessage{Unknown @codequoteundirected value `\temp', must be on|off}% \fi\fi } % \parseargdef\codequotebacktick{% \def\temp{#1}% \ifx\temp\onword \expandafter\let\csname SETtxicodequotebacktick\endcsname = t% \else\ifx\temp\offword \expandafter\let\csname SETtxicodequotebacktick\endcsname = \relax \else \errhelp = \EMsimple \errmessage{Unknown @codequotebacktick value `\temp', must be on|off}% \fi\fi } % [Knuth] pp. 380,381,391, disable Spanish ligatures ?` and !` of \tt font. \def\noligaturesquoteleft{\relax\lq} % Count depth in font-changes, for error checks \newcount\fontdepth \fontdepth=0 % Font commands. % #1 is the font command (\sl or \it), #2 is the text to slant. % If we are in a monospaced environment, however, 1) always use \ttsl, % and 2) do not add an italic correction. \def\dosmartslant#1#2{% \ifusingtt {{\ttsl #2}\let\next=\relax}% {\def\next{{#1#2}\futurelet\next\smartitaliccorrection}}% \next } \def\smartslanted{\dosmartslant\sl} \def\smartitalic{\dosmartslant\it} % Output an italic correction unless \next (presumed to be the following % character) is such as not to need one. \def\smartitaliccorrection{% \ifx\next,% \else\ifx\next-% \else\ifx\next.% \else\ptexslash \fi\fi\fi \aftersmartic } % Unconditional use \ttsl, and no ic. @var is set to this for defuns. \def\ttslanted#1{{\ttsl #1}} % @cite is like \smartslanted except unconditionally use \sl. We never want % ttsl for book titles, do we? \def\cite#1{{\sl #1}\futurelet\next\smartitaliccorrection} \def\aftersmartic{} \def\var#1{% \let\saveaftersmartic = \aftersmartic \def\aftersmartic{\null\let\aftersmartic=\saveaftersmartic}% \smartslanted{#1}% } \let\i=\smartitalic \let\slanted=\smartslanted \let\dfn=\smartslanted \let\emph=\smartitalic % Explicit font changes: @r, @sc, undocumented @ii. \def\r#1{{\rm #1}} % roman font \def\sc#1{{\smallcaps#1}} % smallcaps font \def\ii#1{{\it #1}} % italic font % @b, explicit bold. Also @strong. \def\b#1{{\bf #1}} \let\strong=\b % @sansserif, explicit sans. \def\sansserif#1{{\sf #1}} % We can't just use \exhyphenpenalty, because that only has effect at % the end of a paragraph. Restore normal hyphenation at the end of the % group within which \nohyphenation is presumably called. % \def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation} \def\restorehyphenation{\hyphenchar\font = `- } % Set sfcode to normal for the chars that usually have another value. % Can't use plain's \frenchspacing because it uses the `\x notation, and % sometimes \x has an active definition that messes things up. % \catcode`@=11 \def\plainfrenchspacing{% \sfcode\dotChar =\@m \sfcode\questChar=\@m \sfcode\exclamChar=\@m \sfcode\colonChar=\@m \sfcode\semiChar =\@m \sfcode\commaChar =\@m \def\endofsentencespacefactor{1000}% for @. and friends } \def\plainnonfrenchspacing{% \sfcode`\.3000\sfcode`\?3000\sfcode`\!3000 \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250 \def\endofsentencespacefactor{3000}% for @. and friends } \catcode`@=\other \def\endofsentencespacefactor{3000}% default % @t, explicit typewriter. \def\t#1{% {\tt \rawbackslash \plainfrenchspacing #1}% \null } % @samp. \def\samp#1{{\setupmarkupstyle{samp}\lq\tclose{#1}\rq\null}} % @indicateurl is \samp, that is, with quotes. \let\indicateurl=\samp % @code (and similar) prints in typewriter, but with spaces the same % size as normal in the surrounding text, without hyphenation, etc. % This is a subroutine for that. \def\tclose#1{% {% % Change normal interword space to be same as for the current font. \spaceskip = \fontdimen2\font % % Switch to typewriter. \tt % % But `\ ' produces the large typewriter interword space. \def\ {{\spaceskip = 0pt{} }}% % % Turn off hyphenation. \nohyphenation % \rawbackslash \plainfrenchspacing #1% }% \null % reset spacefactor to 1000 } % We *must* turn on hyphenation at `-' and `_' in @code. % Otherwise, it is too hard to avoid overfull hboxes % in the Emacs manual, the Library manual, etc. % % Unfortunately, TeX uses one parameter (\hyphenchar) to control % both hyphenation at - and hyphenation within words. % We must therefore turn them both off (\tclose does that) % and arrange explicitly to hyphenate at a dash. % -- rms. { \catcode`\-=\active \catcode`\_=\active \catcode`\'=\active \catcode`\`=\active \global\let'=\rq \global\let`=\lq % default definitions % \global\def\code{\begingroup \setupmarkupstyle{code}% % The following should really be moved into \setupmarkupstyle handlers. \catcode\dashChar=\active \catcode\underChar=\active \ifallowcodebreaks \let-\codedash \let_\codeunder \else \let-\realdash \let_\realunder \fi \codex } } \def\codex #1{\tclose{#1}\endgroup} \def\realdash{-} \def\codedash{-\discretionary{}{}{}} \def\codeunder{% % this is all so @math{@code{var_name}+1} can work. In math mode, _ % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.) % will therefore expand the active definition of _, which is us % (inside @code that is), therefore an endless loop. \ifusingtt{\ifmmode \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_. \else\normalunderscore \fi \discretionary{}{}{}}% {\_}% } % An additional complication: the above will allow breaks after, e.g., % each of the four underscores in __typeof__. This is undesirable in % some manuals, especially if they don't have long identifiers in % general. @allowcodebreaks provides a way to control this. % \newif\ifallowcodebreaks \allowcodebreakstrue \def\keywordtrue{true} \def\keywordfalse{false} \parseargdef\allowcodebreaks{% \def\txiarg{#1}% \ifx\txiarg\keywordtrue \allowcodebreakstrue \else\ifx\txiarg\keywordfalse \allowcodebreaksfalse \else \errhelp = \EMsimple \errmessage{Unknown @allowcodebreaks option `\txiarg', must be true|false}% \fi\fi } % For @command, @env, @file, @option quotes seem unnecessary, % so use \code rather than \samp. \let\command=\code \let\env=\code \let\file=\code \let\option=\code % @uref (abbreviation for `urlref') takes an optional (comma-separated) % second argument specifying the text to display and an optional third % arg as text to display instead of (rather than in addition to) the url % itself. First (mandatory) arg is the url. % (This \urefnobreak definition isn't used now, leaving it for a while % for comparison.) \def\urefnobreak#1{\dourefnobreak #1,,,\finish} \def\dourefnobreak#1,#2,#3,#4\finish{\begingroup \unsepspaces \pdfurl{#1}% \setbox0 = \hbox{\ignorespaces #3}% \ifdim\wd0 > 0pt \unhbox0 % third arg given, show only that \else \setbox0 = \hbox{\ignorespaces #2}% \ifdim\wd0 > 0pt \ifpdf \unhbox0 % PDF: 2nd arg given, show only it \else \unhbox0\ (\code{#1})% DVI: 2nd arg given, show both it and url \fi \else \code{#1}% only url given, so show it \fi \fi \endlink \endgroup} % This \urefbreak definition is the active one. \def\urefbreak{\begingroup \urefcatcodes \dourefbreak} \let\uref=\urefbreak \def\dourefbreak#1{\urefbreakfinish #1,,,\finish} \def\urefbreakfinish#1,#2,#3,#4\finish{% doesn't work in @example \unsepspaces \pdfurl{#1}% \setbox0 = \hbox{\ignorespaces #3}% \ifdim\wd0 > 0pt \unhbox0 % third arg given, show only that \else \setbox0 = \hbox{\ignorespaces #2}% \ifdim\wd0 > 0pt \ifpdf \unhbox0 % PDF: 2nd arg given, show only it \else \unhbox0\ (\urefcode{#1})% DVI: 2nd arg given, show both it and url \fi \else \urefcode{#1}% only url given, so show it \fi \fi \endlink \endgroup} % Allow line breaks around only a few characters (only). \def\urefcatcodes{% \catcode\ampChar=\active \catcode\dotChar=\active \catcode\hashChar=\active \catcode\questChar=\active \catcode\slashChar=\active } { \urefcatcodes % \global\def\urefcode{\begingroup \setupmarkupstyle{code}% \urefcatcodes \let&\urefcodeamp \let.\urefcodedot \let#\urefcodehash \let?\urefcodequest \let/\urefcodeslash \codex } % % By default, they are just regular characters. \global\def&{\normalamp} \global\def.{\normaldot} \global\def#{\normalhash} \global\def?{\normalquest} \global\def/{\normalslash} } % we put a little stretch before and after the breakable chars, to help % line breaking of long url's. The unequal skips make look better in % cmtt at least, especially for dots. \def\urefprestretch{\urefprebreak \hskip0pt plus.13em } \def\urefpoststretch{\urefpostbreak \hskip0pt plus.1em } % \def\urefcodeamp{\urefprestretch \&\urefpoststretch} \def\urefcodedot{\urefprestretch .\urefpoststretch} \def\urefcodehash{\urefprestretch \#\urefpoststretch} \def\urefcodequest{\urefprestretch ?\urefpoststretch} \def\urefcodeslash{\futurelet\next\urefcodeslashfinish} { \catcode`\/=\active \global\def\urefcodeslashfinish{% \urefprestretch \slashChar % Allow line break only after the final / in a sequence of % slashes, to avoid line break between the slashes in http://. \ifx\next/\else \urefpoststretch \fi } } % One more complication: by default we'll break after the special % characters, but some people like to break before the special chars, so % allow that. Also allow no breaking at all, for manual control. % \parseargdef\urefbreakstyle{% \def\txiarg{#1}% \ifx\txiarg\wordnone \def\urefprebreak{\nobreak}\def\urefpostbreak{\nobreak} \else\ifx\txiarg\wordbefore \def\urefprebreak{\allowbreak}\def\urefpostbreak{\nobreak} \else\ifx\txiarg\wordafter \def\urefprebreak{\nobreak}\def\urefpostbreak{\allowbreak} \else \errhelp = \EMsimple \errmessage{Unknown @urefbreakstyle setting `\txiarg'}% \fi\fi\fi } \def\wordafter{after} \def\wordbefore{before} \def\wordnone{none} \urefbreakstyle after % @url synonym for @uref, since that's how everyone uses it. % \let\url=\uref % rms does not like angle brackets --karl, 17may97. % So now @email is just like @uref, unless we are pdf. % %\def\email#1{\angleleft{\tt #1}\angleright} \ifpdf \def\email#1{\doemail#1,,\finish} \def\doemail#1,#2,#3\finish{\begingroup \unsepspaces \pdfurl{mailto:#1}% \setbox0 = \hbox{\ignorespaces #2}% \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi \endlink \endgroup} \else \let\email=\uref \fi % @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always), % `example' (@kbd uses ttsl only inside of @example and friends), % or `code' (@kbd uses normal tty font always). \parseargdef\kbdinputstyle{% \def\txiarg{#1}% \ifx\txiarg\worddistinct \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}% \else\ifx\txiarg\wordexample \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}% \else\ifx\txiarg\wordcode \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}% \else \errhelp = \EMsimple \errmessage{Unknown @kbdinputstyle setting `\txiarg'}% \fi\fi\fi } \def\worddistinct{distinct} \def\wordexample{example} \def\wordcode{code} % Default is `distinct'. \kbdinputstyle distinct % @kbd is like @code, except that if the argument is just one @key command, % then @kbd has no effect. \def\kbd#1{{\def\look{#1}\expandafter\kbdsub\look??\par}} \def\xkey{\key} \def\kbdsub#1#2#3\par{% \def\one{#1}\def\three{#3}\def\threex{??}% \ifx\one\xkey\ifx\threex\three \key{#2}% \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi } % definition of @key that produces a lozenge. Doesn't adjust to text size. %\setfont\keyrm\rmshape{8}{1000}{OT1} %\font\keysy=cmsy9 %\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{% % \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{% % \vbox{\hrule\kern-0.4pt % \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}% % \kern-0.4pt\hrule}% % \kern-.06em\raise0.4pt\hbox{\angleright}}}} % definition of @key with no lozenge. If the current font is already % monospace, don't change it; that way, we respect @kbdinputstyle. But % if it isn't monospace, then use \tt. % \def\key#1{{\setupmarkupstyle{key}% \nohyphenation \ifmonospace\else\tt\fi #1}\null} % @clicksequence{File @click{} Open ...} \def\clicksequence#1{\begingroup #1\endgroup} % @clickstyle @arrow (by default) \parseargdef\clickstyle{\def\click{#1}} \def\click{\arrow} % Typeset a dimension, e.g., `in' or `pt'. The only reason for the % argument is to make the input look right: @dmn{pt} instead of @dmn{}pt. % \def\dmn#1{\thinspace #1} % @l was never documented to mean ``switch to the Lisp font'', % and it is not used as such in any manual I can find. We need it for % Polish suppressed-l. --karl, 22sep96. %\def\l#1{{\li #1}\null} % @acronym for "FBI", "NATO", and the like. % We print this one point size smaller, since it's intended for % all-uppercase. % \def\acronym#1{\doacronym #1,,\finish} \def\doacronym#1,#2,#3\finish{% {\selectfonts\lsize #1}% \def\temp{#2}% \ifx\temp\empty \else \space ({\unsepspaces \ignorespaces \temp \unskip})% \fi \null % reset \spacefactor=1000 } % @abbr for "Comput. J." and the like. % No font change, but don't do end-of-sentence spacing. % \def\abbr#1{\doabbr #1,,\finish} \def\doabbr#1,#2,#3\finish{% {\plainfrenchspacing #1}% \def\temp{#2}% \ifx\temp\empty \else \space ({\unsepspaces \ignorespaces \temp \unskip})% \fi \null % reset \spacefactor=1000 } % @asis just yields its argument. Used with @table, for example. % \def\asis#1{#1} % @math outputs its argument in math mode. % % One complication: _ usually means subscripts, but it could also mean % an actual _ character, as in @math{@var{some_variable} + 1}. So make % _ active, and distinguish by seeing if the current family is \slfam, % which is what @var uses. { \catcode`\_ = \active \gdef\mathunderscore{% \catcode`\_=\active \def_{\ifnum\fam=\slfam \_\else\sb\fi}% } } % Another complication: we want \\ (and @\) to output a math (or tt) \. % FYI, plain.tex uses \\ as a temporary control sequence (for no % particular reason), but this is not advertised and we don't care. % % The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\. \def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi} % \def\math{% \tex \mathunderscore \let\\ = \mathbackslash \mathactive % make the texinfo accent commands work in math mode \let\"=\ddot \let\'=\acute \let\==\bar \let\^=\hat \let\`=\grave \let\u=\breve \let\v=\check \let\~=\tilde \let\dotaccent=\dot $\finishmath } \def\finishmath#1{#1$\endgroup} % Close the group opened by \tex. % Some active characters (such as <) are spaced differently in math. % We have to reset their definitions in case the @math was an argument % to a command which sets the catcodes (such as @item or @section). % { \catcode`^ = \active \catcode`< = \active \catcode`> = \active \catcode`+ = \active \catcode`' = \active \gdef\mathactive{% \let^ = \ptexhat \let< = \ptexless \let> = \ptexgtr \let+ = \ptexplus \let' = \ptexquoteright } } % ctrl is no longer a Texinfo command, but leave this definition for fun. \def\ctrl #1{{\tt \rawbackslash \hat}#1} % @inlinefmt{FMTNAME,PROCESSED-TEXT} and @inlineraw{FMTNAME,RAW-TEXT}. % Ignore unless FMTNAME == tex; then it is like @iftex and @tex, % except specified as a normal braced arg, so no newlines to worry about. % \def\outfmtnametex{tex} % \long\def\inlinefmt#1{\doinlinefmt #1,\finish} \long\def\doinlinefmt#1,#2,\finish{% \def\inlinefmtname{#1}% \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\fi } % For raw, must switch into @tex before parsing the argument, to avoid % setting catcodes prematurely. Doing it this way means that, for % example, @inlineraw{html, foo{bar} gets a parse error instead of being % ignored. But this isn't important because if people want a literal % *right* brace they would have to use a command anyway, so they may as % well use a command to get a left brace too. We could re-use the % delimiter character idea from \verb, but it seems like overkill. % \long\def\inlineraw{\tex \doinlineraw} \long\def\doinlineraw#1{\doinlinerawtwo #1,\finish} \def\doinlinerawtwo#1,#2,\finish{% \def\inlinerawname{#1}% \ifx\inlinerawname\outfmtnametex \ignorespaces #2\fi \endgroup % close group opened by \tex. } \message{glyphs,} % and logos. % @@ prints an @, as does @atchar{}. \def\@{\char64 } \let\atchar=\@ % @{ @} @lbracechar{} @rbracechar{} all generate brace characters. % Unless we're in typewriter, use \ecfont because the CM text fonts do % not have braces, and we don't want to switch into math. \def\mylbrace{{\ifmonospace\else\ecfont\fi \char123}} \def\myrbrace{{\ifmonospace\else\ecfont\fi \char125}} \let\{=\mylbrace \let\lbracechar=\{ \let\}=\myrbrace \let\rbracechar=\} \begingroup % Definitions to produce \{ and \} commands for indices, % and @{ and @} for the aux/toc files. \catcode`\{ = \other \catcode`\} = \other \catcode`\[ = 1 \catcode`\] = 2 \catcode`\! = 0 \catcode`\\ = \other !gdef!lbracecmd[\{]% !gdef!rbracecmd[\}]% !gdef!lbraceatcmd[@{]% !gdef!rbraceatcmd[@}]% !endgroup % @comma{} to avoid , parsing problems. \let\comma = , % Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent % Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H. \let\, = \ptexc \let\dotaccent = \ptexdot \def\ringaccent#1{{\accent23 #1}} \let\tieaccent = \ptext \let\ubaraccent = \ptexb \let\udotaccent = \d % Other special characters: @questiondown @exclamdown @ordf @ordm % Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss. \def\questiondown{?`} \def\exclamdown{!`} \def\ordf{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{a}}} \def\ordm{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{o}}} % Dotless i and dotless j, used for accents. \def\imacro{i} \def\jmacro{j} \def\dotless#1{% \def\temp{#1}% \ifx\temp\imacro \ifmmode\imath \else\ptexi \fi \else\ifx\temp\jmacro \ifmmode\jmath \else\j \fi \else \errmessage{@dotless can be used only with i or j}% \fi\fi } % The \TeX{} logo, as in plain, but resetting the spacing so that a % period following counts as ending a sentence. (Idea found in latex.) % \edef\TeX{\TeX \spacefactor=1000 } % @LaTeX{} logo. Not quite the same results as the definition in % latex.ltx, since we use a different font for the raised A; it's most % convenient for us to use an explicitly smaller font, rather than using % the \scriptstyle font (since we don't reset \scriptstyle and % \scriptscriptstyle). % \def\LaTeX{% L\kern-.36em {\setbox0=\hbox{T}% \vbox to \ht0{\hbox{% \ifx\textnominalsize\xwordpt % for 10pt running text, \lllsize (8pt) is too small for the A in LaTeX. % Revert to plain's \scriptsize, which is 7pt. \count255=\the\fam $\fam\count255 \scriptstyle A$% \else % For 11pt, we can use our lllsize. \selectfonts\lllsize A% \fi }% \vss }}% \kern-.15em \TeX } % Some math mode symbols. \def\bullet{$\ptexbullet$} \def\geq{\ifmmode \ge\else $\ge$\fi} \def\leq{\ifmmode \le\else $\le$\fi} \def\minus{\ifmmode -\else $-$\fi} % @dots{} outputs an ellipsis using the current font. % We do .5em per period so that it has the same spacing in the cm % typewriter fonts as three actual period characters; on the other hand, % in other typewriter fonts three periods are wider than 1.5em. So do % whichever is larger. % \def\dots{% \leavevmode \setbox0=\hbox{...}% get width of three periods \ifdim\wd0 > 1.5em \dimen0 = \wd0 \else \dimen0 = 1.5em \fi \hbox to \dimen0{% \hskip 0pt plus.25fil .\hskip 0pt plus1fil .\hskip 0pt plus1fil .\hskip 0pt plus.5fil }% } % @enddots{} is an end-of-sentence ellipsis. % \def\enddots{% \dots \spacefactor=\endofsentencespacefactor } % @point{}, @result{}, @expansion{}, @print{}, @equiv{}. % % Since these characters are used in examples, they should be an even number of % \tt widths. Each \tt character is 1en, so two makes it 1em. % \def\point{$\star$} \def\arrow{\leavevmode\raise.05ex\hbox to 1em{\hfil$\rightarrow$\hfil}} \def\result{\leavevmode\raise.05ex\hbox to 1em{\hfil$\Rightarrow$\hfil}} \def\expansion{\leavevmode\hbox to 1em{\hfil$\mapsto$\hfil}} \def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}} \def\equiv{\leavevmode\hbox to 1em{\hfil$\ptexequiv$\hfil}} % The @error{} command. % Adapted from the TeXbook's \boxit. % \newbox\errorbox % {\tentt \global\dimen0 = 3em}% Width of the box. \dimen2 = .55pt % Thickness of rules % The text. (`r' is open on the right, `e' somewhat less so on the left.) \setbox0 = \hbox{\kern-.75pt \reducedsf \putworderror\kern-1.5pt} % \setbox\errorbox=\hbox to \dimen0{\hfil \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right. \advance\hsize by -2\dimen2 % Rules. \vbox{% \hrule height\dimen2 \hbox{\vrule width\dimen2 \kern3pt % Space to left of text. \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below. \kern3pt\vrule width\dimen2}% Space to right. \hrule height\dimen2} \hfil} % \def\error{\leavevmode\lower.7ex\copy\errorbox} % @pounds{} is a sterling sign, which Knuth put in the CM italic font. % \def\pounds{{\it\$}} % @euro{} comes from a separate font, depending on the current style. % We use the free feym* fonts from the eurosym package by Henrik % Theiling, which support regular, slanted, bold and bold slanted (and % "outlined" (blackboard board, sort of) versions, which we don't need). % It is available from http://www.ctan.org/tex-archive/fonts/eurosym. % % Although only regular is the truly official Euro symbol, we ignore % that. The Euro is designed to be slightly taller than the regular % font height. % % feymr - regular % feymo - slanted % feybr - bold % feybo - bold slanted % % There is no good (free) typewriter version, to my knowledge. % A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide. % Hmm. % % Also doesn't work in math. Do we need to do math with euro symbols? % Hope not. % % \def\euro{{\eurofont e}} \def\eurofont{% % We set the font at each command, rather than predefining it in % \textfonts and the other font-switching commands, so that % installations which never need the symbol don't have to have the % font installed. % % There is only one designed size (nominal 10pt), so we always scale % that to the current nominal size. % % By the way, simply using "at 1em" works for cmr10 and the like, but % does not work for cmbx10 and other extended/shrunken fonts. % \def\eurosize{\csname\curfontsize nominalsize\endcsname}% % \ifx\curfontstyle\bfstylename % bold: \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize \else % regular: \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize \fi \thiseurofont } % Glyphs from the EC fonts. We don't use \let for the aliases, because % sometimes we redefine the original macro, and the alias should reflect % the redefinition. % % Use LaTeX names for the Icelandic letters. \def\DH{{\ecfont \char"D0}} % Eth \def\dh{{\ecfont \char"F0}} % eth \def\TH{{\ecfont \char"DE}} % Thorn \def\th{{\ecfont \char"FE}} % thorn % \def\guillemetleft{{\ecfont \char"13}} \def\guillemotleft{\guillemetleft} \def\guillemetright{{\ecfont \char"14}} \def\guillemotright{\guillemetright} \def\guilsinglleft{{\ecfont \char"0E}} \def\guilsinglright{{\ecfont \char"0F}} \def\quotedblbase{{\ecfont \char"12}} \def\quotesinglbase{{\ecfont \char"0D}} % % This positioning is not perfect (see the ogonek LaTeX package), but % we have the precomposed glyphs for the most common cases. We put the % tests to use those glyphs in the single \ogonek macro so we have fewer % dummy definitions to worry about for index entries, etc. % % ogonek is also used with other letters in Lithuanian (IOU), but using % the precomposed glyphs for those is not so easy since they aren't in % the same EC font. \def\ogonek#1{{% \def\temp{#1}% \ifx\temp\macrocharA\Aogonek \else\ifx\temp\macrochara\aogonek \else\ifx\temp\macrocharE\Eogonek \else\ifx\temp\macrochare\eogonek \else \ecfont \setbox0=\hbox{#1}% \ifdim\ht0=1ex\accent"0C #1% \else\ooalign{\unhbox0\crcr\hidewidth\char"0C \hidewidth}% \fi \fi\fi\fi\fi }% } \def\Aogonek{{\ecfont \char"81}}\def\macrocharA{A} \def\aogonek{{\ecfont \char"A1}}\def\macrochara{a} \def\Eogonek{{\ecfont \char"86}}\def\macrocharE{E} \def\eogonek{{\ecfont \char"A6}}\def\macrochare{e} % % Use the ec* fonts (cm-super in outline format) for non-CM glyphs. \def\ecfont{% % We can't distinguish serif/sans and italic/slanted, but this % is used for crude hacks anyway (like adding French and German % quotes to documents typeset with CM, where we lose kerning), so % hopefully nobody will notice/care. \edef\ecsize{\csname\curfontsize ecsize\endcsname}% \edef\nominalsize{\csname\curfontsize nominalsize\endcsname}% \ifmonospace % typewriter: \font\thisecfont = ectt\ecsize \space at \nominalsize \else \ifx\curfontstyle\bfstylename % bold: \font\thisecfont = ecb\ifusingit{i}{x}\ecsize \space at \nominalsize \else % regular: \font\thisecfont = ec\ifusingit{ti}{rm}\ecsize \space at \nominalsize \fi \fi \thisecfont } % @registeredsymbol - R in a circle. The font for the R should really % be smaller yet, but lllsize is the best we can do for now. % Adapted from the plain.tex definition of \copyright. % \def\registeredsymbol{% $^{{\ooalign{\hfil\raise.07ex\hbox{\selectfonts\lllsize R}% \hfil\crcr\Orb}}% }$% } % @textdegree - the normal degrees sign. % \def\textdegree{$^\circ$} % Laurent Siebenmann reports \Orb undefined with: % Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38 % so we'll define it if necessary. % \ifx\Orb\thisisundefined \def\Orb{\mathhexbox20D} \fi % Quotes. \chardef\quotedblleft="5C \chardef\quotedblright=`\" \chardef\quoteleft=`\` \chardef\quoteright=`\' \message{page headings,} \newskip\titlepagetopglue \titlepagetopglue = 1.5in \newskip\titlepagebottomglue \titlepagebottomglue = 2pc % First the title page. Must do @settitle before @titlepage. \newif\ifseenauthor \newif\iffinishedtitlepage % Do an implicit @contents or @shortcontents after @end titlepage if the % user says @setcontentsaftertitlepage or @setshortcontentsaftertitlepage. % \newif\ifsetcontentsaftertitlepage \let\setcontentsaftertitlepage = \setcontentsaftertitlepagetrue \newif\ifsetshortcontentsaftertitlepage \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue \parseargdef\shorttitlepage{% \begingroup \hbox{}\vskip 1.5in \chaprm \centerline{#1}% \endgroup\page\hbox{}\page} \envdef\titlepage{% % Open one extra group, as we want to close it in the middle of \Etitlepage. \begingroup \parindent=0pt \textfonts % Leave some space at the very top of the page. \vglue\titlepagetopglue % No rule at page bottom unless we print one at the top with @title. \finishedtitlepagetrue % % Most title ``pages'' are actually two pages long, with space % at the top of the second. We don't want the ragged left on the second. \let\oldpage = \page \def\page{% \iffinishedtitlepage\else \finishtitlepage \fi \let\page = \oldpage \page \null }% } \def\Etitlepage{% \iffinishedtitlepage\else \finishtitlepage \fi % It is important to do the page break before ending the group, % because the headline and footline are only empty inside the group. % If we use the new definition of \page, we always get a blank page % after the title page, which we certainly don't want. \oldpage \endgroup % % Need this before the \...aftertitlepage checks so that if they are % in effect the toc pages will come out with page numbers. \HEADINGSon % % If they want short, they certainly want long too. \ifsetshortcontentsaftertitlepage \shortcontents \contents \global\let\shortcontents = \relax \global\let\contents = \relax \fi % \ifsetcontentsaftertitlepage \contents \global\let\contents = \relax \global\let\shortcontents = \relax \fi } \def\finishtitlepage{% \vskip4pt \hrule height 2pt width \hsize \vskip\titlepagebottomglue \finishedtitlepagetrue } % Settings used for typesetting titles: no hyphenation, no indentation, % don't worry much about spacing, ragged right. This should be used % inside a \vbox, and fonts need to be set appropriately first. Because % it is always used for titles, nothing else, we call \rmisbold. \par % should be specified before the end of the \vbox, since a vbox is a group. % \def\raggedtitlesettings{% \rmisbold \hyphenpenalty=10000 \parindent=0pt \tolerance=5000 \ptexraggedright } % Macros to be used within @titlepage: \let\subtitlerm=\tenrm \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines} \parseargdef\title{% \checkenv\titlepage \vbox{\titlefonts \raggedtitlesettings #1\par}% % print a rule at the page bottom also. \finishedtitlepagefalse \vskip4pt \hrule height 4pt width \hsize \vskip4pt } \parseargdef\subtitle{% \checkenv\titlepage {\subtitlefont \rightline{#1}}% } % @author should come last, but may come many times. % It can also be used inside @quotation. % \parseargdef\author{% \def\temp{\quotation}% \ifx\thisenv\temp \def\quotationauthor{#1}% printed in \Equotation. \else \checkenv\titlepage \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi {\secfonts\rmisbold \leftline{#1}}% \fi } % Set up page headings and footings. \let\thispage=\folio \newtoks\evenheadline % headline on even pages \newtoks\oddheadline % headline on odd pages \newtoks\evenfootline % footline on even pages \newtoks\oddfootline % footline on odd pages % Now make TeX use those variables \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline \else \the\evenheadline \fi}} \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline \else \the\evenfootline \fi}\HEADINGShook} \let\HEADINGShook=\relax % Commands to set those variables. % For example, this is what @headings on does % @evenheading @thistitle|@thispage|@thischapter % @oddheading @thischapter|@thispage|@thistitle % @evenfooting @thisfile|| % @oddfooting ||@thisfile \def\evenheading{\parsearg\evenheadingxxx} \def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish} \def\evenheadingyyy #1\|#2\|#3\|#4\finish{% \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} \def\oddheading{\parsearg\oddheadingxxx} \def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish} \def\oddheadingyyy #1\|#2\|#3\|#4\finish{% \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} \parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}% \def\evenfooting{\parsearg\evenfootingxxx} \def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish} \def\evenfootingyyy #1\|#2\|#3\|#4\finish{% \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} \def\oddfooting{\parsearg\oddfootingxxx} \def\oddfootingxxx #1{\oddfootingyyy #1\|\|\|\|\finish} \def\oddfootingyyy #1\|#2\|#3\|#4\finish{% \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}% % % Leave some space for the footline. Hopefully ok to assume % @evenfooting will not be used by itself. \global\advance\pageheight by -12pt \global\advance\vsize by -12pt } \parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}} % @evenheadingmarks top \thischapter <- chapter at the top of a page % @evenheadingmarks bottom \thischapter <- chapter at the bottom of a page % % The same set of arguments for: % % @oddheadingmarks % @evenfootingmarks % @oddfootingmarks % @everyheadingmarks % @everyfootingmarks \def\evenheadingmarks{\headingmarks{even}{heading}} \def\oddheadingmarks{\headingmarks{odd}{heading}} \def\evenfootingmarks{\headingmarks{even}{footing}} \def\oddfootingmarks{\headingmarks{odd}{footing}} \def\everyheadingmarks#1 {\headingmarks{even}{heading}{#1} \headingmarks{odd}{heading}{#1} } \def\everyfootingmarks#1 {\headingmarks{even}{footing}{#1} \headingmarks{odd}{footing}{#1} } % #1 = even/odd, #2 = heading/footing, #3 = top/bottom. \def\headingmarks#1#2#3 {% \expandafter\let\expandafter\temp \csname get#3headingmarks\endcsname \global\expandafter\let\csname get#1#2marks\endcsname \temp } \everyheadingmarks bottom \everyfootingmarks bottom % @headings double turns headings on for double-sided printing. % @headings single turns headings on for single-sided printing. % @headings off turns them off. % @headings on same as @headings double, retained for compatibility. % @headings after turns on double-sided headings after this page. % @headings doubleafter turns on double-sided headings after this page. % @headings singleafter turns on single-sided headings after this page. % By default, they are off at the start of a document, % and turned `on' after @end titlepage. \def\headings #1 {\csname HEADINGS#1\endcsname} \def\headingsoff{% non-global headings elimination \evenheadline={\hfil}\evenfootline={\hfil}% \oddheadline={\hfil}\oddfootline={\hfil}% } \def\HEADINGSoff{{\globaldefs=1 \headingsoff}} % global setting \HEADINGSoff % it's the default % When we turn headings on, set the page number to 1. % For double-sided printing, put current file name in lower left corner, % chapter name on inside top of right hand pages, document % title on inside top of left hand pages, and page numbers on outside top % edge of all pages. \def\HEADINGSdouble{% \global\pageno=1 \global\evenfootline={\hfil} \global\oddfootline={\hfil} \global\evenheadline={\line{\folio\hfil\thistitle}} \global\oddheadline={\line{\thischapter\hfil\folio}} \global\let\contentsalignmacro = \chapoddpage } \let\contentsalignmacro = \chappager % For single-sided printing, chapter title goes across top left of page, % page number on top right. \def\HEADINGSsingle{% \global\pageno=1 \global\evenfootline={\hfil} \global\oddfootline={\hfil} \global\evenheadline={\line{\thischapter\hfil\folio}} \global\oddheadline={\line{\thischapter\hfil\folio}} \global\let\contentsalignmacro = \chappager } \def\HEADINGSon{\HEADINGSdouble} \def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex} \let\HEADINGSdoubleafter=\HEADINGSafter \def\HEADINGSdoublex{% \global\evenfootline={\hfil} \global\oddfootline={\hfil} \global\evenheadline={\line{\folio\hfil\thistitle}} \global\oddheadline={\line{\thischapter\hfil\folio}} \global\let\contentsalignmacro = \chapoddpage } \def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex} \def\HEADINGSsinglex{% \global\evenfootline={\hfil} \global\oddfootline={\hfil} \global\evenheadline={\line{\thischapter\hfil\folio}} \global\oddheadline={\line{\thischapter\hfil\folio}} \global\let\contentsalignmacro = \chappager } % Subroutines used in generating headings % This produces Day Month Year style of output. % Only define if not already defined, in case a txi-??.tex file has set % up a different format (e.g., txi-cs.tex does this). \ifx\today\thisisundefined \def\today{% \number\day\space \ifcase\month \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec \fi \space\number\year} \fi % @settitle line... specifies the title of the document, for headings. % It generates no output of its own. \def\thistitle{\putwordNoTitle} \def\settitle{\parsearg{\gdef\thistitle}} \message{tables,} % Tables -- @table, @ftable, @vtable, @item(x). % default indentation of table text \newdimen\tableindent \tableindent=.8in % default indentation of @itemize and @enumerate text \newdimen\itemindent \itemindent=.3in % margin between end of table item and start of table text. \newdimen\itemmargin \itemmargin=.1in % used internally for \itemindent minus \itemmargin \newdimen\itemmax % Note @table, @ftable, and @vtable define @item, @itemx, etc., with % these defs. % They also define \itemindex % to index the item name in whatever manner is desired (perhaps none). \newif\ifitemxneedsnegativevskip \def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi} \def\internalBitem{\smallbreak \parsearg\itemzzz} \def\internalBitemx{\itemxpar \parsearg\itemzzz} \def\itemzzz #1{\begingroup % \advance\hsize by -\rightskip \advance\hsize by -\tableindent \setbox0=\hbox{\itemindicate{#1}}% \itemindex{#1}% \nobreak % This prevents a break before @itemx. % % If the item text does not fit in the space we have, put it on a line % by itself, and do not allow a page break either before or after that % line. We do not start a paragraph here because then if the next % command is, e.g., @kindex, the whatsit would get put into the % horizontal list on a line by itself, resulting in extra blank space. \ifdim \wd0>\itemmax % % Make this a paragraph so we get the \parskip glue and wrapping, % but leave it ragged-right. \begingroup \advance\leftskip by-\tableindent \advance\hsize by\tableindent \advance\rightskip by0pt plus1fil\relax \leavevmode\unhbox0\par \endgroup % % We're going to be starting a paragraph, but we don't want the % \parskip glue -- logically it's part of the @item we just started. \nobreak \vskip-\parskip % % Stop a page break at the \parskip glue coming up. However, if % what follows is an environment such as @example, there will be no % \parskip glue; then the negative vskip we just inserted would % cause the example and the item to crash together. So we use this % bizarre value of 10001 as a signal to \aboveenvbreak to insert % \parskip glue after all. Section titles are handled this way also. % \penalty 10001 \endgroup \itemxneedsnegativevskipfalse \else % The item text fits into the space. Start a paragraph, so that the % following text (if any) will end up on the same line. \noindent % Do this with kerns and \unhbox so that if there is a footnote in % the item text, it can migrate to the main vertical list and % eventually be printed. \nobreak\kern-\tableindent \dimen0 = \itemmax \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0 \unhbox0 \nobreak\kern\dimen0 \endgroup \itemxneedsnegativevskiptrue \fi } \def\item{\errmessage{@item while not in a list environment}} \def\itemx{\errmessage{@itemx while not in a list environment}} % @table, @ftable, @vtable. \envdef\table{% \let\itemindex\gobble \tablecheck{table}% } \envdef\ftable{% \def\itemindex ##1{\doind {fn}{\code{##1}}}% \tablecheck{ftable}% } \envdef\vtable{% \def\itemindex ##1{\doind {vr}{\code{##1}}}% \tablecheck{vtable}% } \def\tablecheck#1{% \ifnum \the\catcode`\^^M=\active \endgroup \errmessage{This command won't work in this context; perhaps the problem is that we are \inenvironment\thisenv}% \def\next{\doignore{#1}}% \else \let\next\tablex \fi \next } \def\tablex#1{% \def\itemindicate{#1}% \parsearg\tabley } \def\tabley#1{% {% \makevalueexpandable \edef\temp{\noexpand\tablez #1\space\space\space}% \expandafter }\temp \endtablez } \def\tablez #1 #2 #3 #4\endtablez{% \aboveenvbreak \ifnum 0#1>0 \advance \leftskip by #1\mil \fi \ifnum 0#2>0 \tableindent=#2\mil \fi \ifnum 0#3>0 \advance \rightskip by #3\mil \fi \itemmax=\tableindent \advance \itemmax by -\itemmargin \advance \leftskip by \tableindent \exdentamount=\tableindent \parindent = 0pt \parskip = \smallskipamount \ifdim \parskip=0pt \parskip=2pt \fi \let\item = \internalBitem \let\itemx = \internalBitemx } \def\Etable{\endgraf\afterenvbreak} \let\Eftable\Etable \let\Evtable\Etable \let\Eitemize\Etable \let\Eenumerate\Etable % This is the counter used by @enumerate, which is really @itemize \newcount \itemno \envdef\itemize{\parsearg\doitemize} \def\doitemize#1{% \aboveenvbreak \itemmax=\itemindent \advance\itemmax by -\itemmargin \advance\leftskip by \itemindent \exdentamount=\itemindent \parindent=0pt \parskip=\smallskipamount \ifdim\parskip=0pt \parskip=2pt \fi % % Try typesetting the item mark that if the document erroneously says % something like @itemize @samp (intending @table), there's an error % right away at the @itemize. It's not the best error message in the % world, but it's better than leaving it to the @item. This means if % the user wants an empty mark, they have to say @w{} not just @w. \def\itemcontents{#1}% \setbox0 = \hbox{\itemcontents}% % % @itemize with no arg is equivalent to @itemize @bullet. \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi % \let\item=\itemizeitem } % Definition of @item while inside @itemize and @enumerate. % \def\itemizeitem{% \advance\itemno by 1 % for enumerations {\let\par=\endgraf \smallbreak}% reasonable place to break {% % If the document has an @itemize directly after a section title, a % \nobreak will be last on the list, and \sectionheading will have % done a \vskip-\parskip. In that case, we don't want to zero % parskip, or the item text will crash with the heading. On the % other hand, when there is normal text preceding the item (as there % usually is), we do want to zero parskip, or there would be too much % space. In that case, we won't have a \nobreak before. At least % that's the theory. \ifnum\lastpenalty<10000 \parskip=0in \fi \noindent \hbox to 0pt{\hss \itemcontents \kern\itemmargin}% % \vadjust{\penalty 1200}}% not good to break after first line of item. \flushcr } % \splitoff TOKENS\endmark defines \first to be the first token in % TOKENS, and \rest to be the remainder. % \def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}% % Allow an optional argument of an uppercase letter, lowercase letter, % or number, to specify the first label in the enumerated list. No % argument is the same as `1'. % \envparseargdef\enumerate{\enumeratey #1 \endenumeratey} \def\enumeratey #1 #2\endenumeratey{% % If we were given no argument, pretend we were given `1'. \def\thearg{#1}% \ifx\thearg\empty \def\thearg{1}\fi % % Detect if the argument is a single token. If so, it might be a % letter. Otherwise, the only valid thing it can be is a number. % (We will always have one token, because of the test we just made. % This is a good thing, since \splitoff doesn't work given nothing at % all -- the first parameter is undelimited.) \expandafter\splitoff\thearg\endmark \ifx\rest\empty % Only one token in the argument. It could still be anything. % A ``lowercase letter'' is one whose \lccode is nonzero. % An ``uppercase letter'' is one whose \lccode is both nonzero, and % not equal to itself. % Otherwise, we assume it's a number. % % We need the \relax at the end of the \ifnum lines to stop TeX from % continuing to look for a . % \ifnum\lccode\expandafter`\thearg=0\relax \numericenumerate % a number (we hope) \else % It's a letter. \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax \lowercaseenumerate % lowercase letter \else \uppercaseenumerate % uppercase letter \fi \fi \else % Multiple tokens in the argument. We hope it's a number. \numericenumerate \fi } % An @enumerate whose labels are integers. The starting integer is % given in \thearg. % \def\numericenumerate{% \itemno = \thearg \startenumeration{\the\itemno}% } % The starting (lowercase) letter is in \thearg. \def\lowercaseenumerate{% \itemno = \expandafter`\thearg \startenumeration{% % Be sure we're not beyond the end of the alphabet. \ifnum\itemno=0 \errmessage{No more lowercase letters in @enumerate; get a bigger alphabet}% \fi \char\lccode\itemno }% } % The starting (uppercase) letter is in \thearg. \def\uppercaseenumerate{% \itemno = \expandafter`\thearg \startenumeration{% % Be sure we're not beyond the end of the alphabet. \ifnum\itemno=0 \errmessage{No more uppercase letters in @enumerate; get a bigger alphabet} \fi \char\uccode\itemno }% } % Call \doitemize, adding a period to the first argument and supplying the % common last two arguments. Also subtract one from the initial value in % \itemno, since @item increments \itemno. % \def\startenumeration#1{% \advance\itemno by -1 \doitemize{#1.}\flushcr } % @alphaenumerate and @capsenumerate are abbreviations for giving an arg % to @enumerate. % \def\alphaenumerate{\enumerate{a}} \def\capsenumerate{\enumerate{A}} \def\Ealphaenumerate{\Eenumerate} \def\Ecapsenumerate{\Eenumerate} % @multitable macros % Amy Hendrickson, 8/18/94, 3/6/96 % % @multitable ... @end multitable will make as many columns as desired. % Contents of each column will wrap at width given in preamble. Width % can be specified either with sample text given in a template line, % or in percent of \hsize, the current width of text on page. % Table can continue over pages but will only break between lines. % To make preamble: % % Either define widths of columns in terms of percent of \hsize: % @multitable @columnfractions .25 .3 .45 % @item ... % % Numbers following @columnfractions are the percent of the total % current hsize to be used for each column. You may use as many % columns as desired. % Or use a template: % @multitable {Column 1 template} {Column 2 template} {Column 3 template} % @item ... % using the widest term desired in each column. % Each new table line starts with @item, each subsequent new column % starts with @tab. Empty columns may be produced by supplying @tab's % with nothing between them for as many times as empty columns are needed, % ie, @tab@tab@tab will produce two empty columns. % @item, @tab do not need to be on their own lines, but it will not hurt % if they are. % Sample multitable: % @multitable {Column 1 template} {Column 2 template} {Column 3 template} % @item first col stuff @tab second col stuff @tab third col % @item % first col stuff % @tab % second col stuff % @tab % third col % @item first col stuff @tab second col stuff % @tab Many paragraphs of text may be used in any column. % % They will wrap at the width determined by the template. % @item@tab@tab This will be in third column. % @end multitable % Default dimensions may be reset by user. % @multitableparskip is vertical space between paragraphs in table. % @multitableparindent is paragraph indent in table. % @multitablecolmargin is horizontal space to be left between columns. % @multitablelinespace is space to leave between table items, baseline % to baseline. % 0pt means it depends on current normal line spacing. % \newskip\multitableparskip \newskip\multitableparindent \newdimen\multitablecolspace \newskip\multitablelinespace \multitableparskip=0pt \multitableparindent=6pt \multitablecolspace=12pt \multitablelinespace=0pt % Macros used to set up halign preamble: % \let\endsetuptable\relax \def\xendsetuptable{\endsetuptable} \let\columnfractions\relax \def\xcolumnfractions{\columnfractions} \newif\ifsetpercent % #1 is the @columnfraction, usually a decimal number like .5, but might % be just 1. We just use it, whatever it is. % \def\pickupwholefraction#1 {% \global\advance\colcount by 1 \expandafter\xdef\csname col\the\colcount\endcsname{#1\hsize}% \setuptable } \newcount\colcount \def\setuptable#1{% \def\firstarg{#1}% \ifx\firstarg\xendsetuptable \let\go = \relax \else \ifx\firstarg\xcolumnfractions \global\setpercenttrue \else \ifsetpercent \let\go\pickupwholefraction \else \global\advance\colcount by 1 \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a % separator; typically that is always in the input, anyway. \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}% \fi \fi \ifx\go\pickupwholefraction % Put the argument back for the \pickupwholefraction call, so % we'll always have a period there to be parsed. \def\go{\pickupwholefraction#1}% \else \let\go = \setuptable \fi% \fi \go } % multitable-only commands. % % @headitem starts a heading row, which we typeset in bold. % Assignments have to be global since we are inside the implicit group % of an alignment entry. \everycr resets \everytab so we don't have to % undo it ourselves. \def\headitemfont{\b}% for people to use in the template row; not changeable \def\headitem{% \checkenv\multitable \crcr \global\everytab={\bf}% can't use \headitemfont since the parsing differs \the\everytab % for the first item }% % % A \tab used to include \hskip1sp. But then the space in a template % line is not enough. That is bad. So let's go back to just `&' until % we again encounter the problem the 1sp was intended to solve. % --karl, nathan@acm.org, 20apr99. \def\tab{\checkenv\multitable &\the\everytab}% % @multitable ... @end multitable definitions: % \newtoks\everytab % insert after every tab. % \envdef\multitable{% \vskip\parskip \startsavinginserts % % @item within a multitable starts a normal row. % We use \def instead of \let so that if one of the multitable entries % contains an @itemize, we don't choke on the \item (seen as \crcr aka % \endtemplate) expanding \doitemize. \def\item{\crcr}% % \tolerance=9500 \hbadness=9500 \setmultitablespacing \parskip=\multitableparskip \parindent=\multitableparindent \overfullrule=0pt \global\colcount=0 % \everycr = {% \noalign{% \global\everytab={}% \global\colcount=0 % Reset the column counter. % Check for saved footnotes, etc. \checkinserts % Keeps underfull box messages off when table breaks over pages. %\filbreak % Maybe so, but it also creates really weird page breaks when the % table breaks over pages. Wouldn't \vfil be better? Wait until the % problem manifests itself, so it can be fixed for real --karl. }% }% % \parsearg\domultitable } \def\domultitable#1{% % To parse everything between @multitable and @item: \setuptable#1 \endsetuptable % % This preamble sets up a generic column definition, which will % be used as many times as user calls for columns. % \vtop will set a single line and will also let text wrap and % continue for many paragraphs if desired. \halign\bgroup &% \global\advance\colcount by 1 \multistrut \vtop{% % Use the current \colcount to find the correct column width: \hsize=\expandafter\csname col\the\colcount\endcsname % % In order to keep entries from bumping into each other % we will add a \leftskip of \multitablecolspace to all columns after % the first one. % % If a template has been used, we will add \multitablecolspace % to the width of each template entry. % % If the user has set preamble in terms of percent of \hsize we will % use that dimension as the width of the column, and the \leftskip % will keep entries from bumping into each other. Table will start at % left margin and final column will justify at right margin. % % Make sure we don't inherit \rightskip from the outer environment. \rightskip=0pt \ifnum\colcount=1 % The first column will be indented with the surrounding text. \advance\hsize by\leftskip \else \ifsetpercent \else % If user has not set preamble in terms of percent of \hsize % we will advance \hsize by \multitablecolspace. \advance\hsize by \multitablecolspace \fi % In either case we will make \leftskip=\multitablecolspace: \leftskip=\multitablecolspace \fi % Ignoring space at the beginning and end avoids an occasional spurious % blank line, when TeX decides to break the line at the space before the % box from the multistrut, so the strut ends up on a line by itself. % For example: % @multitable @columnfractions .11 .89 % @item @code{#} % @tab Legal holiday which is valid in major parts of the whole country. % Is automatically provided with highlighting sequences respectively % marking characters. \noindent\ignorespaces##\unskip\multistrut }\cr } \def\Emultitable{% \crcr \egroup % end the \halign \global\setpercentfalse } \def\setmultitablespacing{% \def\multistrut{\strut}% just use the standard line spacing % % Compute \multitablelinespace (if not defined by user) for use in % \multitableparskip calculation. We used define \multistrut based on % this, but (ironically) that caused the spacing to be off. % See bug-texinfo report from Werner Lemberg, 31 Oct 2004 12:52:20 +0100. \ifdim\multitablelinespace=0pt \setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip \global\advance\multitablelinespace by-\ht0 \fi % Test to see if parskip is larger than space between lines of % table. If not, do nothing. % If so, set to same dimension as multitablelinespace. \ifdim\multitableparskip>\multitablelinespace \global\multitableparskip=\multitablelinespace \global\advance\multitableparskip-7pt % to keep parskip somewhat smaller % than skip between lines in the table. \fi% \ifdim\multitableparskip=0pt \global\multitableparskip=\multitablelinespace \global\advance\multitableparskip-7pt % to keep parskip somewhat smaller % than skip between lines in the table. \fi} \message{conditionals,} % @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotplaintext, % @ifnotxml always succeed. They currently do nothing; we don't % attempt to check whether the conditionals are properly nested. But we % have to remember that they are conditionals, so that @end doesn't % attempt to close an environment group. % \def\makecond#1{% \expandafter\let\csname #1\endcsname = \relax \expandafter\let\csname iscond.#1\endcsname = 1 } \makecond{iftex} \makecond{ifnotdocbook} \makecond{ifnothtml} \makecond{ifnotinfo} \makecond{ifnotplaintext} \makecond{ifnotxml} % Ignore @ignore, @ifhtml, @ifinfo, and the like. % \def\direntry{\doignore{direntry}} \def\documentdescription{\doignore{documentdescription}} \def\docbook{\doignore{docbook}} \def\html{\doignore{html}} \def\ifdocbook{\doignore{ifdocbook}} \def\ifhtml{\doignore{ifhtml}} \def\ifinfo{\doignore{ifinfo}} \def\ifnottex{\doignore{ifnottex}} \def\ifplaintext{\doignore{ifplaintext}} \def\ifxml{\doignore{ifxml}} \def\ignore{\doignore{ignore}} \def\menu{\doignore{menu}} \def\xml{\doignore{xml}} % Ignore text until a line `@end #1', keeping track of nested conditionals. % % A count to remember the depth of nesting. \newcount\doignorecount \def\doignore#1{\begingroup % Scan in ``verbatim'' mode: \obeylines \catcode`\@ = \other \catcode`\{ = \other \catcode`\} = \other % % Make sure that spaces turn into tokens that match what \doignoretext wants. \spaceisspace % % Count number of #1's that we've seen. \doignorecount = 0 % % Swallow text until we reach the matching `@end #1'. \dodoignore{#1}% } { \catcode`_=11 % We want to use \_STOP_ which cannot appear in texinfo source. \obeylines % % \gdef\dodoignore#1{% % #1 contains the command name as a string, e.g., `ifinfo'. % % Define a command to find the next `@end #1'. \long\def\doignoretext##1^^M@end #1{% \doignoretextyyy##1^^M@#1\_STOP_}% % % And this command to find another #1 command, at the beginning of a % line. (Otherwise, we would consider a line `@c @ifset', for % example, to count as an @ifset for nesting.) \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}% % % And now expand that command. \doignoretext ^^M% }% } \def\doignoreyyy#1{% \def\temp{#1}% \ifx\temp\empty % Nothing found. \let\next\doignoretextzzz \else % Found a nested condition, ... \advance\doignorecount by 1 \let\next\doignoretextyyy % ..., look for another. % If we're here, #1 ends with ^^M\ifinfo (for example). \fi \next #1% the token \_STOP_ is present just after this macro. } % We have to swallow the remaining "\_STOP_". % \def\doignoretextzzz#1{% \ifnum\doignorecount = 0 % We have just found the outermost @end. \let\next\enddoignore \else % Still inside a nested condition. \advance\doignorecount by -1 \let\next\doignoretext % Look for the next @end. \fi \next } % Finish off ignored text. { \obeylines% % Ignore anything after the last `@end #1'; this matters in verbatim % environments, where otherwise the newline after an ignored conditional % would result in a blank line in the output. \gdef\enddoignore#1^^M{\endgroup\ignorespaces}% } % @set VAR sets the variable VAR to an empty value. % @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE. % % Since we want to separate VAR from REST-OF-LINE (which might be % empty), we can't just use \parsearg; we have to insert a space of our % own to delimit the rest of the line, and then take it out again if we % didn't need it. % We rely on the fact that \parsearg sets \catcode`\ =10. % \parseargdef\set{\setyyy#1 \endsetyyy} \def\setyyy#1 #2\endsetyyy{% {% \makevalueexpandable \def\temp{#2}% \edef\next{\gdef\makecsname{SET#1}}% \ifx\temp\empty \next{}% \else \setzzz#2\endsetzzz \fi }% } % Remove the trailing space \setxxx inserted. \def\setzzz#1 \endsetzzz{\next{#1}} % @clear VAR clears (i.e., unsets) the variable VAR. % \parseargdef\clear{% {% \makevalueexpandable \global\expandafter\let\csname SET#1\endcsname=\relax }% } % @value{foo} gets the text saved in variable foo. \def\value{\begingroup\makevalueexpandable\valuexxx} \def\valuexxx#1{\expandablevalue{#1}\endgroup} { \catcode`\- = \active \catcode`\_ = \active % \gdef\makevalueexpandable{% \let\value = \expandablevalue % We don't want these characters active, ... \catcode`\-=\other \catcode`\_=\other % ..., but we might end up with active ones in the argument if % we're called from @code, as @code{@value{foo-bar_}}, though. % So \let them to their normal equivalents. \let-\realdash \let_\normalunderscore } } % We have this subroutine so that we can handle at least some @value's % properly in indexes (we call \makevalueexpandable in \indexdummies). % The command has to be fully expandable (if the variable is set), since % the result winds up in the index file. This means that if the % variable's value contains other Texinfo commands, it's almost certain % it will fail (although perhaps we could fix that with sufficient work % to do a one-level expansion on the result, instead of complete). % \def\expandablevalue#1{% \expandafter\ifx\csname SET#1\endcsname\relax {[No value for ``#1'']}% \message{Variable `#1', used in @value, is not set.}% \else \csname SET#1\endcsname \fi } % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined % with @set. % % To get special treatment of `@end ifset,' call \makeond and the redefine. % \makecond{ifset} \def\ifset{\parsearg{\doifset{\let\next=\ifsetfail}}} \def\doifset#1#2{% {% \makevalueexpandable \let\next=\empty \expandafter\ifx\csname SET#2\endcsname\relax #1% If not set, redefine \next. \fi \expandafter }\next } \def\ifsetfail{\doignore{ifset}} % @ifclear VAR ... @end executes the `...' iff VAR has never been % defined with @set, or has been undefined with @clear. % % The `\else' inside the `\doifset' parameter is a trick to reuse the % above code: if the variable is not set, do nothing, if it is set, % then redefine \next to \ifclearfail. % \makecond{ifclear} \def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}} \def\ifclearfail{\doignore{ifclear}} % @ifcommandisdefined CMD ... @end executes the `...' if CMD (written % without the @) is in fact defined. We can only feasibly check at the % TeX level, so something like `mathcode' is going to considered % defined even though it is not a Texinfo command. % \makecond{ifcommanddefined} \def\ifcommanddefined{\parsearg{\doifcmddefined{\let\next=\ifcmddefinedfail}}} % \def\doifcmddefined#1#2{{% \makevalueexpandable \let\next=\empty \expandafter\ifx\csname #2\endcsname\relax #1% If not defined, \let\next as above. \fi \expandafter }\next } \def\ifcmddefinedfail{\doignore{ifcommanddefined}} % @ifcommandnotdefined CMD ... handled similar to @ifclear above. \makecond{ifcommandnotdefined} \def\ifcommandnotdefined{% \parsearg{\doifcmddefined{\else \let\next=\ifcmdnotdefinedfail}}} \def\ifcmdnotdefinedfail{\doignore{ifcommandnotdefined}} % Set the `txicommandconditionals' variable, so documents have a way to % test if the @ifcommand...defined conditionals are available. \set txicommandconditionals % @dircategory CATEGORY -- specify a category of the dir file % which this file should belong to. Ignore this in TeX. \let\dircategory=\comment % @defininfoenclose. \let\definfoenclose=\comment \message{indexing,} % Index generation facilities % Define \newwrite to be identical to plain tex's \newwrite % except not \outer, so it can be used within macros and \if's. \edef\newwrite{\makecsname{ptexnewwrite}} % \newindex {foo} defines an index named foo. % It automatically defines \fooindex such that % \fooindex ...rest of line... puts an entry in the index foo. % It also defines \fooindfile to be the number of the output channel for % the file that accumulates this index. The file's extension is foo. % The name of an index should be no more than 2 characters long % for the sake of vms. % \def\newindex#1{% \iflinks \expandafter\newwrite \csname#1indfile\endcsname \openout \csname#1indfile\endcsname \jobname.#1 % Open the file \fi \expandafter\xdef\csname#1index\endcsname{% % Define @#1index \noexpand\doindex{#1}} } % @defindex foo == \newindex{foo} % \def\defindex{\parsearg\newindex} % Define @defcodeindex, like @defindex except put all entries in @code. % \def\defcodeindex{\parsearg\newcodeindex} % \def\newcodeindex#1{% \iflinks \expandafter\newwrite \csname#1indfile\endcsname \openout \csname#1indfile\endcsname \jobname.#1 \fi \expandafter\xdef\csname#1index\endcsname{% \noexpand\docodeindex{#1}}% } % @synindex foo bar makes index foo feed into index bar. % Do this instead of @defindex foo if you don't want it as a separate index. % % @syncodeindex foo bar similar, but put all entries made for index foo % inside @code. % \def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}} \def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}} % #1 is \doindex or \docodeindex, #2 the index getting redefined (foo), % #3 the target index (bar). \def\dosynindex#1#2#3{% % Only do \closeout if we haven't already done it, else we'll end up % closing the target index. \expandafter \ifx\csname donesynindex#2\endcsname \relax % The \closeout helps reduce unnecessary open files; the limit on the % Acorn RISC OS is a mere 16 files. \expandafter\closeout\csname#2indfile\endcsname \expandafter\let\csname donesynindex#2\endcsname = 1 \fi % redefine \fooindfile: \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname \expandafter\let\csname#2indfile\endcsname=\temp % redefine \fooindex: \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}% } % Define \doindex, the driver for all \fooindex macros. % Argument #1 is generated by the calling \fooindex macro, % and it is "foo", the name of the index. % \doindex just uses \parsearg; it calls \doind for the actual work. % This is because \doind is more useful to call from other macros. % There is also \dosubind {index}{topic}{subtopic} % which makes an entry in a two-level index such as the operation index. \def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer} \def\singleindexer #1{\doind{\indexname}{#1}} % like the previous two, but they put @code around the argument. \def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer} \def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}} % Take care of Texinfo commands that can appear in an index entry. % Since there are some commands we want to expand, and others we don't, % we have to laboriously prevent expansion for those that we don't. % \def\indexdummies{% \escapechar = `\\ % use backslash in output files. \def\@{@}% change to @@ when we switch to @ as escape char in index files. \def\ {\realbackslash\space }% % % Need these unexpandable (because we define \tt as a dummy) % definitions when @{ or @} appear in index entry text. Also, more % complicated, when \tex is in effect and \{ is a \delimiter again. % We can't use \lbracecmd and \rbracecmd because texindex assumes % braces and backslashes are used only as delimiters. Perhaps we % should define @lbrace and @rbrace commands a la @comma. \def\{{{\tt\char123}}% \def\}{{\tt\char125}}% % % I don't entirely understand this, but when an index entry is % generated from a macro call, the \endinput which \scanmacro inserts % causes processing to be prematurely terminated. This is, % apparently, because \indexsorttmp is fully expanded, and \endinput % is an expandable command. The redefinition below makes \endinput % disappear altogether for that purpose -- although logging shows that % processing continues to some further point. On the other hand, it % seems \endinput does not hurt in the printed index arg, since that % is still getting written without apparent harm. % % Sample source (mac-idx3.tex, reported by Graham Percival to % help-texinfo, 22may06): % @macro funindex {WORD} % @findex xyz % @end macro % ... % @funindex commtest % % The above is not enough to reproduce the bug, but it gives the flavor. % % Sample whatsit resulting: % .@write3{\entry{xyz}{@folio }{@code {xyz@endinput }}} % % So: \let\endinput = \empty % % Do the redefinitions. \commondummies } % For the aux and toc files, @ is the escape character. So we want to % redefine everything using @ as the escape character (instead of % \realbackslash, still used for index files). When everything uses @, % this will be simpler. % \def\atdummies{% \def\@{@@}% \def\ {@ }% \let\{ = \lbraceatcmd \let\} = \rbraceatcmd % % Do the redefinitions. \commondummies \otherbackslash } % Called from \indexdummies and \atdummies. % \def\commondummies{% % % \definedummyword defines \#1 as \string\#1\space, thus effectively % preventing its expansion. This is used only for control words, % not control letters, because the \space would be incorrect for % control characters, but is needed to separate the control word % from whatever follows. % % For control letters, we have \definedummyletter, which omits the % space. % % These can be used both for control words that take an argument and % those that do not. If it is followed by {arg} in the input, then % that will dutifully get written to the index (or wherever). % \def\definedummyword ##1{\def##1{\string##1\space}}% \def\definedummyletter##1{\def##1{\string##1}}% \let\definedummyaccent\definedummyletter % \commondummiesnofonts % \definedummyletter\_% \definedummyletter\-% % % Non-English letters. \definedummyword\AA \definedummyword\AE \definedummyword\DH \definedummyword\L \definedummyword\O \definedummyword\OE \definedummyword\TH \definedummyword\aa \definedummyword\ae \definedummyword\dh \definedummyword\exclamdown \definedummyword\l \definedummyword\o \definedummyword\oe \definedummyword\ordf \definedummyword\ordm \definedummyword\questiondown \definedummyword\ss \definedummyword\th % % Although these internal commands shouldn't show up, sometimes they do. \definedummyword\bf \definedummyword\gtr \definedummyword\hat \definedummyword\less \definedummyword\sf \definedummyword\sl \definedummyword\tclose \definedummyword\tt % \definedummyword\LaTeX \definedummyword\TeX % % Assorted special characters. \definedummyword\arrow \definedummyword\bullet \definedummyword\comma \definedummyword\copyright \definedummyword\registeredsymbol \definedummyword\dots \definedummyword\enddots \definedummyword\entrybreak \definedummyword\equiv \definedummyword\error \definedummyword\euro \definedummyword\expansion \definedummyword\geq \definedummyword\guillemetleft \definedummyword\guillemetright \definedummyword\guilsinglleft \definedummyword\guilsinglright \definedummyword\lbracechar \definedummyword\leq \definedummyword\minus \definedummyword\ogonek \definedummyword\pounds \definedummyword\point \definedummyword\print \definedummyword\quotedblbase \definedummyword\quotedblleft \definedummyword\quotedblright \definedummyword\quoteleft \definedummyword\quoteright \definedummyword\quotesinglbase \definedummyword\rbracechar \definedummyword\result \definedummyword\textdegree % % We want to disable all macros so that they are not expanded by \write. \macrolist % \normalturnoffactive % % Handle some cases of @value -- where it does not contain any % (non-fully-expandable) commands. \makevalueexpandable } % \commondummiesnofonts: common to \commondummies and \indexnofonts. % \def\commondummiesnofonts{% % Control letters and accents. \definedummyletter\!% \definedummyaccent\"% \definedummyaccent\'% \definedummyletter\*% \definedummyaccent\,% \definedummyletter\.% \definedummyletter\/% \definedummyletter\:% \definedummyaccent\=% \definedummyletter\?% \definedummyaccent\^% \definedummyaccent\`% \definedummyaccent\~% \definedummyword\u \definedummyword\v \definedummyword\H \definedummyword\dotaccent \definedummyword\ogonek \definedummyword\ringaccent \definedummyword\tieaccent \definedummyword\ubaraccent \definedummyword\udotaccent \definedummyword\dotless % % Texinfo font commands. \definedummyword\b \definedummyword\i \definedummyword\r \definedummyword\sansserif \definedummyword\sc \definedummyword\slanted \definedummyword\t % % Commands that take arguments. \definedummyword\abbr \definedummyword\acronym \definedummyword\anchor \definedummyword\cite \definedummyword\code \definedummyword\command \definedummyword\dfn \definedummyword\dmn \definedummyword\email \definedummyword\emph \definedummyword\env \definedummyword\file \definedummyword\image \definedummyword\indicateurl \definedummyword\inforef \definedummyword\kbd \definedummyword\key \definedummyword\math \definedummyword\option \definedummyword\pxref \definedummyword\ref \definedummyword\samp \definedummyword\strong \definedummyword\tie \definedummyword\uref \definedummyword\url \definedummyword\var \definedummyword\verb \definedummyword\w \definedummyword\xref } % \indexnofonts is used when outputting the strings to sort the index % by, and when constructing control sequence names. It eliminates all % control sequences and just writes whatever the best ASCII sort string % would be for a given command (usually its argument). % \def\indexnofonts{% % Accent commands should become @asis. \def\definedummyaccent##1{\let##1\asis}% % We can just ignore other control letters. \def\definedummyletter##1{\let##1\empty}% % All control words become @asis by default; overrides below. \let\definedummyword\definedummyaccent % \commondummiesnofonts % % Don't no-op \tt, since it isn't a user-level command % and is used in the definitions of the active chars like <, >, |, etc. % Likewise with the other plain tex font commands. %\let\tt=\asis % \def\ { }% \def\@{@}% \def\_{\normalunderscore}% \def\-{}% @- shouldn't affect sorting % % Unfortunately, texindex is not prepared to handle braces in the % content at all. So for index sorting, we map @{ and @} to strings % starting with |, since that ASCII character is between ASCII { and }. \def\{{|a}% \def\lbracechar{|a}% % \def\}{|b}% \def\rbracechar{|b}% % % Non-English letters. \def\AA{AA}% \def\AE{AE}% \def\DH{DZZ}% \def\L{L}% \def\OE{OE}% \def\O{O}% \def\TH{ZZZ}% \def\aa{aa}% \def\ae{ae}% \def\dh{dzz}% \def\exclamdown{!}% \def\l{l}% \def\oe{oe}% \def\ordf{a}% \def\ordm{o}% \def\o{o}% \def\questiondown{?}% \def\ss{ss}% \def\th{zzz}% % \def\LaTeX{LaTeX}% \def\TeX{TeX}% % % Assorted special characters. % (The following {} will end up in the sort string, but that's ok.) \def\arrow{->}% \def\bullet{bullet}% \def\comma{,}% \def\copyright{copyright}% \def\dots{...}% \def\enddots{...}% \def\equiv{==}% \def\error{error}% \def\euro{euro}% \def\expansion{==>}% \def\geq{>=}% \def\guillemetleft{<<}% \def\guillemetright{>>}% \def\guilsinglleft{<}% \def\guilsinglright{>}% \def\leq{<=}% \def\minus{-}% \def\point{.}% \def\pounds{pounds}% \def\print{-|}% \def\quotedblbase{"}% \def\quotedblleft{"}% \def\quotedblright{"}% \def\quoteleft{`}% \def\quoteright{'}% \def\quotesinglbase{,}% \def\registeredsymbol{R}% \def\result{=>}% \def\textdegree{o}% % \expandafter\ifx\csname SETtxiindexlquoteignore\endcsname\relax \else \indexlquoteignore \fi % % We need to get rid of all macros, leaving only the arguments (if present). % Of course this is not nearly correct, but it is the best we can do for now. % makeinfo does not expand macros in the argument to @deffn, which ends up % writing an index entry, and texindex isn't prepared for an index sort entry % that starts with \. % % Since macro invocations are followed by braces, we can just redefine them % to take a single TeX argument. The case of a macro invocation that % goes to end-of-line is not handled. % \macrolist } % Undocumented (for FSFS 2nd ed.): @set txiindexlquoteignore makes us % ignore left quotes in the sort term. {\catcode`\`=\active \gdef\indexlquoteignore{\let`=\empty}} \let\indexbackslash=0 %overridden during \printindex. \let\SETmarginindex=\relax % put index entries in margin (undocumented)? % Most index entries go through here, but \dosubind is the general case. % #1 is the index name, #2 is the entry text. \def\doind#1#2{\dosubind{#1}{#2}{}} % Workhorse for all \fooindexes. % #1 is name of index, #2 is stuff to put there, #3 is subentry -- % empty if called from \doind, as we usually are (the main exception % is with most defuns, which call us directly). % \def\dosubind#1#2#3{% \iflinks {% % Store the main index entry text (including the third arg). \toks0 = {#2}% % If third arg is present, precede it with a space. \def\thirdarg{#3}% \ifx\thirdarg\empty \else \toks0 = \expandafter{\the\toks0 \space #3}% \fi % \edef\writeto{\csname#1indfile\endcsname}% % \safewhatsit\dosubindwrite }% \fi } % Write the entry in \toks0 to the index file: % \def\dosubindwrite{% % Put the index entry in the margin if desired. \ifx\SETmarginindex\relax\else \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \the\toks0}}% \fi % % Remember, we are within a group. \indexdummies % Must do this here, since \bf, etc expand at this stage \def\backslashcurfont{\indexbackslash}% \indexbackslash isn't defined now % so it will be output as is; and it will print as backslash. % % Process the index entry with all font commands turned off, to % get the string to sort by. {\indexnofonts \edef\temp{\the\toks0}% need full expansion \xdef\indexsorttmp{\temp}% }% % % Set up the complete index entry, with both the sort key and % the original text, including any font commands. We write % three arguments to \entry to the .?? file (four in the % subentry case), texindex reduces to two when writing the .??s % sorted result. \edef\temp{% \write\writeto{% \string\entry{\indexsorttmp}{\noexpand\folio}{\the\toks0}}% }% \temp } % Take care of unwanted page breaks/skips around a whatsit: % % If a skip is the last thing on the list now, preserve it % by backing up by \lastskip, doing the \write, then inserting % the skip again. Otherwise, the whatsit generated by the % \write or \pdfdest will make \lastskip zero. The result is that % sequences like this: % @end defun % @tindex whatever % @defun ... % will have extra space inserted, because the \medbreak in the % start of the @defun won't see the skip inserted by the @end of % the previous defun. % % But don't do any of this if we're not in vertical mode. We % don't want to do a \vskip and prematurely end a paragraph. % % Avoid page breaks due to these extra skips, too. % % But wait, there is a catch there: % We'll have to check whether \lastskip is zero skip. \ifdim is not % sufficient for this purpose, as it ignores stretch and shrink parts % of the skip. The only way seems to be to check the textual % representation of the skip. % % The following is almost like \def\zeroskipmacro{0.0pt} except that % the ``p'' and ``t'' characters have catcode \other, not 11 (letter). % \edef\zeroskipmacro{\expandafter\the\csname z@skip\endcsname} % \newskip\whatsitskip \newcount\whatsitpenalty % % ..., ready, GO: % \def\safewhatsit#1{\ifhmode #1% \else % \lastskip and \lastpenalty cannot both be nonzero simultaneously. \whatsitskip = \lastskip \edef\lastskipmacro{\the\lastskip}% \whatsitpenalty = \lastpenalty % % If \lastskip is nonzero, that means the last item was a % skip. And since a skip is discardable, that means this % -\whatsitskip glue we're inserting is preceded by a % non-discardable item, therefore it is not a potential % breakpoint, therefore no \nobreak needed. \ifx\lastskipmacro\zeroskipmacro \else \vskip-\whatsitskip \fi % #1% % \ifx\lastskipmacro\zeroskipmacro % If \lastskip was zero, perhaps the last item was a penalty, and % perhaps it was >=10000, e.g., a \nobreak. In that case, we want % to re-insert the same penalty (values >10000 are used for various % signals); since we just inserted a non-discardable item, any % following glue (such as a \parskip) would be a breakpoint. For example: % @deffn deffn-whatever % @vindex index-whatever % Description. % would allow a break between the index-whatever whatsit % and the "Description." paragraph. \ifnum\whatsitpenalty>9999 \penalty\whatsitpenalty \fi \else % On the other hand, if we had a nonzero \lastskip, % this make-up glue would be preceded by a non-discardable item % (the whatsit from the \write), so we must insert a \nobreak. \nobreak\vskip\whatsitskip \fi \fi} % The index entry written in the file actually looks like % \entry {sortstring}{page}{topic} % or % \entry {sortstring}{page}{topic}{subtopic} % The texindex program reads in these files and writes files % containing these kinds of lines: % \initial {c} % before the first topic whose initial is c % \entry {topic}{pagelist} % for a topic that is used without subtopics % \primary {topic} % for the beginning of a topic that is used with subtopics % \secondary {subtopic}{pagelist} % for each subtopic. % Define the user-accessible indexing commands % @findex, @vindex, @kindex, @cindex. \def\findex {\fnindex} \def\kindex {\kyindex} \def\cindex {\cpindex} \def\vindex {\vrindex} \def\tindex {\tpindex} \def\pindex {\pgindex} \def\cindexsub {\begingroup\obeylines\cindexsub} {\obeylines % \gdef\cindexsub "#1" #2^^M{\endgroup % \dosubind{cp}{#2}{#1}}} % Define the macros used in formatting output of the sorted index material. % @printindex causes a particular index (the ??s file) to get printed. % It does not print any chapter heading (usually an @unnumbered). % \parseargdef\printindex{\begingroup \dobreak \chapheadingskip{10000}% % \smallfonts \rm \tolerance = 9500 \plainfrenchspacing \everypar = {}% don't want the \kern\-parindent from indentation suppression. % % See if the index file exists and is nonempty. % Change catcode of @ here so that if the index file contains % \initial {@} % as its first line, TeX doesn't complain about mismatched braces % (because it thinks @} is a control sequence). \catcode`\@ = 11 \openin 1 \jobname.#1s \ifeof 1 % \enddoublecolumns gets confused if there is no text in the index, % and it loses the chapter title and the aux file entries for the % index. The easiest way to prevent this problem is to make sure % there is some text. \putwordIndexNonexistent \else % % If the index file exists but is empty, then \openin leaves \ifeof % false. We have to make TeX try to read something from the file, so % it can discover if there is anything in it. \read 1 to \temp \ifeof 1 \putwordIndexIsEmpty \else % Index files are almost Texinfo source, but we use \ as the escape % character. It would be better to use @, but that's too big a change % to make right now. \def\indexbackslash{\backslashcurfont}% \catcode`\\ = 0 \escapechar = `\\ \begindoublecolumns \input \jobname.#1s \enddoublecolumns \fi \fi \closein 1 \endgroup} % These macros are used by the sorted index file itself. % Change them to control the appearance of the index. \def\initial#1{{% % Some minor font changes for the special characters. \let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt % % Remove any glue we may have, we'll be inserting our own. \removelastskip % % We like breaks before the index initials, so insert a bonus. \nobreak \vskip 0pt plus 3\baselineskip \penalty 0 \vskip 0pt plus -3\baselineskip % % Typeset the initial. Making this add up to a whole number of % baselineskips increases the chance of the dots lining up from column % to column. It still won't often be perfect, because of the stretch % we need before each entry, but it's better. % % No shrink because it confuses \balancecolumns. \vskip 1.67\baselineskip plus .5\baselineskip \leftline{\secbf #1}% % Do our best not to break after the initial. \nobreak \vskip .33\baselineskip plus .1\baselineskip }} % \entry typesets a paragraph consisting of the text (#1), dot leaders, and % then page number (#2) flushed to the right margin. It is used for index % and table of contents entries. The paragraph is indented by \leftskip. % % A straightforward implementation would start like this: % \def\entry#1#2{... % But this freezes the catcodes in the argument, and can cause problems to % @code, which sets - active. This problem was fixed by a kludge--- % ``-'' was active throughout whole index, but this isn't really right. % The right solution is to prevent \entry from swallowing the whole text. % --kasal, 21nov03 \def\entry{% \begingroup % % Start a new paragraph if necessary, so our assignments below can't % affect previous text. \par % % Do not fill out the last line with white space. \parfillskip = 0in % % No extra space above this paragraph. \parskip = 0in % % Do not prefer a separate line ending with a hyphen to fewer lines. \finalhyphendemerits = 0 % % \hangindent is only relevant when the entry text and page number % don't both fit on one line. In that case, bob suggests starting the % dots pretty far over on the line. Unfortunately, a large % indentation looks wrong when the entry text itself is broken across % lines. So we use a small indentation and put up with long leaders. % % \hangafter is reset to 1 (which is the value we want) at the start % of each paragraph, so we need not do anything with that. \hangindent = 2em % % When the entry text needs to be broken, just fill out the first line % with blank space. \rightskip = 0pt plus1fil % % A bit of stretch before each entry for the benefit of balancing % columns. \vskip 0pt plus1pt % % When reading the text of entry, convert explicit line breaks % from @* into spaces. The user might give these in long section % titles, for instance. \def\*{\unskip\space\ignorespaces}% \def\entrybreak{\hfil\break}% % % Swallow the left brace of the text (first parameter): \afterassignment\doentry \let\temp = } \def\entrybreak{\unskip\space\ignorespaces}% \def\doentry{% \bgroup % Instead of the swallowed brace. \noindent \aftergroup\finishentry % And now comes the text of the entry. } \def\finishentry#1{% % #1 is the page number. % % The following is kludged to not output a line of dots in the index if % there are no page numbers. The next person who breaks this will be % cursed by a Unix daemon. \setbox\boxA = \hbox{#1}% \ifdim\wd\boxA = 0pt \ % \else % % If we must, put the page number on a line of its own, and fill out % this line with blank space. (The \hfil is overwhelmed with the % fill leaders glue in \indexdotfill if the page number does fit.) \hfil\penalty50 \null\nobreak\indexdotfill % Have leaders before the page number. % % The `\ ' here is removed by the implicit \unskip that TeX does as % part of (the primitive) \par. Without it, a spurious underfull % \hbox ensues. \ifpdf \pdfgettoks#1.% \ \the\toksA \else \ #1% \fi \fi \par \endgroup } % Like plain.tex's \dotfill, except uses up at least 1 em. \def\indexdotfill{\cleaders \hbox{$\mathsurround=0pt \mkern1.5mu.\mkern1.5mu$}\hskip 1em plus 1fill} \def\primary #1{\line{#1\hfil}} \newskip\secondaryindent \secondaryindent=0.5cm \def\secondary#1#2{{% \parfillskip=0in \parskip=0in \hangindent=1in \hangafter=1 \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill \ifpdf \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph. \else #2 \fi \par }} % Define two-column mode, which we use to typeset indexes. % Adapted from the TeXbook, page 416, which is to say, % the manmac.tex format used to print the TeXbook itself. \catcode`\@=11 \newbox\partialpage \newdimen\doublecolumnhsize \def\begindoublecolumns{\begingroup % ended by \enddoublecolumns % Grab any single-column material above us. \output = {% % % Here is a possibility not foreseen in manmac: if we accumulate a % whole lot of material, we might end up calling this \output % routine twice in a row (see the doublecol-lose test, which is % essentially a couple of indexes with @setchapternewpage off). In % that case we just ship out what is in \partialpage with the normal % output routine. Generally, \partialpage will be empty when this % runs and this will be a no-op. See the indexspread.tex test case. \ifvoid\partialpage \else \onepageout{\pagecontents\partialpage}% \fi % \global\setbox\partialpage = \vbox{% % Unvbox the main output page. \unvbox\PAGE \kern-\topskip \kern\baselineskip }% }% \eject % run that output routine to set \partialpage % % Use the double-column output routine for subsequent pages. \output = {\doublecolumnout}% % % Change the page size parameters. We could do this once outside this % routine, in each of @smallbook, @afourpaper, and the default 8.5x11 % format, but then we repeat the same computation. Repeating a couple % of assignments once per index is clearly meaningless for the % execution time, so we may as well do it in one place. % % First we halve the line length, less a little for the gutter between % the columns. We compute the gutter based on the line length, so it % changes automatically with the paper format. The magic constant % below is chosen so that the gutter has the same value (well, +-<1pt) % as it did when we hard-coded it. % % We put the result in a separate register, \doublecolumhsize, so we % can restore it in \pagesofar, after \hsize itself has (potentially) % been clobbered. % \doublecolumnhsize = \hsize \advance\doublecolumnhsize by -.04154\hsize \divide\doublecolumnhsize by 2 \hsize = \doublecolumnhsize % % Double the \vsize as well. (We don't need a separate register here, % since nobody clobbers \vsize.) \vsize = 2\vsize } % The double-column output routine for all double-column pages except % the last. % \def\doublecolumnout{% \splittopskip=\topskip \splitmaxdepth=\maxdepth % Get the available space for the double columns -- the normal % (undoubled) page height minus any material left over from the % previous page. \dimen@ = \vsize \divide\dimen@ by 2 \advance\dimen@ by -\ht\partialpage % % box0 will be the left-hand column, box2 the right. \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@ \onepageout\pagesofar \unvbox255 \penalty\outputpenalty } % % Re-output the contents of the output page -- any previous material, % followed by the two boxes we just split, in box0 and box2. \def\pagesofar{% \unvbox\partialpage % \hsize = \doublecolumnhsize \wd0=\hsize \wd2=\hsize \hbox to\pagewidth{\box0\hfil\box2}% } % % All done with double columns. \def\enddoublecolumns{% % The following penalty ensures that the page builder is exercised % _before_ we change the output routine. This is necessary in the % following situation: % % The last section of the index consists only of a single entry. % Before this section, \pagetotal is less than \pagegoal, so no % break occurs before the last section starts. However, the last % section, consisting of \initial and the single \entry, does not % fit on the page and has to be broken off. Without the following % penalty the page builder will not be exercised until \eject % below, and by that time we'll already have changed the output % routine to the \balancecolumns version, so the next-to-last % double-column page will be processed with \balancecolumns, which % is wrong: The two columns will go to the main vertical list, with % the broken-off section in the recent contributions. As soon as % the output routine finishes, TeX starts reconsidering the page % break. The two columns and the broken-off section both fit on the % page, because the two columns now take up only half of the page % goal. When TeX sees \eject from below which follows the final % section, it invokes the new output routine that we've set after % \balancecolumns below; \onepageout will try to fit the two columns % and the final section into the vbox of \pageheight (see % \pagebody), causing an overfull box. % % Note that glue won't work here, because glue does not exercise the % page builder, unlike penalties (see The TeXbook, pp. 280-281). \penalty0 % \output = {% % Split the last of the double-column material. Leave it on the % current page, no automatic page break. \balancecolumns % % If we end up splitting too much material for the current page, % though, there will be another page break right after this \output % invocation ends. Having called \balancecolumns once, we do not % want to call it again. Therefore, reset \output to its normal % definition right away. (We hope \balancecolumns will never be % called on to balance too much material, but if it is, this makes % the output somewhat more palatable.) \global\output = {\onepageout{\pagecontents\PAGE}}% }% \eject \endgroup % started in \begindoublecolumns % % \pagegoal was set to the doubled \vsize above, since we restarted % the current page. We're now back to normal single-column % typesetting, so reset \pagegoal to the normal \vsize (after the % \endgroup where \vsize got restored). \pagegoal = \vsize } % % Called at the end of the double column material. \def\balancecolumns{% \setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120. \dimen@ = \ht0 \advance\dimen@ by \topskip \advance\dimen@ by-\baselineskip \divide\dimen@ by 2 % target to split to %debug\message{final 2-column material height=\the\ht0, target=\the\dimen@.}% \splittopskip = \topskip % Loop until we get a decent breakpoint. {% \vbadness = 10000 \loop \global\setbox3 = \copy0 \global\setbox1 = \vsplit3 to \dimen@ \ifdim\ht3>\dimen@ \global\advance\dimen@ by 1pt \repeat }% %debug\message{split to \the\dimen@, column heights: \the\ht1, \the\ht3.}% \setbox0=\vbox to\dimen@{\unvbox1}% \setbox2=\vbox to\dimen@{\unvbox3}% % \pagesofar } \catcode`\@ = \other \message{sectioning,} % Chapters, sections, etc. % Let's start with @part. \outer\parseargdef\part{\partzzz{#1}} \def\partzzz#1{% \chapoddpage \null \vskip.3\vsize % move it down on the page a bit \begingroup \noindent \titlefonts\rmisbold #1\par % the text \let\lastnode=\empty % no node to associate with \writetocentry{part}{#1}{}% but put it in the toc \headingsoff % no headline or footline on the part page \chapoddpage \endgroup } % \unnumberedno is an oxymoron. But we count the unnumbered % sections so that we can refer to them unambiguously in the pdf % outlines by their "section number". We avoid collisions with chapter % numbers by starting them at 10000. (If a document ever has 10000 % chapters, we're in trouble anyway, I'm sure.) \newcount\unnumberedno \unnumberedno = 10000 \newcount\chapno \newcount\secno \secno=0 \newcount\subsecno \subsecno=0 \newcount\subsubsecno \subsubsecno=0 % This counter is funny since it counts through charcodes of letters A, B, ... \newcount\appendixno \appendixno = `\@ % % \def\appendixletter{\char\the\appendixno} % We do the following ugly conditional instead of the above simple % construct for the sake of pdftex, which needs the actual % letter in the expansion, not just typeset. % \def\appendixletter{% \ifnum\appendixno=`A A% \else\ifnum\appendixno=`B B% \else\ifnum\appendixno=`C C% \else\ifnum\appendixno=`D D% \else\ifnum\appendixno=`E E% \else\ifnum\appendixno=`F F% \else\ifnum\appendixno=`G G% \else\ifnum\appendixno=`H H% \else\ifnum\appendixno=`I I% \else\ifnum\appendixno=`J J% \else\ifnum\appendixno=`K K% \else\ifnum\appendixno=`L L% \else\ifnum\appendixno=`M M% \else\ifnum\appendixno=`N N% \else\ifnum\appendixno=`O O% \else\ifnum\appendixno=`P P% \else\ifnum\appendixno=`Q Q% \else\ifnum\appendixno=`R R% \else\ifnum\appendixno=`S S% \else\ifnum\appendixno=`T T% \else\ifnum\appendixno=`U U% \else\ifnum\appendixno=`V V% \else\ifnum\appendixno=`W W% \else\ifnum\appendixno=`X X% \else\ifnum\appendixno=`Y Y% \else\ifnum\appendixno=`Z Z% % The \the is necessary, despite appearances, because \appendixletter is % expanded while writing the .toc file. \char\appendixno is not % expandable, thus it is written literally, thus all appendixes come out % with the same letter (or @) in the toc without it. \else\char\the\appendixno \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi} % Each @chapter defines these (using marks) as the number+name, number % and name of the chapter. Page headings and footings can use % these. @section does likewise. \def\thischapter{} \def\thischapternum{} \def\thischaptername{} \def\thissection{} \def\thissectionnum{} \def\thissectionname{} \newcount\absseclevel % used to calculate proper heading level \newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count % @raisesections: treat @section as chapter, @subsection as section, etc. \def\raisesections{\global\advance\secbase by -1} \let\up=\raisesections % original BFox name % @lowersections: treat @chapter as section, @section as subsection, etc. \def\lowersections{\global\advance\secbase by 1} \let\down=\lowersections % original BFox name % we only have subsub. \chardef\maxseclevel = 3 % % A numbered section within an unnumbered changes to unnumbered too. % To achieve this, remember the "biggest" unnum. sec. we are currently in: \chardef\unnlevel = \maxseclevel % % Trace whether the current chapter is an appendix or not: % \chapheadtype is "N" or "A", unnumbered chapters are ignored. \def\chapheadtype{N} % Choose a heading macro % #1 is heading type % #2 is heading level % #3 is text for heading \def\genhead#1#2#3{% % Compute the abs. sec. level: \absseclevel=#2 \advance\absseclevel by \secbase % Make sure \absseclevel doesn't fall outside the range: \ifnum \absseclevel < 0 \absseclevel = 0 \else \ifnum \absseclevel > 3 \absseclevel = 3 \fi \fi % The heading type: \def\headtype{#1}% \if \headtype U% \ifnum \absseclevel < \unnlevel \chardef\unnlevel = \absseclevel \fi \else % Check for appendix sections: \ifnum \absseclevel = 0 \edef\chapheadtype{\headtype}% \else \if \headtype A\if \chapheadtype N% \errmessage{@appendix... within a non-appendix chapter}% \fi\fi \fi % Check for numbered within unnumbered: \ifnum \absseclevel > \unnlevel \def\headtype{U}% \else \chardef\unnlevel = 3 \fi \fi % Now print the heading: \if \headtype U% \ifcase\absseclevel \unnumberedzzz{#3}% \or \unnumberedseczzz{#3}% \or \unnumberedsubseczzz{#3}% \or \unnumberedsubsubseczzz{#3}% \fi \else \if \headtype A% \ifcase\absseclevel \appendixzzz{#3}% \or \appendixsectionzzz{#3}% \or \appendixsubseczzz{#3}% \or \appendixsubsubseczzz{#3}% \fi \else \ifcase\absseclevel \chapterzzz{#3}% \or \seczzz{#3}% \or \numberedsubseczzz{#3}% \or \numberedsubsubseczzz{#3}% \fi \fi \fi \suppressfirstparagraphindent } % an interface: \def\numhead{\genhead N} \def\apphead{\genhead A} \def\unnmhead{\genhead U} % @chapter, @appendix, @unnumbered. Increment top-level counter, reset % all lower-level sectioning counters to zero. % % Also set \chaplevelprefix, which we prepend to @float sequence numbers % (e.g., figures), q.v. By default (before any chapter), that is empty. \let\chaplevelprefix = \empty % \outer\parseargdef\chapter{\numhead0{#1}} % normally numhead0 calls chapterzzz \def\chapterzzz#1{% % section resetting is \global in case the chapter is in a group, such % as an @include file. \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 \global\advance\chapno by 1 % % Used for \float. \gdef\chaplevelprefix{\the\chapno.}% \resetallfloatnos % % \putwordChapter can contain complex things in translations. \toks0=\expandafter{\putwordChapter}% \message{\the\toks0 \space \the\chapno}% % % Write the actual heading. \chapmacro{#1}{Ynumbered}{\the\chapno}% % % So @section and the like are numbered underneath this chapter. \global\let\section = \numberedsec \global\let\subsection = \numberedsubsec \global\let\subsubsection = \numberedsubsubsec } \outer\parseargdef\appendix{\apphead0{#1}} % normally calls appendixzzz % \def\appendixzzz#1{% \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 \global\advance\appendixno by 1 \gdef\chaplevelprefix{\appendixletter.}% \resetallfloatnos % % \putwordAppendix can contain complex things in translations. \toks0=\expandafter{\putwordAppendix}% \message{\the\toks0 \space \appendixletter}% % \chapmacro{#1}{Yappendix}{\appendixletter}% % \global\let\section = \appendixsec \global\let\subsection = \appendixsubsec \global\let\subsubsection = \appendixsubsubsec } % normally unnmhead0 calls unnumberedzzz: \outer\parseargdef\unnumbered{\unnmhead0{#1}} \def\unnumberedzzz#1{% \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 \global\advance\unnumberedno by 1 % % Since an unnumbered has no number, no prefix for figures. \global\let\chaplevelprefix = \empty \resetallfloatnos % % This used to be simply \message{#1}, but TeX fully expands the % argument to \message. Therefore, if #1 contained @-commands, TeX % expanded them. For example, in `@unnumbered The @cite{Book}', TeX % expanded @cite (which turns out to cause errors because \cite is meant % to be executed, not expanded). % % Anyway, we don't want the fully-expanded definition of @cite to appear % as a result of the \message, we just want `@cite' itself. We use % \the to achieve this: TeX expands \the only once, % simply yielding the contents of . (We also do this for % the toc entries.) \toks0 = {#1}% \message{(\the\toks0)}% % \chapmacro{#1}{Ynothing}{\the\unnumberedno}% % \global\let\section = \unnumberedsec \global\let\subsection = \unnumberedsubsec \global\let\subsubsection = \unnumberedsubsubsec } % @centerchap is like @unnumbered, but the heading is centered. \outer\parseargdef\centerchap{% % Well, we could do the following in a group, but that would break % an assumption that \chapmacro is called at the outermost level. % Thus we are safer this way: --kasal, 24feb04 \let\centerparametersmaybe = \centerparameters \unnmhead0{#1}% \let\centerparametersmaybe = \relax } % @top is like @unnumbered. \let\top\unnumbered % Sections. % \outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz \def\seczzz#1{% \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}% } % normally calls appendixsectionzzz: \outer\parseargdef\appendixsection{\apphead1{#1}} \def\appendixsectionzzz#1{% \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}% } \let\appendixsec\appendixsection % normally calls unnumberedseczzz: \outer\parseargdef\unnumberedsec{\unnmhead1{#1}} \def\unnumberedseczzz#1{% \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}% } % Subsections. % % normally calls numberedsubseczzz: \outer\parseargdef\numberedsubsec{\numhead2{#1}} \def\numberedsubseczzz#1{% \global\subsubsecno=0 \global\advance\subsecno by 1 \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}% } % normally calls appendixsubseczzz: \outer\parseargdef\appendixsubsec{\apphead2{#1}} \def\appendixsubseczzz#1{% \global\subsubsecno=0 \global\advance\subsecno by 1 \sectionheading{#1}{subsec}{Yappendix}% {\appendixletter.\the\secno.\the\subsecno}% } % normally calls unnumberedsubseczzz: \outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}} \def\unnumberedsubseczzz#1{% \global\subsubsecno=0 \global\advance\subsecno by 1 \sectionheading{#1}{subsec}{Ynothing}% {\the\unnumberedno.\the\secno.\the\subsecno}% } % Subsubsections. % % normally numberedsubsubseczzz: \outer\parseargdef\numberedsubsubsec{\numhead3{#1}} \def\numberedsubsubseczzz#1{% \global\advance\subsubsecno by 1 \sectionheading{#1}{subsubsec}{Ynumbered}% {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}% } % normally appendixsubsubseczzz: \outer\parseargdef\appendixsubsubsec{\apphead3{#1}} \def\appendixsubsubseczzz#1{% \global\advance\subsubsecno by 1 \sectionheading{#1}{subsubsec}{Yappendix}% {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}% } % normally unnumberedsubsubseczzz: \outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}} \def\unnumberedsubsubseczzz#1{% \global\advance\subsubsecno by 1 \sectionheading{#1}{subsubsec}{Ynothing}% {\the\unnumberedno.\the\secno.\the\subsecno.\the\subsubsecno}% } % These macros control what the section commands do, according % to what kind of chapter we are in (ordinary, appendix, or unnumbered). % Define them by default for a numbered chapter. \let\section = \numberedsec \let\subsection = \numberedsubsec \let\subsubsection = \numberedsubsubsec % Define @majorheading, @heading and @subheading \def\majorheading{% {\advance\chapheadingskip by 10pt \chapbreak }% \parsearg\chapheadingzzz } \def\chapheading{\chapbreak \parsearg\chapheadingzzz} \def\chapheadingzzz#1{% \vbox{\chapfonts \raggedtitlesettings #1\par}% \nobreak\bigskip \nobreak \suppressfirstparagraphindent } % @heading, @subheading, @subsubheading. \parseargdef\heading{\sectionheading{#1}{sec}{Yomitfromtoc}{} \suppressfirstparagraphindent} \parseargdef\subheading{\sectionheading{#1}{subsec}{Yomitfromtoc}{} \suppressfirstparagraphindent} \parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{} \suppressfirstparagraphindent} % These macros generate a chapter, section, etc. heading only % (including whitespace, linebreaking, etc. around it), % given all the information in convenient, parsed form. % Args are the skip and penalty (usually negative) \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi} % Parameter controlling skip before chapter headings (if needed) \newskip\chapheadingskip % Define plain chapter starts, and page on/off switching for it. \def\chapbreak{\dobreak \chapheadingskip {-4000}} \def\chappager{\par\vfill\supereject} % Because \domark is called before \chapoddpage, the filler page will % get the headings for the next chapter, which is wrong. But we don't % care -- we just disable all headings on the filler page. \def\chapoddpage{% \chappager \ifodd\pageno \else \begingroup \headingsoff \null \chappager \endgroup \fi } \def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname} \def\CHAPPAGoff{% \global\let\contentsalignmacro = \chappager \global\let\pchapsepmacro=\chapbreak \global\let\pagealignmacro=\chappager} \def\CHAPPAGon{% \global\let\contentsalignmacro = \chappager \global\let\pchapsepmacro=\chappager \global\let\pagealignmacro=\chappager \global\def\HEADINGSon{\HEADINGSsingle}} \def\CHAPPAGodd{% \global\let\contentsalignmacro = \chapoddpage \global\let\pchapsepmacro=\chapoddpage \global\let\pagealignmacro=\chapoddpage \global\def\HEADINGSon{\HEADINGSdouble}} \CHAPPAGon % Chapter opening. % % #1 is the text, #2 is the section type (Ynumbered, Ynothing, % Yappendix, Yomitfromtoc), #3 the chapter number. % % To test against our argument. \def\Ynothingkeyword{Ynothing} \def\Yomitfromtockeyword{Yomitfromtoc} \def\Yappendixkeyword{Yappendix} % \def\chapmacro#1#2#3{% % Insert the first mark before the heading break (see notes for \domark). \let\prevchapterdefs=\lastchapterdefs \let\prevsectiondefs=\lastsectiondefs \gdef\lastsectiondefs{\gdef\thissectionname{}\gdef\thissectionnum{}% \gdef\thissection{}}% % \def\temptype{#2}% \ifx\temptype\Ynothingkeyword \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}% \gdef\thischapter{\thischaptername}}% \else\ifx\temptype\Yomitfromtockeyword \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}% \gdef\thischapter{}}% \else\ifx\temptype\Yappendixkeyword \toks0={#1}% \xdef\lastchapterdefs{% \gdef\noexpand\thischaptername{\the\toks0}% \gdef\noexpand\thischapternum{\appendixletter}% % \noexpand\putwordAppendix avoids expanding indigestible % commands in some of the translations. \gdef\noexpand\thischapter{\noexpand\putwordAppendix{} \noexpand\thischapternum: \noexpand\thischaptername}% }% \else \toks0={#1}% \xdef\lastchapterdefs{% \gdef\noexpand\thischaptername{\the\toks0}% \gdef\noexpand\thischapternum{\the\chapno}% % \noexpand\putwordChapter avoids expanding indigestible % commands in some of the translations. \gdef\noexpand\thischapter{\noexpand\putwordChapter{} \noexpand\thischapternum: \noexpand\thischaptername}% }% \fi\fi\fi % % Output the mark. Pass it through \safewhatsit, to take care of % the preceding space. \safewhatsit\domark % % Insert the chapter heading break. \pchapsepmacro % % Now the second mark, after the heading break. No break points % between here and the heading. \let\prevchapterdefs=\lastchapterdefs \let\prevsectiondefs=\lastsectiondefs \domark % {% \chapfonts \rmisbold % % Have to define \lastsection before calling \donoderef, because the % xref code eventually uses it. On the other hand, it has to be called % after \pchapsepmacro, or the headline will change too soon. \gdef\lastsection{#1}% % % Only insert the separating space if we have a chapter/appendix % number, and don't print the unnumbered ``number''. \ifx\temptype\Ynothingkeyword \setbox0 = \hbox{}% \def\toctype{unnchap}% \else\ifx\temptype\Yomitfromtockeyword \setbox0 = \hbox{}% contents like unnumbered, but no toc entry \def\toctype{omit}% \else\ifx\temptype\Yappendixkeyword \setbox0 = \hbox{\putwordAppendix{} #3\enspace}% \def\toctype{app}% \else \setbox0 = \hbox{#3\enspace}% \def\toctype{numchap}% \fi\fi\fi % % Write the toc entry for this chapter. Must come before the % \donoderef, because we include the current node name in the toc % entry, and \donoderef resets it to empty. \writetocentry{\toctype}{#1}{#3}% % % For pdftex, we have to write out the node definition (aka, make % the pdfdest) after any page break, but before the actual text has % been typeset. If the destination for the pdf outline is after the % text, then jumping from the outline may wind up with the text not % being visible, for instance under high magnification. \donoderef{#2}% % % Typeset the actual heading. \nobreak % Avoid page breaks at the interline glue. \vbox{\raggedtitlesettings \hangindent=\wd0 \centerparametersmaybe \unhbox0 #1\par}% }% \nobreak\bigskip % no page break after a chapter title \nobreak } % @centerchap -- centered and unnumbered. \let\centerparametersmaybe = \relax \def\centerparameters{% \advance\rightskip by 3\rightskip \leftskip = \rightskip \parfillskip = 0pt } % I don't think this chapter style is supported any more, so I'm not % updating it with the new noderef stuff. We'll see. --karl, 11aug03. % \def\setchapterstyle #1 {\csname CHAPF#1\endcsname} % \def\unnchfopen #1{% \chapoddpage \vbox{\chapfonts \raggedtitlesettings #1\par}% \nobreak\bigskip\nobreak } \def\chfopen #1#2{\chapoddpage {\chapfonts \vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}% \par\penalty 5000 % } \def\centerchfopen #1{% \chapoddpage \vbox{\chapfonts \raggedtitlesettings \hfill #1\hfill}% \nobreak\bigskip \nobreak } \def\CHAPFopen{% \global\let\chapmacro=\chfopen \global\let\centerchapmacro=\centerchfopen} % Section titles. These macros combine the section number parts and % call the generic \sectionheading to do the printing. % \newskip\secheadingskip \def\secheadingbreak{\dobreak \secheadingskip{-1000}} % Subsection titles. \newskip\subsecheadingskip \def\subsecheadingbreak{\dobreak \subsecheadingskip{-500}} % Subsubsection titles. \def\subsubsecheadingskip{\subsecheadingskip} \def\subsubsecheadingbreak{\subsecheadingbreak} % Print any size, any type, section title. % % #1 is the text, #2 is the section level (sec/subsec/subsubsec), #3 is % the section type for xrefs (Ynumbered, Ynothing, Yappendix), #4 is the % section number. % \def\seckeyword{sec} % \def\sectionheading#1#2#3#4{% {% \checkenv{}% should not be in an environment. % % Switch to the right set of fonts. \csname #2fonts\endcsname \rmisbold % \def\sectionlevel{#2}% \def\temptype{#3}% % % Insert first mark before the heading break (see notes for \domark). \let\prevsectiondefs=\lastsectiondefs \ifx\temptype\Ynothingkeyword \ifx\sectionlevel\seckeyword \gdef\lastsectiondefs{\gdef\thissectionname{#1}\gdef\thissectionnum{}% \gdef\thissection{\thissectionname}}% \fi \else\ifx\temptype\Yomitfromtockeyword % Don't redefine \thissection. \else\ifx\temptype\Yappendixkeyword \ifx\sectionlevel\seckeyword \toks0={#1}% \xdef\lastsectiondefs{% \gdef\noexpand\thissectionname{\the\toks0}% \gdef\noexpand\thissectionnum{#4}% % \noexpand\putwordSection avoids expanding indigestible % commands in some of the translations. \gdef\noexpand\thissection{\noexpand\putwordSection{} \noexpand\thissectionnum: \noexpand\thissectionname}% }% \fi \else \ifx\sectionlevel\seckeyword \toks0={#1}% \xdef\lastsectiondefs{% \gdef\noexpand\thissectionname{\the\toks0}% \gdef\noexpand\thissectionnum{#4}% % \noexpand\putwordSection avoids expanding indigestible % commands in some of the translations. \gdef\noexpand\thissection{\noexpand\putwordSection{} \noexpand\thissectionnum: \noexpand\thissectionname}% }% \fi \fi\fi\fi % % Go into vertical mode. Usually we'll already be there, but we % don't want the following whatsit to end up in a preceding paragraph % if the document didn't happen to have a blank line. \par % % Output the mark. Pass it through \safewhatsit, to take care of % the preceding space. \safewhatsit\domark % % Insert space above the heading. \csname #2headingbreak\endcsname % % Now the second mark, after the heading break. No break points % between here and the heading. \let\prevsectiondefs=\lastsectiondefs \domark % % Only insert the space after the number if we have a section number. \ifx\temptype\Ynothingkeyword \setbox0 = \hbox{}% \def\toctype{unn}% \gdef\lastsection{#1}% \else\ifx\temptype\Yomitfromtockeyword % for @headings -- no section number, don't include in toc, % and don't redefine \lastsection. \setbox0 = \hbox{}% \def\toctype{omit}% \let\sectionlevel=\empty \else\ifx\temptype\Yappendixkeyword \setbox0 = \hbox{#4\enspace}% \def\toctype{app}% \gdef\lastsection{#1}% \else \setbox0 = \hbox{#4\enspace}% \def\toctype{num}% \gdef\lastsection{#1}% \fi\fi\fi % % Write the toc entry (before \donoderef). See comments in \chapmacro. \writetocentry{\toctype\sectionlevel}{#1}{#4}% % % Write the node reference (= pdf destination for pdftex). % Again, see comments in \chapmacro. \donoderef{#3}% % % Interline glue will be inserted when the vbox is completed. % That glue will be a valid breakpoint for the page, since it'll be % preceded by a whatsit (usually from the \donoderef, or from the % \writetocentry if there was no node). We don't want to allow that % break, since then the whatsits could end up on page n while the % section is on page n+1, thus toc/etc. are wrong. Debian bug 276000. \nobreak % % Output the actual section heading. \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \ptexraggedright \hangindent=\wd0 % zero if no section number \unhbox0 #1}% }% % Add extra space after the heading -- half of whatever came above it. % Don't allow stretch, though. \kern .5 \csname #2headingskip\endcsname % % Do not let the kern be a potential breakpoint, as it would be if it % was followed by glue. \nobreak % % We'll almost certainly start a paragraph next, so don't let that % glue accumulate. (Not a breakpoint because it's preceded by a % discardable item.) However, when a paragraph is not started next % (\startdefun, \cartouche, \center, etc.), this needs to be wiped out % or the negative glue will cause weirdly wrong output, typically % obscuring the section heading with something else. \vskip-\parskip % % This is so the last item on the main vertical list is a known % \penalty > 10000, so \startdefun, etc., can recognize the situation % and do the needful. \penalty 10001 } \message{toc,} % Table of contents. \newwrite\tocfile % Write an entry to the toc file, opening it if necessary. % Called from @chapter, etc. % % Example usage: \writetocentry{sec}{Section Name}{\the\chapno.\the\secno} % We append the current node name (if any) and page number as additional % arguments for the \{chap,sec,...}entry macros which will eventually % read this. The node name is used in the pdf outlines as the % destination to jump to. % % We open the .toc file for writing here instead of at @setfilename (or % any other fixed time) so that @contents can be anywhere in the document. % But if #1 is `omit', then we don't do anything. This is used for the % table of contents chapter openings themselves. % \newif\iftocfileopened \def\omitkeyword{omit}% % \def\writetocentry#1#2#3{% \edef\writetoctype{#1}% \ifx\writetoctype\omitkeyword \else \iftocfileopened\else \immediate\openout\tocfile = \jobname.toc \global\tocfileopenedtrue \fi % \iflinks {\atdummies \edef\temp{% \write\tocfile{@#1entry{#2}{#3}{\lastnode}{\noexpand\folio}}}% \temp }% \fi \fi % % Tell \shipout to create a pdf destination on each page, if we're % writing pdf. These are used in the table of contents. We can't % just write one on every page because the title pages are numbered % 1 and 2 (the page numbers aren't printed), and so are the first % two pages of the document. Thus, we'd have two destinations named % `1', and two named `2'. \ifpdf \global\pdfmakepagedesttrue \fi } % These characters do not print properly in the Computer Modern roman % fonts, so we must take special care. This is more or less redundant % with the Texinfo input format setup at the end of this file. % \def\activecatcodes{% \catcode`\"=\active \catcode`\$=\active \catcode`\<=\active \catcode`\>=\active \catcode`\\=\active \catcode`\^=\active \catcode`\_=\active \catcode`\|=\active \catcode`\~=\active } % Read the toc file, which is essentially Texinfo input. \def\readtocfile{% \setupdatafile \activecatcodes \input \tocreadfilename } \newskip\contentsrightmargin \contentsrightmargin=1in \newcount\savepageno \newcount\lastnegativepageno \lastnegativepageno = -1 % Prepare to read what we've written to \tocfile. % \def\startcontents#1{% % If @setchapternewpage on, and @headings double, the contents should % start on an odd page, unlike chapters. Thus, we maintain % \contentsalignmacro in parallel with \pagealignmacro. % From: Torbjorn Granlund \contentsalignmacro \immediate\closeout\tocfile % % Don't need to put `Contents' or `Short Contents' in the headline. % It is abundantly clear what they are. \chapmacro{#1}{Yomitfromtoc}{}% % \savepageno = \pageno \begingroup % Set up to handle contents files properly. \raggedbottom % Worry more about breakpoints than the bottom. \advance\hsize by -\contentsrightmargin % Don't use the full line length. % % Roman numerals for page numbers. \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi } % redefined for the two-volume lispref. We always output on % \jobname.toc even if this is redefined. % \def\tocreadfilename{\jobname.toc} % Normal (long) toc. % \def\contents{% \startcontents{\putwordTOC}% \openin 1 \tocreadfilename\space \ifeof 1 \else \readtocfile \fi \vfill \eject \contentsalignmacro % in case @setchapternewpage odd is in effect \ifeof 1 \else \pdfmakeoutlines \fi \closein 1 \endgroup \lastnegativepageno = \pageno \global\pageno = \savepageno } % And just the chapters. \def\summarycontents{% \startcontents{\putwordShortTOC}% % \let\partentry = \shortpartentry \let\numchapentry = \shortchapentry \let\appentry = \shortchapentry \let\unnchapentry = \shortunnchapentry % We want a true roman here for the page numbers. \secfonts \let\rm=\shortcontrm \let\bf=\shortcontbf \let\sl=\shortcontsl \let\tt=\shortconttt \rm \hyphenpenalty = 10000 \advance\baselineskip by 1pt % Open it up a little. \def\numsecentry##1##2##3##4{} \let\appsecentry = \numsecentry \let\unnsecentry = \numsecentry \let\numsubsecentry = \numsecentry \let\appsubsecentry = \numsecentry \let\unnsubsecentry = \numsecentry \let\numsubsubsecentry = \numsecentry \let\appsubsubsecentry = \numsecentry \let\unnsubsubsecentry = \numsecentry \openin 1 \tocreadfilename\space \ifeof 1 \else \readtocfile \fi \closein 1 \vfill \eject \contentsalignmacro % in case @setchapternewpage odd is in effect \endgroup \lastnegativepageno = \pageno \global\pageno = \savepageno } \let\shortcontents = \summarycontents % Typeset the label for a chapter or appendix for the short contents. % The arg is, e.g., `A' for an appendix, or `3' for a chapter. % \def\shortchaplabel#1{% % This space should be enough, since a single number is .5em, and the % widest letter (M) is 1em, at least in the Computer Modern fonts. % But use \hss just in case. % (This space doesn't include the extra space that gets added after % the label; that gets put in by \shortchapentry above.) % % We'd like to right-justify chapter numbers, but that looks strange % with appendix letters. And right-justifying numbers and % left-justifying letters looks strange when there is less than 10 % chapters. Have to read the whole toc once to know how many chapters % there are before deciding ... \hbox to 1em{#1\hss}% } % These macros generate individual entries in the table of contents. % The first argument is the chapter or section name. % The last argument is the page number. % The arguments in between are the chapter number, section number, ... % Parts, in the main contents. Replace the part number, which doesn't % exist, with an empty box. Let's hope all the numbers have the same width. % Also ignore the page number, which is conventionally not printed. \def\numeralbox{\setbox0=\hbox{8}\hbox to \wd0{\hfil}} \def\partentry#1#2#3#4{\dochapentry{\numeralbox\labelspace#1}{}} % % Parts, in the short toc. \def\shortpartentry#1#2#3#4{% \penalty-300 \vskip.5\baselineskip plus.15\baselineskip minus.1\baselineskip \shortchapentry{{\bf #1}}{\numeralbox}{}{}% } % Chapters, in the main contents. \def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}} % % Chapters, in the short toc. % See comments in \dochapentry re vbox and related settings. \def\shortchapentry#1#2#3#4{% \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#4\egroup}% } % Appendices, in the main contents. % Need the word Appendix, and a fixed-size box. % \def\appendixbox#1{% % We use M since it's probably the widest letter. \setbox0 = \hbox{\putwordAppendix{} M}% \hbox to \wd0{\putwordAppendix{} #1\hss}} % \def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\labelspace#1}{#4}} % Unnumbered chapters. \def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}} \def\shortunnchapentry#1#2#3#4{\tocentry{#1}{\doshortpageno\bgroup#4\egroup}} % Sections. \def\numsecentry#1#2#3#4{\dosecentry{#2\labelspace#1}{#4}} \let\appsecentry=\numsecentry \def\unnsecentry#1#2#3#4{\dosecentry{#1}{#4}} % Subsections. \def\numsubsecentry#1#2#3#4{\dosubsecentry{#2\labelspace#1}{#4}} \let\appsubsecentry=\numsubsecentry \def\unnsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}} % And subsubsections. \def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#2\labelspace#1}{#4}} \let\appsubsubsecentry=\numsubsubsecentry \def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#4}} % This parameter controls the indentation of the various levels. % Same as \defaultparindent. \newdimen\tocindent \tocindent = 15pt % Now for the actual typesetting. In all these, #1 is the text and #2 is the % page number. % % If the toc has to be broken over pages, we want it to be at chapters % if at all possible; hence the \penalty. \def\dochapentry#1#2{% \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip \begingroup \chapentryfonts \tocentry{#1}{\dopageno\bgroup#2\egroup}% \endgroup \nobreak\vskip .25\baselineskip plus.1\baselineskip } \def\dosecentry#1#2{\begingroup \secentryfonts \leftskip=\tocindent \tocentry{#1}{\dopageno\bgroup#2\egroup}% \endgroup} \def\dosubsecentry#1#2{\begingroup \subsecentryfonts \leftskip=2\tocindent \tocentry{#1}{\dopageno\bgroup#2\egroup}% \endgroup} \def\dosubsubsecentry#1#2{\begingroup \subsubsecentryfonts \leftskip=3\tocindent \tocentry{#1}{\dopageno\bgroup#2\egroup}% \endgroup} % We use the same \entry macro as for the index entries. \let\tocentry = \entry % Space between chapter (or whatever) number and the title. \def\labelspace{\hskip1em \relax} \def\dopageno#1{{\rm #1}} \def\doshortpageno#1{{\rm #1}} \def\chapentryfonts{\secfonts \rm} \def\secentryfonts{\textfonts} \def\subsecentryfonts{\textfonts} \def\subsubsecentryfonts{\textfonts} \message{environments,} % @foo ... @end foo. % @tex ... @end tex escapes into raw TeX temporarily. % One exception: @ is still an escape character, so that @end tex works. % But \@ or @@ will get a plain @ character. \envdef\tex{% \setupmarkupstyle{tex}% \catcode `\\=0 \catcode `\{=1 \catcode `\}=2 \catcode `\$=3 \catcode `\&=4 \catcode `\#=6 \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie \catcode `\%=14 \catcode `\+=\other \catcode `\"=\other \catcode `\|=\other \catcode `\<=\other \catcode `\>=\other \catcode`\`=\other \catcode`\'=\other \escapechar=`\\ % % ' is active in math mode (mathcode"8000). So reset it, and all our % other math active characters (just in case), to plain's definitions. \mathactive % \let\b=\ptexb \let\bullet=\ptexbullet \let\c=\ptexc \let\,=\ptexcomma \let\.=\ptexdot \let\dots=\ptexdots \let\equiv=\ptexequiv \let\!=\ptexexclam \let\i=\ptexi \let\indent=\ptexindent \let\noindent=\ptexnoindent \let\{=\ptexlbrace \let\+=\tabalign \let\}=\ptexrbrace \let\/=\ptexslash \let\*=\ptexstar \let\t=\ptext \expandafter \let\csname top\endcsname=\ptextop % outer \let\frenchspacing=\plainfrenchspacing % \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}% \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}% \def\@{@}% } % There is no need to define \Etex. % Define @lisp ... @end lisp. % @lisp environment forms a group so it can rebind things, % including the definition of @end lisp (which normally is erroneous). % Amount to narrow the margins by for @lisp. \newskip\lispnarrowing \lispnarrowing=0.4in % This is the definition that ^^M gets inside @lisp, @example, and other % such environments. \null is better than a space, since it doesn't % have any width. \def\lisppar{\null\endgraf} % This space is always present above and below environments. \newskip\envskipamount \envskipamount = 0pt % Make spacing and below environment symmetrical. We use \parskip here % to help in doing that, since in @example-like environments \parskip % is reset to zero; thus the \afterenvbreak inserts no space -- but the % start of the next paragraph will insert \parskip. % \def\aboveenvbreak{{% % =10000 instead of <10000 because of a special case in \itemzzz and % \sectionheading, q.v. \ifnum \lastpenalty=10000 \else \advance\envskipamount by \parskip \endgraf \ifdim\lastskip<\envskipamount \removelastskip % it's not a good place to break if the last penalty was \nobreak % or better ... \ifnum\lastpenalty<10000 \penalty-50 \fi \vskip\envskipamount \fi \fi }} \let\afterenvbreak = \aboveenvbreak % \nonarrowing is a flag. If "set", @lisp etc don't narrow margins; it will % also clear it, so that its embedded environments do the narrowing again. \let\nonarrowing=\relax % @cartouche ... @end cartouche: draw rectangle w/rounded corners around % environment contents. \font\circle=lcircle10 \newdimen\circthick \newdimen\cartouter\newdimen\cartinner \newskip\normbskip\newskip\normpskip\newskip\normlskip \circthick=\fontdimen8\circle % \def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth \def\ctr{{\hskip 6pt\circle\char'010}} \def\cbl{{\circle\char'012\hskip -6pt}} \def\cbr{{\hskip 6pt\circle\char'011}} \def\carttop{\hbox to \cartouter{\hskip\lskip \ctl\leaders\hrule height\circthick\hfil\ctr \hskip\rskip}} \def\cartbot{\hbox to \cartouter{\hskip\lskip \cbl\leaders\hrule height\circthick\hfil\cbr \hskip\rskip}} % \newskip\lskip\newskip\rskip \envdef\cartouche{% \ifhmode\par\fi % can't be in the midst of a paragraph. \startsavinginserts \lskip=\leftskip \rskip=\rightskip \leftskip=0pt\rightskip=0pt % we want these *outside*. \cartinner=\hsize \advance\cartinner by-\lskip \advance\cartinner by-\rskip \cartouter=\hsize \advance\cartouter by 18.4pt % allow for 3pt kerns on either % side, and for 6pt waste from % each corner char, and rule thickness \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip % Flag to tell @lisp, etc., not to narrow margin. \let\nonarrowing = t% % % If this cartouche directly follows a sectioning command, we need the % \parskip glue (backspaced over by default) or the cartouche can % collide with the section heading. \ifnum\lastpenalty>10000 \vskip\parskip \penalty\lastpenalty \fi % \vbox\bgroup \baselineskip=0pt\parskip=0pt\lineskip=0pt \carttop \hbox\bgroup \hskip\lskip \vrule\kern3pt \vbox\bgroup \kern3pt \hsize=\cartinner \baselineskip=\normbskip \lineskip=\normlskip \parskip=\normpskip \vskip -\parskip \comment % For explanation, see the end of def\group. } \def\Ecartouche{% \ifhmode\par\fi \kern3pt \egroup \kern3pt\vrule \hskip\rskip \egroup \cartbot \egroup \checkinserts } % This macro is called at the beginning of all the @example variants, % inside a group. \newdimen\nonfillparindent \def\nonfillstart{% \aboveenvbreak \hfuzz = 12pt % Don't be fussy \sepspaces % Make spaces be word-separators rather than space tokens. \let\par = \lisppar % don't ignore blank lines \obeylines % each line of input is a line of output \parskip = 0pt % Turn off paragraph indentation but redefine \indent to emulate % the normal \indent. \nonfillparindent=\parindent \parindent = 0pt \let\indent\nonfillindent % \emergencystretch = 0pt % don't try to avoid overfull boxes \ifx\nonarrowing\relax \advance \leftskip by \lispnarrowing \exdentamount=\lispnarrowing \else \let\nonarrowing = \relax \fi \let\exdent=\nofillexdent } \begingroup \obeyspaces % We want to swallow spaces (but not other tokens) after the fake % @indent in our nonfill-environments, where spaces are normally % active and set to @tie, resulting in them not being ignored after % @indent. \gdef\nonfillindent{\futurelet\temp\nonfillindentcheck}% \gdef\nonfillindentcheck{% \ifx\temp % \expandafter\nonfillindentgobble% \else% \leavevmode\nonfillindentbox% \fi% }% \endgroup \def\nonfillindentgobble#1{\nonfillindent} \def\nonfillindentbox{\hbox to \nonfillparindent{\hss}} % If you want all examples etc. small: @set dispenvsize small. % If you want even small examples the full size: @set dispenvsize nosmall. % This affects the following displayed environments: % @example, @display, @format, @lisp % \def\smallword{small} \def\nosmallword{nosmall} \let\SETdispenvsize\relax \def\setnormaldispenv{% \ifx\SETdispenvsize\smallword % end paragraph for sake of leading, in case document has no blank % line. This is redundant with what happens in \aboveenvbreak, but % we need to do it before changing the fonts, and it's inconvenient % to change the fonts afterward. \ifnum \lastpenalty=10000 \else \endgraf \fi \smallexamplefonts \rm \fi } \def\setsmalldispenv{% \ifx\SETdispenvsize\nosmallword \else \ifnum \lastpenalty=10000 \else \endgraf \fi \smallexamplefonts \rm \fi } % We often define two environments, @foo and @smallfoo. % Let's do it in one command. #1 is the env name, #2 the definition. \def\makedispenvdef#1#2{% \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2}% \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2}% \expandafter\let\csname E#1\endcsname \afterenvbreak \expandafter\let\csname Esmall#1\endcsname \afterenvbreak } % Define two environment synonyms (#1 and #2) for an environment. \def\maketwodispenvdef#1#2#3{% \makedispenvdef{#1}{#3}% \makedispenvdef{#2}{#3}% } % % @lisp: indented, narrowed, typewriter font; % @example: same as @lisp. % % @smallexample and @smalllisp: use smaller fonts. % Originally contributed by Pavel@xerox. % \maketwodispenvdef{lisp}{example}{% \nonfillstart \tt\setupmarkupstyle{example}% \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special. \gobble % eat return } % @display/@smalldisplay: same as @lisp except keep current font. % \makedispenvdef{display}{% \nonfillstart \gobble } % @format/@smallformat: same as @display except don't narrow margins. % \makedispenvdef{format}{% \let\nonarrowing = t% \nonfillstart \gobble } % @flushleft: same as @format, but doesn't obey \SETdispenvsize. \envdef\flushleft{% \let\nonarrowing = t% \nonfillstart \gobble } \let\Eflushleft = \afterenvbreak % @flushright. % \envdef\flushright{% \let\nonarrowing = t% \nonfillstart \advance\leftskip by 0pt plus 1fill\relax \gobble } \let\Eflushright = \afterenvbreak % @raggedright does more-or-less normal line breaking but no right % justification. From plain.tex. \envdef\raggedright{% \rightskip0pt plus2em \spaceskip.3333em \xspaceskip.5em\relax } \let\Eraggedright\par \envdef\raggedleft{% \parindent=0pt \leftskip0pt plus2em \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt \hbadness=10000 % Last line will usually be underfull, so turn off % badness reporting. } \let\Eraggedleft\par \envdef\raggedcenter{% \parindent=0pt \rightskip0pt plus1em \leftskip0pt plus1em \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt \hbadness=10000 % Last line will usually be underfull, so turn off % badness reporting. } \let\Eraggedcenter\par % @quotation does normal linebreaking (hence we can't use \nonfillstart) % and narrows the margins. We keep \parskip nonzero in general, since % we're doing normal filling. So, when using \aboveenvbreak and % \afterenvbreak, temporarily make \parskip 0. % \makedispenvdef{quotation}{\quotationstart} % \def\quotationstart{% \indentedblockstart % same as \indentedblock, but increase right margin too. \ifx\nonarrowing\relax \advance\rightskip by \lispnarrowing \fi \parsearg\quotationlabel } % We have retained a nonzero parskip for the environment, since we're % doing normal filling. % \def\Equotation{% \par \ifx\quotationauthor\thisisundefined\else % indent a bit. \leftline{\kern 2\leftskip \sl ---\quotationauthor}% \fi {\parskip=0pt \afterenvbreak}% } \def\Esmallquotation{\Equotation} % If we're given an argument, typeset it in bold with a colon after. \def\quotationlabel#1{% \def\temp{#1}% \ifx\temp\empty \else {\bf #1: }% \fi } % @indentedblock is like @quotation, but indents only on the left and % has no optional argument. % \makedispenvdef{indentedblock}{\indentedblockstart} % \def\indentedblockstart{% {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip \parindent=0pt % % @cartouche defines \nonarrowing to inhibit narrowing at next level down. \ifx\nonarrowing\relax \advance\leftskip by \lispnarrowing \exdentamount = \lispnarrowing \else \let\nonarrowing = \relax \fi } % Keep a nonzero parskip for the environment, since we're doing normal filling. % \def\Eindentedblock{% \par {\parskip=0pt \afterenvbreak}% } \def\Esmallindentedblock{\Eindentedblock} % LaTeX-like @verbatim...@end verbatim and @verb{...} % If we want to allow any as delimiter, % we need the curly braces so that makeinfo sees the @verb command, eg: % `@verbx...x' would look like the '@verbx' command. --janneke@gnu.org % % [Knuth]: Donald Ervin Knuth, 1996. The TeXbook. % % [Knuth] p.344; only we need to do the other characters Texinfo sets % active too. Otherwise, they get lost as the first character on a % verbatim line. \def\dospecials{% \do\ \do\\\do\{\do\}\do\$\do\&% \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~% \do\<\do\>\do\|\do\@\do+\do\"% % Don't do the quotes -- if we do, @set txicodequoteundirected and % @set txicodequotebacktick will not have effect on @verb and % @verbatim, and ?` and !` ligatures won't get disabled. %\do\`\do\'% } % % [Knuth] p. 380 \def\uncatcodespecials{% \def\do##1{\catcode`##1=\other}\dospecials} % % Setup for the @verb command. % % Eight spaces for a tab \begingroup \catcode`\^^I=\active \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }} \endgroup % \def\setupverb{% \tt % easiest (and conventionally used) font for verbatim \def\par{\leavevmode\endgraf}% \setupmarkupstyle{verb}% \tabeightspaces % Respect line breaks, % print special symbols as themselves, and % make each space count % must do in this order: \obeylines \uncatcodespecials \sepspaces } % Setup for the @verbatim environment % % Real tab expansion. \newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount % % We typeset each line of the verbatim in an \hbox, so we can handle % tabs. The \global is in case the verbatim line starts with an accent, % or some other command that starts with a begin-group. Otherwise, the % entire \verbbox would disappear at the corresponding end-group, before % it is typeset. Meanwhile, we can't have nested verbatim commands % (can we?), so the \global won't be overwriting itself. \newbox\verbbox \def\starttabbox{\global\setbox\verbbox=\hbox\bgroup} % \begingroup \catcode`\^^I=\active \gdef\tabexpand{% \catcode`\^^I=\active \def^^I{\leavevmode\egroup \dimen\verbbox=\wd\verbbox % the width so far, or since the previous tab \divide\dimen\verbbox by\tabw \multiply\dimen\verbbox by\tabw % compute previous multiple of \tabw \advance\dimen\verbbox by\tabw % advance to next multiple of \tabw \wd\verbbox=\dimen\verbbox \box\verbbox \starttabbox }% } \endgroup % start the verbatim environment. \def\setupverbatim{% \let\nonarrowing = t% \nonfillstart \tt % easiest (and conventionally used) font for verbatim % The \leavevmode here is for blank lines. Otherwise, we would % never \starttabox and the \egroup would end verbatim mode. \def\par{\leavevmode\egroup\box\verbbox\endgraf}% \tabexpand \setupmarkupstyle{verbatim}% % Respect line breaks, % print special symbols as themselves, and % make each space count. % Must do in this order: \obeylines \uncatcodespecials \sepspaces \everypar{\starttabbox}% } % Do the @verb magic: verbatim text is quoted by unique % delimiter characters. Before first delimiter expect a % right brace, after last delimiter expect closing brace: % % \def\doverb'{'#1'}'{#1} % % [Knuth] p. 382; only eat outer {} \begingroup \catcode`[=1\catcode`]=2\catcode`\{=\other\catcode`\}=\other \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next] \endgroup % \def\verb{\begingroup\setupverb\doverb} % % % Do the @verbatim magic: define the macro \doverbatim so that % the (first) argument ends when '@end verbatim' is reached, ie: % % \def\doverbatim#1@end verbatim{#1} % % For Texinfo it's a lot easier than for LaTeX, % because texinfo's \verbatim doesn't stop at '\end{verbatim}': % we need not redefine '\', '{' and '}'. % % Inspired by LaTeX's verbatim command set [latex.ltx] % \begingroup \catcode`\ =\active \obeylines % % ignore everything up to the first ^^M, that's the newline at the end % of the @verbatim input line itself. Otherwise we get an extra blank % line in the output. \xdef\doverbatim#1^^M#2@end verbatim{#2\noexpand\end\gobble verbatim}% % We really want {...\end verbatim} in the body of the macro, but % without the active space; thus we have to use \xdef and \gobble. \endgroup % \envdef\verbatim{% \setupverbatim\doverbatim } \let\Everbatim = \afterenvbreak % @verbatiminclude FILE - insert text of file in verbatim environment. % \def\verbatiminclude{\parseargusing\filenamecatcodes\doverbatiminclude} % \def\doverbatiminclude#1{% {% \makevalueexpandable \setupverbatim \indexnofonts % Allow `@@' and other weird things in file names. \wlog{texinfo.tex: doing @verbatiminclude of #1^^J}% \input #1 \afterenvbreak }% } % @copying ... @end copying. % Save the text away for @insertcopying later. % % We save the uninterpreted tokens, rather than creating a box. % Saving the text in a box would be much easier, but then all the % typesetting commands (@smallbook, font changes, etc.) have to be done % beforehand -- and a) we want @copying to be done first in the source % file; b) letting users define the frontmatter in as flexible order as % possible is very desirable. % \def\copying{\checkenv{}\begingroup\scanargctxt\docopying} \def\docopying#1@end copying{\endgroup\def\copyingtext{#1}} % \def\insertcopying{% \begingroup \parindent = 0pt % paragraph indentation looks wrong on title page \scanexp\copyingtext \endgroup } \message{defuns,} % @defun etc. \newskip\defbodyindent \defbodyindent=.4in \newskip\defargsindent \defargsindent=50pt \newskip\deflastargmargin \deflastargmargin=18pt \newcount\defunpenalty % Start the processing of @deffn: \def\startdefun{% \ifnum\lastpenalty<10000 \medbreak \defunpenalty=10003 % Will keep this @deffn together with the % following @def command, see below. \else % If there are two @def commands in a row, we'll have a \nobreak, % which is there to keep the function description together with its % header. But if there's nothing but headers, we need to allow a % break somewhere. Check specifically for penalty 10002, inserted % by \printdefunline, instead of 10000, since the sectioning % commands also insert a nobreak penalty, and we don't want to allow % a break between a section heading and a defun. % % As a further refinement, we avoid "club" headers by signalling % with penalty of 10003 after the very first @deffn in the % sequence (see above), and penalty of 10002 after any following % @def command. \ifnum\lastpenalty=10002 \penalty2000 \else \defunpenalty=10002 \fi % % Similarly, after a section heading, do not allow a break. % But do insert the glue. \medskip % preceded by discardable penalty, so not a breakpoint \fi % \parindent=0in \advance\leftskip by \defbodyindent \exdentamount=\defbodyindent } \def\dodefunx#1{% % First, check whether we are in the right environment: \checkenv#1% % % As above, allow line break if we have multiple x headers in a row. % It's not a great place, though. \ifnum\lastpenalty=10002 \penalty3000 \else \defunpenalty=10002 \fi % % And now, it's time to reuse the body of the original defun: \expandafter\gobbledefun#1% } \def\gobbledefun#1\startdefun{} % \printdefunline \deffnheader{text} % \def\printdefunline#1#2{% \begingroup % call \deffnheader: #1#2 \endheader % common ending: \interlinepenalty = 10000 \advance\rightskip by 0pt plus 1fil\relax \endgraf \nobreak\vskip -\parskip \penalty\defunpenalty % signal to \startdefun and \dodefunx % Some of the @defun-type tags do not enable magic parentheses, % rendering the following check redundant. But we don't optimize. \checkparencounts \endgroup } \def\Edefun{\endgraf\medbreak} % \makedefun{deffn} creates \deffn, \deffnx and \Edeffn; % the only thing remaining is to define \deffnheader. % \def\makedefun#1{% \expandafter\let\csname E#1\endcsname = \Edefun \edef\temp{\noexpand\domakedefun \makecsname{#1}\makecsname{#1x}\makecsname{#1header}}% \temp } % \domakedefun \deffn \deffnx \deffnheader % % Define \deffn and \deffnx, without parameters. % \deffnheader has to be defined explicitly. % \def\domakedefun#1#2#3{% \envdef#1{% \startdefun \doingtypefnfalse % distinguish typed functions from all else \parseargusing\activeparens{\printdefunline#3}% }% \def#2{\dodefunx#1}% \def#3% } \newif\ifdoingtypefn % doing typed function? \newif\ifrettypeownline % typeset return type on its own line? % @deftypefnnewline on|off says whether the return type of typed functions % are printed on their own line. This affects @deftypefn, @deftypefun, % @deftypeop, and @deftypemethod. % \parseargdef\deftypefnnewline{% \def\temp{#1}% \ifx\temp\onword \expandafter\let\csname SETtxideftypefnnl\endcsname = \empty \else\ifx\temp\offword \expandafter\let\csname SETtxideftypefnnl\endcsname = \relax \else \errhelp = \EMsimple \errmessage{Unknown @txideftypefnnl value `\temp', must be on|off}% \fi\fi } % Untyped functions: % @deffn category name args \makedefun{deffn}{\deffngeneral{}} % @deffn category class name args \makedefun{defop}#1 {\defopon{#1\ \putwordon}} % \defopon {category on}class name args \def\defopon#1#2 {\deffngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} } % \deffngeneral {subind}category name args % \def\deffngeneral#1#2 #3 #4\endheader{% % Remember that \dosubind{fn}{foo}{} is equivalent to \doind{fn}{foo}. \dosubind{fn}{\code{#3}}{#1}% \defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}% } % Typed functions: % @deftypefn category type name args \makedefun{deftypefn}{\deftypefngeneral{}} % @deftypeop category class type name args \makedefun{deftypeop}#1 {\deftypeopon{#1\ \putwordon}} % \deftypeopon {category on}class type name args \def\deftypeopon#1#2 {\deftypefngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} } % \deftypefngeneral {subind}category type name args % \def\deftypefngeneral#1#2 #3 #4 #5\endheader{% \dosubind{fn}{\code{#4}}{#1}% \doingtypefntrue \defname{#2}{#3}{#4}\defunargs{#5\unskip}% } % Typed variables: % @deftypevr category type var args \makedefun{deftypevr}{\deftypecvgeneral{}} % @deftypecv category class type var args \makedefun{deftypecv}#1 {\deftypecvof{#1\ \putwordof}} % \deftypecvof {category of}class type var args \def\deftypecvof#1#2 {\deftypecvgeneral{\putwordof\ \code{#2}}{#1\ \code{#2}} } % \deftypecvgeneral {subind}category type var args % \def\deftypecvgeneral#1#2 #3 #4 #5\endheader{% \dosubind{vr}{\code{#4}}{#1}% \defname{#2}{#3}{#4}\defunargs{#5\unskip}% } % Untyped variables: % @defvr category var args \makedefun{defvr}#1 {\deftypevrheader{#1} {} } % @defcv category class var args \makedefun{defcv}#1 {\defcvof{#1\ \putwordof}} % \defcvof {category of}class var args \def\defcvof#1#2 {\deftypecvof{#1}#2 {} } % Types: % @deftp category name args \makedefun{deftp}#1 #2 #3\endheader{% \doind{tp}{\code{#2}}% \defname{#1}{}{#2}\defunargs{#3\unskip}% } % Remaining @defun-like shortcuts: \makedefun{defun}{\deffnheader{\putwordDeffunc} } \makedefun{defmac}{\deffnheader{\putwordDefmac} } \makedefun{defspec}{\deffnheader{\putwordDefspec} } \makedefun{deftypefun}{\deftypefnheader{\putwordDeffunc} } \makedefun{defvar}{\defvrheader{\putwordDefvar} } \makedefun{defopt}{\defvrheader{\putwordDefopt} } \makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} } \makedefun{defmethod}{\defopon\putwordMethodon} \makedefun{deftypemethod}{\deftypeopon\putwordMethodon} \makedefun{defivar}{\defcvof\putwordInstanceVariableof} \makedefun{deftypeivar}{\deftypecvof\putwordInstanceVariableof} % \defname, which formats the name of the @def (not the args). % #1 is the category, such as "Function". % #2 is the return type, if any. % #3 is the function name. % % We are followed by (but not passed) the arguments, if any. % \def\defname#1#2#3{% \par % Get the values of \leftskip and \rightskip as they were outside the @def... \advance\leftskip by -\defbodyindent % % Determine if we are typesetting the return type of a typed function % on a line by itself. \rettypeownlinefalse \ifdoingtypefn % doing a typed function specifically? % then check user option for putting return type on its own line: \expandafter\ifx\csname SETtxideftypefnnl\endcsname\relax \else \rettypeownlinetrue \fi \fi % % How we'll format the category name. Putting it in brackets helps % distinguish it from the body text that may end up on the next line % just below it. \def\temp{#1}% \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi} % % Figure out line sizes for the paragraph shape. We'll always have at % least two. \tempnum = 2 % % The first line needs space for \box0; but if \rightskip is nonzero, % we need only space for the part of \box0 which exceeds it: \dimen0=\hsize \advance\dimen0 by -\wd0 \advance\dimen0 by \rightskip % % If doing a return type on its own line, we'll have another line. \ifrettypeownline \advance\tempnum by 1 \def\maybeshapeline{0in \hsize}% \else \def\maybeshapeline{}% \fi % % The continuations: \dimen2=\hsize \advance\dimen2 by -\defargsindent % % The final paragraph shape: \parshape \tempnum 0in \dimen0 \maybeshapeline \defargsindent \dimen2 % % Put the category name at the right margin. \noindent \hbox to 0pt{% \hfil\box0 \kern-\hsize % \hsize has to be shortened this way: \kern\leftskip % Intentionally do not respect \rightskip, since we need the space. }% % % Allow all lines to be underfull without complaint: \tolerance=10000 \hbadness=10000 \exdentamount=\defbodyindent {% % defun fonts. We use typewriter by default (used to be bold) because: % . we're printing identifiers, they should be in tt in principle. % . in languages with many accents, such as Czech or French, it's % common to leave accents off identifiers. The result looks ok in % tt, but exceedingly strange in rm. % . we don't want -- and --- to be treated as ligatures. % . this still does not fix the ?` and !` ligatures, but so far no % one has made identifiers using them :). \df \tt \def\temp{#2}% text of the return type \ifx\temp\empty\else \tclose{\temp}% typeset the return type \ifrettypeownline % put return type on its own line; prohibit line break following: \hfil\vadjust{\nobreak}\break \else \space % type on same line, so just followed by a space \fi \fi % no return type #3% output function name }% {\rm\enskip}% hskip 0.5 em of \tenrm % \boldbrax % arguments will be output next, if any. } % Print arguments in slanted roman (not ttsl), inconsistently with using % tt for the name. This is because literal text is sometimes needed in % the argument list (groff manual), and ttsl and tt are not very % distinguishable. Prevent hyphenation at `-' chars. % \def\defunargs#1{% % use sl by default (not ttsl), % tt for the names. \df \sl \hyphenchar\font=0 % % On the other hand, if an argument has two dashes (for instance), we % want a way to get ttsl. We used to recommend @var for that, so % leave the code in, but it's strange for @var to lead to typewriter. % Nowadays we recommend @code, since the difference between a ttsl hyphen % and a tt hyphen is pretty tiny. @code also disables ?` !`. \def\var##1{{\setupmarkupstyle{var}\ttslanted{##1}}}% #1% \sl\hyphenchar\font=45 } % We want ()&[] to print specially on the defun line. % \def\activeparens{% \catcode`\(=\active \catcode`\)=\active \catcode`\[=\active \catcode`\]=\active \catcode`\&=\active } % Make control sequences which act like normal parenthesis chars. \let\lparen = ( \let\rparen = ) % Be sure that we always have a definition for `(', etc. For example, % if the fn name has parens in it, \boldbrax will not be in effect yet, % so TeX would otherwise complain about undefined control sequence. { \activeparens \global\let(=\lparen \global\let)=\rparen \global\let[=\lbrack \global\let]=\rbrack \global\let& = \& \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb} \gdef\magicamp{\let&=\amprm} } \newcount\parencount % If we encounter &foo, then turn on ()-hacking afterwards \newif\ifampseen \def\amprm#1 {\ampseentrue{\bf\ }} \def\parenfont{% \ifampseen % At the first level, print parens in roman, % otherwise use the default font. \ifnum \parencount=1 \rm \fi \else % The \sf parens (in \boldbrax) actually are a little bolder than % the contained text. This is especially needed for [ and ] . \sf \fi } \def\infirstlevel#1{% \ifampseen \ifnum\parencount=1 #1% \fi \fi } \def\bfafterword#1 {#1 \bf} \def\opnr{% \global\advance\parencount by 1 {\parenfont(}% \infirstlevel \bfafterword } \def\clnr{% {\parenfont)}% \infirstlevel \sl \global\advance\parencount by -1 } \newcount\brackcount \def\lbrb{% \global\advance\brackcount by 1 {\bf[}% } \def\rbrb{% {\bf]}% \global\advance\brackcount by -1 } \def\checkparencounts{% \ifnum\parencount=0 \else \badparencount \fi \ifnum\brackcount=0 \else \badbrackcount \fi } % these should not use \errmessage; the glibc manual, at least, actually % has such constructs (when documenting function pointers). \def\badparencount{% \message{Warning: unbalanced parentheses in @def...}% \global\parencount=0 } \def\badbrackcount{% \message{Warning: unbalanced square brackets in @def...}% \global\brackcount=0 } \message{macros,} % @macro. % To do this right we need a feature of e-TeX, \scantokens, % which we arrange to emulate with a temporary file in ordinary TeX. \ifx\eTeXversion\thisisundefined \newwrite\macscribble \def\scantokens#1{% \toks0={#1}% \immediate\openout\macscribble=\jobname.tmp \immediate\write\macscribble{\the\toks0}% \immediate\closeout\macscribble \input \jobname.tmp } \fi \def\scanmacro#1{\begingroup \newlinechar`\^^M \let\xeatspaces\eatspaces % % Undo catcode changes of \startcontents and \doprintindex % When called from @insertcopying or (short)caption, we need active % backslash to get it printed correctly. Previously, we had % \catcode`\\=\other instead. We'll see whether a problem appears % with macro expansion. --kasal, 19aug04 \catcode`\@=0 \catcode`\\=\active \escapechar=`\@ % % ... and for \example: \spaceisspace % % The \empty here causes a following catcode 5 newline to be eaten as % part of reading whitespace after a control sequence. It does not % eat a catcode 13 newline. There's no good way to handle the two % cases (untried: maybe e-TeX's \everyeof could help, though plain TeX % would then have different behavior). See the Macro Details node in % the manual for the workaround we recommend for macros and % line-oriented commands. % \scantokens{#1\empty}% \endgroup} \def\scanexp#1{% \edef\temp{\noexpand\scanmacro{#1}}% \temp } \newcount\paramno % Count of parameters \newtoks\macname % Macro name \newif\ifrecursive % Is it recursive? % List of all defined macros in the form % \definedummyword\macro1\definedummyword\macro2... % Currently is also contains all @aliases; the list can be split % if there is a need. \def\macrolist{} % Add the macro to \macrolist \def\addtomacrolist#1{\expandafter \addtomacrolistxxx \csname#1\endcsname} \def\addtomacrolistxxx#1{% \toks0 = \expandafter{\macrolist\definedummyword#1}% \xdef\macrolist{\the\toks0}% } % Utility routines. % This does \let #1 = #2, with \csnames; that is, % \let \csname#1\endcsname = \csname#2\endcsname % (except of course we have to play expansion games). % \def\cslet#1#2{% \expandafter\let \csname#1\expandafter\endcsname \csname#2\endcsname } % Trim leading and trailing spaces off a string. % Concepts from aro-bend problem 15 (see CTAN). {\catcode`\@=11 \gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }} \gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@} \gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @} \def\unbrace#1{#1} \unbrace{\gdef\trim@@@ #1 } #2@{#1} } % Trim a single trailing ^^M off a string. {\catcode`\^^M=\other \catcode`\Q=3% \gdef\eatcr #1{\eatcra #1Q^^MQ}% \gdef\eatcra#1^^MQ{\eatcrb#1Q}% \gdef\eatcrb#1Q#2Q{#1}% } % Macro bodies are absorbed as an argument in a context where % all characters are catcode 10, 11 or 12, except \ which is active % (as in normal texinfo). It is necessary to change the definition of \ % to recognize macro arguments; this is the job of \mbodybackslash. % % Non-ASCII encodings make 8-bit characters active, so un-activate % them to avoid their expansion. Must do this non-globally, to % confine the change to the current group. % % It's necessary to have hard CRs when the macro is executed. This is % done by making ^^M (\endlinechar) catcode 12 when reading the macro % body, and then making it the \newlinechar in \scanmacro. % \def\scanctxt{% used as subroutine \catcode`\"=\other \catcode`\+=\other \catcode`\<=\other \catcode`\>=\other \catcode`\@=\other \catcode`\^=\other \catcode`\_=\other \catcode`\|=\other \catcode`\~=\other \ifx\declaredencoding\ascii \else \setnonasciicharscatcodenonglobal\other \fi } \def\scanargctxt{% used for copying and captions, not macros. \scanctxt \catcode`\\=\other \catcode`\^^M=\other } \def\macrobodyctxt{% used for @macro definitions \scanctxt \catcode`\{=\other \catcode`\}=\other \catcode`\^^M=\other \usembodybackslash } \def\macroargctxt{% used when scanning invocations \scanctxt \catcode`\\=0 } % why catcode 0 for \ in the above? To recognize \\ \{ \} as "escapes" % for the single characters \ { }. Thus, we end up with the "commands" % that would be written @\ @{ @} in a Texinfo document. % % We already have @{ and @}. For @\, we define it here, and only for % this purpose, to produce a typewriter backslash (so, the @\ that we % define for @math can't be used with @macro calls): % \def\\{\normalbackslash}% % % We would like to do this for \, too, since that is what makeinfo does. % But it is not possible, because Texinfo already has a command @, for a % cedilla accent. Documents must use @comma{} instead. % % \anythingelse will almost certainly be an error of some kind. % \mbodybackslash is the definition of \ in @macro bodies. % It maps \foo\ => \csname macarg.foo\endcsname => #N % where N is the macro parameter number. % We define \csname macarg.\endcsname to be \realbackslash, so % \\ in macro replacement text gets you a backslash. % {\catcode`@=0 @catcode`@\=@active @gdef@usembodybackslash{@let\=@mbodybackslash} @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname} } \expandafter\def\csname macarg.\endcsname{\realbackslash} \def\margbackslash#1{\char`\#1 } \def\macro{\recursivefalse\parsearg\macroxxx} \def\rmacro{\recursivetrue\parsearg\macroxxx} \def\macroxxx#1{% \getargs{#1}% now \macname is the macname and \argl the arglist \ifx\argl\empty % no arguments \paramno=0\relax \else \expandafter\parsemargdef \argl;% \if\paramno>256\relax \ifx\eTeXversion\thisisundefined \errhelp = \EMsimple \errmessage{You need eTeX to compile a file with macros with more than 256 arguments} \fi \fi \fi \if1\csname ismacro.\the\macname\endcsname \message{Warning: redefining \the\macname}% \else \expandafter\ifx\csname \the\macname\endcsname \relax \else \errmessage{Macro name \the\macname\space already defined}\fi \global\cslet{macsave.\the\macname}{\the\macname}% \global\expandafter\let\csname ismacro.\the\macname\endcsname=1% \addtomacrolist{\the\macname}% \fi \begingroup \macrobodyctxt \ifrecursive \expandafter\parsermacbody \else \expandafter\parsemacbody \fi} \parseargdef\unmacro{% \if1\csname ismacro.#1\endcsname \global\cslet{#1}{macsave.#1}% \global\expandafter\let \csname ismacro.#1\endcsname=0% % Remove the macro name from \macrolist: \begingroup \expandafter\let\csname#1\endcsname \relax \let\definedummyword\unmacrodo \xdef\macrolist{\macrolist}% \endgroup \else \errmessage{Macro #1 not defined}% \fi } % Called by \do from \dounmacro on each macro. The idea is to omit any % macro definitions that have been changed to \relax. % \def\unmacrodo#1{% \ifx #1\relax % remove this \else \noexpand\definedummyword \noexpand#1% \fi } % This makes use of the obscure feature that if the last token of a % is #, then the preceding argument is delimited by % an opening brace, and that opening brace is not consumed. \def\getargs#1{\getargsxxx#1{}} \def\getargsxxx#1#{\getmacname #1 \relax\getmacargs} \def\getmacname#1 #2\relax{\macname={#1}} \def\getmacargs#1{\def\argl{#1}} % For macro processing make @ a letter so that we can make Texinfo private macro names. \edef\texiatcatcode{\the\catcode`\@} \catcode `@=11\relax % Parse the optional {params} list. Set up \paramno and \paramlist % so \defmacro knows what to do. Define \macarg.BLAH for each BLAH % in the params list to some hook where the argument si to be expanded. If % there are less than 10 arguments that hook is to be replaced by ##N where N % is the position in that list, that is to say the macro arguments are to be % defined `a la TeX in the macro body. % % That gets used by \mbodybackslash (above). % % We need to get `macro parameter char #' into several definitions. % The technique used is stolen from LaTeX: let \hash be something % unexpandable, insert that wherever you need a #, and then redefine % it to # just before using the token list produced. % % The same technique is used to protect \eatspaces till just before % the macro is used. % % If there are 10 or more arguments, a different technique is used, where the % hook remains in the body, and when macro is to be expanded the body is % processed again to replace the arguments. % % In that case, the hook is \the\toks N-1, and we simply set \toks N-1 to the % argument N value and then \edef the body (nothing else will expand because of % the catcode regime underwhich the body was input). % % If you compile with TeX (not eTeX), and you have macros with 10 or more % arguments, you need that no macro has more than 256 arguments, otherwise an % error is produced. \def\parsemargdef#1;{% \paramno=0\def\paramlist{}% \let\hash\relax \let\xeatspaces\relax \parsemargdefxxx#1,;,% % In case that there are 10 or more arguments we parse again the arguments % list to set new definitions for the \macarg.BLAH macros corresponding to % each BLAH argument. It was anyhow needed to parse already once this list % in order to count the arguments, and as macros with at most 9 arguments % are by far more frequent than macro with 10 or more arguments, defining % twice the \macarg.BLAH macros does not cost too much processing power. \ifnum\paramno<10\relax\else \paramno0\relax \parsemmanyargdef@@#1,;,% 10 or more arguments \fi } \def\parsemargdefxxx#1,{% \if#1;\let\next=\relax \else \let\next=\parsemargdefxxx \advance\paramno by 1 \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname {\xeatspaces{\hash\the\paramno}}% \edef\paramlist{\paramlist\hash\the\paramno,}% \fi\next} \def\parsemmanyargdef@@#1,{% \if#1;\let\next=\relax \else \let\next=\parsemmanyargdef@@ \edef\tempb{\eatspaces{#1}}% \expandafter\def\expandafter\tempa \expandafter{\csname macarg.\tempb\endcsname}% % Note that we need some extra \noexpand\noexpand, this is because we % don't want \the to be expanded in the \parsermacbody as it uses an % \xdef . \expandafter\edef\tempa {\noexpand\noexpand\noexpand\the\toks\the\paramno}% \advance\paramno by 1\relax \fi\next} % These two commands read recursive and nonrecursive macro bodies. % (They're different since rec and nonrec macros end differently.) % \catcode `\@\texiatcatcode \long\def\parsemacbody#1@end macro% {\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% \long\def\parsermacbody#1@end rmacro% {\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% \catcode `\@=11\relax \let\endargs@\relax \let\nil@\relax \def\nilm@{\nil@}% \long\def\nillm@{\nil@}% % This macro is expanded during the Texinfo macro expansion, not during its % definition. It gets all the arguments values and assigns them to macros % macarg.ARGNAME % % #1 is the macro name % #2 is the list of argument names % #3 is the list of argument values \def\getargvals@#1#2#3{% \def\macargdeflist@{}% \def\saveparamlist@{#2}% Need to keep a copy for parameter expansion. \def\paramlist{#2,\nil@}% \def\macroname{#1}% \begingroup \macroargctxt \def\argvaluelist{#3,\nil@}% \def\@tempa{#3}% \ifx\@tempa\empty \setemptyargvalues@ \else \getargvals@@ \fi } % \def\getargvals@@{% \ifx\paramlist\nilm@ % Some sanity check needed here that \argvaluelist is also empty. \ifx\argvaluelist\nillm@ \else \errhelp = \EMsimple \errmessage{Too many arguments in macro `\macroname'!}% \fi \let\next\macargexpandinbody@ \else \ifx\argvaluelist\nillm@ % No more arguments values passed to macro. Set remaining named-arg % macros to empty. \let\next\setemptyargvalues@ \else % pop current arg name into \@tempb \def\@tempa##1{\pop@{\@tempb}{\paramlist}##1\endargs@}% \expandafter\@tempa\expandafter{\paramlist}% % pop current argument value into \@tempc \def\@tempa##1{\longpop@{\@tempc}{\argvaluelist}##1\endargs@}% \expandafter\@tempa\expandafter{\argvaluelist}% % Here \@tempb is the current arg name and \@tempc is the current arg value. % First place the new argument macro definition into \@tempd \expandafter\macname\expandafter{\@tempc}% \expandafter\let\csname macarg.\@tempb\endcsname\relax \expandafter\def\expandafter\@tempe\expandafter{% \csname macarg.\@tempb\endcsname}% \edef\@tempd{\long\def\@tempe{\the\macname}}% \push@\@tempd\macargdeflist@ \let\next\getargvals@@ \fi \fi \next } \def\push@#1#2{% \expandafter\expandafter\expandafter\def \expandafter\expandafter\expandafter#2% \expandafter\expandafter\expandafter{% \expandafter#1#2}% } % Replace arguments by their values in the macro body, and place the result % in macro \@tempa \def\macvalstoargs@{% % To do this we use the property that token registers that are \the'ed % within an \edef expand only once. So we are going to place all argument % values into respective token registers. % % First we save the token context, and initialize argument numbering. \begingroup \paramno0\relax % Then, for each argument number #N, we place the corresponding argument % value into a new token list register \toks#N \expandafter\putargsintokens@\saveparamlist@,;,% % Then, we expand the body so that argument are replaced by their % values. The trick for values not to be expanded themselves is that they % are within tokens and that tokens expand only once in an \edef . \edef\@tempc{\csname mac.\macroname .body\endcsname}% % Now we restore the token stack pointer to free the token list registers % which we have used, but we make sure that expanded body is saved after % group. \expandafter \endgroup \expandafter\def\expandafter\@tempa\expandafter{\@tempc}% } \def\macargexpandinbody@{% %% Define the named-macro outside of this group and then close this group. \expandafter \endgroup \macargdeflist@ % First the replace in body the macro arguments by their values, the result % is in \@tempa . \macvalstoargs@ % Then we point at the \norecurse or \gobble (for recursive) macro value % with \@tempb . \expandafter\let\expandafter\@tempb\csname mac.\macroname .recurse\endcsname % Depending on whether it is recursive or not, we need some tailing % \egroup . \ifx\@tempb\gobble \let\@tempc\relax \else \let\@tempc\egroup \fi % And now we do the real job: \edef\@tempd{\noexpand\@tempb{\macroname}\noexpand\scanmacro{\@tempa}\@tempc}% \@tempd } \def\putargsintokens@#1,{% \if#1;\let\next\relax \else \let\next\putargsintokens@ % First we allocate the new token list register, and give it a temporary % alias \@tempb . \toksdef\@tempb\the\paramno % Then we place the argument value into that token list register. \expandafter\let\expandafter\@tempa\csname macarg.#1\endcsname \expandafter\@tempb\expandafter{\@tempa}% \advance\paramno by 1\relax \fi \next } % Save the token stack pointer into macro #1 \def\texisavetoksstackpoint#1{\edef#1{\the\@cclvi}} % Restore the token stack pointer from number in macro #1 \def\texirestoretoksstackpoint#1{\expandafter\mathchardef\expandafter\@cclvi#1\relax} % newtoks that can be used non \outer . \def\texinonouternewtoks{\alloc@ 5\toks \toksdef \@cclvi} % Tailing missing arguments are set to empty \def\setemptyargvalues@{% \ifx\paramlist\nilm@ \let\next\macargexpandinbody@ \else \expandafter\setemptyargvaluesparser@\paramlist\endargs@ \let\next\setemptyargvalues@ \fi \next } \def\setemptyargvaluesparser@#1,#2\endargs@{% \expandafter\def\expandafter\@tempa\expandafter{% \expandafter\def\csname macarg.#1\endcsname{}}% \push@\@tempa\macargdeflist@ \def\paramlist{#2}% } % #1 is the element target macro % #2 is the list macro % #3,#4\endargs@ is the list value \def\pop@#1#2#3,#4\endargs@{% \def#1{#3}% \def#2{#4}% } \long\def\longpop@#1#2#3,#4\endargs@{% \long\def#1{#3}% \long\def#2{#4}% } % This defines a Texinfo @macro. There are eight cases: recursive and % nonrecursive macros of zero, one, up to nine, and many arguments. % Much magic with \expandafter here. % \xdef is used so that macro definitions will survive the file % they're defined in; @include reads the file inside a group. % \def\defmacro{% \let\hash=##% convert placeholders to macro parameter chars \ifrecursive \ifcase\paramno % 0 \expandafter\xdef\csname\the\macname\endcsname{% \noexpand\scanmacro{\temp}}% \or % 1 \expandafter\xdef\csname\the\macname\endcsname{% \bgroup\noexpand\macroargctxt \noexpand\braceorline \expandafter\noexpand\csname\the\macname xxx\endcsname}% \expandafter\xdef\csname\the\macname xxx\endcsname##1{% \egroup\noexpand\scanmacro{\temp}}% \else \ifnum\paramno<10\relax % at most 9 \expandafter\xdef\csname\the\macname\endcsname{% \bgroup\noexpand\macroargctxt \noexpand\csname\the\macname xx\endcsname}% \expandafter\xdef\csname\the\macname xx\endcsname##1{% \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% \expandafter\expandafter \expandafter\xdef \expandafter\expandafter \csname\the\macname xxx\endcsname \paramlist{\egroup\noexpand\scanmacro{\temp}}% \else % 10 or more \expandafter\xdef\csname\the\macname\endcsname{% \noexpand\getargvals@{\the\macname}{\argl}% }% \global\expandafter\let\csname mac.\the\macname .body\endcsname\temp \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\gobble \fi \fi \else \ifcase\paramno % 0 \expandafter\xdef\csname\the\macname\endcsname{% \noexpand\norecurse{\the\macname}% \noexpand\scanmacro{\temp}\egroup}% \or % 1 \expandafter\xdef\csname\the\macname\endcsname{% \bgroup\noexpand\macroargctxt \noexpand\braceorline \expandafter\noexpand\csname\the\macname xxx\endcsname}% \expandafter\xdef\csname\the\macname xxx\endcsname##1{% \egroup \noexpand\norecurse{\the\macname}% \noexpand\scanmacro{\temp}\egroup}% \else % at most 9 \ifnum\paramno<10\relax \expandafter\xdef\csname\the\macname\endcsname{% \bgroup\noexpand\macroargctxt \expandafter\noexpand\csname\the\macname xx\endcsname}% \expandafter\xdef\csname\the\macname xx\endcsname##1{% \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% \expandafter\expandafter \expandafter\xdef \expandafter\expandafter \csname\the\macname xxx\endcsname \paramlist{% \egroup \noexpand\norecurse{\the\macname}% \noexpand\scanmacro{\temp}\egroup}% \else % 10 or more: \expandafter\xdef\csname\the\macname\endcsname{% \noexpand\getargvals@{\the\macname}{\argl}% }% \global\expandafter\let\csname mac.\the\macname .body\endcsname\temp \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\norecurse \fi \fi \fi} \catcode `\@\texiatcatcode\relax \def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}} % \braceorline decides whether the next nonwhitespace character is a % {. If so it reads up to the closing }, if not, it reads the whole % line. Whatever was read is then fed to the next control sequence % as an argument (by \parsebrace or \parsearg). % \def\braceorline#1{\let\macnamexxx=#1\futurelet\nchar\braceorlinexxx} \def\braceorlinexxx{% \ifx\nchar\bgroup\else \expandafter\parsearg \fi \macnamexxx} % @alias. % We need some trickery to remove the optional spaces around the equal % sign. Make them active and then expand them all to nothing. % \def\alias{\parseargusing\obeyspaces\aliasxxx} \def\aliasxxx #1{\aliasyyy#1\relax} \def\aliasyyy #1=#2\relax{% {% \expandafter\let\obeyedspace=\empty \addtomacrolist{#1}% \xdef\next{\global\let\makecsname{#1}=\makecsname{#2}}% }% \next } \message{cross references,} \newwrite\auxfile \newif\ifhavexrefs % True if xref values are known. \newif\ifwarnedxrefs % True if we warned once that they aren't known. % @inforef is relatively simple. \def\inforef #1{\inforefzzz #1,,,,**} \def\inforefzzz #1,#2,#3,#4**{% \putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}}, node \samp{\ignorespaces#1{}}} % @node's only job in TeX is to define \lastnode, which is used in % cross-references. The @node line might or might not have commas, and % might or might not have spaces before the first comma, like: % @node foo , bar , ... % We don't want such trailing spaces in the node name. % \parseargdef\node{\checkenv{}\donode #1 ,\finishnodeparse} % % also remove a trailing comma, in case of something like this: % @node Help-Cross, , , Cross-refs \def\donode#1 ,#2\finishnodeparse{\dodonode #1,\finishnodeparse} \def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}} \let\nwnode=\node \let\lastnode=\empty % Write a cross-reference definition for the current node. #1 is the % type (Ynumbered, Yappendix, Ynothing). % \def\donoderef#1{% \ifx\lastnode\empty\else \setref{\lastnode}{#1}% \global\let\lastnode=\empty \fi } % @anchor{NAME} -- define xref target at arbitrary point. % \newcount\savesfregister % \def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi} \def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi} \def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces} % \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an % anchor), which consists of three parts: % 1) NAME-title - the current sectioning name taken from \lastsection, % or the anchor name. % 2) NAME-snt - section number and type, passed as the SNT arg, or % empty for anchors. % 3) NAME-pg - the page number. % % This is called from \donoderef, \anchor, and \dofloat. In the case of % floats, there is an additional part, which is not written here: % 4) NAME-lof - the text as it should appear in a @listoffloats. % \def\setref#1#2{% \pdfmkdest{#1}% \iflinks {% \atdummies % preserve commands, but don't expand them \edef\writexrdef##1##2{% \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef ##1}{##2}}% these are parameters of \writexrdef }% \toks0 = \expandafter{\lastsection}% \immediate \writexrdef{title}{\the\toks0 }% \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc. \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, at \shipout }% \fi } % @xrefautosectiontitle on|off says whether @section(ing) names are used % automatically in xrefs, if the third arg is not explicitly specified. % This was provided as a "secret" @set xref-automatic-section-title % variable, now it's official. % \parseargdef\xrefautomaticsectiontitle{% \def\temp{#1}% \ifx\temp\onword \expandafter\let\csname SETxref-automatic-section-title\endcsname = \empty \else\ifx\temp\offword \expandafter\let\csname SETxref-automatic-section-title\endcsname = \relax \else \errhelp = \EMsimple \errmessage{Unknown @xrefautomaticsectiontitle value `\temp', must be on|off}% \fi\fi } % % @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is % the node name, #2 the name of the Info cross-reference, #3 the printed % node name, #4 the name of the Info file, #5 the name of the printed % manual. All but the node name can be omitted. % \def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]} \def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]} \def\ref#1{\xrefX[#1,,,,,,,]} % \newbox\toprefbox \newbox\printedrefnamebox \newbox\infofilenamebox \newbox\printedmanualbox % \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup \unsepspaces % % Get args without leading/trailing spaces. \def\printedrefname{\ignorespaces #3}% \setbox\printedrefnamebox = \hbox{\printedrefname\unskip}% % \def\infofilename{\ignorespaces #4}% \setbox\infofilenamebox = \hbox{\infofilename\unskip}% % \def\printedmanual{\ignorespaces #5}% \setbox\printedmanualbox = \hbox{\printedmanual\unskip}% % % If the printed reference name (arg #3) was not explicitly given in % the @xref, figure out what we want to use. \ifdim \wd\printedrefnamebox = 0pt % No printed node name was explicitly given. \expandafter\ifx\csname SETxref-automatic-section-title\endcsname \relax % Not auto section-title: use node name inside the square brackets. \def\printedrefname{\ignorespaces #1}% \else % Auto section-title: use chapter/section title inside % the square brackets if we have it. \ifdim \wd\printedmanualbox > 0pt % It is in another manual, so we don't have it; use node name. \def\printedrefname{\ignorespaces #1}% \else \ifhavexrefs % We (should) know the real title if we have the xref values. \def\printedrefname{\refx{#1-title}{}}% \else % Otherwise just copy the Info node name. \def\printedrefname{\ignorespaces #1}% \fi% \fi \fi \fi % % Make link in pdf output. \ifpdf {\indexnofonts \turnoffactive \makevalueexpandable % This expands tokens, so do it after making catcode changes, so _ % etc. don't get their TeX definitions. This ignores all spaces in % #4, including (wrongly) those in the middle of the filename. \getfilename{#4}% % % This (wrongly) does not take account of leading or trailing % spaces in #1, which should be ignored. \edef\pdfxrefdest{#1}% \ifx\pdfxrefdest\empty \def\pdfxrefdest{Top}% no empty targets \else \txiescapepdf\pdfxrefdest % escape PDF special chars \fi % \leavevmode \startlink attr{/Border [0 0 0]}% \ifnum\filenamelength>0 goto file{\the\filename.pdf} name{\pdfxrefdest}% \else goto name{\pdfmkpgn{\pdfxrefdest}}% \fi }% \setcolor{\linkcolor}% \fi % % Float references are printed completely differently: "Figure 1.2" % instead of "[somenode], p.3". We distinguish them by the % LABEL-title being set to a magic string. {% % Have to otherify everything special to allow the \csname to % include an _ in the xref name, etc. \indexnofonts \turnoffactive \expandafter\global\expandafter\let\expandafter\Xthisreftitle \csname XR#1-title\endcsname }% \iffloat\Xthisreftitle % If the user specified the print name (third arg) to the ref, % print it instead of our usual "Figure 1.2". \ifdim\wd\printedrefnamebox = 0pt \refx{#1-snt}{}% \else \printedrefname \fi % % If the user also gave the printed manual name (fifth arg), append % "in MANUALNAME". \ifdim \wd\printedmanualbox > 0pt \space \putwordin{} \cite{\printedmanual}% \fi \else % node/anchor (non-float) references. % % If we use \unhbox to print the node names, TeX does not insert % empty discretionaries after hyphens, which means that it will not % find a line break at a hyphen in a node names. Since some manuals % are best written with fairly long node names, containing hyphens, % this is a loss. Therefore, we give the text of the node name % again, so it is as if TeX is seeing it for the first time. % \ifdim \wd\printedmanualbox > 0pt % Cross-manual reference with a printed manual name. % \crossmanualxref{\cite{\printedmanual\unskip}}% % \else\ifdim \wd\infofilenamebox > 0pt % Cross-manual reference with only an info filename (arg 4), no % printed manual name (arg 5). This is essentially the same as % the case above; we output the filename, since we have nothing else. % \crossmanualxref{\code{\infofilename\unskip}}% % \else % Reference within this manual. % % _ (for example) has to be the character _ for the purposes of the % control sequence corresponding to the node, but it has to expand % into the usual \leavevmode...\vrule stuff for purposes of % printing. So we \turnoffactive for the \refx-snt, back on for the % printing, back off for the \refx-pg. {\turnoffactive % Only output a following space if the -snt ref is nonempty; for % @unnumbered and @anchor, it won't be. \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}% \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi }% % output the `[mynode]' via the macro below so it can be overridden. \xrefprintnodename\printedrefname % % But we always want a comma and a space: ,\space % % output the `page 3'. \turnoffactive \putwordpage\tie\refx{#1-pg}{}% \fi\fi \fi \endlink \endgroup} % Output a cross-manual xref to #1. Used just above (twice). % % Only include the text "Section ``foo'' in" if the foo is neither % missing or Top. Thus, @xref{,,,foo,The Foo Manual} outputs simply % "see The Foo Manual", the idea being to refer to the whole manual. % % But, this being TeX, we can't easily compare our node name against the % string "Top" while ignoring the possible spaces before and after in % the input. By adding the arbitrary 7sp below, we make it much less % likely that a real node name would have the same width as "Top" (e.g., % in a monospaced font). Hopefully it will never happen in practice. % % For the same basic reason, we retypeset the "Top" at every % reference, since the current font is indeterminate. % \def\crossmanualxref#1{% \setbox\toprefbox = \hbox{Top\kern7sp}% \setbox2 = \hbox{\ignorespaces \printedrefname \unskip \kern7sp}% \ifdim \wd2 > 7sp % nonempty? \ifdim \wd2 = \wd\toprefbox \else % same as Top? \putwordSection{} ``\printedrefname'' \putwordin{}\space \fi \fi #1% } % This macro is called from \xrefX for the `[nodename]' part of xref % output. It's a separate macro only so it can be changed more easily, % since square brackets don't work well in some documents. Particularly % one that Bob is working on :). % \def\xrefprintnodename#1{[#1]} % Things referred to by \setref. % \def\Ynothing{} \def\Yomitfromtoc{} \def\Ynumbered{% \ifnum\secno=0 \putwordChapter@tie \the\chapno \else \ifnum\subsecno=0 \putwordSection@tie \the\chapno.\the\secno \else \ifnum\subsubsecno=0 \putwordSection@tie \the\chapno.\the\secno.\the\subsecno \else \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno \fi\fi\fi } \def\Yappendix{% \ifnum\secno=0 \putwordAppendix@tie @char\the\appendixno{}% \else \ifnum\subsecno=0 \putwordSection@tie @char\the\appendixno.\the\secno \else \ifnum\subsubsecno=0 \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno \else \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno \fi\fi\fi } % Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME. % If its value is nonempty, SUFFIX is output afterward. % \def\refx#1#2{% {% \indexnofonts \otherbackslash \expandafter\global\expandafter\let\expandafter\thisrefX \csname XR#1\endcsname }% \ifx\thisrefX\relax % If not defined, say something at least. \angleleft un\-de\-fined\angleright \iflinks \ifhavexrefs {\toks0 = {#1}% avoid expansion of possibly-complex value \message{\linenumber Undefined cross reference `\the\toks0'.}}% \else \ifwarnedxrefs\else \global\warnedxrefstrue \message{Cross reference values unknown; you must run TeX again.}% \fi \fi \fi \else % It's defined, so just use it. \thisrefX \fi #2% Output the suffix in any case. } % This is the macro invoked by entries in the aux file. Usually it's % just a \def (we prepend XR to the control sequence name to avoid % collisions). But if this is a float type, we have more work to do. % \def\xrdef#1#2{% {% The node name might contain 8-bit characters, which in our current % implementation are changed to commands like @'e. Don't let these % mess up the control sequence name. \indexnofonts \turnoffactive \xdef\safexrefname{#1}% }% % \expandafter\gdef\csname XR\safexrefname\endcsname{#2}% remember this xref % % Was that xref control sequence that we just defined for a float? \expandafter\iffloat\csname XR\safexrefname\endcsname % it was a float, and we have the (safe) float type in \iffloattype. \expandafter\let\expandafter\floatlist \csname floatlist\iffloattype\endcsname % % Is this the first time we've seen this float type? \expandafter\ifx\floatlist\relax \toks0 = {\do}% yes, so just \do \else % had it before, so preserve previous elements in list. \toks0 = \expandafter{\floatlist\do}% \fi % % Remember this xref in the control sequence \floatlistFLOATTYPE, % for later use in \listoffloats. \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0 {\safexrefname}}% \fi } % Read the last existing aux file, if any. No error if none exists. % \def\tryauxfile{% \openin 1 \jobname.aux \ifeof 1 \else \readdatafile{aux}% \global\havexrefstrue \fi \closein 1 } \def\setupdatafile{% \catcode`\^^@=\other \catcode`\^^A=\other \catcode`\^^B=\other \catcode`\^^C=\other \catcode`\^^D=\other \catcode`\^^E=\other \catcode`\^^F=\other \catcode`\^^G=\other \catcode`\^^H=\other \catcode`\^^K=\other \catcode`\^^L=\other \catcode`\^^N=\other \catcode`\^^P=\other \catcode`\^^Q=\other \catcode`\^^R=\other \catcode`\^^S=\other \catcode`\^^T=\other \catcode`\^^U=\other \catcode`\^^V=\other \catcode`\^^W=\other \catcode`\^^X=\other \catcode`\^^Z=\other \catcode`\^^[=\other \catcode`\^^\=\other \catcode`\^^]=\other \catcode`\^^^=\other \catcode`\^^_=\other % It was suggested to set the catcode of ^ to 7, which would allow ^^e4 etc. % in xref tags, i.e., node names. But since ^^e4 notation isn't % supported in the main text, it doesn't seem desirable. Furthermore, % that is not enough: for node names that actually contain a ^ % character, we would end up writing a line like this: 'xrdef {'hat % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first % argument, and \hat is not an expandable control sequence. It could % all be worked out, but why? Either we support ^^ or we don't. % % The other change necessary for this was to define \auxhat: % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter % and then to call \auxhat in \setq. % \catcode`\^=\other % % Special characters. Should be turned off anyway, but... \catcode`\~=\other \catcode`\[=\other \catcode`\]=\other \catcode`\"=\other \catcode`\_=\other \catcode`\|=\other \catcode`\<=\other \catcode`\>=\other \catcode`\$=\other \catcode`\#=\other \catcode`\&=\other \catcode`\%=\other \catcode`+=\other % avoid \+ for paranoia even though we've turned it off % % This is to support \ in node names and titles, since the \ % characters end up in a \csname. It's easier than % leaving it active and making its active definition an actual \ % character. What I don't understand is why it works in the *value* % of the xrdef. Seems like it should be a catcode12 \, and that % should not typeset properly. But it works, so I'm moving on for % now. --karl, 15jan04. \catcode`\\=\other % % Make the characters 128-255 be printing characters. {% \count1=128 \def\loop{% \catcode\count1=\other \advance\count1 by 1 \ifnum \count1<256 \loop \fi }% }% % % @ is our escape character in .aux files, and we need braces. \catcode`\{=1 \catcode`\}=2 \catcode`\@=0 } \def\readdatafile#1{% \begingroup \setupdatafile \input\jobname.#1 \endgroup} \message{insertions,} % including footnotes. \newcount \footnoteno % The trailing space in the following definition for supereject is % vital for proper filling; pages come out unaligned when you do a % pagealignmacro call if that space before the closing brace is % removed. (Generally, numeric constants should always be followed by a % space to prevent strange expansion errors.) \def\supereject{\par\penalty -20000\footnoteno =0 } % @footnotestyle is meaningful for Info output only. \let\footnotestyle=\comment {\catcode `\@=11 % % Auto-number footnotes. Otherwise like plain. \gdef\footnote{% \let\indent=\ptexindent \let\noindent=\ptexnoindent \global\advance\footnoteno by \@ne \edef\thisfootno{$^{\the\footnoteno}$}% % % In case the footnote comes at the end of a sentence, preserve the % extra spacing after we do the footnote number. \let\@sf\empty \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi % % Remove inadvertent blank space before typesetting the footnote number. \unskip \thisfootno\@sf \dofootnote }% % Don't bother with the trickery in plain.tex to not require the % footnote text as a parameter. Our footnotes don't need to be so general. % % Oh yes, they do; otherwise, @ifset (and anything else that uses % \parseargline) fails inside footnotes because the tokens are fixed when % the footnote is read. --karl, 16nov96. % \gdef\dofootnote{% \insert\footins\bgroup % We want to typeset this text as a normal paragraph, even if the % footnote reference occurs in (for example) a display environment. % So reset some parameters. \hsize=\pagewidth \interlinepenalty\interfootnotelinepenalty \splittopskip\ht\strutbox % top baseline for broken footnotes \splitmaxdepth\dp\strutbox \floatingpenalty\@MM \leftskip\z@skip \rightskip\z@skip \spaceskip\z@skip \xspaceskip\z@skip \parindent\defaultparindent % \smallfonts \rm % % Because we use hanging indentation in footnotes, a @noindent appears % to exdent this text, so make it be a no-op. makeinfo does not use % hanging indentation so @noindent can still be needed within footnote % text after an @example or the like (not that this is good style). \let\noindent = \relax % % Hang the footnote text off the number. Use \everypar in case the % footnote extends for more than one paragraph. \everypar = {\hang}% \textindent{\thisfootno}% % % Don't crash into the line above the footnote text. Since this % expands into a box, it must come within the paragraph, lest it % provide a place where TeX can split the footnote. \footstrut % % Invoke rest of plain TeX footnote routine. \futurelet\next\fo@t } }%end \catcode `\@=11 % In case a @footnote appears in a vbox, save the footnote text and create % the real \insert just after the vbox finished. Otherwise, the insertion % would be lost. % Similarly, if a @footnote appears inside an alignment, save the footnote % text to a box and make the \insert when a row of the table is finished. % And the same can be done for other insert classes. --kasal, 16nov03. % Replace the \insert primitive by a cheating macro. % Deeper inside, just make sure that the saved insertions are not spilled % out prematurely. % \def\startsavinginserts{% \ifx \insert\ptexinsert \let\insert\saveinsert \else \let\checkinserts\relax \fi } % This \insert replacement works for both \insert\footins{foo} and % \insert\footins\bgroup foo\egroup, but it doesn't work for \insert27{foo}. % \def\saveinsert#1{% \edef\next{\noexpand\savetobox \makeSAVEname#1}% \afterassignment\next % swallow the left brace \let\temp = } \def\makeSAVEname#1{\makecsname{SAVE\expandafter\gobble\string#1}} \def\savetobox#1{\global\setbox#1 = \vbox\bgroup \unvbox#1} \def\checksaveins#1{\ifvoid#1\else \placesaveins#1\fi} \def\placesaveins#1{% \ptexinsert \csname\expandafter\gobblesave\string#1\endcsname {\box#1}% } % eat @SAVE -- beware, all of them have catcode \other: { \def\dospecials{\do S\do A\do V\do E} \uncatcodespecials % ;-) \gdef\gobblesave @SAVE{} } % initialization: \def\newsaveins #1{% \edef\next{\noexpand\newsaveinsX \makeSAVEname#1}% \next } \def\newsaveinsX #1{% \csname newbox\endcsname #1% \expandafter\def\expandafter\checkinserts\expandafter{\checkinserts \checksaveins #1}% } % initialize: \let\checkinserts\empty \newsaveins\footins \newsaveins\margin % @image. We use the macros from epsf.tex to support this. % If epsf.tex is not installed and @image is used, we complain. % % Check for and read epsf.tex up front. If we read it only at @image % time, we might be inside a group, and then its definitions would get % undone and the next image would fail. \openin 1 = epsf.tex \ifeof 1 \else % Do not bother showing banner with epsf.tex v2.7k (available in % doc/epsf.tex and on ctan). \def\epsfannounce{\toks0 = }% \input epsf.tex \fi \closein 1 % % We will only complain once about lack of epsf.tex. \newif\ifwarnednoepsf \newhelp\noepsfhelp{epsf.tex must be installed for images to work. It is also included in the Texinfo distribution, or you can get it from ftp://tug.org/tex/epsf.tex.} % \def\image#1{% \ifx\epsfbox\thisisundefined \ifwarnednoepsf \else \errhelp = \noepsfhelp \errmessage{epsf.tex not found, images will be ignored}% \global\warnednoepsftrue \fi \else \imagexxx #1,,,,,\finish \fi } % % Arguments to @image: % #1 is (mandatory) image filename; we tack on .eps extension. % #2 is (optional) width, #3 is (optional) height. % #4 is (ignored optional) html alt text. % #5 is (ignored optional) extension. % #6 is just the usual extra ignored arg for parsing stuff. \newif\ifimagevmode \def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup \catcode`\^^M = 5 % in case we're inside an example \normalturnoffactive % allow _ et al. in names % If the image is by itself, center it. \ifvmode \imagevmodetrue \else \ifx\centersub\centerV % for @center @image, we need a vbox so we can have our vertical space \imagevmodetrue \vbox\bgroup % vbox has better behavior than vtop herev \fi\fi % \ifimagevmode \nobreak\medskip % Usually we'll have text after the image which will insert % \parskip glue, so insert it here too to equalize the space % above and below. \nobreak\vskip\parskip \nobreak \fi % % Leave vertical mode so that indentation from an enclosing % environment such as @quotation is respected. % However, if we're at the top level, we don't want the % normal paragraph indentation. % On the other hand, if we are in the case of @center @image, we don't % want to start a paragraph, which will create a hsize-width box and % eradicate the centering. \ifx\centersub\centerV\else \noindent \fi % % Output the image. \ifpdf \dopdfimage{#1}{#2}{#3}% \else % \epsfbox itself resets \epsf?size at each figure. \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi \epsfbox{#1.eps}% \fi % \ifimagevmode \medskip % space after a standalone image \fi \ifx\centersub\centerV \egroup \fi \endgroup} % @float FLOATTYPE,LABEL,LOC ... @end float for displayed figures, tables, % etc. We don't actually implement floating yet, we always include the % float "here". But it seemed the best name for the future. % \envparseargdef\float{\eatcommaspace\eatcommaspace\dofloat#1, , ,\finish} % There may be a space before second and/or third parameter; delete it. \def\eatcommaspace#1, {#1,} % #1 is the optional FLOATTYPE, the text label for this float, typically % "Figure", "Table", "Example", etc. Can't contain commas. If omitted, % this float will not be numbered and cannot be referred to. % % #2 is the optional xref label. Also must be present for the float to % be referable. % % #3 is the optional positioning argument; for now, it is ignored. It % will somehow specify the positions allowed to float to (here, top, bottom). % % We keep a separate counter for each FLOATTYPE, which we reset at each % chapter-level command. \let\resetallfloatnos=\empty % \def\dofloat#1,#2,#3,#4\finish{% \let\thiscaption=\empty \let\thisshortcaption=\empty % % don't lose footnotes inside @float. % % BEWARE: when the floats start float, we have to issue warning whenever an % insert appears inside a float which could possibly float. --kasal, 26may04 % \startsavinginserts % % We can't be used inside a paragraph. \par % \vtop\bgroup \def\floattype{#1}% \def\floatlabel{#2}% \def\floatloc{#3}% we do nothing with this yet. % \ifx\floattype\empty \let\safefloattype=\empty \else {% % the floattype might have accents or other special characters, % but we need to use it in a control sequence name. \indexnofonts \turnoffactive \xdef\safefloattype{\floattype}% }% \fi % % If label is given but no type, we handle that as the empty type. \ifx\floatlabel\empty \else % We want each FLOATTYPE to be numbered separately (Figure 1, % Table 1, Figure 2, ...). (And if no label, no number.) % \expandafter\getfloatno\csname\safefloattype floatno\endcsname \global\advance\floatno by 1 % {% % This magic value for \lastsection is output by \setref as the % XREFLABEL-title value. \xrefX uses it to distinguish float % labels (which have a completely different output format) from % node and anchor labels. And \xrdef uses it to construct the % lists of floats. % \edef\lastsection{\floatmagic=\safefloattype}% \setref{\floatlabel}{Yfloat}% }% \fi % % start with \parskip glue, I guess. \vskip\parskip % % Don't suppress indentation if a float happens to start a section. \restorefirstparagraphindent } % we have these possibilities: % @float Foo,lbl & @caption{Cap}: Foo 1.1: Cap % @float Foo,lbl & no caption: Foo 1.1 % @float Foo & @caption{Cap}: Foo: Cap % @float Foo & no caption: Foo % @float ,lbl & Caption{Cap}: 1.1: Cap % @float ,lbl & no caption: 1.1 % @float & @caption{Cap}: Cap % @float & no caption: % \def\Efloat{% \let\floatident = \empty % % In all cases, if we have a float type, it comes first. \ifx\floattype\empty \else \def\floatident{\floattype}\fi % % If we have an xref label, the number comes next. \ifx\floatlabel\empty \else \ifx\floattype\empty \else % if also had float type, need tie first. \appendtomacro\floatident{\tie}% \fi % the number. \appendtomacro\floatident{\chaplevelprefix\the\floatno}% \fi % % Start the printed caption with what we've constructed in % \floatident, but keep it separate; we need \floatident again. \let\captionline = \floatident % \ifx\thiscaption\empty \else \ifx\floatident\empty \else \appendtomacro\captionline{: }% had ident, so need a colon between \fi % % caption text. \appendtomacro\captionline{\scanexp\thiscaption}% \fi % % If we have anything to print, print it, with space before. % Eventually this needs to become an \insert. \ifx\captionline\empty \else \vskip.5\parskip \captionline % % Space below caption. \vskip\parskip \fi % % If have an xref label, write the list of floats info. Do this % after the caption, to avoid chance of it being a breakpoint. \ifx\floatlabel\empty \else % Write the text that goes in the lof to the aux file as % \floatlabel-lof. Besides \floatident, we include the short % caption if specified, else the full caption if specified, else nothing. {% \atdummies % % since we read the caption text in the macro world, where ^^M % is turned into a normal character, we have to scan it back, so % we don't write the literal three characters "^^M" into the aux file. \scanexp{% \xdef\noexpand\gtemp{% \ifx\thisshortcaption\empty \thiscaption \else \thisshortcaption \fi }% }% \immediate\write\auxfile{@xrdef{\floatlabel-lof}{\floatident \ifx\gtemp\empty \else : \gtemp \fi}}% }% \fi \egroup % end of \vtop % % place the captured inserts % % BEWARE: when the floats start floating, we have to issue warning % whenever an insert appears inside a float which could possibly % float. --kasal, 26may04 % \checkinserts } % Append the tokens #2 to the definition of macro #1, not expanding either. % \def\appendtomacro#1#2{% \expandafter\def\expandafter#1\expandafter{#1#2}% } % @caption, @shortcaption % \def\caption{\docaption\thiscaption} \def\shortcaption{\docaption\thisshortcaption} \def\docaption{\checkenv\float \bgroup\scanargctxt\defcaption} \def\defcaption#1#2{\egroup \def#1{#2}} % The parameter is the control sequence identifying the counter we are % going to use. Create it if it doesn't exist and assign it to \floatno. \def\getfloatno#1{% \ifx#1\relax % Haven't seen this figure type before. \csname newcount\endcsname #1% % % Remember to reset this floatno at the next chap. \expandafter\gdef\expandafter\resetallfloatnos \expandafter{\resetallfloatnos #1=0 }% \fi \let\floatno#1% } % \setref calls this to get the XREFLABEL-snt value. We want an @xref % to the FLOATLABEL to expand to "Figure 3.1". We call \setref when we % first read the @float command. % \def\Yfloat{\floattype@tie \chaplevelprefix\the\floatno}% % Magic string used for the XREFLABEL-title value, so \xrefX can % distinguish floats from other xref types. \def\floatmagic{!!float!!} % #1 is the control sequence we are passed; we expand into a conditional % which is true if #1 represents a float ref. That is, the magic % \lastsection value which we \setref above. % \def\iffloat#1{\expandafter\doiffloat#1==\finish} % % #1 is (maybe) the \floatmagic string. If so, #2 will be the % (safe) float type for this float. We set \iffloattype to #2. % \def\doiffloat#1=#2=#3\finish{% \def\temp{#1}% \def\iffloattype{#2}% \ifx\temp\floatmagic } % @listoffloats FLOATTYPE - print a list of floats like a table of contents. % \parseargdef\listoffloats{% \def\floattype{#1}% floattype {% % the floattype might have accents or other special characters, % but we need to use it in a control sequence name. \indexnofonts \turnoffactive \xdef\safefloattype{\floattype}% }% % % \xrdef saves the floats as a \do-list in \floatlistSAFEFLOATTYPE. \expandafter\ifx\csname floatlist\safefloattype\endcsname \relax \ifhavexrefs % if the user said @listoffloats foo but never @float foo. \message{\linenumber No `\safefloattype' floats to list.}% \fi \else \begingroup \leftskip=\tocindent % indent these entries like a toc \let\do=\listoffloatsdo \csname floatlist\safefloattype\endcsname \endgroup \fi } % This is called on each entry in a list of floats. We're passed the % xref label, in the form LABEL-title, which is how we save it in the % aux file. We strip off the -title and look up \XRLABEL-lof, which % has the text we're supposed to typeset here. % % Figures without xref labels will not be included in the list (since % they won't appear in the aux file). % \def\listoffloatsdo#1{\listoffloatsdoentry#1\finish} \def\listoffloatsdoentry#1-title\finish{{% % Can't fully expand XR#1-lof because it can contain anything. Just % pass the control sequence. On the other hand, XR#1-pg is just the % page number, and we want to fully expand that so we can get a link % in pdf output. \toksA = \expandafter{\csname XR#1-lof\endcsname}% % % use the same \entry macro we use to generate the TOC and index. \edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}% \writeentry }} \message{localization,} % For single-language documents, @documentlanguage is usually given very % early, just after @documentencoding. Single argument is the language % (de) or locale (de_DE) abbreviation. % { \catcode`\_ = \active \globaldefs=1 \parseargdef\documentlanguage{\begingroup \let_=\normalunderscore % normal _ character for filenames \tex % read txi-??.tex file in plain TeX. % Read the file by the name they passed if it exists. \openin 1 txi-#1.tex \ifeof 1 \documentlanguagetrywithoutunderscore{#1_\finish}% \else \globaldefs = 1 % everything in the txi-LL files needs to persist \input txi-#1.tex \fi \closein 1 \endgroup % end raw TeX \endgroup} % % If they passed de_DE, and txi-de_DE.tex doesn't exist, % try txi-de.tex. % \gdef\documentlanguagetrywithoutunderscore#1_#2\finish{% \openin 1 txi-#1.tex \ifeof 1 \errhelp = \nolanghelp \errmessage{Cannot read language file txi-#1.tex}% \else \globaldefs = 1 % everything in the txi-LL files needs to persist \input txi-#1.tex \fi \closein 1 } }% end of special _ catcode % \newhelp\nolanghelp{The given language definition file cannot be found or is empty. Maybe you need to install it? Putting it in the current directory should work if nowhere else does.} % This macro is called from txi-??.tex files; the first argument is the % \language name to set (without the "\lang@" prefix), the second and % third args are \{left,right}hyphenmin. % % The language names to pass are determined when the format is built. % See the etex.log file created at that time, e.g., % /usr/local/texlive/2008/texmf-var/web2c/pdftex/etex.log. % % With TeX Live 2008, etex now includes hyphenation patterns for all % available languages. This means we can support hyphenation in % Texinfo, at least to some extent. (This still doesn't solve the % accented characters problem.) % \catcode`@=11 \def\txisetlanguage#1#2#3{% % do not set the language if the name is undefined in the current TeX. \expandafter\ifx\csname lang@#1\endcsname \relax \message{no patterns for #1}% \else \global\language = \csname lang@#1\endcsname \fi % but there is no harm in adjusting the hyphenmin values regardless. \global\lefthyphenmin = #2\relax \global\righthyphenmin = #3\relax } % Helpers for encodings. % Set the catcode of characters 128 through 255 to the specified number. % \def\setnonasciicharscatcode#1{% \count255=128 \loop\ifnum\count255<256 \global\catcode\count255=#1\relax \advance\count255 by 1 \repeat } \def\setnonasciicharscatcodenonglobal#1{% \count255=128 \loop\ifnum\count255<256 \catcode\count255=#1\relax \advance\count255 by 1 \repeat } % @documentencoding sets the definition of non-ASCII characters % according to the specified encoding. % \parseargdef\documentencoding{% % Encoding being declared for the document. \def\declaredencoding{\csname #1.enc\endcsname}% % % Supported encodings: names converted to tokens in order to be able % to compare them with \ifx. \def\ascii{\csname US-ASCII.enc\endcsname}% \def\latnine{\csname ISO-8859-15.enc\endcsname}% \def\latone{\csname ISO-8859-1.enc\endcsname}% \def\lattwo{\csname ISO-8859-2.enc\endcsname}% \def\utfeight{\csname UTF-8.enc\endcsname}% % \ifx \declaredencoding \ascii \asciichardefs % \else \ifx \declaredencoding \lattwo \setnonasciicharscatcode\active \lattwochardefs % \else \ifx \declaredencoding \latone \setnonasciicharscatcode\active \latonechardefs % \else \ifx \declaredencoding \latnine \setnonasciicharscatcode\active \latninechardefs % \else \ifx \declaredencoding \utfeight \setnonasciicharscatcode\active \utfeightchardefs % \else \message{Unknown document encoding #1, ignoring.}% % \fi % utfeight \fi % latnine \fi % latone \fi % lattwo \fi % ascii } % A message to be logged when using a character that isn't available % the default font encoding (OT1). % \def\missingcharmsg#1{\message{Character missing in OT1 encoding: #1.}} % Take account of \c (plain) vs. \, (Texinfo) difference. \def\cedilla#1{\ifx\c\ptexc\c{#1}\else\,{#1}\fi} % First, make active non-ASCII characters in order for them to be % correctly categorized when TeX reads the replacement text of % macros containing the character definitions. \setnonasciicharscatcode\active % % Latin1 (ISO-8859-1) character definitions. \def\latonechardefs{% \gdef^^a0{\tie} \gdef^^a1{\exclamdown} \gdef^^a2{\missingcharmsg{CENT SIGN}} \gdef^^a3{{\pounds}} \gdef^^a4{\missingcharmsg{CURRENCY SIGN}} \gdef^^a5{\missingcharmsg{YEN SIGN}} \gdef^^a6{\missingcharmsg{BROKEN BAR}} \gdef^^a7{\S} \gdef^^a8{\"{}} \gdef^^a9{\copyright} \gdef^^aa{\ordf} \gdef^^ab{\guillemetleft} \gdef^^ac{$\lnot$} \gdef^^ad{\-} \gdef^^ae{\registeredsymbol} \gdef^^af{\={}} % \gdef^^b0{\textdegree} \gdef^^b1{$\pm$} \gdef^^b2{$^2$} \gdef^^b3{$^3$} \gdef^^b4{\'{}} \gdef^^b5{$\mu$} \gdef^^b6{\P} % \gdef^^b7{$^.$} \gdef^^b8{\cedilla\ } \gdef^^b9{$^1$} \gdef^^ba{\ordm} % \gdef^^bb{\guillemetright} \gdef^^bc{$1\over4$} \gdef^^bd{$1\over2$} \gdef^^be{$3\over4$} \gdef^^bf{\questiondown} % \gdef^^c0{\`A} \gdef^^c1{\'A} \gdef^^c2{\^A} \gdef^^c3{\~A} \gdef^^c4{\"A} \gdef^^c5{\ringaccent A} \gdef^^c6{\AE} \gdef^^c7{\cedilla C} \gdef^^c8{\`E} \gdef^^c9{\'E} \gdef^^ca{\^E} \gdef^^cb{\"E} \gdef^^cc{\`I} \gdef^^cd{\'I} \gdef^^ce{\^I} \gdef^^cf{\"I} % \gdef^^d0{\DH} \gdef^^d1{\~N} \gdef^^d2{\`O} \gdef^^d3{\'O} \gdef^^d4{\^O} \gdef^^d5{\~O} \gdef^^d6{\"O} \gdef^^d7{$\times$} \gdef^^d8{\O} \gdef^^d9{\`U} \gdef^^da{\'U} \gdef^^db{\^U} \gdef^^dc{\"U} \gdef^^dd{\'Y} \gdef^^de{\TH} \gdef^^df{\ss} % \gdef^^e0{\`a} \gdef^^e1{\'a} \gdef^^e2{\^a} \gdef^^e3{\~a} \gdef^^e4{\"a} \gdef^^e5{\ringaccent a} \gdef^^e6{\ae} \gdef^^e7{\cedilla c} \gdef^^e8{\`e} \gdef^^e9{\'e} \gdef^^ea{\^e} \gdef^^eb{\"e} \gdef^^ec{\`{\dotless i}} \gdef^^ed{\'{\dotless i}} \gdef^^ee{\^{\dotless i}} \gdef^^ef{\"{\dotless i}} % \gdef^^f0{\dh} \gdef^^f1{\~n} \gdef^^f2{\`o} \gdef^^f3{\'o} \gdef^^f4{\^o} \gdef^^f5{\~o} \gdef^^f6{\"o} \gdef^^f7{$\div$} \gdef^^f8{\o} \gdef^^f9{\`u} \gdef^^fa{\'u} \gdef^^fb{\^u} \gdef^^fc{\"u} \gdef^^fd{\'y} \gdef^^fe{\th} \gdef^^ff{\"y} } % Latin9 (ISO-8859-15) encoding character definitions. \def\latninechardefs{% % Encoding is almost identical to Latin1. \latonechardefs % \gdef^^a4{\euro} \gdef^^a6{\v S} \gdef^^a8{\v s} \gdef^^b4{\v Z} \gdef^^b8{\v z} \gdef^^bc{\OE} \gdef^^bd{\oe} \gdef^^be{\"Y} } % Latin2 (ISO-8859-2) character definitions. \def\lattwochardefs{% \gdef^^a0{\tie} \gdef^^a1{\ogonek{A}} \gdef^^a2{\u{}} \gdef^^a3{\L} \gdef^^a4{\missingcharmsg{CURRENCY SIGN}} \gdef^^a5{\v L} \gdef^^a6{\'S} \gdef^^a7{\S} \gdef^^a8{\"{}} \gdef^^a9{\v S} \gdef^^aa{\cedilla S} \gdef^^ab{\v T} \gdef^^ac{\'Z} \gdef^^ad{\-} \gdef^^ae{\v Z} \gdef^^af{\dotaccent Z} % \gdef^^b0{\textdegree} \gdef^^b1{\ogonek{a}} \gdef^^b2{\ogonek{ }} \gdef^^b3{\l} \gdef^^b4{\'{}} \gdef^^b5{\v l} \gdef^^b6{\'s} \gdef^^b7{\v{}} \gdef^^b8{\cedilla\ } \gdef^^b9{\v s} \gdef^^ba{\cedilla s} \gdef^^bb{\v t} \gdef^^bc{\'z} \gdef^^bd{\H{}} \gdef^^be{\v z} \gdef^^bf{\dotaccent z} % \gdef^^c0{\'R} \gdef^^c1{\'A} \gdef^^c2{\^A} \gdef^^c3{\u A} \gdef^^c4{\"A} \gdef^^c5{\'L} \gdef^^c6{\'C} \gdef^^c7{\cedilla C} \gdef^^c8{\v C} \gdef^^c9{\'E} \gdef^^ca{\ogonek{E}} \gdef^^cb{\"E} \gdef^^cc{\v E} \gdef^^cd{\'I} \gdef^^ce{\^I} \gdef^^cf{\v D} % \gdef^^d0{\DH} \gdef^^d1{\'N} \gdef^^d2{\v N} \gdef^^d3{\'O} \gdef^^d4{\^O} \gdef^^d5{\H O} \gdef^^d6{\"O} \gdef^^d7{$\times$} \gdef^^d8{\v R} \gdef^^d9{\ringaccent U} \gdef^^da{\'U} \gdef^^db{\H U} \gdef^^dc{\"U} \gdef^^dd{\'Y} \gdef^^de{\cedilla T} \gdef^^df{\ss} % \gdef^^e0{\'r} \gdef^^e1{\'a} \gdef^^e2{\^a} \gdef^^e3{\u a} \gdef^^e4{\"a} \gdef^^e5{\'l} \gdef^^e6{\'c} \gdef^^e7{\cedilla c} \gdef^^e8{\v c} \gdef^^e9{\'e} \gdef^^ea{\ogonek{e}} \gdef^^eb{\"e} \gdef^^ec{\v e} \gdef^^ed{\'{\dotless{i}}} \gdef^^ee{\^{\dotless{i}}} \gdef^^ef{\v d} % \gdef^^f0{\dh} \gdef^^f1{\'n} \gdef^^f2{\v n} \gdef^^f3{\'o} \gdef^^f4{\^o} \gdef^^f5{\H o} \gdef^^f6{\"o} \gdef^^f7{$\div$} \gdef^^f8{\v r} \gdef^^f9{\ringaccent u} \gdef^^fa{\'u} \gdef^^fb{\H u} \gdef^^fc{\"u} \gdef^^fd{\'y} \gdef^^fe{\cedilla t} \gdef^^ff{\dotaccent{}} } % UTF-8 character definitions. % % This code to support UTF-8 is based on LaTeX's utf8.def, with some % changes for Texinfo conventions. It is included here under the GPL by % permission from Frank Mittelbach and the LaTeX team. % \newcount\countUTFx \newcount\countUTFy \newcount\countUTFz \gdef\UTFviiiTwoOctets#1#2{\expandafter \UTFviiiDefined\csname u8:#1\string #2\endcsname} % \gdef\UTFviiiThreeOctets#1#2#3{\expandafter \UTFviiiDefined\csname u8:#1\string #2\string #3\endcsname} % \gdef\UTFviiiFourOctets#1#2#3#4{\expandafter \UTFviiiDefined\csname u8:#1\string #2\string #3\string #4\endcsname} \gdef\UTFviiiDefined#1{% \ifx #1\relax \message{\linenumber Unicode char \string #1 not defined for Texinfo}% \else \expandafter #1% \fi } \begingroup \catcode`\~13 \catcode`\"12 \def\UTFviiiLoop{% \global\catcode\countUTFx\active \uccode`\~\countUTFx \uppercase\expandafter{\UTFviiiTmp}% \advance\countUTFx by 1 \ifnum\countUTFx < \countUTFy \expandafter\UTFviiiLoop \fi} \countUTFx = "C2 \countUTFy = "E0 \def\UTFviiiTmp{% \xdef~{\noexpand\UTFviiiTwoOctets\string~}} \UTFviiiLoop \countUTFx = "E0 \countUTFy = "F0 \def\UTFviiiTmp{% \xdef~{\noexpand\UTFviiiThreeOctets\string~}} \UTFviiiLoop \countUTFx = "F0 \countUTFy = "F4 \def\UTFviiiTmp{% \xdef~{\noexpand\UTFviiiFourOctets\string~}} \UTFviiiLoop \endgroup \begingroup \catcode`\"=12 \catcode`\<=12 \catcode`\.=12 \catcode`\,=12 \catcode`\;=12 \catcode`\!=12 \catcode`\~=13 \gdef\DeclareUnicodeCharacter#1#2{% \countUTFz = "#1\relax %\wlog{\space\space defining Unicode char U+#1 (decimal \the\countUTFz)}% \begingroup \parseXMLCharref \def\UTFviiiTwoOctets##1##2{% \csname u8:##1\string ##2\endcsname}% \def\UTFviiiThreeOctets##1##2##3{% \csname u8:##1\string ##2\string ##3\endcsname}% \def\UTFviiiFourOctets##1##2##3##4{% \csname u8:##1\string ##2\string ##3\string ##4\endcsname}% \expandafter\expandafter\expandafter\expandafter \expandafter\expandafter\expandafter \gdef\UTFviiiTmp{#2}% \endgroup} \gdef\parseXMLCharref{% \ifnum\countUTFz < "A0\relax \errhelp = \EMsimple \errmessage{Cannot define Unicode char value < 00A0}% \else\ifnum\countUTFz < "800\relax \parseUTFviiiA,% \parseUTFviiiB C\UTFviiiTwoOctets.,% \else\ifnum\countUTFz < "10000\relax \parseUTFviiiA;% \parseUTFviiiA,% \parseUTFviiiB E\UTFviiiThreeOctets.{,;}% \else \parseUTFviiiA;% \parseUTFviiiA,% \parseUTFviiiA!% \parseUTFviiiB F\UTFviiiFourOctets.{!,;}% \fi\fi\fi } \gdef\parseUTFviiiA#1{% \countUTFx = \countUTFz \divide\countUTFz by 64 \countUTFy = \countUTFz \multiply\countUTFz by 64 \advance\countUTFx by -\countUTFz \advance\countUTFx by 128 \uccode `#1\countUTFx \countUTFz = \countUTFy} \gdef\parseUTFviiiB#1#2#3#4{% \advance\countUTFz by "#10\relax \uccode `#3\countUTFz \uppercase{\gdef\UTFviiiTmp{#2#3#4}}} \endgroup \def\utfeightchardefs{% \DeclareUnicodeCharacter{00A0}{\tie} \DeclareUnicodeCharacter{00A1}{\exclamdown} \DeclareUnicodeCharacter{00A3}{\pounds} \DeclareUnicodeCharacter{00A8}{\"{ }} \DeclareUnicodeCharacter{00A9}{\copyright} \DeclareUnicodeCharacter{00AA}{\ordf} \DeclareUnicodeCharacter{00AB}{\guillemetleft} \DeclareUnicodeCharacter{00AD}{\-} \DeclareUnicodeCharacter{00AE}{\registeredsymbol} \DeclareUnicodeCharacter{00AF}{\={ }} \DeclareUnicodeCharacter{00B0}{\ringaccent{ }} \DeclareUnicodeCharacter{00B4}{\'{ }} \DeclareUnicodeCharacter{00B8}{\cedilla{ }} \DeclareUnicodeCharacter{00BA}{\ordm} \DeclareUnicodeCharacter{00BB}{\guillemetright} \DeclareUnicodeCharacter{00BF}{\questiondown} \DeclareUnicodeCharacter{00C0}{\`A} \DeclareUnicodeCharacter{00C1}{\'A} \DeclareUnicodeCharacter{00C2}{\^A} \DeclareUnicodeCharacter{00C3}{\~A} \DeclareUnicodeCharacter{00C4}{\"A} \DeclareUnicodeCharacter{00C5}{\AA} \DeclareUnicodeCharacter{00C6}{\AE} \DeclareUnicodeCharacter{00C7}{\cedilla{C}} \DeclareUnicodeCharacter{00C8}{\`E} \DeclareUnicodeCharacter{00C9}{\'E} \DeclareUnicodeCharacter{00CA}{\^E} \DeclareUnicodeCharacter{00CB}{\"E} \DeclareUnicodeCharacter{00CC}{\`I} \DeclareUnicodeCharacter{00CD}{\'I} \DeclareUnicodeCharacter{00CE}{\^I} \DeclareUnicodeCharacter{00CF}{\"I} \DeclareUnicodeCharacter{00D0}{\DH} \DeclareUnicodeCharacter{00D1}{\~N} \DeclareUnicodeCharacter{00D2}{\`O} \DeclareUnicodeCharacter{00D3}{\'O} \DeclareUnicodeCharacter{00D4}{\^O} \DeclareUnicodeCharacter{00D5}{\~O} \DeclareUnicodeCharacter{00D6}{\"O} \DeclareUnicodeCharacter{00D8}{\O} \DeclareUnicodeCharacter{00D9}{\`U} \DeclareUnicodeCharacter{00DA}{\'U} \DeclareUnicodeCharacter{00DB}{\^U} \DeclareUnicodeCharacter{00DC}{\"U} \DeclareUnicodeCharacter{00DD}{\'Y} \DeclareUnicodeCharacter{00DE}{\TH} \DeclareUnicodeCharacter{00DF}{\ss} \DeclareUnicodeCharacter{00E0}{\`a} \DeclareUnicodeCharacter{00E1}{\'a} \DeclareUnicodeCharacter{00E2}{\^a} \DeclareUnicodeCharacter{00E3}{\~a} \DeclareUnicodeCharacter{00E4}{\"a} \DeclareUnicodeCharacter{00E5}{\aa} \DeclareUnicodeCharacter{00E6}{\ae} \DeclareUnicodeCharacter{00E7}{\cedilla{c}} \DeclareUnicodeCharacter{00E8}{\`e} \DeclareUnicodeCharacter{00E9}{\'e} \DeclareUnicodeCharacter{00EA}{\^e} \DeclareUnicodeCharacter{00EB}{\"e} \DeclareUnicodeCharacter{00EC}{\`{\dotless{i}}} \DeclareUnicodeCharacter{00ED}{\'{\dotless{i}}} \DeclareUnicodeCharacter{00EE}{\^{\dotless{i}}} \DeclareUnicodeCharacter{00EF}{\"{\dotless{i}}} \DeclareUnicodeCharacter{00F0}{\dh} \DeclareUnicodeCharacter{00F1}{\~n} \DeclareUnicodeCharacter{00F2}{\`o} \DeclareUnicodeCharacter{00F3}{\'o} \DeclareUnicodeCharacter{00F4}{\^o} \DeclareUnicodeCharacter{00F5}{\~o} \DeclareUnicodeCharacter{00F6}{\"o} \DeclareUnicodeCharacter{00F8}{\o} \DeclareUnicodeCharacter{00F9}{\`u} \DeclareUnicodeCharacter{00FA}{\'u} \DeclareUnicodeCharacter{00FB}{\^u} \DeclareUnicodeCharacter{00FC}{\"u} \DeclareUnicodeCharacter{00FD}{\'y} \DeclareUnicodeCharacter{00FE}{\th} \DeclareUnicodeCharacter{00FF}{\"y} \DeclareUnicodeCharacter{0100}{\=A} \DeclareUnicodeCharacter{0101}{\=a} \DeclareUnicodeCharacter{0102}{\u{A}} \DeclareUnicodeCharacter{0103}{\u{a}} \DeclareUnicodeCharacter{0104}{\ogonek{A}} \DeclareUnicodeCharacter{0105}{\ogonek{a}} \DeclareUnicodeCharacter{0106}{\'C} \DeclareUnicodeCharacter{0107}{\'c} \DeclareUnicodeCharacter{0108}{\^C} \DeclareUnicodeCharacter{0109}{\^c} \DeclareUnicodeCharacter{0118}{\ogonek{E}} \DeclareUnicodeCharacter{0119}{\ogonek{e}} \DeclareUnicodeCharacter{010A}{\dotaccent{C}} \DeclareUnicodeCharacter{010B}{\dotaccent{c}} \DeclareUnicodeCharacter{010C}{\v{C}} \DeclareUnicodeCharacter{010D}{\v{c}} \DeclareUnicodeCharacter{010E}{\v{D}} \DeclareUnicodeCharacter{0112}{\=E} \DeclareUnicodeCharacter{0113}{\=e} \DeclareUnicodeCharacter{0114}{\u{E}} \DeclareUnicodeCharacter{0115}{\u{e}} \DeclareUnicodeCharacter{0116}{\dotaccent{E}} \DeclareUnicodeCharacter{0117}{\dotaccent{e}} \DeclareUnicodeCharacter{011A}{\v{E}} \DeclareUnicodeCharacter{011B}{\v{e}} \DeclareUnicodeCharacter{011C}{\^G} \DeclareUnicodeCharacter{011D}{\^g} \DeclareUnicodeCharacter{011E}{\u{G}} \DeclareUnicodeCharacter{011F}{\u{g}} \DeclareUnicodeCharacter{0120}{\dotaccent{G}} \DeclareUnicodeCharacter{0121}{\dotaccent{g}} \DeclareUnicodeCharacter{0124}{\^H} \DeclareUnicodeCharacter{0125}{\^h} \DeclareUnicodeCharacter{0128}{\~I} \DeclareUnicodeCharacter{0129}{\~{\dotless{i}}} \DeclareUnicodeCharacter{012A}{\=I} \DeclareUnicodeCharacter{012B}{\={\dotless{i}}} \DeclareUnicodeCharacter{012C}{\u{I}} \DeclareUnicodeCharacter{012D}{\u{\dotless{i}}} \DeclareUnicodeCharacter{0130}{\dotaccent{I}} \DeclareUnicodeCharacter{0131}{\dotless{i}} \DeclareUnicodeCharacter{0132}{IJ} \DeclareUnicodeCharacter{0133}{ij} \DeclareUnicodeCharacter{0134}{\^J} \DeclareUnicodeCharacter{0135}{\^{\dotless{j}}} \DeclareUnicodeCharacter{0139}{\'L} \DeclareUnicodeCharacter{013A}{\'l} \DeclareUnicodeCharacter{0141}{\L} \DeclareUnicodeCharacter{0142}{\l} \DeclareUnicodeCharacter{0143}{\'N} \DeclareUnicodeCharacter{0144}{\'n} \DeclareUnicodeCharacter{0147}{\v{N}} \DeclareUnicodeCharacter{0148}{\v{n}} \DeclareUnicodeCharacter{014C}{\=O} \DeclareUnicodeCharacter{014D}{\=o} \DeclareUnicodeCharacter{014E}{\u{O}} \DeclareUnicodeCharacter{014F}{\u{o}} \DeclareUnicodeCharacter{0150}{\H{O}} \DeclareUnicodeCharacter{0151}{\H{o}} \DeclareUnicodeCharacter{0152}{\OE} \DeclareUnicodeCharacter{0153}{\oe} \DeclareUnicodeCharacter{0154}{\'R} \DeclareUnicodeCharacter{0155}{\'r} \DeclareUnicodeCharacter{0158}{\v{R}} \DeclareUnicodeCharacter{0159}{\v{r}} \DeclareUnicodeCharacter{015A}{\'S} \DeclareUnicodeCharacter{015B}{\'s} \DeclareUnicodeCharacter{015C}{\^S} \DeclareUnicodeCharacter{015D}{\^s} \DeclareUnicodeCharacter{015E}{\cedilla{S}} \DeclareUnicodeCharacter{015F}{\cedilla{s}} \DeclareUnicodeCharacter{0160}{\v{S}} \DeclareUnicodeCharacter{0161}{\v{s}} \DeclareUnicodeCharacter{0162}{\cedilla{t}} \DeclareUnicodeCharacter{0163}{\cedilla{T}} \DeclareUnicodeCharacter{0164}{\v{T}} \DeclareUnicodeCharacter{0168}{\~U} \DeclareUnicodeCharacter{0169}{\~u} \DeclareUnicodeCharacter{016A}{\=U} \DeclareUnicodeCharacter{016B}{\=u} \DeclareUnicodeCharacter{016C}{\u{U}} \DeclareUnicodeCharacter{016D}{\u{u}} \DeclareUnicodeCharacter{016E}{\ringaccent{U}} \DeclareUnicodeCharacter{016F}{\ringaccent{u}} \DeclareUnicodeCharacter{0170}{\H{U}} \DeclareUnicodeCharacter{0171}{\H{u}} \DeclareUnicodeCharacter{0174}{\^W} \DeclareUnicodeCharacter{0175}{\^w} \DeclareUnicodeCharacter{0176}{\^Y} \DeclareUnicodeCharacter{0177}{\^y} \DeclareUnicodeCharacter{0178}{\"Y} \DeclareUnicodeCharacter{0179}{\'Z} \DeclareUnicodeCharacter{017A}{\'z} \DeclareUnicodeCharacter{017B}{\dotaccent{Z}} \DeclareUnicodeCharacter{017C}{\dotaccent{z}} \DeclareUnicodeCharacter{017D}{\v{Z}} \DeclareUnicodeCharacter{017E}{\v{z}} \DeclareUnicodeCharacter{01C4}{D\v{Z}} \DeclareUnicodeCharacter{01C5}{D\v{z}} \DeclareUnicodeCharacter{01C6}{d\v{z}} \DeclareUnicodeCharacter{01C7}{LJ} \DeclareUnicodeCharacter{01C8}{Lj} \DeclareUnicodeCharacter{01C9}{lj} \DeclareUnicodeCharacter{01CA}{NJ} \DeclareUnicodeCharacter{01CB}{Nj} \DeclareUnicodeCharacter{01CC}{nj} \DeclareUnicodeCharacter{01CD}{\v{A}} \DeclareUnicodeCharacter{01CE}{\v{a}} \DeclareUnicodeCharacter{01CF}{\v{I}} \DeclareUnicodeCharacter{01D0}{\v{\dotless{i}}} \DeclareUnicodeCharacter{01D1}{\v{O}} \DeclareUnicodeCharacter{01D2}{\v{o}} \DeclareUnicodeCharacter{01D3}{\v{U}} \DeclareUnicodeCharacter{01D4}{\v{u}} \DeclareUnicodeCharacter{01E2}{\={\AE}} \DeclareUnicodeCharacter{01E3}{\={\ae}} \DeclareUnicodeCharacter{01E6}{\v{G}} \DeclareUnicodeCharacter{01E7}{\v{g}} \DeclareUnicodeCharacter{01E8}{\v{K}} \DeclareUnicodeCharacter{01E9}{\v{k}} \DeclareUnicodeCharacter{01F0}{\v{\dotless{j}}} \DeclareUnicodeCharacter{01F1}{DZ} \DeclareUnicodeCharacter{01F2}{Dz} \DeclareUnicodeCharacter{01F3}{dz} \DeclareUnicodeCharacter{01F4}{\'G} \DeclareUnicodeCharacter{01F5}{\'g} \DeclareUnicodeCharacter{01F8}{\`N} \DeclareUnicodeCharacter{01F9}{\`n} \DeclareUnicodeCharacter{01FC}{\'{\AE}} \DeclareUnicodeCharacter{01FD}{\'{\ae}} \DeclareUnicodeCharacter{01FE}{\'{\O}} \DeclareUnicodeCharacter{01FF}{\'{\o}} \DeclareUnicodeCharacter{021E}{\v{H}} \DeclareUnicodeCharacter{021F}{\v{h}} \DeclareUnicodeCharacter{0226}{\dotaccent{A}} \DeclareUnicodeCharacter{0227}{\dotaccent{a}} \DeclareUnicodeCharacter{0228}{\cedilla{E}} \DeclareUnicodeCharacter{0229}{\cedilla{e}} \DeclareUnicodeCharacter{022E}{\dotaccent{O}} \DeclareUnicodeCharacter{022F}{\dotaccent{o}} \DeclareUnicodeCharacter{0232}{\=Y} \DeclareUnicodeCharacter{0233}{\=y} \DeclareUnicodeCharacter{0237}{\dotless{j}} \DeclareUnicodeCharacter{02DB}{\ogonek{ }} \DeclareUnicodeCharacter{1E02}{\dotaccent{B}} \DeclareUnicodeCharacter{1E03}{\dotaccent{b}} \DeclareUnicodeCharacter{1E04}{\udotaccent{B}} \DeclareUnicodeCharacter{1E05}{\udotaccent{b}} \DeclareUnicodeCharacter{1E06}{\ubaraccent{B}} \DeclareUnicodeCharacter{1E07}{\ubaraccent{b}} \DeclareUnicodeCharacter{1E0A}{\dotaccent{D}} \DeclareUnicodeCharacter{1E0B}{\dotaccent{d}} \DeclareUnicodeCharacter{1E0C}{\udotaccent{D}} \DeclareUnicodeCharacter{1E0D}{\udotaccent{d}} \DeclareUnicodeCharacter{1E0E}{\ubaraccent{D}} \DeclareUnicodeCharacter{1E0F}{\ubaraccent{d}} \DeclareUnicodeCharacter{1E1E}{\dotaccent{F}} \DeclareUnicodeCharacter{1E1F}{\dotaccent{f}} \DeclareUnicodeCharacter{1E20}{\=G} \DeclareUnicodeCharacter{1E21}{\=g} \DeclareUnicodeCharacter{1E22}{\dotaccent{H}} \DeclareUnicodeCharacter{1E23}{\dotaccent{h}} \DeclareUnicodeCharacter{1E24}{\udotaccent{H}} \DeclareUnicodeCharacter{1E25}{\udotaccent{h}} \DeclareUnicodeCharacter{1E26}{\"H} \DeclareUnicodeCharacter{1E27}{\"h} \DeclareUnicodeCharacter{1E30}{\'K} \DeclareUnicodeCharacter{1E31}{\'k} \DeclareUnicodeCharacter{1E32}{\udotaccent{K}} \DeclareUnicodeCharacter{1E33}{\udotaccent{k}} \DeclareUnicodeCharacter{1E34}{\ubaraccent{K}} \DeclareUnicodeCharacter{1E35}{\ubaraccent{k}} \DeclareUnicodeCharacter{1E36}{\udotaccent{L}} \DeclareUnicodeCharacter{1E37}{\udotaccent{l}} \DeclareUnicodeCharacter{1E3A}{\ubaraccent{L}} \DeclareUnicodeCharacter{1E3B}{\ubaraccent{l}} \DeclareUnicodeCharacter{1E3E}{\'M} \DeclareUnicodeCharacter{1E3F}{\'m} \DeclareUnicodeCharacter{1E40}{\dotaccent{M}} \DeclareUnicodeCharacter{1E41}{\dotaccent{m}} \DeclareUnicodeCharacter{1E42}{\udotaccent{M}} \DeclareUnicodeCharacter{1E43}{\udotaccent{m}} \DeclareUnicodeCharacter{1E44}{\dotaccent{N}} \DeclareUnicodeCharacter{1E45}{\dotaccent{n}} \DeclareUnicodeCharacter{1E46}{\udotaccent{N}} \DeclareUnicodeCharacter{1E47}{\udotaccent{n}} \DeclareUnicodeCharacter{1E48}{\ubaraccent{N}} \DeclareUnicodeCharacter{1E49}{\ubaraccent{n}} \DeclareUnicodeCharacter{1E54}{\'P} \DeclareUnicodeCharacter{1E55}{\'p} \DeclareUnicodeCharacter{1E56}{\dotaccent{P}} \DeclareUnicodeCharacter{1E57}{\dotaccent{p}} \DeclareUnicodeCharacter{1E58}{\dotaccent{R}} \DeclareUnicodeCharacter{1E59}{\dotaccent{r}} \DeclareUnicodeCharacter{1E5A}{\udotaccent{R}} \DeclareUnicodeCharacter{1E5B}{\udotaccent{r}} \DeclareUnicodeCharacter{1E5E}{\ubaraccent{R}} \DeclareUnicodeCharacter{1E5F}{\ubaraccent{r}} \DeclareUnicodeCharacter{1E60}{\dotaccent{S}} \DeclareUnicodeCharacter{1E61}{\dotaccent{s}} \DeclareUnicodeCharacter{1E62}{\udotaccent{S}} \DeclareUnicodeCharacter{1E63}{\udotaccent{s}} \DeclareUnicodeCharacter{1E6A}{\dotaccent{T}} \DeclareUnicodeCharacter{1E6B}{\dotaccent{t}} \DeclareUnicodeCharacter{1E6C}{\udotaccent{T}} \DeclareUnicodeCharacter{1E6D}{\udotaccent{t}} \DeclareUnicodeCharacter{1E6E}{\ubaraccent{T}} \DeclareUnicodeCharacter{1E6F}{\ubaraccent{t}} \DeclareUnicodeCharacter{1E7C}{\~V} \DeclareUnicodeCharacter{1E7D}{\~v} \DeclareUnicodeCharacter{1E7E}{\udotaccent{V}} \DeclareUnicodeCharacter{1E7F}{\udotaccent{v}} \DeclareUnicodeCharacter{1E80}{\`W} \DeclareUnicodeCharacter{1E81}{\`w} \DeclareUnicodeCharacter{1E82}{\'W} \DeclareUnicodeCharacter{1E83}{\'w} \DeclareUnicodeCharacter{1E84}{\"W} \DeclareUnicodeCharacter{1E85}{\"w} \DeclareUnicodeCharacter{1E86}{\dotaccent{W}} \DeclareUnicodeCharacter{1E87}{\dotaccent{w}} \DeclareUnicodeCharacter{1E88}{\udotaccent{W}} \DeclareUnicodeCharacter{1E89}{\udotaccent{w}} \DeclareUnicodeCharacter{1E8A}{\dotaccent{X}} \DeclareUnicodeCharacter{1E8B}{\dotaccent{x}} \DeclareUnicodeCharacter{1E8C}{\"X} \DeclareUnicodeCharacter{1E8D}{\"x} \DeclareUnicodeCharacter{1E8E}{\dotaccent{Y}} \DeclareUnicodeCharacter{1E8F}{\dotaccent{y}} \DeclareUnicodeCharacter{1E90}{\^Z} \DeclareUnicodeCharacter{1E91}{\^z} \DeclareUnicodeCharacter{1E92}{\udotaccent{Z}} \DeclareUnicodeCharacter{1E93}{\udotaccent{z}} \DeclareUnicodeCharacter{1E94}{\ubaraccent{Z}} \DeclareUnicodeCharacter{1E95}{\ubaraccent{z}} \DeclareUnicodeCharacter{1E96}{\ubaraccent{h}} \DeclareUnicodeCharacter{1E97}{\"t} \DeclareUnicodeCharacter{1E98}{\ringaccent{w}} \DeclareUnicodeCharacter{1E99}{\ringaccent{y}} \DeclareUnicodeCharacter{1EA0}{\udotaccent{A}} \DeclareUnicodeCharacter{1EA1}{\udotaccent{a}} \DeclareUnicodeCharacter{1EB8}{\udotaccent{E}} \DeclareUnicodeCharacter{1EB9}{\udotaccent{e}} \DeclareUnicodeCharacter{1EBC}{\~E} \DeclareUnicodeCharacter{1EBD}{\~e} \DeclareUnicodeCharacter{1ECA}{\udotaccent{I}} \DeclareUnicodeCharacter{1ECB}{\udotaccent{i}} \DeclareUnicodeCharacter{1ECC}{\udotaccent{O}} \DeclareUnicodeCharacter{1ECD}{\udotaccent{o}} \DeclareUnicodeCharacter{1EE4}{\udotaccent{U}} \DeclareUnicodeCharacter{1EE5}{\udotaccent{u}} \DeclareUnicodeCharacter{1EF2}{\`Y} \DeclareUnicodeCharacter{1EF3}{\`y} \DeclareUnicodeCharacter{1EF4}{\udotaccent{Y}} \DeclareUnicodeCharacter{1EF8}{\~Y} \DeclareUnicodeCharacter{1EF9}{\~y} \DeclareUnicodeCharacter{2013}{--} \DeclareUnicodeCharacter{2014}{---} \DeclareUnicodeCharacter{2018}{\quoteleft} \DeclareUnicodeCharacter{2019}{\quoteright} \DeclareUnicodeCharacter{201A}{\quotesinglbase} \DeclareUnicodeCharacter{201C}{\quotedblleft} \DeclareUnicodeCharacter{201D}{\quotedblright} \DeclareUnicodeCharacter{201E}{\quotedblbase} \DeclareUnicodeCharacter{2022}{\bullet} \DeclareUnicodeCharacter{2026}{\dots} \DeclareUnicodeCharacter{2039}{\guilsinglleft} \DeclareUnicodeCharacter{203A}{\guilsinglright} \DeclareUnicodeCharacter{20AC}{\euro} \DeclareUnicodeCharacter{2192}{\expansion} \DeclareUnicodeCharacter{21D2}{\result} \DeclareUnicodeCharacter{2212}{\minus} \DeclareUnicodeCharacter{2217}{\point} \DeclareUnicodeCharacter{2261}{\equiv} }% end of \utfeightchardefs % US-ASCII character definitions. \def\asciichardefs{% nothing need be done \relax } % Make non-ASCII characters printable again for compatibility with % existing Texinfo documents that may use them, even without declaring a % document encoding. % \setnonasciicharscatcode \other \message{formatting,} \newdimen\defaultparindent \defaultparindent = 15pt \chapheadingskip = 15pt plus 4pt minus 2pt \secheadingskip = 12pt plus 3pt minus 2pt \subsecheadingskip = 9pt plus 2pt minus 2pt % Prevent underfull vbox error messages. \vbadness = 10000 % Don't be very finicky about underfull hboxes, either. \hbadness = 6666 % Following George Bush, get rid of widows and orphans. \widowpenalty=10000 \clubpenalty=10000 % Use TeX 3.0's \emergencystretch to help line breaking, but if we're % using an old version of TeX, don't do anything. We want the amount of % stretch added to depend on the line length, hence the dependence on % \hsize. We call this whenever the paper size is set. % \def\setemergencystretch{% \ifx\emergencystretch\thisisundefined % Allow us to assign to \emergencystretch anyway. \def\emergencystretch{\dimen0}% \else \emergencystretch = .15\hsize \fi } % Parameters in order: 1) textheight; 2) textwidth; % 3) voffset; 4) hoffset; 5) binding offset; 6) topskip; % 7) physical page height; 8) physical page width. % % We also call \setleading{\textleading}, so the caller should define % \textleading. The caller should also set \parskip. % \def\internalpagesizes#1#2#3#4#5#6#7#8{% \voffset = #3\relax \topskip = #6\relax \splittopskip = \topskip % \vsize = #1\relax \advance\vsize by \topskip \outervsize = \vsize \advance\outervsize by 2\topandbottommargin \pageheight = \vsize % \hsize = #2\relax \outerhsize = \hsize \advance\outerhsize by 0.5in \pagewidth = \hsize % \normaloffset = #4\relax \bindingoffset = #5\relax % \ifpdf \pdfpageheight #7\relax \pdfpagewidth #8\relax % if we don't reset these, they will remain at "1 true in" of % whatever layout pdftex was dumped with. \pdfhorigin = 1 true in \pdfvorigin = 1 true in \fi % \setleading{\textleading} % \parindent = \defaultparindent \setemergencystretch } % @letterpaper (the default). \def\letterpaper{{\globaldefs = 1 \parskip = 3pt plus 2pt minus 1pt \textleading = 13.2pt % % If page is nothing but text, make it come out even. \internalpagesizes{607.2pt}{6in}% that's 46 lines {\voffset}{.25in}% {\bindingoffset}{36pt}% {11in}{8.5in}% }} % Use @smallbook to reset parameters for 7x9.25 trim size. \def\smallbook{{\globaldefs = 1 \parskip = 2pt plus 1pt \textleading = 12pt % \internalpagesizes{7.5in}{5in}% {-.2in}{0in}% {\bindingoffset}{16pt}% {9.25in}{7in}% % \lispnarrowing = 0.3in \tolerance = 700 \hfuzz = 1pt \contentsrightmargin = 0pt \defbodyindent = .5cm }} % Use @smallerbook to reset parameters for 6x9 trim size. % (Just testing, parameters still in flux.) \def\smallerbook{{\globaldefs = 1 \parskip = 1.5pt plus 1pt \textleading = 12pt % \internalpagesizes{7.4in}{4.8in}% {-.2in}{-.4in}% {0pt}{14pt}% {9in}{6in}% % \lispnarrowing = 0.25in \tolerance = 700 \hfuzz = 1pt \contentsrightmargin = 0pt \defbodyindent = .4cm }} % Use @afourpaper to print on European A4 paper. \def\afourpaper{{\globaldefs = 1 \parskip = 3pt plus 2pt minus 1pt \textleading = 13.2pt % % Double-side printing via postscript on Laserjet 4050 % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm. % To change the settings for a different printer or situation, adjust % \normaloffset until the front-side and back-side texts align. Then % do the same for \bindingoffset. You can set these for testing in % your texinfo source file like this: % @tex % \global\normaloffset = -6mm % \global\bindingoffset = 10mm % @end tex \internalpagesizes{673.2pt}{160mm}% that's 51 lines {\voffset}{\hoffset}% {\bindingoffset}{44pt}% {297mm}{210mm}% % \tolerance = 700 \hfuzz = 1pt \contentsrightmargin = 0pt \defbodyindent = 5mm }} % Use @afivepaper to print on European A5 paper. % From romildo@urano.iceb.ufop.br, 2 July 2000. % He also recommends making @example and @lisp be small. \def\afivepaper{{\globaldefs = 1 \parskip = 2pt plus 1pt minus 0.1pt \textleading = 12.5pt % \internalpagesizes{160mm}{120mm}% {\voffset}{\hoffset}% {\bindingoffset}{8pt}% {210mm}{148mm}% % \lispnarrowing = 0.2in \tolerance = 800 \hfuzz = 1.2pt \contentsrightmargin = 0pt \defbodyindent = 2mm \tableindent = 12mm }} % A specific text layout, 24x15cm overall, intended for A4 paper. \def\afourlatex{{\globaldefs = 1 \afourpaper \internalpagesizes{237mm}{150mm}% {\voffset}{4.6mm}% {\bindingoffset}{7mm}% {297mm}{210mm}% % % Must explicitly reset to 0 because we call \afourpaper. \globaldefs = 0 }} % Use @afourwide to print on A4 paper in landscape format. \def\afourwide{{\globaldefs = 1 \afourpaper \internalpagesizes{241mm}{165mm}% {\voffset}{-2.95mm}% {\bindingoffset}{7mm}% {297mm}{210mm}% \globaldefs = 0 }} % @pagesizes TEXTHEIGHT[,TEXTWIDTH] % Perhaps we should allow setting the margins, \topskip, \parskip, % and/or leading, also. Or perhaps we should compute them somehow. % \parseargdef\pagesizes{\pagesizesyyy #1,,\finish} \def\pagesizesyyy#1,#2,#3\finish{{% \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi \globaldefs = 1 % \parskip = 3pt plus 2pt minus 1pt \setleading{\textleading}% % \dimen0 = #1\relax \advance\dimen0 by \voffset % \dimen2 = \hsize \advance\dimen2 by \normaloffset % \internalpagesizes{#1}{\hsize}% {\voffset}{\normaloffset}% {\bindingoffset}{44pt}% {\dimen0}{\dimen2}% }} % Set default to letter. % \letterpaper \message{and turning on texinfo input format.} \def^^L{\par} % remove \outer, so ^L can appear in an @comment % DEL is a comment character, in case @c does not suffice. \catcode`\^^? = 14 % Define macros to output various characters with catcode for normal text. \catcode`\"=\other \def\normaldoublequote{"} \catcode`\$=\other \def\normaldollar{$}%$ font-lock fix \catcode`\+=\other \def\normalplus{+} \catcode`\<=\other \def\normalless{<} \catcode`\>=\other \def\normalgreater{>} \catcode`\^=\other \def\normalcaret{^} \catcode`\_=\other \def\normalunderscore{_} \catcode`\|=\other \def\normalverticalbar{|} \catcode`\~=\other \def\normaltilde{~} % This macro is used to make a character print one way in \tt % (where it can probably be output as-is), and another way in other fonts, % where something hairier probably needs to be done. % % #1 is what to print if we are indeed using \tt; #2 is what to print % otherwise. Since all the Computer Modern typewriter fonts have zero % interword stretch (and shrink), and it is reasonable to expect all % typewriter fonts to have this, we can check that font parameter. % \def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi} % Same as above, but check for italic font. Actually this also catches % non-italic slanted fonts since it is impossible to distinguish them from % italic fonts. But since this is only used by $ and it uses \sl anyway % this is not a problem. \def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi} % Turn off all special characters except @ % (and those which the user can use as if they were ordinary). % Most of these we simply print from the \tt font, but for some, we can % use math or other variants that look better in normal text. \catcode`\"=\active \def\activedoublequote{{\tt\char34}} \let"=\activedoublequote \catcode`\~=\active \def~{{\tt\char126}} \chardef\hat=`\^ \catcode`\^=\active \def^{{\tt \hat}} \catcode`\_=\active \def_{\ifusingtt\normalunderscore\_} \let\realunder=_ % Subroutine for the previous macro. \def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em } \catcode`\|=\active \def|{{\tt\char124}} \chardef \less=`\< \catcode`\<=\active \def<{{\tt \less}} \chardef \gtr=`\> \catcode`\>=\active \def>{{\tt \gtr}} \catcode`\+=\active \def+{{\tt \char 43}} \catcode`\$=\active \def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix % If a .fmt file is being used, characters that might appear in a file % name cannot be active until we have parsed the command line. % So turn them off again, and have \everyjob (or @setfilename) turn them on. % \otherifyactive is called near the end of this file. \def\otherifyactive{\catcode`+=\other \catcode`\_=\other} % Used sometimes to turn off (effectively) the active characters even after % parsing them. \def\turnoffactive{% \normalturnoffactive \otherbackslash } \catcode`\@=0 % \backslashcurfont outputs one backslash character in current font, % as in \char`\\. \global\chardef\backslashcurfont=`\\ \global\let\rawbackslashxx=\backslashcurfont % let existing .??s files work % \realbackslash is an actual character `\' with catcode other, and % \doublebackslash is two of them (for the pdf outlines). {\catcode`\\=\other @gdef@realbackslash{\} @gdef@doublebackslash{\\}} % In texinfo, backslash is an active character; it prints the backslash % in fixed width font. \catcode`\\=\active % @ for escape char from now on. % The story here is that in math mode, the \char of \backslashcurfont % ends up printing the roman \ from the math symbol font (because \char % in math mode uses the \mathcode, and plain.tex sets % \mathcode`\\="026E). It seems better for @backslashchar{} to always % print a typewriter backslash, hence we use an explicit \mathchar, % which is the decimal equivalent of "715c (class 7, e.g., use \fam; % ignored family value; char position "5C). We can't use " for the % usual hex value because it has already been made active. @def@normalbackslash{{@tt @ifmmode @mathchar29020 @else @backslashcurfont @fi}} @let@backslashchar = @normalbackslash % @backslashchar{} is for user documents. % On startup, @fixbackslash assigns: % @let \ = @normalbackslash % \rawbackslash defines an active \ to do \backslashcurfont. % \otherbackslash defines an active \ to be a literal `\' character with % catcode other. We switch back and forth between these. @gdef@rawbackslash{@let\=@backslashcurfont} @gdef@otherbackslash{@let\=@realbackslash} % Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of % the literal character `\'. % @def@normalturnoffactive{% @let"=@normaldoublequote @let$=@normaldollar %$ font-lock fix @let+=@normalplus @let<=@normalless @let>=@normalgreater @let\=@normalbackslash @let^=@normalcaret @let_=@normalunderscore @let|=@normalverticalbar @let~=@normaltilde @markupsetuplqdefault @markupsetuprqdefault @unsepspaces } % Make _ and + \other characters, temporarily. % This is canceled by @fixbackslash. @otherifyactive % If a .fmt file is being used, we don't want the `\input texinfo' to show up. % That is what \eatinput is for; after that, the `\' should revert to printing % a backslash. % @gdef@eatinput input texinfo{@fixbackslash} @global@let\ = @eatinput % On the other hand, perhaps the file did not have a `\input texinfo'. Then % the first `\' in the file would cause an error. This macro tries to fix % that, assuming it is called before the first `\' could plausibly occur. % Also turn back on active characters that might appear in the input % file name, in case not using a pre-dumped format. % @gdef@fixbackslash{% @ifx\@eatinput @let\ = @normalbackslash @fi @catcode`+=@active @catcode`@_=@active } % Say @foo, not \foo, in error messages. @escapechar = `@@ % These (along with & and #) are made active for url-breaking, so need % active definitions as the normal characters. @def@normaldot{.} @def@normalquest{?} @def@normalslash{/} % These look ok in all fonts, so just make them not special. % @hashchar{} gets its own user-level command, because of #line. @catcode`@& = @other @def@normalamp{&} @catcode`@# = @other @def@normalhash{#} @catcode`@% = @other @def@normalpercent{%} @let @hashchar = @normalhash @c Finally, make ` and ' active, so that txicodequoteundirected and @c txicodequotebacktick work right in, e.g., @w{@code{`foo'}}. If we @c don't make ` and ' active, @code will not get them as active chars. @c Do this last of all since we use ` in the previous @catcode assignments. @catcode`@'=@active @catcode`@`=@active @markupsetuplqdefault @markupsetuprqdefault @c Local variables: @c eval: (add-hook 'write-file-hooks 'time-stamp) @c page-delimiter: "^\\\\message" @c time-stamp-start: "def\\\\texinfoversion{" @c time-stamp-format: "%:y-%02m-%02d.%02H" @c time-stamp-end: "}" @c End: @c vim:sw=2: @ignore arch-tag: e1b36e32-c96e-4135-a41a-0b2efa2ea115 @end ignore cgdb-0.6.7/config/ylwrap000755 000765 000120 00000015536 12072642155 016121 0ustar00mmuelleradmin000000 000000 #! /bin/sh # ylwrap - wrapper for lex/yacc invocations. scriptversion=2012-12-21.17; # UTC # Copyright (C) 1996-2013 Free Software Foundation, Inc. # # Written by Tom Tromey . # # 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. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . get_dirname () { case $1 in */*|*\\*) printf '%s\n' "$1" | sed -e 's|\([\\/]\)[^\\/]*$|\1|';; # Otherwise, we want the empty string (not "."). esac } # guard FILE # ---------- # The CPP macro used to guard inclusion of FILE. guard() { printf '%s\n' "$1" \ | sed \ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \ -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g' \ -e 's/__*/_/g' } # quote_for_sed [STRING] # ---------------------- # Return STRING (or stdin) quoted to be used as a sed pattern. quote_for_sed () { case $# in 0) cat;; 1) printf '%s\n' "$1";; esac \ | sed -e 's|[][\\.*]|\\&|g' } case "$1" in '') echo "$0: No files given. Try '$0 --help' for more information." 1>&2 exit 1 ;; --basedir) basedir=$2 shift 2 ;; -h|--h*) cat <<\EOF Usage: ylwrap [--help|--version] INPUT [OUTPUT DESIRED]... -- PROGRAM [ARGS]... Wrapper for lex/yacc invocations, renaming files as desired. INPUT is the input file OUTPUT is one file PROG generates DESIRED is the file we actually want instead of OUTPUT PROGRAM is program to run ARGS are passed to PROG Any number of OUTPUT,DESIRED pairs may be used. Report bugs to . EOF exit $? ;; -v|--v*) echo "ylwrap $scriptversion" exit $? ;; esac # The input. input="$1" shift # We'll later need for a correct munging of "#line" directives. input_sub_rx=`get_dirname "$input" | quote_for_sed` case "$input" in [\\/]* | ?:[\\/]*) # Absolute path; do nothing. ;; *) # Relative path. Make it absolute. input="`pwd`/$input" ;; esac input_rx=`get_dirname "$input" | quote_for_sed` # Since DOS filename conventions don't allow two dots, # the DOS version of Bison writes out y_tab.c instead of y.tab.c # and y_tab.h instead of y.tab.h. Test to see if this is the case. y_tab_nodot=false if test -f y_tab.c || test -f y_tab.h; then y_tab_nodot=true fi # The parser itself, the first file, is the destination of the .y.c # rule in the Makefile. parser=$1 # A sed program to s/FROM/TO/g for all the FROM/TO so that, for # instance, we rename #include "y.tab.h" into #include "parse.h" # during the conversion from y.tab.c to parse.c. sed_fix_filenames= # Also rename header guards, as Bison 2.7 for instance uses its header # guard in its implementation file. sed_fix_header_guards= while test "$#" -ne 0; do if test "$1" = "--"; then shift break fi from=$1 # Handle y_tab.c and y_tab.h output by DOS if $y_tab_nodot; then case $from in "y.tab.c") from=y_tab.c;; "y.tab.h") from=y_tab.h;; esac fi shift to=$1 shift sed_fix_filenames="${sed_fix_filenames}s|"`quote_for_sed "$from"`"|$to|g;" sed_fix_header_guards="${sed_fix_header_guards}s|"`guard "$from"`"|"`guard "$to"`"|g;" done # The program to run. prog="$1" shift # Make any relative path in $prog absolute. case "$prog" in [\\/]* | ?:[\\/]*) ;; *[\\/]*) prog="`pwd`/$prog" ;; esac # FIXME: add hostname here for parallel makes that run commands on # other machines. But that might take us over the 14-char limit. dirname=ylwrap$$ do_exit="cd '`pwd`' && rm -rf $dirname > /dev/null 2>&1;"' (exit $ret); exit $ret' trap "ret=129; $do_exit" 1 trap "ret=130; $do_exit" 2 trap "ret=141; $do_exit" 13 trap "ret=143; $do_exit" 15 mkdir $dirname || exit 1 cd $dirname case $# in 0) "$prog" "$input" ;; *) "$prog" "$@" "$input" ;; esac ret=$? if test $ret -eq 0; then for from in * do to=`printf '%s\n' "$from" | sed "$sed_fix_filenames"` if test -f "$from"; then # If $2 is an absolute path name, then just use that, # otherwise prepend '../'. case $to in [\\/]* | ?:[\\/]*) target=$to;; *) target="../$to";; esac # Do not overwrite unchanged header files to avoid useless # recompilations. Always update the parser itself: it is the # destination of the .y.c rule in the Makefile. Divert the # output of all other files to a temporary file so we can # compare them to existing versions. if test $from != $parser; then realtarget="$target" target=tmp-`printf '%s\n' "$target" | sed 's|.*[\\/]||g'` fi # Munge "#line" or "#" directives. Don't let the resulting # debug information point at an absolute srcdir. Use the real # output file name, not yy.lex.c for instance. Adjust the # include guards too. sed -e "/^#/!b" \ -e "s|$input_rx|$input_sub_rx|" \ -e "$sed_fix_filenames" \ -e "$sed_fix_header_guards" \ "$from" >"$target" || ret=$? # Check whether files must be updated. if test "$from" != "$parser"; then if test -f "$realtarget" && cmp -s "$realtarget" "$target"; then echo "$to is unchanged" rm -f "$target" else echo "updating $to" mv -f "$target" "$realtarget" fi fi else # A missing file is only an error for the parser. This is a # blatant hack to let us support using "yacc -d". If -d is not # specified, don't fail when the header file is "missing". if test "$from" = "$parser"; then ret=1 fi fi done fi # Remove the directory. cd .. rm -rf $dirname exit $ret # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: cgdb-0.6.7/cgdb/cgdb.c000644 000765 000024 00000143100 12074711270 015352 0ustar00mmuellerstaff000000 000000 #if HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #ifdef HAVE_SYS_TYPES_H #include #endif /* HAVE_SYS_TYPES_H */ #ifdef HAVE_FCNTL_H #include #endif /* HAVE_FCNTL_H */ #if HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STDIO_H #include #endif /* HAVE_STDIO_H */ #if HAVE_CURSES_H #include #elif HAVE_NCURSES_CURSES_H #include #endif /* HAVE_CURSES_H */ #ifdef HAVE_SYS_TIME_H #include #endif #ifdef HAVE_SYS_SELECT_H #include #endif /* HAVE_SYS_SELECT_H */ #if HAVE_SYS_STAT_H #include #endif #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #if HAVE_SYS_IOCTL_H #include #endif /* HAVE_SYS_IOCTL_H */ #if HAVE_ERRNO_H #include #endif /* HAVE_ERRNO_H */ #ifdef HAVE_GETOPT_H #include #endif #if HAVE_CTYPE_H #include #endif /* Local Includes */ #include "cgdb.h" #include "logger.h" #include "interface.h" #include "scroller.h" #include "sources.h" #include "tgdb.h" #include "kui.h" #include "kui_term.h" #include "fs_util.h" #include "cgdbrc.h" #include "io.h" #include "tgdb_list.h" #include "fork_util.h" #include "terminal.h" #include "queue.h" #include "rline.h" #include "ibuf.h" #include "usage.h" #include "sys_util.h" /* --------- */ /* Constants */ /* --------- */ const char *readline_history_filename = "readline_history.txt"; /* --------------- */ /* Local Variables */ /* --------------- */ struct tgdb *tgdb; /* The main TGDB context */ struct tgdb_request *last_request = NULL; char cgdb_home_dir[MAXLINE]; /* Path to home directory with trailing slash */ char *readline_history_path; /* After readline init is called, this will * contain the path to the readline history * file. */ static int gdb_fd = -1; /* File descriptor for GDB communication */ static int tty_fd = -1; /* File descriptor for process being debugged */ /** Master/Slave PTY used to keep readline off of stdin/stdout. */ static pty_pair_ptr pty_pair; static char *debugger_path = NULL; /* Path to debugger to use */ struct kui_manager *kui_ctx = NULL; /* The key input package */ struct kui_map_set *kui_map = NULL; struct kui_map_set *kui_imap = NULL; /** * This allows CGDB to know if it is acceptable to read more input from * the KUI at this particular moment. Under certain circumstances, CGDB may * have to complete a particular communication message to GDB, in while doing * so, may not want to process's the users keystrokes. This flag is purely for * CGDB to keep track of if it wants to read from the KUI. The KUI is always * ready. * * If kui_input_acceptable is set to 1, then input can be read from * the kui. Otherwise, some part of CGDB is waiting for more events to happen. * * For example, when the user types 'o' at the CGDB source window, the * user is requesting the file dialog to open. CGDB must first ask GDB for * the list of files. While it is retreiving these files, CGDB shouldn't * shoot through the rest of the kui keys available. If the user had * typed 'o /main' they would want to open the file dialog and start * searching for a file that had the substring 'main' in it. So, CGDB must * first ensure all the files are retrieved, displayed in the file * dialog, and ensure the file dialog is ready to recieve keys from the * user before the input is allowed to hit the file dialog. */ int kui_input_acceptable = 1; int resize_pipe[2] = { -1, -1 }; /* Readline interface */ static struct rline *rline; /** * If this is 1, then CGDB is performing a tab completion in the GDB window. * When this is true, there can be no data passed to readline. The completion * must be displayed to the user first. */ static int is_tab_completing = 0; /* Current readline line. If the user enters 'b ma\in', where * NL is the same as the user hitting the enter key, then 2 commands are * received by readline. The first is 'b ma\' and the second is 'in'. * * In general, the user can put a \ as the last char on the line and GDB * accepts this as meaning, "allow me to enter more data on the next line". * The trailing \, does not belong in the command to GDB, it is purely there * to tell GDB that the user wants to enter more data on the next line. * * For this reason, CGDB keeps this buffer. It adds the command the user * is typeing to this buffer. When a line comes that does not end in a \, * then the command is sent to GDB. */ static struct ibuf *current_line = NULL; /** * When the user is entering a multi-line command in the GDB window * via the \ char at the end of line, the prompt get's set to "". This * variable is used to remember what the previous prompt was so that it * can be set back when the user has finished entering the line. */ static char *rline_last_prompt = NULL; /** * Represents all the different states that can be reached while displaying * the tab completion information to the user. */ enum tab_completion_state { /** Nothing has been done yet */ TAB_COMPLETION_START, /** The query possibilities message was issued, and waiting for response */ TAB_COMPLETION_QUERY_POSSIBILITIES, /** Displaying the tab completion */ TAB_COMPLETION_COMPLETION_DISPLAY, /** Query the user to continue tab completion, and waiting for response */ TAB_COMPLETION_QUERY_PAGER, /** All done */ TAB_COMPLETION_DONE }; /** * A context needed to allow the displaying of tab completion to take place. * Readline calls back into CGDB with the tab completion information. CGDB can * not simply display all the information to the user because the displaying of * the tab completion data can be interactive (and is by default). So, this * context keeps track of what has been displayed to the user, and what needs * to be displayed while CGDB get's input from the user. */ typedef struct tab_completion_ctx { /** All of the possible completion matches, valid from [0,num_matches]. */ char **matches; /** The number of completion matches in the 'matches' field. */ int num_matches; /** The longest line in the 'matches' field */ int max_length; /** These variables changed based on the state of this object */ /** Total number of lines printed so far. */ int total; /** Total number of lines printed so far since last pager. */ int lines; /** The current tab completion state */ enum tab_completion_state state; } *tab_completion_ptr; /** * The current tab completion display context. * If non-null, currently doing a display */ static tab_completion_ptr completion_ptr = NULL; /* Original terminal attributes */ static struct termios term_attributes; /** * If the TGDB instance is not busy, it will run the requested command. * Otherwise, the command will get queued to run later. * * \param tgdb * An instance of the tgdb library to operate on. * * \param request * The requested command to have TGDB process. * * \return * 0 on success or -1 on error */ int handle_request(struct tgdb *tgdb, struct tgdb_request *request) { int val, is_busy; if (!tgdb || !request) return -1; val = tgdb_is_busy(tgdb, &is_busy); if (val == -1) return -1; if (is_busy) tgdb_queue_append(tgdb, request); else { last_request = request; tgdb_process_command(tgdb, request); } return 0; } /** * Runs a command in the shell. The shell may be interactive, and CGDB * will be paused for the duration of the shell. Any leading stuff, like * 'shell ' or '!' should be removed prior to calling this function. * * \param command The command to run at the shell. Empty string or null * means to invoke an interactive shell. * * \return The exit status of the system() call. */ int run_shell_command(const char *command) { int rv; /* Cleanly scroll the screen up for a prompt */ scrl(1); move(LINES - 1, 0); printf("\n"); /* Put the terminal in cooked mode and turn on echo */ endwin(); tty_set_attributes(STDIN_FILENO, &term_attributes); /* NULL or empty string means invoke user's shell */ if (command == NULL || strlen(command) == 0) { /* Check for SHELL environment variable */ char *shell = getenv("SHELL"); if (shell == NULL) { /* Run /bin/sh instead */ rv = system("/bin/sh"); } else { rv = system(shell); } } else { /* Execute the command passed in via system() */ rv = system(command); } /* Press any key to continue... */ fprintf(stderr, "Hit ENTER to continue..."); while (fgetc(stdin) != '\n') { } /* Turn off echo and put the terminal back into raw mode */ tty_cbreak(STDIN_FILENO, &term_attributes); if_draw(); return rv; } /* readline code {{{*/ /* Please forgive me for adding all the comment below. This function * has some strange bahaviors that I thought should be well explained. */ void rlctx_send_user_command(char *line) { char *cline; int length; char *rline_prompt; tgdb_request_ptr request_ptr; if (line == NULL) { /* NULL line means rl_callback_read_char received EOF */ ibuf_add(current_line, "quit"); } else { /* Add the line passed in to the current line */ ibuf_add(current_line, line); } /* Get current line, and current line length */ cline = ibuf_get(current_line); length = ibuf_length(current_line); /* Check to see if the user is escaping the line, to use a * multi line command. If so, return so that the user can * continue the command. This data should not go into the history * buffer, or be sent to gdb yet. * * Also, notice the length > 0 condition. (length == 0) can happen * when the user simply hits Enter on the keyboard. */ if (length > 0 && cline[length - 1] == '\\') { /* The \ char is for continuation only, it is not meant to be sent * to GDB as a character. */ ibuf_delchar(current_line); /* Only need to change the prompt the first time the \ char is used. * Doing it a second time would erase the real rline_last_prompt, * since the prompt has already been set to "". */ if (!rline_last_prompt) { rline_get_prompt(rline, &rline_prompt); rline_last_prompt = strdup(rline_prompt); /* GDB set's the prompt to nothing when doing continuation. * This is here just for compatibility. */ rline_set_prompt(rline, ""); } return; } /* If here, a full command has been sent. Restore the prompt. */ if (rline_last_prompt) { rline_set_prompt(rline, rline_last_prompt); free(rline_last_prompt); rline_last_prompt = NULL; } /* Don't add the enter command to the history */ if (length > 0) rline_add_history(rline, cline); request_ptr = tgdb_request_run_console_command(tgdb, cline); if (!request_ptr) logger_write_pos(logger, __FILE__, __LINE__, "rlctx_send_user_command\n"); /* Send this command to TGDB */ handle_request(tgdb, request_ptr); ibuf_clear(current_line); } static int tab_completion(int a, int b) { char *cur_line; int ret; tgdb_request_ptr request_ptr; is_tab_completing = 1; ret = rline_get_current_line(rline, &cur_line); if (ret == -1) logger_write_pos(logger, __FILE__, __LINE__, "rline_get_current_line error\n"); request_ptr = tgdb_request_complete(tgdb, cur_line); if (!request_ptr) logger_write_pos(logger, __FILE__, __LINE__, "tgdb_request_complete error\n"); handle_request(tgdb, request_ptr); return 0; } /** * Create a tab completion context. * * \param matches * See tab_completion field documentation * * \param num_matches * See tab_completion field documentation * * \param max_length * See tab_completion field documentation * * \return * The next context, or NULL on error. */ static tab_completion_ptr tab_completion_create(char **matches, int num_matches, int max_length) { int i; tab_completion_ptr comptr; comptr = (tab_completion_ptr) cgdb_malloc(sizeof (struct tab_completion_ctx)); comptr->matches = cgdb_malloc(sizeof (char *) * (num_matches + 1)); for (i = 0; i <= num_matches; ++i) comptr->matches[i] = cgdb_strdup(matches[i]); comptr->num_matches = num_matches; comptr->max_length = max_length; comptr->total = 1; comptr->lines = 0; comptr->state = TAB_COMPLETION_START; return comptr; } /** * Destroy the tab completion context. * * \param comptr * This object to destroy. */ static void tab_completion_destroy(tab_completion_ptr comptr) { int i; if (!comptr) return; if (comptr->matches == 0) return; for (i = 0; i <= comptr->num_matches; ++i) { free(comptr->matches[i]); comptr->matches[i] = NULL; } free(comptr->matches); comptr->matches = NULL; free(comptr); comptr = NULL; } /** * Get a yes or no from the user. * * \param key * The key that the user pressed * * \param for_pager * Will be non-zero if this is for the pager, otherwise 0. * * \return * 0 for no, 1 for yes, 2 for single line yes, -1 for nothing. */ static int cgdb_get_y_or_n(int key, int for_pager) { if (key == 'y' || key == 'Y' || key == ' ') return 1; if (key == 'n' || key == 'N') return 0; if (for_pager && (key == '\r' || key == '\n' || key == CGDB_KEY_CTRL_M)) return 2; if (for_pager && (key == 'q' || key == 'Q')) return 0; if (key == CGDB_KEY_CTRL_G) return 0; return -1; } /** * The goal of this function is to display the tab completion information * to the user in an asychronous and potentially interactive manner. * * It will output to the screen as much as can be until user input is needed. * If user input is needed, then this function must stop, and wait until * that data has been recieved. * * If this function is called a second time with the same completion_ptr * parameter, it will continue outputting the tab completion data from * where it left off. * * \param completion_ptr * The tab completion data to output to the user * * \param key * The key the user wants to pass to the query command that was made. * If -1, then this is assummed to be the first time this function has been * called. * * \return * 0 on success or -1 on error */ static int handle_tab_completion_request(tab_completion_ptr comptr, int key) { int query_items; int gdb_window_size; if (!comptr) return -1; query_items = rline_get_rl_completion_query_items(rline); gdb_window_size = get_gdb_height(); if (comptr->state == TAB_COMPLETION_START) { if_print("\n"); if (query_items > 0 && comptr->num_matches >= query_items) { if_print_message("Display all %d possibilities? (y or n)\n", comptr->num_matches); comptr->state = TAB_COMPLETION_QUERY_POSSIBILITIES; return 0; } comptr->state = TAB_COMPLETION_COMPLETION_DISPLAY; } if (comptr->state == TAB_COMPLETION_QUERY_POSSIBILITIES) { int val = cgdb_get_y_or_n(key, 0); if (val == 1) comptr->state = TAB_COMPLETION_COMPLETION_DISPLAY; else if (val == 0) comptr->state = TAB_COMPLETION_DONE; else return 0; /* stay at the same state */ } if (comptr->state == TAB_COMPLETION_QUERY_PAGER) { int i = cgdb_get_y_or_n(key, 1); if_clear_line(); /* Clear the --More-- */ if (i == 0) comptr->state = TAB_COMPLETION_DONE; else if (i == 2) { comptr->lines--; comptr->state = TAB_COMPLETION_COMPLETION_DISPLAY; } else { comptr->lines = 0; comptr->state = TAB_COMPLETION_COMPLETION_DISPLAY; } } if (comptr->state == TAB_COMPLETION_COMPLETION_DISPLAY) { for (; comptr->total <= comptr->num_matches; comptr->total++) { if_print(comptr->matches[comptr->total]); if_print("\n"); comptr->lines++; if (comptr->lines >= (gdb_window_size - 1) && comptr->total < comptr->num_matches) { if_print("--More--"); comptr->state = TAB_COMPLETION_QUERY_PAGER; comptr->total++; return 0; } } comptr->state = TAB_COMPLETION_DONE; } if (comptr->state == TAB_COMPLETION_DONE) { tab_completion_destroy(completion_ptr); completion_ptr = NULL; is_tab_completing = 0; rline_rl_forced_update_display(rline); } return 0; } /** * This is the function responsible for display the readline completions when there * is more than 1 item to complete. Currently it prints 1 per line. */ static void readline_completion_display_func(char **matches, int num_matches, int max_length) { /* Create the tab completion item, and attempt to display it to the user */ completion_ptr = tab_completion_create(matches, num_matches, max_length); if (!completion_ptr) logger_write_pos(logger, __FILE__, __LINE__, "tab_completion_create error\n"); if (handle_tab_completion_request(completion_ptr, -1) == -1) logger_write_pos(logger, __FILE__, __LINE__, "handle_tab_completion_request error\n"); } int do_tab_completion(struct tgdb_list *list) { if (rline_rl_complete(rline, list, &readline_completion_display_func) == -1) { logger_write_pos(logger, __FILE__, __LINE__, "rline_rl_complete error\n"); return -1; } /** * If completion_ptr is non-null, then this means CGDB still has to display * the completion to the user. is_tab_completing can not be turned off until * the completions are displayed to the user. */ if (!completion_ptr) is_tab_completing = 0; return 0; } void rl_sigint_recved(void) { rline_clear(rline); is_tab_completing = 0; } void rl_resize(int rows, int cols) { rline_resize_terminal_and_redisplay(rline, rows, cols); } static void change_prompt(const char *new_prompt) { rline_set_prompt(rline, new_prompt); } /* }}}*/ /* ------------------------ */ /* Initialization functions */ /* ------------------------ */ /* version_info: Returns version information about cgdb. * ------------- * * Return: A pointer to a static buffer, containing version info. */ static char *version_info(void) { static char buf[MAXLINE]; sprintf(buf, "%s %s\r\n%s", "CGDB", VERSION, "Copyright 2002-2010 Bob Rossi and Mike Mueller.\n" "CGDB is free software, covered by the GNU General Public License, and you are\n" "welcome to change it and/or distribute copies of it under certain conditions.\n" "There is absolutely no warranty for CGDB.\n"); return buf; } static void parse_long_options(int *argc, char ***argv) { int c, option_index = 0, n = 1; const char *args = "d:hv"; #ifdef HAVE_GETOPT_H static struct option long_options[] = { {"version", 0, 0, 0}, {"help", 0, 0, 0}, {0, 0, 0, 0} }; #endif while (1) { opterr = 0; #ifdef HAVE_GETOPT_H c = getopt_long(*argc, *argv, args, long_options, &option_index); #else c = getopt(*argc, *argv, args); #endif if (c == -1) break; if (((char) c) == '?') break; switch (c) { case 0: switch (option_index) { case 0: printf("%s", version_info()); exit(0); case 1: usage(); exit(0); default: break; } break; case 'v': printf("%s", version_info()); exit(0); case 'd': debugger_path = strdup(optarg); if (optarg == (*argv)[n + 1]) { /* optarg is in next argv (-d foo) */ n += 2; } else { /* optarg is in this argv (-dfoo) */ n++; } break; case 'h': usage(); exit(0); default: break; } } *argc -= n; *argv += n; if (**argv && strcmp(**argv, "--") == 0) { (*argc)--; (*argv)++; } } /* init_home_dir: Attempts to create a config directory in the user's home * ------------- directory. * * Return: 0 on sucess or -1 on error */ static int init_home_dir(void) { /* Get the home directory */ char *home_dir = getenv("HOME"); const char *cgdb_dir = ".cgdb"; /* Create the config directory */ if (!fs_util_create_dir_in_base(home_dir, cgdb_dir)) { logger_write_pos(logger, __FILE__, __LINE__, "fs_util_create_dir_in_base error"); return -1; } fs_util_get_path(home_dir, cgdb_dir, cgdb_home_dir); return 0; } /* start_gdb: Starts up libtgdb * Returns: -1 on error, 0 on success */ static int start_gdb(int argc, char *argv[]) { tgdb_request_ptr request_ptr; tgdb = tgdb_initialize(debugger_path, argc, argv, &gdb_fd, &tty_fd); if (tgdb == NULL) return -1; /* Run some initialize commands */ /* gdb may already have some breakpoints when it starts. This could happen * if the user puts breakpoints in there .gdbinit. * This makes sure that TGDB asks for the breakpoints on start up. */ /** * Get the filename GDB defaults to. */ request_ptr = tgdb_request_current_location(tgdb, 1); if (handle_request(tgdb, request_ptr) == -1) return -1; return 0; } static void send_key(int focus, char key) { if (focus == 1) { int size; int masterfd; masterfd = pty_pair_get_masterfd(pty_pair); if (masterfd == -1) logger_write_pos(logger, __FILE__, __LINE__, "send_key error"); size = write(masterfd, &key, sizeof (char)); if (size != 1) logger_write_pos(logger, __FILE__, __LINE__, "send_key error"); } else if (focus == 2) { tgdb_send_inferior_char(tgdb, key); } } /* user_input: This function will get a key from the user and process it. * * Returns: -1 on error, 0 on success */ static int user_input(void) { static int key, val; /* Clear the current map sets. Give the KUI the map sets * that should be used with the current focus. */ val = kui_manager_clear_map_sets(kui_ctx); if (val == -1) { logger_write_pos(logger, __FILE__, __LINE__, "user_input error"); return -1; } if (if_get_focus() == CGDB) val = kui_manager_add_map_set(kui_ctx, kui_map); else if (if_get_focus() == GDB) val = kui_manager_add_map_set(kui_ctx, kui_imap); key = kui_manager_getkey(kui_ctx); if (key == -1) { logger_write_pos(logger, __FILE__, __LINE__, "kui_manager_getkey error"); return -1; } val = if_input(key); if (val == -1) { logger_write_pos(logger, __FILE__, __LINE__, "if_input error"); return -1; } else if (val != 1 && val != 2) return 0; if (val == 1 && completion_ptr) return handle_tab_completion_request(completion_ptr, key); /* Process the key */ if (kui_term_is_cgdb_key(key)) { char *seqbuf = kui_term_get_ascii_char_sequence_from_key(key); if (seqbuf == NULL) { logger_write_pos(logger, __FILE__, __LINE__, "kui_term_get_ascii_char_sequence_from_key error %d", key); return -1; } else { int length = strlen(seqbuf), i; for (i = 0; i < length; i++) send_key(val, seqbuf[i]); } } else send_key(val, key); return 0; } /** * This will usually process all the input that the KUI has. * * However, it's possible that one of the keys the user sends to CGDB * switches the state of CGDB in such a way, that CGDB has to do some I/O * with GDB before the keys can continue to be sent to CGDB. For this reason, * this loop can return before all the KUI's data has been used, in order to * give the main loop a chance to run a GDB command. * * \return * 0 on success or -1 on error */ static int user_input_loop() { do { /* There are reasons that CGDB should wait to get more info from the kui. * See the documentation for kui_input_acceptable */ if (!kui_input_acceptable) return 0; if (user_input() == -1) { logger_write_pos(logger, __FILE__, __LINE__, "user_input_loop failed"); return -1; } } while (kui_manager_cangetkey(kui_ctx)); return 0; } static void process_commands(struct tgdb *tgdb) { struct tgdb_response *item; while ((item = tgdb_get_response(tgdb)) != NULL) { switch (item->header) { /* This updates all the breakpoints */ case TGDB_UPDATE_BREAKPOINTS: { struct sviewer *sview = if_get_sview(); char *file; struct tgdb_list *list = item->choice.update_breakpoints.breakpoint_list; tgdb_list_iterator *iterator; struct tgdb_breakpoint *tb; source_clear_breaks(if_get_sview()); iterator = tgdb_list_get_first(list); while (iterator) { /* For each breakpoint */ tb = (struct tgdb_breakpoint *) tgdb_list_get_item(iterator); file = tb->file; if (tb->enabled) source_enable_break(sview, file, tb->line); else source_disable_break(sview, file, tb->line); iterator = tgdb_list_next(iterator); } if_show_file(NULL, 0); break; } /* This means a source file or line number changed */ case TGDB_UPDATE_FILE_POSITION: { struct tgdb_file_position *tfp; tfp = item->choice.update_file_position.file_position; /* Update the file */ source_reload(if_get_sview(), tfp->absolute_path, 0); if_show_file(tfp->absolute_path, tfp->line_number); source_set_relative_path(if_get_sview(), tfp->absolute_path, tfp->relative_path); break; } /* This is a list of all the source files */ case TGDB_UPDATE_SOURCE_FILES: { struct tgdb_list *list = item->choice.update_source_files.source_files; tgdb_list_iterator *i = tgdb_list_get_first(list); char *s; if_clear_filedlg(); while (i) { s = tgdb_list_get_item(i); if_add_filedlg_choice(s); i = tgdb_list_next(i); } if_set_focus(FILE_DLG); kui_input_acceptable = 1; break; } /* The user is trying to get a list of source files that make up * the debugged program but libtgdb is claiming that gdb knows * none. */ case TGDB_SOURCES_DENIED: if_display_message("Error:", 0, " No sources available! Was the program compiled with debug?"); kui_input_acceptable = 1; break; /* This is the absolute path to the last file the user requested */ case TGDB_FILENAME_PAIR: { const char *apath = item->choice.filename_pair.absolute_path; const char *rpath = item->choice.filename_pair.relative_path; if_show_file((char *) apath, 1); source_set_relative_path(if_get_sview(), apath, rpath); break; } /* The source file requested does not exist */ case TGDB_ABSOLUTE_SOURCE_DENIED: { struct tgdb_source_file *file = item->choice.absolute_source_denied.source_file; if_show_file(NULL, 0); /* com can be NULL when tgdb orig requests main file */ if (file->absolute_path != NULL) if_display_message("No such file:", 0, " %s", file->absolute_path); break; } case TGDB_INFERIOR_EXITED: { /* * int *status = item->data; * This could eventually go here, but for now, the update breakpoint * display function makes the status bar go back to the name of the file. * * if_display_message ( "Program exited with value", 0, " %d", *status ); */ /* Clear the cache */ break; } case TGDB_UPDATE_COMPLETIONS: { struct tgdb_list *list = item->choice.update_completions.completion_list; do_tab_completion(list); break; } case TGDB_UPDATE_CONSOLE_PROMPT_VALUE: { const char *new_prompt = item->choice.update_console_prompt_value.prompt_value; change_prompt(new_prompt); break; } case TGDB_QUIT: cleanup(); exit(0); break; /* Default */ default: break; } } } /** * This function looks at the request that CGDB has made and determines if it * effects the GDB console window. For instance, if the request makes output go * to that window, then the user would like to see another prompt there when the * command finishes. However, if the command is 'o', to get all the sources and * display them, then this doesn't effect the GDB console window and the window * should not redisplay the prompt. * * \param request * The request to analysize * * \param update * Will return as 1 if the console window should be updated, or 0 otherwise * * \return * 0 on success or -1 on error */ static int does_request_require_console_update(struct tgdb_request *request, int *update) { if (!request || !update) return -1; switch (request->header) { case TGDB_REQUEST_CONSOLE_COMMAND: *update = 1; break; case TGDB_REQUEST_INFO_SOURCES: case TGDB_REQUEST_FILENAME_PAIR: case TGDB_REQUEST_CURRENT_LOCATION: *update = 0; break; case TGDB_REQUEST_DEBUGGER_COMMAND: case TGDB_REQUEST_MODIFY_BREAKPOINT: case TGDB_REQUEST_COMPLETE: *update = 1; break; default: return -1; } return 0; } /* gdb_input: Recieves data from tgdb: * * Returns: -1 on error, 0 on success */ static int gdb_input() { char *buf = malloc(GDB_MAXBUF + 1); int size; int is_finished; /* Read from GDB */ size = tgdb_process(tgdb, buf, GDB_MAXBUF, &is_finished); if (size == -1) { logger_write_pos(logger, __FILE__, __LINE__, "tgdb_recv_debugger_data error"); free(buf); buf = NULL; return -1; } buf[size] = 0; process_commands(tgdb); /* Display GDB output * The strlen check is here so that if_print does not get called * when displaying the filedlg. If it does get called, then the * gdb window gets displayed when the filedlg is up */ if (strlen(buf) > 0) if_print(buf); free(buf); buf = NULL; /* Check to see if GDB is ready to recieve another command. If it is, then * readline should redisplay what it currently contains. There are 2 special * case's here. * * If there are no commands in the queue to send to GDB then readline * should simply redisplay what it has currently in it's buffer. * rl_forced_update_display does this. * * However, if there are commands in the queue to send to GDB, that means * the user already entered these through readline. In that case, simply * write the command entered through readline directly, instead of having * readline do it (readline already processed the data). This is important * also because rl_forced_update_display doesn't write the data right away. * It writes data to rl_outstream, and then the main_loop handles both the * readline data and the data from the TGDB command being sent. This could * result in a race condition. */ if (is_finished) { int size; tgdb_queue_size(tgdb, &size); /* This is the second case, this command was queued. */ if (size > 0) { struct tgdb_request *request = tgdb_queue_pop(tgdb); char *prompt; rline_get_prompt(rline, &prompt); if_print(prompt); if (request->header == TGDB_REQUEST_CONSOLE_COMMAND) { if_print(request->choice.console_command.command); if_print("\n"); } last_request = request; tgdb_process_command(tgdb, request); /* This is the first case */ } /** If the user is currently completing, do not update the prompt */ else if (!completion_ptr) { int update = 1, ret_val; if (last_request) { ret_val = does_request_require_console_update(last_request, &update); if (ret_val == -1) return -1; last_request = NULL; } if (update) rline_rl_forced_update_display(rline); } } return 0; } static int readline_input() { const int MAX = 1024; char *buf = malloc(MAX + 1); int size; int masterfd = pty_pair_get_masterfd(pty_pair); if (masterfd == -1) { logger_write_pos(logger, __FILE__, __LINE__, "pty_pair_get_masterfd error"); return -1; } size = read(masterfd, buf, MAX); if (size == -1) { logger_write_pos(logger, __FILE__, __LINE__, "read error"); free(buf); buf = NULL; return -1; } buf[size] = 0; /* Display GDB output * The strlen check is here so that if_print does not get called * when displaying the filedlg. If it does get called, then the * gdb window gets displayed when the filedlg is up */ if (size > 0) if_print(buf); free(buf); buf = NULL; return 0; } /* child_input: Recieves data from the child application: * * Returns: -1 on error, 0 on success */ static int child_input() { char *buf = malloc(GDB_MAXBUF + 1); int size; /* Read from GDB */ size = tgdb_recv_inferior_data(tgdb, buf, GDB_MAXBUF); if (size == -1) { logger_write_pos(logger, __FILE__, __LINE__, "tgdb_recv_inferior_data error "); free(buf); buf = NULL; return -1; } buf[size] = 0; /* Display CHILD output */ if_tty_print(buf); free(buf); buf = NULL; return 0; } static int cgdb_resize_term(int fd) { int c, result; if (read(resize_pipe[0], &c, sizeof (int)) < sizeof (int)) { logger_write_pos(logger, __FILE__, __LINE__, "read from resize pipe"); return -1; } /* If there is more input in the pipe, that means another resize has * been recieved, and we still have not handled this one. So, skip this * one and only handle the next one. */ result = io_data_ready(resize_pipe[0], 0); if (result == -1) { logger_write_pos(logger, __FILE__, __LINE__, "io_data_ready"); return -1; } if (result) return 0; if (if_resize_term() == -1) { logger_write_pos(logger, __FILE__, __LINE__, "if_resize_term error"); return -1; } return 0; } static int main_loop(void) { fd_set rset; int max; int masterfd, slavefd; masterfd = pty_pair_get_masterfd(pty_pair); if (masterfd == -1) { logger_write_pos(logger, __FILE__, __LINE__, "pty_pair_get_masterfd error"); return -1; } slavefd = pty_pair_get_slavefd(pty_pair); if (slavefd == -1) { logger_write_pos(logger, __FILE__, __LINE__, "pty_pair_get_slavefd error"); return -1; } max = (gdb_fd > STDIN_FILENO) ? gdb_fd : STDIN_FILENO; max = (max > tty_fd) ? max : tty_fd; max = (max > resize_pipe[0]) ? max : resize_pipe[0]; max = (max > slavefd) ? max : slavefd; max = (max > masterfd) ? max : masterfd; /* Main (infinite) loop: * Sits and waits for input on either stdin (user input) or the * GDB file descriptor. When input is received, wrapper functions * are called to process the input, and handle it appropriately. * This will result in calls to the curses interface, typically. */ for (;;) { /* Reset the fd_set, and watch for input from GDB or stdin */ FD_ZERO(&rset); FD_SET(STDIN_FILENO, &rset); FD_SET(gdb_fd, &rset); FD_SET(tty_fd, &rset); FD_SET(resize_pipe[0], &rset); /* No readline activity allowed while displaying tab completion */ if (!is_tab_completing) { FD_SET(slavefd, &rset); FD_SET(masterfd, &rset); } /* Before waits for any input, check if gdb process is terminated. * If it is, handle it here because the gdb_fd can have nothing * to read. This happens on mac OSX */ if (tgdb_has_sigchld_recv(tgdb)) { if (gdb_input() == -1) { return -1; } } /* Wait for input */ if (select(max + 1, &rset, NULL, NULL, NULL) == -1) { if (errno == EINTR) continue; else { logger_write_pos(logger, __FILE__, __LINE__, "select failed: %s", strerror(errno)); return -1; } } /* Input received through the pty: Handle it * Wrote to masterfd, now slavefd is ready, tell readline */ if (FD_ISSET(slavefd, &rset)) rline_rl_callback_read_char(rline); /* Input received through the pty: Handle it * Readline read from slavefd, and it wrote to the masterfd. */ if (FD_ISSET(masterfd, &rset)) if (readline_input() == -1) return -1; /* Input received: Handle it */ if (FD_ISSET(STDIN_FILENO, &rset)) { int val = user_input_loop(); /* The below condition happens on cygwin when user types ctrl-z * select returns (when it shouldn't) with the value of 1. the * user input loop gets called, the kui gets called and does a * non blocking read which returns EAGAIN. The kui then passes * the -1 up the stack with out making any more system calls. */ if (val == -1 && errno == EAGAIN) continue; else if (val == -1) return -1; } /* child's ouptut -> stdout * The continue is important I think. It allows all of the child * output to get written to stdout before tgdb's next command. * This is because sometimes they are both ready. */ if (FD_ISSET(tty_fd, &rset)) { if (child_input() == -1) return -1; continue; } /* gdb's output -> stdout */ if (FD_ISSET(gdb_fd, &rset)) { if (gdb_input() == -1) { return -1; } /* When the file dialog is opened, the user input is blocked, * until GDB returns all the files that should be displayed, * and the file dialog can open, and be prepared to receive * input. So, if we are in the file dialog, and are no longer * waiting for the gdb command, then read the input. */ if (kui_manager_cangetkey(kui_ctx)) { user_input_loop(); } } /* A resize signal occured */ if (FD_ISSET(resize_pipe[0], &rset)) if (cgdb_resize_term(resize_pipe[0]) == -1) return -1; } return 0; } /* ----------------- */ /* Exposed Functions */ /* ----------------- */ /* cleanup: Invoked by the various err_xxx funtions when dying. * -------- */ void cleanup() { char *log_file, *tmp_log_file; int has_recv_data; ibuf_free(current_line); /* Cleanly scroll the screen up for a prompt */ scrl(1); move(LINES - 1, 0); printf("\n"); rline_write_history(rline, readline_history_path); /* The order of these is important. They each must restore the terminal * the way they found it. Thus, the order in which curses/readline is * started, is the reverse order in which they should be shutdown */ /* Shut down interface */ if_shutdown(); #if 0 if (masterfd != -1) util_free_tty(&masterfd, &slavefd, tty_name); #endif /* Finally, should display the errors. * TGDB guarentees the logger to be open at this point. * So, we can get the filename directly from the logger */ logger_get_file(logger, &tmp_log_file); log_file = strdup(tmp_log_file); logger_has_recv_data(logger, &has_recv_data); /* Shut down debugger */ tgdb_shutdown(tgdb); if (tty_set_attributes(STDIN_FILENO, &term_attributes) == -1) logger_write_pos(logger, __FILE__, __LINE__, "tty_reset error"); if (has_recv_data) fprintf(stderr, "CGDB had unexpected results, see %s for details.\n", log_file); free(log_file); log_file = NULL; } int init_resize_pipe(void) { if (pipe(resize_pipe) == -1) { logger_write_pos(logger, __FILE__, __LINE__, "pipe error"); return -1; } return 0; } int init_readline(void) { int slavefd, masterfd; int length; slavefd = pty_pair_get_slavefd(pty_pair); if (slavefd == -1) return -1; masterfd = pty_pair_get_masterfd(pty_pair); if (masterfd == -1) return -1; if (tty_off_xon_xoff(slavefd) == -1) return -1; /* The 16 is because I don't know how many char's the directory separator * is going to be, I expect it to be 1, but who knows. */ length = strlen(cgdb_home_dir) + strlen(readline_history_filename) + 16; readline_history_path = (char *) malloc(sizeof (char) * length); fs_util_get_path(cgdb_home_dir, readline_history_filename, readline_history_path); rline = rline_initialize(slavefd, rlctx_send_user_command, tab_completion, "dumb"); rline_read_history(rline, readline_history_path); return 0; } int create_and_init_pair() { struct winsize size; int slavefd; pty_pair = pty_pair_create(); if (!pty_pair) { fprintf(stderr, "%s:%d Unable to create PTY pair", __FILE__, __LINE__); return -1; } slavefd = pty_pair_get_slavefd(pty_pair); if (slavefd == -1) { logger_write_pos(logger, __FILE__, __LINE__, "pty_pair_get_slavefd error"); return -1; } /* Set the pty winsize to the winsize of stdout */ if (ioctl(0, TIOCGWINSZ, &size) < 0) return -1; if (ioctl(slavefd, TIOCSWINSZ, &size) < 0) return -1; return 0; } int update_kui(cgdbrc_config_option_ptr option) { kui_manager_set_terminal_escape_sequence_timeout(kui_ctx, cgdbrc_get_key_code_timeoutlen()); kui_manager_set_key_mapping_timeout(kui_ctx, cgdbrc_get_mapped_key_timeoutlen()); return 0; } static int destroyReadlineKeySeq(void *data) { char *keyseq = (char *) data; free(keyseq); return 0; } int add_readline_key_sequence(const char *readline_str, enum cgdb_key key) { int ret_val; std_list keyseq_list = std_list_create(destroyReadlineKeySeq); ret_val = rline_get_keyseq(rline, readline_str, keyseq_list); if (ret_val == -1) { std_list_destroy(keyseq_list); return -1; } ret_val = kui_manager_get_terminal_keys_kui_map(kui_ctx, key, keyseq_list); if (ret_val == -1) { std_list_destroy(keyseq_list); return -1; } std_list_destroy(keyseq_list); return 0; } int init_kui(void) { kui_ctx = kui_manager_create(STDIN_FILENO, cgdbrc_get_key_code_timeoutlen(), cgdbrc_get_mapped_key_timeoutlen()); if (!kui_ctx) { logger_write_pos(logger, __FILE__, __LINE__, "Unable to initialize input library"); cleanup(); exit(-1); } kui_map = kui_ms_create(); if (!kui_map) { logger_write_pos(logger, __FILE__, __LINE__, "Unable to initialize input library"); cleanup(); exit(-1); } kui_imap = kui_ms_create(); if (!kui_imap) { logger_write_pos(logger, __FILE__, __LINE__, "Unable to initialize input library"); cleanup(); exit(-1); } if (kui_manager_add_map_set(kui_ctx, kui_map) == -1) { logger_write_pos(logger, __FILE__, __LINE__, "Unable to initialize input library"); cleanup(); exit(-1); } /* Combine the cgdbrc config package with libkui. If any of the options * below change, update the KUI. Currently, the handles are not kept around, * because CGDB never plans on detaching. */ cgdbrc_attach(CGDBRC_TIMEOUT, &update_kui, NULL); cgdbrc_attach(CGDBRC_TIMEOUT_LEN, &update_kui, NULL); cgdbrc_attach(CGDBRC_TTIMEOUT, &update_kui, NULL); cgdbrc_attach(CGDBRC_TTIMEOUT_LEN, &update_kui, NULL); /* It's important that CGDB uses readline's view of * Home and End keys. A few distros I've run into (redhat e3 * and ubuntu) provide incorrect terminfo entries for xterm. * So, Home and End do not work. The distro's fixed readline * by modifing /etc/inputrc to hard code the terminal sequences. * I have no idea why they wouldn't just fix the terminfo * database, but they didn't! Therefor, readline, bash, gdb all * work but cgdb doesn't. So, I'm going to simply ask readline * what it thinks the Home and End keys are and add them to * CGDB's mappings. */ /* For now, I've decided it's OK for these functions to fail as they * only add functionality to CGDB. */ /* Home key */ add_readline_key_sequence("beginning-of-line", CGDB_KEY_HOME); /* End key */ add_readline_key_sequence("end-of-line", CGDB_KEY_END); return 0; } int main(int argc, char *argv[]) { /* Uncomment to debug and attach */ #if 0 int c; read(0, &c, 1); #endif parse_long_options(&argc, &argv); current_line = ibuf_init(); cgdbrc_init(); if (create_and_init_pair() == -1) { fprintf(stderr, "%s:%d Unable to create PTY pair", __FILE__, __LINE__); exit(-1); } /* First create tgdb, because it has the error log */ if (start_gdb(argc, argv) == -1) { fprintf(stderr, "%s:%d Unable to invoke GDB", __FILE__, __LINE__); exit(-1); } /* From here on, the logger is initialized */ /* Create the home directory */ if (init_home_dir() == -1) { logger_write_pos(logger, __FILE__, __LINE__, "Unable to create home dir ~/.cgdb"); cleanup(); exit(-1); } if (init_readline() == -1) { logger_write_pos(logger, __FILE__, __LINE__, "Unable to init readline"); cleanup(); exit(-1); } if (tty_cbreak(STDIN_FILENO, &term_attributes) == -1) { logger_write_pos(logger, __FILE__, __LINE__, "tty_cbreak error"); cleanup(); exit(-1); } if (init_kui() == -1) { logger_write_pos(logger, __FILE__, __LINE__, "init_kui error"); cleanup(); exit(-1); } /* Initialize the display */ switch (if_init()) { case 1: logger_write_pos(logger, __FILE__, __LINE__, "Unable to initialize the curses library"); cleanup(); exit(-1); case 2: logger_write_pos(logger, __FILE__, __LINE__, "Unable to handle signal: SIGWINCH"); cleanup(); exit(-1); case 3: logger_write_pos(logger, __FILE__, __LINE__, "Unable to setup highlighting groups"); cleanup(); exit(-1); case 4: logger_write_pos(logger, __FILE__, __LINE__, "New GDB window failed -- out of memory?"); cleanup(); exit(-1); } /* Initialize the pipe that is used for resize */ if (init_resize_pipe() == -1) { logger_write_pos(logger, __FILE__, __LINE__, "init_resize_pipe error"); cleanup(); exit(-1); } { char config_file[FSUTIL_PATH_MAX]; FILE *config; fs_util_get_path(cgdb_home_dir, "cgdbrc", config_file); config = fopen(config_file, "r"); if (config) { command_parse_file(config); fclose(config); } } /* Enter main loop */ main_loop(); /* Shut down curses and exit */ cleanup(); return 0; } cgdb-0.6.7/cgdb/cgdb.h000644 000765 000024 00000001626 12074441140 015361 0ustar00mmuellerstaff000000 000000 /* cgdb.h: * ------- * * Contains macros for any of the sources here to use. */ #ifndef _CGDB_H_ #define _CGDB_H_ /* ----------- */ /* Definitions */ /* ----------- */ #define GDB_MAXBUF 4096 /* GDB input buffer size */ /* Special char to use for vertical line * CYGWIN does not support this character */ #ifdef HAVE_CYGWIN #define VERT_LINE ':' #else #define VERT_LINE ACS_VLINE #endif /* Keys */ #define CGDB_BACKSPACE_KEY(c) (c == 8 || c == 127 || c == KEY_BACKSPACE) #define CGDB_KEY_RESIZE KEY_MAX #define MAXLINE 4096 /* TODO: Remove the below 3 lines. This is a reorganization effort to allow * TGDB to understand the new request/response mechanism that TGDB supports. */ struct tgdb; struct tgdb_request; int handle_request(struct tgdb *tgdb, struct tgdb_request *request); void cleanup(); /* * See documentation in cgdb.c. */ int run_shell_command(const char *command); #endif cgdb-0.6.7/cgdb/cgdbrc.c000644 000765 000024 00000065500 12074441140 015702 0ustar00mmuellerstaff000000 000000 #if HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #if HAVE_STRINGS_H #include #endif /* HAVE_STRINGS_H */ #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #include "cgdbrc.h" #include "command_lexer.h" #include "tgdb.h" #include "interface.h" #include "tokenizer.h" #include "highlight_groups.h" #include "cgdb.h" #include "sys_util.h" #include "std_list.h" #include "kui_term.h" extern struct tgdb *tgdb; /** * The general idea is that the configuration will read in the users ~/.cgdbrc * file, or ~/.cgdb/config or whatever, and execute each command. This will * also be responsible for processing all : commands in the tui. * */ enum ConfigType { CONFIG_TYPE_BOOL, /* set ic / set noic */ CONFIG_TYPE_INT, /* set tabstop=8 */ CONFIG_TYPE_STRING, CONFIG_TYPE_FUNC_VOID, CONFIG_TYPE_FUNC_BOOL, CONFIG_TYPE_FUNC_INT, CONFIG_TYPE_FUNC_STRING }; static int command_set_arrowstyle(const char *value); static int command_set_cgdb_mode_key(const char *value); static int command_set_winsplit(const char *value); static int command_set_timeout(int value); static int command_set_timeoutlen(int value); static int command_set_ttimeout(int value); static int command_set_ttimeoutlen(int value); static int command_set_winminheight(int value); static int command_set_syntax_type(const char *value); static int command_set_stc(int value); static int cgdbrc_set_val(struct cgdbrc_config_option config_option); /** * This data structure stores all the values of all the config options. * It is initialized with the default values. */ static struct cgdbrc_config_option cgdbrc_config_options[CGDBRC_WRAPSCAN + 1] = { {CGDBRC_ARROWSTYLE, {ARROWSTYLE_SHORT}}, {CGDBRC_AUTOSOURCERELOAD, {1}}, {CGDBRC_CGDB_MODE_KEY, {CGDB_KEY_ESC}}, {CGDBRC_IGNORECASE, {0}}, {CGDBRC_SHOWTGDBCOMMANDS, {0}}, {CGDBRC_SYNTAX, {TOKENIZER_LANGUAGE_UNKNOWN}}, {CGDBRC_TABSTOP, {8}}, {CGDBRC_TIMEOUT, {1}}, {CGDBRC_TIMEOUT_LEN, {1000}}, {CGDBRC_TTIMEOUT, {1}}, {CGDBRC_TTIMEOUT_LEN, {100}}, {CGDBRC_WINMINHEIGHT, {0}}, {CGDBRC_WINSPLIT, {WIN_SPLIT_EVEN}}, {CGDBRC_WRAPSCAN, {1}} }; static struct std_list *cgdbrc_attach_list; static unsigned long cgdbrc_attach_handle = 1; struct cgdbrc_attach_item { enum cgdbrc_option_kind option; int handle; cgdbrc_notify notify_hook; }; static struct ConfigVariable { const char *name, *s_name; enum ConfigType type; void *data; } VARIABLES[] = { /* keep this stuff sorted! !sort */ /* arrowstyle */ { "arrowstyle", "as", CONFIG_TYPE_FUNC_STRING, command_set_arrowstyle}, /* autosourcereload */ { "autosourcereload", "asr", CONFIG_TYPE_BOOL, &cgdbrc_config_options[CGDBRC_AUTOSOURCERELOAD].variant. int_val}, /* cgdbmodekey */ { "cgdbmodekey", "cgdbmodekey", CONFIG_TYPE_FUNC_STRING, command_set_cgdb_mode_key}, /* ignorecase */ { "ignorecase", "ic", CONFIG_TYPE_BOOL, &cgdbrc_config_options[CGDBRC_IGNORECASE].variant.int_val}, /* showtgdbcommands */ { "showtgdbcommands", "stc", CONFIG_TYPE_FUNC_BOOL, &command_set_stc}, /* syntax */ { "syntax", "syn", CONFIG_TYPE_FUNC_STRING, command_set_syntax_type}, /* tabstop */ { "tabstop", "ts", CONFIG_TYPE_INT, &cgdbrc_config_options[CGDBRC_TABSTOP].variant.int_val}, /* timeout */ { "timeout", "to", CONFIG_TYPE_FUNC_BOOL, &command_set_timeout}, /* timeoutlen */ { "timeoutlen", "tm", CONFIG_TYPE_FUNC_INT, &command_set_timeoutlen}, /* ttimeout */ { "ttimeout", "ttimeout", CONFIG_TYPE_FUNC_BOOL, &command_set_ttimeout}, /* ttimeoutlen */ { "ttimeoutlen", "ttm", CONFIG_TYPE_FUNC_INT, &command_set_ttimeoutlen}, /* winminheight */ { "winminheight", "wmh", CONFIG_TYPE_FUNC_INT, &command_set_winminheight}, /* winsplit */ { "winsplit", "winsplit", CONFIG_TYPE_FUNC_STRING, command_set_winsplit}, /* wrapscan */ { "wrapscan", "ws", CONFIG_TYPE_BOOL, &cgdbrc_config_options[CGDBRC_WRAPSCAN].variant.int_val},}; static int command_do_tgdbcommand(int param); static int command_focus_cgdb(int param); static int command_focus_gdb(int param); static int command_focus_tty(int param); static int command_do_bang(int param); static int command_do_focus(int param); static int command_do_help(int param); static int command_do_quit(int param); static int command_do_shell(int param); static int command_source_reload(int param); static int command_parse_syntax(int param); static int command_parse_highlight(int param); static int command_parse_map(int param); static int command_parse_unmap(int param); typedef int (*action_t) (int param); typedef struct COMMANDS { const char *name; /* these functions will return 0 on success and 1 on error. */ /* Should the configuration file processing continue after an error? */ action_t action; int param; } COMMANDS; COMMANDS commands[] = { /* bang */ {"bang", command_do_bang, 0}, /* edit */ {"edit", command_source_reload, 0}, /* edit */ {"e", command_source_reload, 0}, /* focus */ {"focus", command_do_focus, 0}, /* help */ {"help", command_do_help, 0}, /* highlight */ {"highlight", command_parse_highlight, 0}, /* highlight */ {"hi", command_parse_highlight, 0}, /* imap */ {"imap", command_parse_map, 0}, /* imap */ {"im", command_parse_map, 0}, /* iunmap */ {"iunmap", command_parse_unmap, 0}, /* iunmap */ {"iu", command_parse_unmap, 0}, /* insert */ {"insert", command_focus_gdb, 0}, /* map */ {"map", command_parse_map, 0}, /* quit */ {"quit", command_do_quit, 0}, /* quit */ {"q", command_do_quit, 0}, /* shell */ {"shell", command_do_shell, 0}, /* shell */ {"sh", command_do_shell, 0}, /* syntax */ {"syntax", command_parse_syntax, 0}, /* unmap */ {"unmap", command_parse_unmap, 0}, /* unmap */ {"unm", command_parse_unmap, 0}, /* continue */ {"continue", command_do_tgdbcommand, TGDB_CONTINUE}, /* continue */ {"c", command_do_tgdbcommand, TGDB_CONTINUE}, /* down */ {"down", command_do_tgdbcommand, TGDB_DOWN}, /* finish */ {"finish", command_do_tgdbcommand, TGDB_FINISH}, /* finish */ {"f", command_do_tgdbcommand, TGDB_FINISH}, /* next */ {"next", command_do_tgdbcommand, TGDB_NEXT}, /* next */ {"n", command_do_tgdbcommand, TGDB_NEXT}, /* run */ {"run", command_do_tgdbcommand, TGDB_RUN}, /* run */ {"r", command_do_tgdbcommand, TGDB_RUN}, /* kill */ {"kill", command_do_tgdbcommand, TGDB_KILL}, /* kill */ {"k", command_do_tgdbcommand, TGDB_KILL}, /* step */ {"step", command_do_tgdbcommand, TGDB_STEP}, /* step */ {"s", command_do_tgdbcommand, TGDB_STEP}, /* start */ {"start", command_do_tgdbcommand, TGDB_START}, /* up */ {"up", command_do_tgdbcommand, TGDB_UP}, }; int command_sort_find(const void *_left_cmd, const void *_right_cmd) { COMMANDS *right_cmd = (COMMANDS *) _right_cmd; COMMANDS *left_cmd = (COMMANDS *) _left_cmd; return strcmp(left_cmd->name, right_cmd->name); } #define COMMANDS_SIZE (sizeof(COMMANDS)) #define COMMANDS_COUNT (sizeof(commands) / sizeof(COMMANDS)) void cgdbrc_init(void) { qsort((void *) commands, COMMANDS_COUNT, COMMANDS_SIZE, command_sort_find); } COMMANDS *get_command(const char *cmd) { COMMANDS command = { cmd, NULL, 0 }; return bsearch((void *) &command, (void *) commands, COMMANDS_COUNT, COMMANDS_SIZE, command_sort_find); } struct ConfigVariable *get_variable(const char *variable) { /* FIXME: replace with binary search */ int i; for (i = 0; i < (sizeof (VARIABLES) / sizeof (VARIABLES[0])); ++i) { if (strcmp(variable, VARIABLES[i].name) == 0 || strcmp(variable, VARIABLES[i].s_name) == 0) { return &VARIABLES[i]; } } return NULL; } int command_set_arrowstyle(const char *value) { struct cgdbrc_config_option option; option.option_kind = CGDBRC_ARROWSTYLE; if (strcasecmp(value, "short") == 0) option.variant.arrow_style = ARROWSTYLE_SHORT; else if (strcasecmp(value, "long") == 0) option.variant.arrow_style = ARROWSTYLE_LONG; else if (strcasecmp(value, "highlight") == 0) option.variant.arrow_style = ARROWSTYLE_HIGHLIGHT; else return 1; return cgdbrc_set_val(option); } int command_set_cgdb_mode_key(const char *value) { struct cgdbrc_config_option option; option.option_kind = CGDBRC_CGDB_MODE_KEY; if (value) { /* If the user typed in a single key, use it. */ if (strlen(value) == 1) { option.variant.int_val = value[0]; } else { /* The user may have typed in a keycode. (e.g. ) * attempt to translate it. */ int key = kui_term_get_cgdb_key_from_keycode(value); if (key == -1) return -1; option.variant.int_val = key; } } else { return -1; } return cgdbrc_set_val(option); } static int command_set_stc(int value) { if ((value == 0) || (value == 1)) { struct cgdbrc_config_option option; option.option_kind = CGDBRC_SHOWTGDBCOMMANDS; option.variant.int_val = value; if (cgdbrc_set_val(option)) return 1; /* TODO: Make this not a member function. */ tgdb_set_verbose_gui_command_output(tgdb, value); } else return 1; return 0; } int command_set_winsplit(const char *value) { struct cgdbrc_config_option option; WIN_SPLIT_TYPE split_type = WIN_SPLIT_EVEN; option.option_kind = CGDBRC_WINSPLIT; if (strcasecmp(value, "top_big") == 0) split_type = WIN_SPLIT_TOP_BIG; else if (strcasecmp(value, "top_full") == 0) split_type = WIN_SPLIT_TOP_FULL; else if (strcasecmp(value, "bottom_big") == 0) split_type = WIN_SPLIT_BOTTOM_BIG; else if (strcasecmp(value, "bottom_full") == 0) split_type = WIN_SPLIT_BOTTOM_FULL; else split_type = WIN_SPLIT_EVEN; option.variant.win_split_val = split_type; if (cgdbrc_set_val(option)) return 1; if_set_winsplit(split_type); return 0; } static int command_set_winminheight(int value) { struct cgdbrc_config_option option; option.option_kind = CGDBRC_WINMINHEIGHT; if (if_change_winminheight(value) == -1) return 1; option.variant.int_val = value; return cgdbrc_set_val(option); } static int command_set_timeout(int value) { struct cgdbrc_config_option option; option.option_kind = CGDBRC_TIMEOUT; option.variant.int_val = value; if (cgdbrc_set_val(option)) return 1; return 0; } static int command_set_timeoutlen(int value) { if (value >= 0 && value <= 10000) { struct cgdbrc_config_option option; option.option_kind = CGDBRC_TIMEOUT_LEN; option.variant.int_val = value; if (cgdbrc_set_val(option)) return 1; } return 0; } static int command_set_ttimeout(int value) { struct cgdbrc_config_option option; option.option_kind = CGDBRC_TTIMEOUT; option.variant.int_val = value; if (cgdbrc_set_val(option)) return 1; return 0; } static int command_set_ttimeoutlen(int value) { if (value >= 0 && value <= 10000) { struct cgdbrc_config_option option; option.option_kind = CGDBRC_TTIMEOUT_LEN; option.variant.int_val = value; if (cgdbrc_set_val(option)) return 1; } return 0; } int command_set_syntax_type(const char *value) { enum tokenizer_language_support lang; struct cgdbrc_config_option option; option.option_kind = CGDBRC_SYNTAX; if (strcasecmp(value, "c") == 0) lang = TOKENIZER_LANGUAGE_C; else if (strcasecmp(value, "ada") == 0) lang = TOKENIZER_LANGUAGE_ADA; else if (strcasecmp(value, "off") == 0) lang = TOKENIZER_LANGUAGE_UNKNOWN; option.variant.language_support_val = lang; if (cgdbrc_set_val(option)) return 1; if_highlight_sviewer(lang); return 0; } int command_focus_cgdb(int param) { if_set_focus(CGDB); return 0; } int command_focus_gdb(int param) { if_set_focus(GDB); return 0; } int command_focus_tty(int param) { if_set_focus(TTY); return 0; } int command_do_bang(int param) { return 0; } int command_do_tgdbcommand(int param) { tgdb_request_ptr request_ptr; request_ptr = tgdb_request_run_debugger_command(tgdb, param); if (!request_ptr) return -1; handle_request(tgdb, request_ptr); return 0; } int command_do_focus(int param) { int token = yylex(); const char *value; if (token != IDENTIFIER) return 1; value = get_token(); if (strcasecmp(value, "cgdb") == 0) command_focus_cgdb(0); else if (strcasecmp(value, "gdb") == 0) command_focus_gdb(0); else if (strcasecmp(value, "tty") == 0) command_focus_tty(0); else return 1; return 0; } int command_do_help(int param) { if_display_help(); return 0; } int command_do_quit(int param) { /* FIXME: Test to see if debugged program is still running */ cleanup(); exit(0); return 0; } int command_do_shell(int param) { return run_shell_command(NULL); } int command_source_reload(int param) { struct sviewer *sview = if_get_sview(); if (!sview) return -1; /* If there is no current source file, then there is nothing to reload. */ if (!sview->cur) return 0; if (source_reload(sview, sview->cur->path, 1) == -1) return -1; return 0; } int command_parse_syntax(int param) { /* This is something like: :syntax :syntax on :syntax off */ int rv = 1; switch ((rv = yylex())) { case EOL:{ /* TODO: Print out syntax info (like vim?) */ } break; case BOOLEAN: case IDENTIFIER:{ extern int sources_syntax_on; const char *value = get_token(); if (strcasecmp(value, "on") == 0 || strcasecmp(value, "yes") == 0) sources_syntax_on = 1; else if (strcasecmp(value, "no") == 0 || strcasecmp(value, "off") == 0) sources_syntax_on = 0; if_draw(); } break; default: break; } return 0; } static int command_parse_highlight(int param) { return hl_groups_parse_config(hl_groups_instance); } extern struct kui_map_set *kui_map, *kui_imap; static int command_parse_map(int param) { struct kui_map_set *kui_map_choice; int key, value, val; char *key_token; extern int enter_map_id; enter_map_id = 1; if (strcmp(get_token(), "map") == 0) kui_map_choice = kui_map; else kui_map_choice = kui_imap; key = yylex(); if (key != IDENTIFIER) { enter_map_id = 0; return -1; } key_token = cgdb_strdup(get_token()); value = yylex(); if (value != IDENTIFIER) { free(key_token); enter_map_id = 0; return -1; } val = kui_ms_register_map(kui_map_choice, key_token, get_token()); if (val == -1) { free(key_token); enter_map_id = 0; return -1; } enter_map_id = 0; return 0; } static int command_parse_unmap(int param) { struct kui_map_set *kui_map_choice; int key, val; char *key_token; extern int enter_map_id; enter_map_id = 1; if ((strcmp(get_token(), "unmap") == 0) || (strcmp(get_token(), "unm") == 0)) kui_map_choice = kui_map; else kui_map_choice = kui_imap; key = yylex(); if (key != IDENTIFIER) { enter_map_id = 0; return -1; } key_token = cgdb_strdup(get_token()); val = kui_ms_deregister_map(kui_map_choice, key_token); if (val == -1) { free(key_token); enter_map_id = 0; return -1; } enter_map_id = 0; return 0; } int command_parse_set(void) { /* commands could look like the following: * set ignorecase * set noignorecase * set focus=gdb * set tabstop=8 */ int rv = 1; int boolean = 1; const char *value = NULL; switch ((rv = yylex())) { case EOL:{ /* TODO: Print out all the variables that have been set. */ } break; case IDENTIFIER:{ const char *token = get_token(); int length = strlen(token); struct ConfigVariable *variable = NULL; if (length > 2 && token[0] == 'n' && token[1] == 'o') { value = token + 2; boolean = 0; } else { value = token; } if ((variable = get_variable(value)) != NULL) { rv = 0; if (boolean == 0 && variable->type != CONFIG_TYPE_BOOL) { /* this is an error, you cant' do: * set notabstop */ rv = 1; } switch (variable->type) { case CONFIG_TYPE_BOOL: *(int *) (variable->data) = boolean; break; case CONFIG_TYPE_INT:{ if (yylex() == '=' && yylex() == NUMBER) { int data = strtol(get_token(), NULL, 10); *(int *) (variable->data) = data; } else { rv = 1; } } break; case CONFIG_TYPE_STRING:{ if (yylex() == '=' && (rv = yylex(), rv == STRING || rv == IDENTIFIER)) { /* BAM! comma operator */ char *data = (char *) get_token(); if (rv == STRING) { /* get rid of quotes */ data = data + 1; data[strlen(data) - 1] = '\0'; } if (variable->data) { free(variable->data); } variable->data = strdup(data); } else { rv = 1; } } break; case CONFIG_TYPE_FUNC_VOID:{ int (*functor) (void) = (int (*)(void)) variable->data; if (functor) { rv = functor(); } else { rv = 1; } } break; case CONFIG_TYPE_FUNC_BOOL:{ int (*functor) (int) = (int (*)(int)) variable->data; if (functor) { rv = functor(boolean); } else { rv = 1; } } break; case CONFIG_TYPE_FUNC_INT:{ int (*functor) (int) = (int (*)(int)) variable->data; if (yylex() == '=' && yylex() == NUMBER) { int data = strtol(get_token(), NULL, 10); if (functor) { rv = functor(data); } else { rv = 1; } } else { rv = 1; } } break; case CONFIG_TYPE_FUNC_STRING:{ int (*functor) (const char *) = (int (*)(const char *)) variable->data; if (yylex() == '=' && (rv = yylex(), rv == STRING || rv == IDENTIFIER)) { /* BAM! comma operator */ char *data = (char *) get_token(); if (rv == STRING) { /* get rid of quotes */ data = data + 1; data[strlen(data) - 1] = '\0'; } if (functor) { rv = functor(data); } else { rv = 1; } } else { rv = 1; } } break; default: rv = 1; break; } } } break; default: break; } return rv; } int command_parse_string(const char *buffer) { typedef struct yy_buffer_state *YY_BUFFER_STATE; extern YY_BUFFER_STATE yy_scan_string(const char *yy_str); extern void yy_delete_buffer(YY_BUFFER_STATE state); int rv = 1; YY_BUFFER_STATE state = yy_scan_string((char *) buffer); switch (yylex()) { case SET: /* get the next token */ rv = command_parse_set(); break; case UNSET: case BIND: case MACRO: /* ignore this stuff for now. */ rv = 1; break; case NUMBER:{ const char *number = get_token(); if (number[0] == '+') { source_vscroll(if_get_sview(), atoi(number + 1)); rv = 0; } else if (number[0] == '-') { source_vscroll(if_get_sview(), -atoi(number + 1)); rv = 0; } else { source_set_sel_line(if_get_sview(), atoi(number)); rv = 0; } if_draw(); } break; case IDENTIFIER:{ COMMANDS *command = get_command(get_token()); if (command) { command->action(command->param); rv = 0; } else { rv = 1; } } break; case EOL: /* basically just an empty line, don't do nothin. */ rv = 0; break; default: rv = 1; break; } yy_delete_buffer(state); return rv; } int command_parse_file(FILE * fp) { char buffer[4096]; char *p = buffer; int linenumber = 0; while (linenumber++, fgets(p, sizeof (buffer) - (p - buffer), fp)) { int bufferlen = strlen(buffer); if ((bufferlen - 2 >= 0) && buffer[bufferlen - 2] == '\\') { /* line continuation character, read another line into the buffer */ linenumber--; p = buffer + bufferlen - 2; continue; } if (command_parse_string(buffer)) { /* buffer already has an \n */ if_print_message("Error parsing line %d: %s", linenumber, buffer); /* return -1; don't return, lets keep parsing the file. */ } p = buffer; } return 0; } /** * Will set a configuration option. If any of the notify hook's reject the * update of the value, the value will not be set, and this function will fail. * Otherwise, the option will be set. * * \param config_option * The new configuration option and value to set. * * \return * 1 if the option is not set, otherwise 0. */ static int cgdbrc_set_val(struct cgdbrc_config_option config_option) { std_list_iterator iter; void *data; struct cgdbrc_attach_item *item; cgdbrc_config_options[config_option.option_kind] = config_option; /* Alert anyone that wants to be notified that an option has changed. */ for (iter = std_list_begin(cgdbrc_attach_list); iter != std_list_end(cgdbrc_attach_list); iter = std_list_next(iter)) { if (std_list_get_data(iter, &data) == -1) return 1; item = (struct cgdbrc_attach_item *) data; if (item->option == config_option.option_kind) { if (item->notify_hook(&config_option)) return 1; } } return 0; } /* Attach/Detach options {{{ */ static int destroy_notify(void *data) { free(data); return 0; } int cgdbrc_attach(enum cgdbrc_option_kind option, cgdbrc_notify notify, int *handle) { struct cgdbrc_attach_item *item = (struct cgdbrc_attach_item *) cgdb_malloc(sizeof (struct cgdbrc_attach_item)); item->option = option; item->handle = cgdbrc_attach_handle++; item->notify_hook = notify; if (!cgdbrc_attach_list) cgdbrc_attach_list = std_list_create(destroy_notify); std_list_append(cgdbrc_attach_list, item); if (handle) *handle = item->handle; return 0; } int cgdbrc_detach(int handle) { std_list_iterator iter; void *data; struct cgdbrc_attach_item *item; for (iter = std_list_begin(cgdbrc_attach_list); iter != std_list_end(cgdbrc_attach_list); iter = std_list_next(iter)) { if (std_list_get_data(iter, &data) == -1) return -1; item = (struct cgdbrc_attach_item *) data; if (item->handle == handle) { std_list_remove(cgdbrc_attach_list, iter); break; } } return 0; } /* }}} */ /* Get options {{{ */ cgdbrc_config_option_ptr cgdbrc_get(enum cgdbrc_option_kind option) { return &cgdbrc_config_options[option]; } int cgdbrc_get_key_code_timeoutlen(void) { cgdbrc_config_option_ptr timeout_option_ptr = cgdbrc_get(CGDBRC_TIMEOUT); cgdbrc_config_option_ptr ttimeout_option_ptr = cgdbrc_get(CGDBRC_TTIMEOUT); /* Do not time out. */ if (timeout_option_ptr->variant.int_val == 0 && ttimeout_option_ptr->variant.int_val == 0) return 0; if (cgdbrc_get(CGDBRC_TTIMEOUT_LEN)->variant.int_val < 0) return cgdbrc_get(CGDBRC_TIMEOUT_LEN)->variant.int_val; else return cgdbrc_get(CGDBRC_TTIMEOUT_LEN)->variant.int_val; } int cgdbrc_get_mapped_key_timeoutlen(void) { cgdbrc_config_option_ptr timeout_option_ptr = cgdbrc_get(CGDBRC_TIMEOUT); /* Do not time out. */ if (timeout_option_ptr->variant.int_val == 0) return 0; return cgdbrc_get(CGDBRC_TIMEOUT_LEN)->variant.int_val; } /* }}} */ cgdb-0.6.7/cgdb/cgdbrc.h000644 000765 000024 00000015211 12074441140 015701 0ustar00mmuellerstaff000000 000000 #ifndef __CGDBRC_H__ #define __CGDBRC_H__ #if HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #if HAVE_STDIO_H #include #endif /* HAVE_STDIO_H */ /* TODO: Remove this include. It is simply used to get * enum tokenizer_language_support. */ #include "tokenizer.h" /** * \file * cgdbrc.h * * \brief * An interface for dealing with config parameters. A client can determine * the value of a configuration option by calling cgdbrc_get. A client can * also ask to be notified when a particular option is changed. This gives * them two benefits. They can determine if the new value the user is trying * to set the option to is valid, and they can be kept up to date when * the option is changed. * * This package is currently not context driven. That is because at this * point there is only need for one cgdbrc package. Feel free to make * a 'struct cgdbrc' if it's needed in the future. * * Also, the higlight_group package is really part of the configuration too. * Feel free to integrate the two files somehow. */ /* Initialization {{{ */ /** * Initialize the cgdbrc interface. * * TODO: This interface should become instance driven instead of having * a global context. * * \return * 0 on success, otherwise error. */ void cgdbrc_init(void); /* }}} */ /* Parse options {{{ */ /** * Parse a string of command data and execute the commands that it represents. * * \param buffer * A line of command data to parse (representing a single command). * * \return * 0 on success, otherwise error. */ int command_parse_string(const char *buffer); /** * Parse a configuration file, and execute teh commands that it contains. * The commands will be executed in order. * * \param fp * The file to parse. * * \return * Currently only returns 0. */ int command_parse_file(FILE * fp); /* }}} */ /* Options types {{{ */ /** * The different ways to highlight the current line the debugger is at. * This enum name is incorrect, it should be renamed to something like, * 'enum HighlightStyle'. */ enum ArrowStyle { ARROWSTYLE_SHORT, ARROWSTYLE_LONG, ARROWSTYLE_HIGHLIGHT }; /** window split type enumeration*/ typedef enum { WIN_SPLIT_FREE = -3, /* split point not on quarter mark */ WIN_SPLIT_BOTTOM_FULL = -2, /* src window is 0% of screen */ WIN_SPLIT_BOTTOM_BIG = -1, /* src window is 25% of screen */ WIN_SPLIT_EVEN = 0, /* src window is 50% of screen */ WIN_SPLIT_TOP_BIG = 1, /* src window is 75% of screen */ WIN_SPLIT_TOP_FULL = 2 /* src window is 100% of screen */ } WIN_SPLIT_TYPE; /** All of the different configuration options */ enum cgdbrc_option_kind { CGDBRC_ARROWSTYLE, CGDBRC_AUTOSOURCERELOAD, CGDBRC_CGDB_MODE_KEY, CGDBRC_IGNORECASE, CGDBRC_SHOWTGDBCOMMANDS, CGDBRC_SYNTAX, CGDBRC_TABSTOP, CGDBRC_TIMEOUT, CGDBRC_TIMEOUT_LEN, CGDBRC_TTIMEOUT, CGDBRC_TTIMEOUT_LEN, CGDBRC_WINMINHEIGHT, CGDBRC_WINSPLIT, CGDBRC_WRAPSCAN }; /** This represents a single configuration option. */ struct cgdbrc_config_option { enum cgdbrc_option_kind option_kind; union { /* option_kind == CGDBRC_ARROWSTYLE */ enum ArrowStyle arrow_style; /* option_kind == CGDBRC_AUTOSOURCERELOAD */ /* option_kind == CGDBRC_CGDB_MODE_KEY */ /* option_kind == CGDBRC_IGNORECASE */ /* option_kind == CGDBRC_SHOWTGDBCOMMANDS */ /* option_kind == CGDBRC_TABSTOP */ /* option_kind == CGDBRC_TIMEOUT */ /* option_kind == CGDBRC_TIMEOUTLEN */ /* option_kind == CGDBRC_TTIMEOUT */ /* option_kind == CGDBRC_TTIMEOUTLEN */ /* option_kind == CGDBRC_WINMINHEIGHT */ /* option_kind == CGDBRC_WRAPSCAN */ int int_val; /* option_kind == CGDBRC_SYNTAX */ enum tokenizer_language_support language_support_val; /* option_kind == CGDBRC_WINSPLIT */ WIN_SPLIT_TYPE win_split_val; } variant; }; /* }}} */ /* Attach/Detach options {{{ */ typedef struct cgdbrc_config_option *cgdbrc_config_option_ptr; /** * If the notify function fails, this tells the configuration package * that the option was not acceptable. The option will not be kept. * This allows a mechanism for the configuration package to allow other * packages to validate if a particular config option value is OK. So, * a client might use this even if they are not interested in getting the * new values, but want to validate the values, in order to not tightly * couple the config reader with the other parts of CGDB. */ typedef int (*cgdbrc_notify) (cgdbrc_config_option_ptr option); /** * This will attach a new callback function for a particular option. * The client will be notified when the value is changed. * The handle returned from this function should be used if the * client ever wishes to disable the callback function from being called when * an option is changed. * * \param option * The new option to attach a callback to. * * \param notify * The callback function to call when the state of the data changes. * * \param handle * The unique identifier to use when detaching this notification * If the handle is passed in as NULL, it will not be set on the way out. This * callback can never be removed. * * \return * 0 on success or -1 on error */ int cgdbrc_attach(enum cgdbrc_option_kind option, cgdbrc_notify notify, int *handle); /** * This will detach a notify function so that it will no longer be called * when an option is updated. * * \param handle * The value returned from cgdbrc_attach when the notify request was made. * * \return * 0 on success, -1 if it couldn't be detached (error) */ int cgdbrc_detach(int handle); /* }}} */ /* Get options {{{ */ /** * Get a configuration option. * * \param option * The option to get * * \return * This will never return NULL. It is returned as a pointer simply to not * pass the entire structure back. The configuration option corresponding * to the option asked for is returned. */ cgdbrc_config_option_ptr cgdbrc_get(enum cgdbrc_option_kind option); /** * A convience function for determining the timeout that should be used to * allow a key code sequence to complete. This function can not fail. * * \return * The number of milliseconds to delay before timing out. If 0, then do not * timeout. */ int cgdbrc_get_key_code_timeoutlen(void); /** * A convience function for determining the timeout that should be used to * allow a mapped key sequence to complete. This function can not fail. * * \return * The number of milliseconds to delay before timing out. If 0, then do not * timeout. */ int cgdbrc_get_mapped_key_timeoutlen(void); /* }}} */ #endif /* __CGDBRC_H__ */ cgdb-0.6.7/cgdb/command_lexer.c000644 000765 000024 00000140731 12074441140 017273 0ustar00mmuellerstaff000000 000000 #line 3 "../../../cgdb/cgdb/src/command_lexer.c" #define YY_INT_ALIGNED short int /* A lexical scanner generated by flex */ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 #define YY_FLEX_SUBMINOR_VERSION 33 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif /* First, we deal with platform-specific or compiler-specific issues. */ /* begin standard C headers. */ #include #include #include #include /* end standard C headers. */ /* flex integer type definitions */ #ifndef FLEXINT_H #define FLEXINT_H /* C99 systems have . Non-C99 systems may or may not. */ #if __STDC_VERSION__ >= 199901L /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, * if you want the limit (max/min) macros for int types. */ #ifndef __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS 1 #endif #include typedef int8_t flex_int8_t; typedef uint8_t flex_uint8_t; typedef int16_t flex_int16_t; typedef uint16_t flex_uint16_t; typedef int32_t flex_int32_t; typedef uint32_t flex_uint32_t; #else typedef signed char flex_int8_t; typedef short int flex_int16_t; typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; #endif /* ! C99 */ /* Limits of integral types. */ #ifndef INT8_MIN #define INT8_MIN (-128) #endif #ifndef INT16_MIN #define INT16_MIN (-32767-1) #endif #ifndef INT32_MIN #define INT32_MIN (-2147483647-1) #endif #ifndef INT8_MAX #define INT8_MAX (127) #endif #ifndef INT16_MAX #define INT16_MAX (32767) #endif #ifndef INT32_MAX #define INT32_MAX (2147483647) #endif #ifndef UINT8_MAX #define UINT8_MAX (255U) #endif #ifndef UINT16_MAX #define UINT16_MAX (65535U) #endif #ifndef UINT32_MAX #define UINT32_MAX (4294967295U) #endif #endif /* ! FLEXINT_H */ #ifdef __cplusplus /* The "const" storage-class-modifier is valid. */ #define YY_USE_CONST #else /* ! __cplusplus */ #if __STDC__ #define YY_USE_CONST #endif /* __STDC__ */ #endif /* ! __cplusplus */ #ifdef YY_USE_CONST #define yyconst const #else #define yyconst #endif /* Returned upon end-of-file. */ #define YY_NULL 0 /* Promotes a possibly negative, possibly signed char to an unsigned * integer for use as an array index. If the signed char is negative, * we want to instead treat it as an 8-bit unsigned char, hence the * double cast. */ #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) /* Enter a start condition. This macro really ought to take a parameter, * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ #define BEGIN (yy_start) = 1 + 2 * /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ #define YY_START (((yy_start) - 1) / 2) #define YYSTATE YY_START /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) /* Special action meaning "start processing a new file". */ #define YY_NEW_FILE yyrestart(yyin ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ #ifndef YY_BUF_SIZE #define YY_BUF_SIZE 16384 #endif /* The state buf must be large enough to hold one state per character in the main buffer. */ #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) #ifndef YY_TYPEDEF_YY_BUFFER_STATE #define YY_TYPEDEF_YY_BUFFER_STATE typedef struct yy_buffer_state *YY_BUFFER_STATE; #endif extern int yyleng; extern FILE *yyin, *yyout; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 #define YY_LESS_LINENO(n) /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ do \ { \ /* Undo effects of setting up yytext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ *yy_cp = (yy_hold_char); \ YY_RESTORE_YY_MORE_OFFSET \ (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ YY_DO_BEFORE_ACTION; /* set up yytext again */ \ } \ while ( 0 ) #define unput(c) yyunput( c, (yytext_ptr) ) /* The following is because we cannot portably get our hands on size_t * (without autoconf's help, which isn't available because we want * flex-generated scanners to compile on their own). */ #ifndef YY_TYPEDEF_YY_SIZE_T #define YY_TYPEDEF_YY_SIZE_T typedef unsigned int yy_size_t; #endif #ifndef YY_STRUCT_YY_BUFFER_STATE #define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state { FILE *yy_input_file; char *yy_ch_buf; /* input buffer */ char *yy_buf_pos; /* current position in input buffer */ /* Size of input buffer in bytes, not including room for EOB * characters. */ yy_size_t yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. */ int yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to * delete it. */ int yy_is_our_buffer; /* Whether this is an "interactive" input source; if so, and * if we're using stdio for input, then we want to use getc() * instead of fread(), to make sure we stop fetching input after * each newline. */ int yy_is_interactive; /* Whether we're considered to be at the beginning of a line. * If so, '^' rules will be active on the next match, otherwise * not. */ int yy_at_bol; int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ /* Whether to try to fill the input buffer when we reach the * end of it. */ int yy_fill_buffer; int yy_buffer_status; #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 /* When an EOF's been seen but there's still some text to process * then we mark the buffer as YY_EOF_PENDING, to indicate that we * shouldn't try reading from the input source any more. We might * still have a bunch of tokens to match, though, because of * possible backing-up. * * When we actually see the EOF, we change the status to "new" * (via yyrestart()), so that the user can continue scanning by * just pointing yyin at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 }; #endif /* !YY_STRUCT_YY_BUFFER_STATE */ /* Stack of input buffers. */ static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general * "scanner state". * * Returns the top of the stack, or NULL. */ #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ : NULL) /* Same as previous macro, but useful when we know that the buffer stack is not * NULL or when we need an lvalue. For internal use only. */ #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] /* yy_hold_char holds the character lost when yytext is formed. */ static char yy_hold_char; static int yy_n_chars; /* number of characters read into yy_ch_buf */ int yyleng; /* Points to current character in buffer. */ static char *yy_c_buf_p = (char *) 0; static int yy_init = 0; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ /* Flag which is used to allow yywrap()'s to do buffer switches * instead of setting up a fresh yyin. A bit of a hack ... */ static int yy_did_buffer_switch_on_eof; void yyrestart (FILE *input_file ); void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ); void yy_delete_buffer (YY_BUFFER_STATE b ); void yy_flush_buffer (YY_BUFFER_STATE b ); void yypush_buffer_state (YY_BUFFER_STATE new_buffer ); void yypop_buffer_state (void ); static void yyensure_buffer_stack (void ); static void yy_load_buffer_state (void ); static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); #define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ) YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ); void *yyalloc (yy_size_t ); void *yyrealloc (void *,yy_size_t ); void yyfree (void * ); #define yy_new_buffer yy_create_buffer #define yy_set_interactive(is_interactive) \ { \ if ( ! YY_CURRENT_BUFFER ){ \ yyensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ yy_create_buffer(yyin,YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } #define yy_set_bol(at_bol) \ { \ if ( ! YY_CURRENT_BUFFER ){\ yyensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ yy_create_buffer(yyin,YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ } #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) /* Begin user sect3 */ typedef unsigned char YY_CHAR; FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; typedef int yy_state_type; extern int yylineno; int yylineno = 1; extern char *yytext; #define yytext_ptr yytext static yy_state_type yy_get_previous_state (void ); static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); static int yy_get_next_buffer (void ); static void yy_fatal_error (yyconst char msg[] ); /* Done after the current pattern has been matched and before the * corresponding action - sets up yytext. */ #define YY_DO_BEFORE_ACTION \ (yytext_ptr) = yy_bp; \ yyleng = (size_t) (yy_cp - yy_bp); \ (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; #define YY_NUM_RULES 19 #define YY_END_OF_BUFFER 20 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info { flex_int32_t yy_verify; flex_int32_t yy_nxt; }; static yyconst flex_int16_t yy_accept[63] = { 0, 0, 0, 0, 0, 20, 15, 14, 13, 13, 15, 1, 15, 12, 8, 11, 15, 10, 7, 6, 6, 7, 7, 6, 7, 7, 6, 17, 17, 16, 13, 0, 9, 0, 1, 8, 0, 0, 7, 7, 7, 0, 7, 6, 7, 7, 7, 7, 7, 7, 7, 17, 7, 7, 7, 3, 7, 4, 7, 7, 5, 2, 0 } ; static yyconst flex_int32_t yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 2, 2, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 6, 7, 8, 1, 1, 1, 1, 1, 1, 1, 9, 10, 9, 1, 1, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 1, 12, 13, 14, 15, 1, 1, 16, 16, 16, 16, 17, 16, 16, 16, 16, 16, 16, 16, 16, 18, 19, 16, 16, 16, 20, 16, 16, 16, 16, 16, 21, 16, 1, 22, 1, 1, 16, 1, 23, 24, 25, 26, 27, 16, 16, 16, 28, 16, 16, 16, 29, 30, 31, 16, 16, 32, 33, 34, 35, 16, 16, 16, 36, 16, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } ; static yyconst flex_int32_t yy_meta[37] = { 0, 1, 1, 2, 1, 3, 4, 1, 1, 1, 1, 5, 1, 4, 1, 1, 4, 4, 4, 4, 4, 4, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 } ; static yyconst flex_int16_t yy_base[69] = { 0, 0, 0, 34, 35, 124, 200, 200, 119, 119, 34, 0, 43, 200, 42, 200, 56, 200, 36, 87, 77, 24, 76, 31, 78, 82, 83, 0, 0, 200, 200, 104, 200, 45, 0, 35, 0, 0, 38, 200, 84, 0, 97, 98, 100, 102, 106, 113, 108, 115, 121, 0, 122, 124, 126, 128, 137, 130, 132, 141, 143, 146, 200, 177, 182, 187, 189, 194, 41 } ; static yyconst flex_int16_t yy_def[69] = { 0, 62, 1, 63, 63, 62, 62, 62, 62, 62, 64, 65, 62, 62, 62, 62, 62, 62, 66, 66, 19, 19, 19, 19, 19, 19, 19, 67, 67, 62, 62, 64, 62, 64, 65, 62, 16, 16, 68, 62, 19, 16, 19, 19, 19, 19, 19, 19, 19, 19, 19, 67, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 0, 62, 62, 62, 62, 62, 62 } ; static yyconst flex_int16_t yy_nxt[237] = { 0, 6, 7, 8, 9, 7, 6, 10, 11, 12, 13, 14, 15, 16, 17, 6, 18, 18, 19, 18, 18, 20, 6, 18, 21, 18, 18, 18, 18, 22, 23, 18, 18, 24, 18, 25, 26, 28, 28, 29, 29, 32, 39, 42, 39, 52, 35, 40, 62, 41, 42, 41, 46, 35, 35, 42, 33, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 37, 36, 36, 36, 38, 37, 37, 37, 37, 37, 37, 36, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 39, 44, 42, 42, 42, 40, 47, 41, 42, 42, 42, 45, 48, 43, 42, 42, 42, 50, 32, 49, 42, 42, 42, 42, 42, 43, 42, 43, 42, 30, 30, 62, 42, 33, 42, 42, 42, 62, 42, 42, 42, 42, 43, 53, 42, 54, 42, 42, 42, 55, 42, 42, 42, 42, 42, 56, 42, 57, 42, 42, 42, 43, 42, 42, 42, 58, 42, 42, 42, 42, 60, 59, 42, 62, 62, 42, 62, 62, 62, 42, 62, 42, 61, 62, 42, 27, 27, 27, 27, 27, 31, 31, 31, 31, 31, 34, 62, 34, 34, 34, 42, 42, 51, 51, 62, 51, 51, 5, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62 } ; static yyconst flex_int16_t yy_chk[237] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 4, 3, 4, 10, 18, 21, 38, 68, 35, 18, 33, 18, 23, 38, 21, 14, 12, 21, 10, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 19, 20, 22, 20, 24, 19, 22, 19, 25, 26, 40, 20, 24, 19, 22, 20, 24, 26, 31, 25, 25, 26, 40, 42, 43, 19, 44, 44, 45, 9, 8, 5, 46, 31, 48, 42, 43, 0, 44, 47, 45, 49, 45, 46, 46, 47, 48, 50, 52, 48, 53, 47, 54, 49, 55, 49, 57, 53, 58, 50, 52, 50, 53, 56, 54, 54, 55, 59, 57, 60, 58, 56, 61, 0, 0, 56, 0, 0, 0, 59, 0, 60, 59, 0, 61, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 65, 0, 65, 65, 65, 66, 66, 67, 67, 0, 67, 67, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62 } ; static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; extern int yy_flex_debug; int yy_flex_debug = 0; /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. */ #define REJECT reject_used_but_not_detected #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *yytext; #line 1 "../../../cgdb/cgdb/src/command_lexer.l" #line 5 "../../../cgdb/cgdb/src/command_lexer.l" /* config_lexer.c * -------------- * THIS FILE IS GENERATED, DO NOT EDIT */ #include #include "command_lexer.h" const char * get_token( void ) { return yytext; } int enter_map_id = 0; /* An identifier used in a map like command */ #line 542 "../../../cgdb/cgdb/src/command_lexer.c" #define INITIAL 0 #define MAP_ID 1 #ifndef YY_NO_UNISTD_H /* Special case for "unistd.h", since it is non-ANSI. We include it way * down here because we want the user's section 1 to have been scanned first. * The user has a chance to override it with an option. */ #include #endif #ifndef YY_EXTRA_TYPE #define YY_EXTRA_TYPE void * #endif static int yy_init_globals (void ); /* Macros after this point can all be overridden by user definitions in * section 1. */ #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus extern "C" int yywrap (void ); #else extern int yywrap (void ); #endif #endif static void yyunput (int c,char *buf_ptr ); #ifndef yytext_ptr static void yy_flex_strncpy (char *,yyconst char *,int ); #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen (yyconst char * ); #endif #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (void ); #else static int input (void ); #endif #endif /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE #define YY_READ_BUF_SIZE 8192 #endif /* Copy whatever the last rule matched to the standard output. */ #ifndef ECHO /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ #define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, * is returned in "result". */ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ size_t n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ if ( c == '\n' ) \ buf[n++] = (char) c; \ if ( c == EOF && ferror( yyin ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ else \ { \ errno=0; \ while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ { \ if( errno != EINTR) \ { \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ break; \ } \ errno=0; \ clearerr(yyin); \ } \ }\ \ #endif /* No semi-colon after return; correct usage is to write "yyterminate();" - * we don't want an extra ';' after the "return" because that will cause * some compilers to complain about unreachable statements. */ #ifndef yyterminate #define yyterminate() return YY_NULL #endif /* Number of entries by which start-condition stack grows. */ #ifndef YY_START_STACK_INCR #define YY_START_STACK_INCR 25 #endif /* Report a fatal error. */ #ifndef YY_FATAL_ERROR #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) #endif /* end tables serialization structures and prototypes */ /* Default declaration of generated scanner - a define so the user can * easily add parameters. */ #ifndef YY_DECL #define YY_DECL_IS_OURS 1 extern int yylex (void); #define YY_DECL int yylex (void) #endif /* !YY_DECL */ /* Code executed at the beginning of each rule, after yytext and yyleng * have been set up. */ #ifndef YY_USER_ACTION #define YY_USER_ACTION #endif /* Code executed at the end of each rule. */ #ifndef YY_BREAK #define YY_BREAK break; #endif #define YY_RULE_SETUP \ YY_USER_ACTION /** The main scanner function which does all the work. */ YY_DECL { register yy_state_type yy_current_state; register char *yy_cp, *yy_bp; register int yy_act; #line 26 "../../../cgdb/cgdb/src/command_lexer.l" if (enter_map_id) BEGIN (MAP_ID); else BEGIN (INITIAL); #line 703 "../../../cgdb/cgdb/src/command_lexer.c" if ( !(yy_init) ) { (yy_init) = 1; #ifdef YY_USER_INIT YY_USER_INIT; #endif if ( ! (yy_start) ) (yy_start) = 1; /* first start state */ if ( ! yyin ) yyin = stdin; if ( ! yyout ) yyout = stdout; if ( ! YY_CURRENT_BUFFER ) { yyensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin,YY_BUF_SIZE ); } yy_load_buffer_state( ); } while ( 1 ) /* loops until end-of-file is reached */ { yy_cp = (yy_c_buf_p); /* Support of yytext. */ *yy_cp = (yy_hold_char); /* yy_bp points to the position in yy_ch_buf of the start of * the current run. */ yy_bp = yy_cp; yy_current_state = (yy_start); yy_match: do { register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 63 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } while ( yy_base[yy_current_state] != 200 ); yy_find_action: yy_act = yy_accept[yy_current_state]; if ( yy_act == 0 ) { /* have to back up */ yy_cp = (yy_last_accepting_cpos); yy_current_state = (yy_last_accepting_state); yy_act = yy_accept[yy_current_state]; } YY_DO_BEFORE_ACTION; do_action: /* This label is used only to access EOF actions. */ switch ( yy_act ) { /* beginning of action switch */ case 0: /* must back up */ /* undo the effects of YY_DO_BEFORE_ACTION */ *yy_cp = (yy_hold_char); yy_cp = (yy_last_accepting_cpos); yy_current_state = (yy_last_accepting_state); goto yy_find_action; case 1: YY_RULE_SETUP #line 34 "../../../cgdb/cgdb/src/command_lexer.l" { /* ignore comments */ } YY_BREAK case 2: YY_RULE_SETUP #line 35 "../../../cgdb/cgdb/src/command_lexer.l" { return UNSET; } YY_BREAK case 3: YY_RULE_SETUP #line 36 "../../../cgdb/cgdb/src/command_lexer.l" { return SET; } YY_BREAK case 4: YY_RULE_SETUP #line 37 "../../../cgdb/cgdb/src/command_lexer.l" { return BIND; } YY_BREAK case 5: YY_RULE_SETUP #line 38 "../../../cgdb/cgdb/src/command_lexer.l" { return MACRO; } YY_BREAK case 6: YY_RULE_SETUP #line 40 "../../../cgdb/cgdb/src/command_lexer.l" { return BOOLEAN; } YY_BREAK case 7: /* rule 7 can match eol */ YY_RULE_SETUP #line 41 "../../../cgdb/cgdb/src/command_lexer.l" { return IDENTIFIER; } YY_BREAK case 8: YY_RULE_SETUP #line 42 "../../../cgdb/cgdb/src/command_lexer.l" { return NUMBER; } YY_BREAK case 9: /* rule 9 can match eol */ YY_RULE_SETUP #line 43 "../../../cgdb/cgdb/src/command_lexer.l" { return STRING; } YY_BREAK case 10: YY_RULE_SETUP #line 45 "../../../cgdb/cgdb/src/command_lexer.l" { return '='; } YY_BREAK case 11: YY_RULE_SETUP #line 46 "../../../cgdb/cgdb/src/command_lexer.l" { return ';'; } YY_BREAK case 12: YY_RULE_SETUP #line 47 "../../../cgdb/cgdb/src/command_lexer.l" { return ','; } YY_BREAK case 13: /* rule 13 can match eol */ YY_RULE_SETUP #line 50 "../../../cgdb/cgdb/src/command_lexer.l" { return EOL; } YY_BREAK case 14: YY_RULE_SETUP #line 51 "../../../cgdb/cgdb/src/command_lexer.l" { /* ignore white-space */ } YY_BREAK case 15: YY_RULE_SETUP #line 52 "../../../cgdb/cgdb/src/command_lexer.l" { /* ignore bad-characters */ } YY_BREAK case 16: YY_RULE_SETUP #line 57 "../../../cgdb/cgdb/src/command_lexer.l" { /* ignore white space */ } YY_BREAK case 17: /* rule 17 can match eol */ YY_RULE_SETUP #line 58 "../../../cgdb/cgdb/src/command_lexer.l" { return IDENTIFIER; } YY_BREAK case 18: YY_RULE_SETUP #line 59 "../../../cgdb/cgdb/src/command_lexer.l" { /* ignore bad-characters */ } YY_BREAK case 19: YY_RULE_SETUP #line 62 "../../../cgdb/cgdb/src/command_lexer.l" ECHO; YY_BREAK #line 889 "../../../cgdb/cgdb/src/command_lexer.c" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(MAP_ID): yyterminate(); case YY_END_OF_BUFFER: { /* Amount of text matched not including the EOB char. */ int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; /* Undo the effects of YY_DO_BEFORE_ACTION. */ *yy_cp = (yy_hold_char); YY_RESTORE_YY_MORE_OFFSET if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) { /* We're scanning a new file or input source. It's * possible that this happened because the user * just pointed yyin at a new source and called * yylex(). If so, then we have to assure * consistency between YY_CURRENT_BUFFER and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; } /* Note that here we test for yy_c_buf_p "<=" to the position * of the first EOB in the buffer, since yy_c_buf_p will * already have been incremented past the NUL character * (since all states make transitions on EOB to the * end-of-buffer state). Contrast this with the test * in input(). */ if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) { /* This was really a NUL. */ yy_state_type yy_next_state; (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state( ); /* Okay, we're now positioned to make the NUL * transition. We couldn't have * yy_get_previous_state() go ahead and do it * for us because it doesn't know how to deal * with the possibility of jamming (and we don't * want to build jamming into it because then it * will run more slowly). */ yy_next_state = yy_try_NUL_trans( yy_current_state ); yy_bp = (yytext_ptr) + YY_MORE_ADJ; if ( yy_next_state ) { /* Consume the NUL. */ yy_cp = ++(yy_c_buf_p); yy_current_state = yy_next_state; goto yy_match; } else { yy_cp = (yy_c_buf_p); goto yy_find_action; } } else switch ( yy_get_next_buffer( ) ) { case EOB_ACT_END_OF_FILE: { (yy_did_buffer_switch_on_eof) = 0; if ( yywrap( ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up * yytext, we can now set up * yy_c_buf_p so that if some total * hoser (like flex itself) wants to * call the scanner after we return the * YY_NULL, it'll still work - another * YY_NULL will get returned. */ (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; yy_act = YY_STATE_EOF(YY_START); goto do_action; } else { if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; } break; } case EOB_ACT_CONTINUE_SCAN: (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state( ); yy_cp = (yy_c_buf_p); yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_match; case EOB_ACT_LAST_MATCH: (yy_c_buf_p) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; yy_current_state = yy_get_previous_state( ); yy_cp = (yy_c_buf_p); yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_find_action; } break; } default: YY_FATAL_ERROR( "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ } /* end of yylex */ /* yy_get_next_buffer - try to read in a new buffer * * Returns a code representing an action: * EOB_ACT_LAST_MATCH - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */ static int yy_get_next_buffer (void) { register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; register char *source = (yytext_ptr); register int number_to_move, i; int ret_val; if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) YY_FATAL_ERROR( "fatal flex scanner internal error--end of buffer missed" ); if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) { /* Don't try to fill the buffer, so this is an EOF. */ if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) { /* We matched a single character, the EOB, so * treat this as a final EOF. */ return EOB_ACT_END_OF_FILE; } else { /* We matched some text prior to the EOB, first * process it. */ return EOB_ACT_LAST_MATCH; } } /* Try to read more data. */ /* First move last chars to start of buffer. */ number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) /* don't do the read, it's not guaranteed to return an EOF, * just force an EOF */ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; else { int num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ /* just a shorter name for the current buffer */ YY_BUFFER_STATE b = YY_CURRENT_BUFFER; int yy_c_buf_p_offset = (int) ((yy_c_buf_p) - b->yy_ch_buf); if ( b->yy_is_our_buffer ) { int new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; else b->yy_buf_size *= 2; b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); } else /* Can't grow it, we don't own it. */ b->yy_ch_buf = 0; if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; } if ( num_to_read > YY_READ_BUF_SIZE ) num_to_read = YY_READ_BUF_SIZE; /* Read in more data. */ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), (yy_n_chars), (size_t) num_to_read ); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } if ( (yy_n_chars) == 0 ) { if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; yyrestart(yyin ); } else { ret_val = EOB_ACT_LAST_MATCH; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_EOF_PENDING; } } else ret_val = EOB_ACT_CONTINUE_SCAN; (yy_n_chars) += number_to_move; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; return ret_val; } /* yy_get_previous_state - get the state just before the EOB char was reached */ static yy_state_type yy_get_previous_state (void) { register yy_state_type yy_current_state; register char *yy_cp; yy_current_state = (yy_start); for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) { register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 63 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; } return yy_current_state; } /* yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis * next_state = yy_try_NUL_trans( current_state ); */ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) { register int yy_is_jam; register char *yy_cp = (yy_c_buf_p); register YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 63 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; yy_is_jam = (yy_current_state == 62); return yy_is_jam ? 0 : yy_current_state; } static void yyunput (int c, register char * yy_bp ) { register char *yy_cp; yy_cp = (yy_c_buf_p); /* undo effects of setting up yytext */ *yy_cp = (yy_hold_char); if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) { /* need to shift things up to make room */ /* +2 for EOB chars. */ register int number_to_move = (yy_n_chars) + 2; register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; register char *source = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) *--dest = *--source; yy_cp += (int) (dest - source); yy_bp += (int) (dest - source); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) YY_FATAL_ERROR( "flex scanner push-back overflow" ); } *--yy_cp = (char) c; (yytext_ptr) = yy_bp; (yy_hold_char) = *yy_cp; (yy_c_buf_p) = yy_cp; } #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (void) #else static int input (void) #endif { int c; *(yy_c_buf_p) = (yy_hold_char); if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) { /* yy_c_buf_p now points to the character we want to return. * If this occurs *before* the EOB characters, then it's a * valid NUL; if not, then we've hit the end of the buffer. */ if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) /* This was really a NUL. */ *(yy_c_buf_p) = '\0'; else { /* need more input */ int offset = (yy_c_buf_p) - (yytext_ptr); ++(yy_c_buf_p); switch ( yy_get_next_buffer( ) ) { case EOB_ACT_LAST_MATCH: /* This happens because yy_g_n_b() * sees that we've accumulated a * token and flags that we need to * try matching the token before * proceeding. But for input(), * there's no matching to consider. * So convert the EOB_ACT_LAST_MATCH * to EOB_ACT_END_OF_FILE. */ /* Reset buffer status. */ yyrestart(yyin ); /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { if ( yywrap( ) ) return EOF; if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; #ifdef __cplusplus return yyinput(); #else return input(); #endif } case EOB_ACT_CONTINUE_SCAN: (yy_c_buf_p) = (yytext_ptr) + offset; break; } } } c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ *(yy_c_buf_p) = '\0'; /* preserve yytext */ (yy_hold_char) = *++(yy_c_buf_p); return c; } #endif /* ifndef YY_NO_INPUT */ /** Immediately switch to a different input stream. * @param input_file A readable stream. * * @note This function does not reset the start condition to @c INITIAL . */ void yyrestart (FILE * input_file ) { if ( ! YY_CURRENT_BUFFER ){ yyensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin,YY_BUF_SIZE ); } yy_init_buffer(YY_CURRENT_BUFFER,input_file ); yy_load_buffer_state( ); } /** Switch to a different input buffer. * @param new_buffer The new input buffer. * */ void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) { /* TODO. We should be able to replace this entire function body * with * yypop_buffer_state(); * yypush_buffer_state(new_buffer); */ yyensure_buffer_stack (); if ( YY_CURRENT_BUFFER == new_buffer ) return; if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ *(yy_c_buf_p) = (yy_hold_char); YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } YY_CURRENT_BUFFER_LVALUE = new_buffer; yy_load_buffer_state( ); /* We don't actually know whether we did this switch during * EOF (yywrap()) processing, but the only time this flag * is looked at is after yywrap() is called, so it's safe * to go ahead and always set it. */ (yy_did_buffer_switch_on_eof) = 1; } static void yy_load_buffer_state (void) { (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; (yy_hold_char) = *(yy_c_buf_p); } /** Allocate and initialize an input buffer state. * @param file A readable stream. * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. * * @return the allocated buffer state. */ YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) { YY_BUFFER_STATE b; b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_buf_size = size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ); if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_is_our_buffer = 1; yy_init_buffer(b,file ); return b; } /** Destroy the buffer. * @param b a buffer created with yy_create_buffer() * */ void yy_delete_buffer (YY_BUFFER_STATE b ) { if ( ! b ) return; if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) yyfree((void *) b->yy_ch_buf ); yyfree((void *) b ); } #ifndef __cplusplus extern int isatty (int ); #endif /* __cplusplus */ /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, * such as during a yyrestart() or at EOF. */ static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) { int oerrno = errno; yy_flush_buffer(b ); b->yy_input_file = file; b->yy_fill_buffer = 1; /* If b is the current buffer, then yy_init_buffer was _probably_ * called from yyrestart() or through yy_get_next_buffer. * In that case, we don't want to reset the lineno or column. */ if (b != YY_CURRENT_BUFFER){ b->yy_bs_lineno = 1; b->yy_bs_column = 0; } b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; errno = oerrno; } /** Discard all buffered characters. On the next scan, YY_INPUT will be called. * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. * */ void yy_flush_buffer (YY_BUFFER_STATE b ) { if ( ! b ) return; b->yy_n_chars = 0; /* We always need two end-of-buffer characters. The first causes * a transition to the end-of-buffer state. The second causes * a jam in that state. */ b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; b->yy_buf_pos = &b->yy_ch_buf[0]; b->yy_at_bol = 1; b->yy_buffer_status = YY_BUFFER_NEW; if ( b == YY_CURRENT_BUFFER ) yy_load_buffer_state( ); } /** Pushes the new state onto the stack. The new state becomes * the current state. This function will allocate the stack * if necessary. * @param new_buffer The new state. * */ void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) { if (new_buffer == NULL) return; yyensure_buffer_stack(); /* This block is copied from yy_switch_to_buffer. */ if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ *(yy_c_buf_p) = (yy_hold_char); YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } /* Only push if top exists. Otherwise, replace top. */ if (YY_CURRENT_BUFFER) (yy_buffer_stack_top)++; YY_CURRENT_BUFFER_LVALUE = new_buffer; /* copied from yy_switch_to_buffer. */ yy_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } /** Removes and deletes the top of the stack, if present. * The next element becomes the new top. * */ void yypop_buffer_state (void) { if (!YY_CURRENT_BUFFER) return; yy_delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; if ((yy_buffer_stack_top) > 0) --(yy_buffer_stack_top); if (YY_CURRENT_BUFFER) { yy_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } } /* Allocates the stack if it does not exist. * Guarantees space for at least one push. */ static void yyensure_buffer_stack (void) { int num_to_alloc; if (!(yy_buffer_stack)) { /* First allocation is just for 2 elements, since we don't know if this * scanner will even need a stack. We use 2 instead of 1 to avoid an * immediate realloc on the next call. */ num_to_alloc = 1; (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc (num_to_alloc * sizeof(struct yy_buffer_state*) ); memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); (yy_buffer_stack_max) = num_to_alloc; (yy_buffer_stack_top) = 0; return; } if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ /* Increase the buffer to prepare for a possible push. */ int grow_size = 8 /* arbitrary grow size */; num_to_alloc = (yy_buffer_stack_max) + grow_size; (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc ((yy_buffer_stack), num_to_alloc * sizeof(struct yy_buffer_state*) ); /* zero only the new slots.*/ memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); (yy_buffer_stack_max) = num_to_alloc; } } /** Setup the input buffer state to scan directly from a user-specified character buffer. * @param base the character buffer * @param size the size in bytes of the character buffer * * @return the newly allocated buffer state object. */ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) { YY_BUFFER_STATE b; if ( size < 2 || base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ return 0; b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; b->yy_is_our_buffer = 0; b->yy_input_file = 0; b->yy_n_chars = b->yy_buf_size; b->yy_is_interactive = 0; b->yy_at_bol = 1; b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; yy_switch_to_buffer(b ); return b; } /** Setup the input buffer state to scan a string. The next call to yylex() will * scan from a @e copy of @a str. * @param yystr a NUL-terminated string to scan * * @return the newly allocated buffer state object. * @note If you want to scan bytes that may contain NUL values, then use * yy_scan_bytes() instead. */ YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) { return yy_scan_bytes(yystr,strlen(yystr) ); } /** Setup the input buffer state to scan the given bytes. The next call to yylex() will * scan from a @e copy of @a bytes. * @param bytes the byte buffer to scan * @param len the number of bytes in the buffer pointed to by @a bytes. * * @return the newly allocated buffer state object. */ YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len ) { YY_BUFFER_STATE b; char *buf; yy_size_t n; int i; /* Get memory for full buffer, including space for trailing EOB's. */ n = _yybytes_len + 2; buf = (char *) yyalloc(n ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); for ( i = 0; i < _yybytes_len; ++i ) buf[i] = yybytes[i]; buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; b = yy_scan_buffer(buf,n ); if ( ! b ) YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); /* It's okay to grow etc. this buffer, and we should throw it * away when we're done. */ b->yy_is_our_buffer = 1; return b; } #ifndef YY_EXIT_FAILURE #define YY_EXIT_FAILURE 2 #endif static void yy_fatal_error (yyconst char* msg ) { (void) fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } /* Redefine yyless() so it works in section 3 code. */ #undef yyless #define yyless(n) \ do \ { \ /* Undo effects of setting up yytext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ yytext[yyleng] = (yy_hold_char); \ (yy_c_buf_p) = yytext + yyless_macro_arg; \ (yy_hold_char) = *(yy_c_buf_p); \ *(yy_c_buf_p) = '\0'; \ yyleng = yyless_macro_arg; \ } \ while ( 0 ) /* Accessor methods (get/set functions) to struct members. */ /** Get the current line number. * */ int yyget_lineno (void) { return yylineno; } /** Get the input stream. * */ FILE *yyget_in (void) { return yyin; } /** Get the output stream. * */ FILE *yyget_out (void) { return yyout; } /** Get the length of the current token. * */ int yyget_leng (void) { return yyleng; } /** Get the current token. * */ char *yyget_text (void) { return yytext; } /** Set the current line number. * @param line_number * */ void yyset_lineno (int line_number ) { yylineno = line_number; } /** Set the input stream. This does not discard the current * input buffer. * @param in_str A readable stream. * * @see yy_switch_to_buffer */ void yyset_in (FILE * in_str ) { yyin = in_str ; } void yyset_out (FILE * out_str ) { yyout = out_str ; } int yyget_debug (void) { return yy_flex_debug; } void yyset_debug (int bdebug ) { yy_flex_debug = bdebug ; } static int yy_init_globals (void) { /* Initialization is the same as for the non-reentrant scanner. * This function is called from yylex_destroy(), so don't allocate here. */ (yy_buffer_stack) = 0; (yy_buffer_stack_top) = 0; (yy_buffer_stack_max) = 0; (yy_c_buf_p) = (char *) 0; (yy_init) = 0; (yy_start) = 0; /* Defined in main.c */ #ifdef YY_STDINIT yyin = stdin; yyout = stdout; #else yyin = (FILE *) 0; yyout = (FILE *) 0; #endif /* For future reference: Set errno on error, since we are called by * yylex_init() */ return 0; } /* yylex_destroy is for both reentrant and non-reentrant scanners. */ int yylex_destroy (void) { /* Pop the buffer stack, destroying each element. */ while(YY_CURRENT_BUFFER){ yy_delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; yypop_buffer_state(); } /* Destroy the stack itself. */ yyfree((yy_buffer_stack) ); (yy_buffer_stack) = NULL; /* Reset the globals. This is important in a non-reentrant scanner so the next time * yylex() is called, initialization will occur. */ yy_init_globals( ); return 0; } /* * Internal utility routines. */ #ifndef yytext_ptr static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) { register int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen (yyconst char * s ) { register int n; for ( n = 0; s[n]; ++n ) ; return n; } #endif void *yyalloc (yy_size_t size ) { return (void *) malloc( size ); } void *yyrealloc (void * ptr, yy_size_t size ) { /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter * because both ANSI C and C++ allow castless assignment from * any pointer type to void*, and deal with argument conversions * as though doing an assignment. */ return (void *) realloc( (char *) ptr, size ); } void yyfree (void * ptr ) { free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" #line 62 "../../../cgdb/cgdb/src/command_lexer.l" int yywrap(void ) { { /* Silly impossible function call to stop warning of unused functions */ if ( 0 ) { yyunput(0, ""); } } return 1; } cgdb-0.6.7/cgdb/command_lexer.h000644 000765 000024 00000001752 12074441140 017277 0ustar00mmuellerstaff000000 000000 #ifndef COMMAND_LEXER_H #define COMMAND_LEXER_H /* enum TOKENS: the set of tokens that can be recognized by yylex * ------------- * SET: "set" * UNSET: for future expansion * BIND: for future expansion * MACRO: for future expansion * BOOLEAN: yes or no * NUMBER: a series of digits * IDENTIFIER: a valid identifier (letter followed by letters or numbers) * COMMAND: a recognized command (for future expansion) * STRING: a quoted-string. * EOL: end of line */ enum TOKENS { SET = 255, UNSET, BIND, MACRO, SHELL, BANG, BOOLEAN, NUMBER, IDENTIFIER, COMMAND, STRING, EOL }; /* yylex: retreive the next token from the current scan buffer * -------------- * return: an integer value representing the token type (enum TOKEN). 0 when * no more input. */ int yylex(void); /* get_token: Get the scanned token. This value will change the next time yylex is called * -------------- */ const char *get_token(void); #endif cgdb-0.6.7/cgdb/command_lexer.l000644 000765 000024 00000003577 12074441140 017312 0ustar00mmuellerstaff000000 000000 D [0-9] L [a-zA-Z_] %{ /* config_lexer.c * -------------- * THIS FILE IS GENERATED, DO NOT EDIT */ #include #include "command_lexer.h" const char * get_token( void ) { return yytext; } %} int enter_map_id = 0; /* An identifier used in a map like command */ %x MAP_ID %% if (enter_map_id) BEGIN (MAP_ID); else BEGIN (INITIAL); { #[^\n]* { /* ignore comments */ } "unset" { return UNSET; } "set" { return SET; } "bind" { return BIND; } "macro" { return MACRO; } (yes|YES|Yes|Y|y|no|NO|No|n|N) { return BOOLEAN; } ((<({L}|{D}|[^>])*>)|({L}({L}|{D})*))+\!? { return IDENTIFIER; } [+-]?{D}+ { return NUMBER; } \"(\\.|[^\\"])*\" { return STRING; } "=" { return '='; } ";" { return ';'; } "," { return ','; } (\r\n|\n\r|\n|\r) { return EOL; } [ \t\v\f] { /* ignore white-space */ } . { /* ignore bad-characters */ } } { " " { /* ignore white space */ } [^ ]+ { return IDENTIFIER; } . { /* ignore bad-characters */ } } %% int yywrap( void ) { { /* Silly impossible function call to stop warning of unused functions */ if ( 0 ) { yyunput(0, ""); } } return 1; } cgdb-0.6.7/cgdb/filedlg.c000644 000765 000024 00000036504 12074441140 016066 0ustar00mmuellerstaff000000 000000 #if HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #if HAVE_CURSES_H #include #elif HAVE_NCURSES_CURSES_H #include #endif /* HAVE_CURSES_H */ #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #if HAVE_MATH_H #include #endif /* HAVE_MATH_H */ #include "filedlg.h" #include "cgdb.h" #include "highlight.h" #include "kui_term.h" #include "highlight_groups.h" struct file_buffer { int length; /* Number of files in program */ char **files; /* Array containing file */ char *cur_line; /* cur line may have unique color */ int max_width; /* Width of longest line in file */ int sel_line; /* Current line selected in file dialog */ int sel_col; /* Current column selected in file dialog */ int sel_col_rbeg; /* Current beg column matched in regex */ int sel_col_rend; /* Current end column matched in regex */ int sel_rline; /* Current line used by regex */ }; struct filedlg { struct file_buffer *buf; /* All of the widget's data ( files ) */ WINDOW *win; /* Curses window */ }; static char regex_line[MAX_LINE]; /* The regex the user enters */ static int regex_line_pos; /* The index into the current regex */ static int regex_search; /* Currently searching text ? */ static int regex_direction; /* Direction to search */ /* print_in_middle: Prints the message 'string' centered at line in win * ---------------- * * win: Curses window * line: The line to print the message at * width: The width of the window * string: The message to print */ static void print_in_middle(WINDOW * win, int line, int width, char *string) { int x, y; int j; int length = strlen(string); getyx(win, y, x); x = (int) ((width - length) / 2); wmove(win, line, 0); for (j = 0; j < x; j++) waddch(win, ' '); mvwprintw(win, line, x, "%s", string); for (j = x + length; j < width; j++) waddch(win, ' '); } struct filedlg *filedlg_new(int pos_r, int pos_c, int height, int width) { struct filedlg *fd; /* Allocate a new structure */ if ((fd = malloc(sizeof (struct filedlg))) == NULL) return NULL; /* Initialize the structure */ fd->win = newwin(height, width, pos_r, pos_c); keypad(fd->win, TRUE); /* Initialize the buffer */ if ((fd->buf = malloc(sizeof (struct file_buffer))) == NULL) return NULL; fd->buf->length = 0; fd->buf->files = NULL; fd->buf->cur_line = NULL; fd->buf->max_width = 0; fd->buf->sel_line = 0; fd->buf->sel_col = 0; fd->buf->sel_col_rbeg = 0; fd->buf->sel_col_rend = 0; fd->buf->sel_rline = 0; return fd; } void filedlg_free(struct filedlg *fdlg) { filedlg_clear(fdlg); delwin(fdlg->win); free(fdlg->buf); free(fdlg); } int filedlg_add_file_choice(struct filedlg *fd, const char *file_choice) { int length; int index, i; int equal = 1; /* Not set to 0, because 0 *is* equal */ if (file_choice == NULL || *file_choice == '\0') return -1; /* find index to insert by comparing: * Absolute paths go to the end * Relative paths go before the absolute paths */ for (i = 0; i < fd->buf->length; i++) { /* Don't add duplicate entry's ... gdb outputs duplicates */ if ((equal = strcmp(fd->buf->files[i], file_choice)) == 0) return -3; else if (equal < 0) { /* Inserting filename, stop before relative path */ if ((file_choice[0] != '.' && file_choice[0] != '/') && fd->buf->files[i][0] == '.') break; /* Inserting filename, stop before absolute path */ if (file_choice[0] != '/' && fd->buf->files[i][0] == '/') break; } else if (equal > 0) { /* Found ( file_choice is greater ) */ /* Inserting Absolute path, it goes to the end */ if (file_choice[0] == '/' && fd->buf->files[i][0] != '/') continue; /* Inserting relative path, continue until before absolute or relative path */ if (file_choice[0] == '.' && (fd->buf->files[i][0] != '.' && fd->buf->files[i][0] != '/')) continue; break; } } index = i; fd->buf->length = fd->buf->length + 1; fd->buf->files = realloc(fd->buf->files, sizeof (char *) * fd->buf->length); /* shift everything down and then insert into index */ for (i = fd->buf->length - 1; i > index; i--) fd->buf->files[i] = fd->buf->files[i - 1]; if ((fd->buf->files[index] = strdup(file_choice)) == NULL) return -2; if ((length = strlen(file_choice)) > fd->buf->max_width) fd->buf->max_width = length; return 0; } void filedlg_clear(struct filedlg *fd) { int i; for (i = 0; i < fd->buf->length; i++) free(fd->buf->files[i]); free(fd->buf->files); fd->buf->files = NULL; free(fd->buf->cur_line); fd->buf->cur_line = NULL; fd->buf->max_width = 0; fd->buf->length = 0; fd->buf->sel_line = 0; fd->buf->sel_col = 0; fd->buf->sel_col_rbeg = 0; fd->buf->sel_col_rend = 0; fd->buf->sel_rline = 0; } static void filedlg_vscroll(struct filedlg *fd, int offset) { if (fd->buf) { fd->buf->sel_line += offset; if (fd->buf->sel_line < 0) fd->buf->sel_line = 0; /* The display message and status bar takes a line */ if (fd->buf->sel_line >= fd->buf->length) fd->buf->sel_line = fd->buf->length - 1; } } static void filedlg_hscroll(struct filedlg *fd, int offset) { int lwidth; int max_width; if (fd->buf) { lwidth = (int) log10(fd->buf->length) + 1; max_width = fd->buf->max_width - COLS + lwidth + 6; fd->buf->sel_col += offset; if (fd->buf->sel_col > max_width) fd->buf->sel_col = max_width; if (fd->buf->sel_col < 0) fd->buf->sel_col = 0; } } static void filedlg_search_regex_init(struct filedlg *fd) { if (fd == NULL || fd->buf == NULL) return; /* Start from beggining of line if not at same line */ if (fd->buf->sel_rline != fd->buf->sel_line) { fd->buf->sel_col_rend = 0; fd->buf->sel_col_rbeg = 0; } /* Start searching at the beggining of the selected line */ fd->buf->sel_rline = fd->buf->sel_line; } static int filedlg_search_regex(struct filedlg *fd, const char *regex, int opt, int direction, int icase) { if (fd == NULL || fd->buf == NULL || regex == NULL || strlen(regex) == 0) return -1; return hl_regex(regex, (const char **) fd->buf->files, (const char **) fd->buf->files, fd->buf->length, &fd->buf->cur_line, &fd->buf->sel_line, &fd->buf->sel_rline, &fd->buf->sel_col_rbeg, &fd->buf->sel_col_rend, opt, direction, icase); } int filedlg_display(struct filedlg *fd) { char fmt[5]; int width, height; int lwidth; int file; int i; int attr; static char *label = "Select a file or press q to cancel."; curs_set(0); /* Check that a file is loaded */ if (fd == NULL || fd->buf == NULL || fd->buf->files == NULL) { wrefresh(fd->win); return 0; } /* Initialize variables */ getmaxyx(fd->win, height, width); /* The status bar and display line * Fake the display function to think the height is 2 lines less */ height -= 2; /* Set starting line number (center source file if it's small enough) */ if (fd->buf->length < height) file = (fd->buf->length - height) / 2; else { file = fd->buf->sel_line - height / 2; if (file > fd->buf->length - height) file = fd->buf->length - height; else if (file < 0) file = 0; } /* Print 'height' lines of the file, starting at 'file' */ lwidth = (int) log10(fd->buf->length) + 1; sprintf(fmt, "%%%dd", lwidth); print_in_middle(fd->win, 0, width, label); wmove(fd->win, 0, 0); for (i = 1; i < height + 1; i++, file++) { wmove(fd->win, i, 0); if (has_colors()) { /* Outside of filename, just finish drawing the vertical file */ if (file < 0 || file >= fd->buf->length) { int j; for (j = 1; j < lwidth; j++) waddch(fd->win, ' '); waddch(fd->win, '~'); wattron(fd->win, A_BOLD); waddch(fd->win, VERT_LINE); wattroff(fd->win, A_BOLD); for (j = 2 + lwidth; j < width; j++) waddch(fd->win, ' '); } /* Mark the current file with an arrow */ else if (file == fd->buf->sel_line) { wattron(fd->win, A_BOLD); wprintw(fd->win, fmt, file + 1); wattroff(fd->win, A_BOLD); if (hl_groups_get_attr(hl_groups_instance, HLG_ARROW, &attr) == -1) return -1; wattron(fd->win, attr); waddch(fd->win, '-'); waddch(fd->win, '>'); wattroff(fd->win, attr); if (fd->buf->cur_line != NULL) hl_wprintw(fd->win, fd->buf->cur_line, width - lwidth - 2, fd->buf->sel_col); else hl_wprintw(fd->win, fd->buf->files[file], width - lwidth - 2, fd->buf->sel_col); } /* Ordinary file */ else { wprintw(fd->win, fmt, file + 1); wattron(fd->win, A_BOLD); waddch(fd->win, VERT_LINE); wattroff(fd->win, A_BOLD); waddch(fd->win, ' '); /* No special file information */ if (file == fd->buf->sel_line && fd->buf->cur_line != NULL) hl_wprintw(fd->win, fd->buf->cur_line, width - lwidth - 2, fd->buf->sel_col); else hl_wprintw(fd->win, fd->buf->files[file], width - lwidth - 2, fd->buf->sel_col); } } else { wprintw(fd->win, "%s\n", fd->buf->files[file]); } } /* Add the 2 lines back in so the status bar can be drawn */ height += 2; /* Update status bar */ wmove(fd->win, height, 0); /* Print white background */ if (hl_groups_get_attr(hl_groups_instance, HLG_STATUS_BAR, &attr) == -1) return -1; wattron(fd->win, attr); for (i = 0; i < width; i++) mvwprintw(fd->win, height - 1, i, " "); if (regex_search && regex_direction) mvwprintw(fd->win, height - 1, 0, "Search:%s", regex_line); else if (regex_search) mvwprintw(fd->win, height - 1, 0, "RSearch:%s", regex_line); wattroff(fd->win, attr); wmove(fd->win, height - (file - fd->buf->sel_line) - 1, lwidth + 2); wrefresh(fd->win); return 0; } void filedlg_display_message(struct filedlg *fd, char *message) { int height, width, i; int attr; if (hl_groups_get_attr(hl_groups_instance, HLG_STATUS_BAR, &attr) == -1) return; getmaxyx(fd->win, height, width); /* Print white background */ wattron(fd->win, attr); for (i = 0; i < width; i++) mvwprintw(fd->win, height - 1, i, " "); mvwprintw(fd->win, height - 1, 0, "%s", message); wattroff(fd->win, attr); wrefresh(fd->win); } /* capture_regex: Captures a regular expression from the user. * --------------- * Side Effect: * * regex_line: The regex the user has entered. * regex_line_pos: The next available index into regex_line. * * Return Value: 0 if user gave a regex, otherwise 1. */ static int capture_regex(struct filedlg *fd) { int c; extern struct kui_manager *kui_ctx; /* Initialize the function for finding a regex and tell user */ regex_search = 1; regex_line_pos = 0; regex_line[regex_line_pos] = '\0'; filedlg_display(fd); do { c = kui_manager_getkey_blocking(kui_ctx); if (regex_line_pos == (MAX_LINE - 1) && !(c == CGDB_KEY_ESC || c == 8 || c == 127)) continue; /* Quit the search if the user hit escape */ if (c == CGDB_KEY_ESC) { regex_line_pos = 0; regex_line[regex_line_pos] = '\0'; regex_search = 0; filedlg_search_regex(fd, regex_line, 2, regex_direction, 1); filedlg_display(fd); return 1; } /* If the user hit enter, then a successful regex has been recieved */ if (c == '\r' || c == '\n' || c == CGDB_KEY_CTRL_M) { regex_line[regex_line_pos] = '\0'; break; } /* If the user hit backspace or delete remove a char */ if (CGDB_BACKSPACE_KEY(c)) { if (regex_line_pos > 0) --regex_line_pos; regex_line[regex_line_pos] = '\0'; filedlg_search_regex(fd, regex_line, 1, regex_direction, 1); filedlg_display(fd); continue; } /* Add a char, search and draw */ regex_line[regex_line_pos++] = c; regex_line[regex_line_pos] = '\0'; filedlg_search_regex(fd, regex_line, 1, regex_direction, 1); filedlg_display(fd); } while (1); /* Finished */ regex_search = 0; filedlg_search_regex(fd, regex_line, 2, regex_direction, 1); filedlg_display(fd); return 0; } int filedlg_recv_char(struct filedlg *fd, int key, char *file) { int height, width; /* Initialize size variables */ getmaxyx(fd->win, height, width); filedlg_display(fd); switch (key) { case 'q': return -1; /* Vertical scrolling */ case CGDB_KEY_DOWN: case 'j': filedlg_vscroll(fd, 1); break; case CGDB_KEY_NPAGE: case CGDB_KEY_CTRL_F: /* VI-style page down */ filedlg_vscroll(fd, height - 1); break; case CGDB_KEY_UP: case 'k': filedlg_vscroll(fd, -1); break; case CGDB_KEY_PPAGE: case CGDB_KEY_CTRL_B: /* VI-style page up */ filedlg_vscroll(fd, -(height - 1)); break; /* Horizontal scrolling */ case CGDB_KEY_RIGHT: case 'l': filedlg_hscroll(fd, 1); break; case CGDB_KEY_LEFT: case 'h': filedlg_hscroll(fd, -1); break; case '/': case '?': regex_direction = ('/' == key); /* Capturing regular expressions */ filedlg_search_regex_init(fd); capture_regex(fd); break; case 'n': filedlg_search_regex(fd, regex_line, 2, regex_direction, 1); break; case 'N': filedlg_search_regex(fd, regex_line, 2, !regex_direction, 1); break; /* User selected a file */ case '\n': case '\r': case CGDB_KEY_CTRL_M: strcpy(file, fd->buf->files[fd->buf->sel_line]); return 1; default: break; } filedlg_display(fd); return 0; } cgdb-0.6.7/cgdb/filedlg.h000644 000765 000024 00000003436 12074441140 016071 0ustar00mmuellerstaff000000 000000 #ifndef _FILEDLG_H_ #define _FILEDLG_H_ struct filedlg; /* filedlg_new: Create a new file dialog. * ____________ * * pos_r: position of the viewer (row) * pos_c: position of the viewer (column) * height: height (in lines) of the viewer * width: width (in columns) of the viewer * * return value: a new filedlg object on success, null on failure. */ struct filedlg *filedlg_new(int pos_r, int pos_c, int height, int width); /* filedlg_free: Release the memory associated with a file dialog. * ------------ * * fdlg: The file dialog to free. */ void filedlg_free(struct filedlg *fdlg); /* filedlg_add_file_choice: Add a file to the list of source files. * ----------- * * file_choice: A path to a file that the user will be able to choose from. * * Return Value: Zero on success, non-zero on error. */ int filedlg_add_file_choice(struct filedlg *fd, const char *file_choice); /* filedlg_clear: Clears all the file_choice's in the dialog. * ______________ */ void filedlg_clear(struct filedlg *fd); /* filedlg_recv_char: Sens a character to the filedlg. * * fdlg: The file dialog to free. * key : The next key of input to process * file: The file the user selected * * returns -1 when aborted by user. * returns 0 when needs more input * returns 1 when done ( file is valid ) */ int filedlg_recv_char(struct filedlg *fd, int key, char *file); /* filedlg_display_message: Displays a message on the filedlg window status bar. * ------------------------ * * fd: The file dialog to use. * message: The message to display */ void filedlg_display_message(struct filedlg *fd, char *message); /* filedlg_display: Redraws the file dialog. * * Returns 0 on success or -1 on error */ int filedlg_display(struct filedlg *fd); #endif /* _FILEDLG_H_ */ cgdb-0.6.7/cgdb/highlight.c000644 000765 000024 00000035546 12074441140 016434 0ustar00mmuellerstaff000000 000000 /* highlight.c: * ------------ * * Syntax highlighting routines. * */ #if HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ /* System Includes */ #if HAVE_CTYPE_H #include #endif /* HAVE_CTYPE_H */ #if HAVE_LIMITS_H #include /* CHAR_MAX */ #endif /* HAVE_LIMITS_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #ifdef HAVE_SYS_TYPES_H #include #endif /* HAVE_SYS_TYPES_H */ #if HAVE_REGEX_H #include #endif /* HAVE_REGEX_H */ /* Local Includes */ #include "highlight.h" #include "highlight_groups.h" #include "sources.h" #include "cgdb.h" #include "tokenizer.h" #include "interface.h" #include "sys_util.h" #include "logger.h" /* ----------- */ /* Definitions */ /* ----------- */ #define HL_CHAR CHAR_MAX /* Special marker character */ /* --------------- */ /* Local Variables */ /* --------------- */ static int highlight_node(struct list_node *node) { struct tokenizer *t = tokenizer_init(); int ret; struct ibuf *ibuf = ibuf_init(); ibuf_addchar(ibuf, HL_CHAR); ibuf_addchar(ibuf, HLG_TEXT); /* Initialize */ node->buf.length = 0; node->buf.tlines = NULL; node->buf.max_width = 0; if (tokenizer_set_file(t, node->path, node->language) == -1) { if_print_message("%s:%d tokenizer_set_file error", __FILE__, __LINE__); return -1; } while ((ret = tokenizer_get_token(t)) > 0) { enum tokenizer_type e = tokenizer_get_packet_type(t); /*if_print_message ( "TOKEN(%d:%s)\n", e, tokenizer_get_printable_enum ( e ) ); */ switch (e) { case TOKENIZER_KEYWORD: ibuf_addchar(ibuf, HL_CHAR); ibuf_addchar(ibuf, HLG_KEYWORD); ibuf_add(ibuf, tokenizer_get_data(t)); ibuf_addchar(ibuf, HL_CHAR); ibuf_addchar(ibuf, HLG_TEXT); break; case TOKENIZER_TYPE: ibuf_addchar(ibuf, HL_CHAR); ibuf_addchar(ibuf, HLG_TYPE); ibuf_add(ibuf, tokenizer_get_data(t)); ibuf_addchar(ibuf, HL_CHAR); ibuf_addchar(ibuf, HLG_TEXT); break; case TOKENIZER_LITERAL: ibuf_addchar(ibuf, HL_CHAR); ibuf_addchar(ibuf, HLG_LITERAL); ibuf_add(ibuf, tokenizer_get_data(t)); ibuf_addchar(ibuf, HL_CHAR); ibuf_addchar(ibuf, HLG_TEXT); break; case TOKENIZER_NUMBER: ibuf_add(ibuf, tokenizer_get_data(t)); break; case TOKENIZER_COMMENT: ibuf_addchar(ibuf, HL_CHAR); ibuf_addchar(ibuf, HLG_COMMENT); ibuf_add(ibuf, tokenizer_get_data(t)); ibuf_addchar(ibuf, HL_CHAR); ibuf_addchar(ibuf, HLG_TEXT); break; case TOKENIZER_DIRECTIVE: ibuf_addchar(ibuf, HL_CHAR); ibuf_addchar(ibuf, HLG_DIRECTIVE); ibuf_add(ibuf, tokenizer_get_data(t)); ibuf_addchar(ibuf, HL_CHAR); ibuf_addchar(ibuf, HLG_TEXT); break; case TOKENIZER_TEXT: ibuf_add(ibuf, tokenizer_get_data(t)); break; case TOKENIZER_NEWLINE: node->buf.length++; node->buf.tlines = realloc(node->buf.tlines, sizeof (char *) * node->buf.length); node->buf.tlines[node->buf.length - 1] = strdup(ibuf_get(ibuf)); if (ibuf_length(ibuf) > node->buf.max_width) node->buf.max_width = ibuf_length(ibuf); ibuf_clear(ibuf); ibuf_addchar(ibuf, HL_CHAR); ibuf_addchar(ibuf, HLG_TEXT); break; case TOKENIZER_ERROR: ibuf_add(ibuf, tokenizer_get_data(t)); break; default: return -1; break; } } return 0; } /* --------- */ /* Functions */ /* --------- */ /* See comments in highlight.h for function descriptions. */ void highlight(struct list_node *node) { if (node->language == TOKENIZER_LANGUAGE_UNKNOWN) { /* Just copy the lines from the original buffer if no highlighting * is possible */ int i; node->buf.length = node->orig_buf.length; node->buf.max_width = node->orig_buf.max_width; node->buf.tlines = cgdb_malloc(sizeof (char *) * node->orig_buf.length); for (i = 0; i < node->orig_buf.length; i++) node->buf.tlines[i] = cgdb_strdup(node->orig_buf.tlines[i]); } else highlight_node(node); } /* highlight_line_segment: Creates a new line that is hightlighted. * ------------------------ * * orig: The line that needs to be highlighted. * start: The desired starting position of the highlighted portion. * The start index *is* included in the highlighted segment. * end: The desired ending position of the highlighted portion. * The end index *is not* include in the highlighted segment. * * Return Value: Null on error. Or a pointer to a new line that * has highlighting. The new line MUST BE FREED. */ /*#define HIGHLIGHT_DEBUG*/ static char *highlight_line_segment(const char *orig, int start, int end) { char *new_line = NULL; int length = strlen(orig), j = 0, pos = 0; int syn_search_recieved = 0, cur_color = HLG_TEXT; /* Cases not possible */ if (start > end || orig == NULL || start > length || start < 0 || end > length || end < 0) return NULL; /* The 5 is: color start (2), color end (2) and EOL */ if ((new_line = (char *) malloc(sizeof (char) * (length + 5))) == NULL) return NULL; #ifdef HIGHLIGHT_DEBUG /* for ( j = 0; j < strlen(orig); j++ ) { char temp[100]; sprintf(temp, "(%d:%c)", orig[j], orig[j]); scr_add(gdb_win, temp); } scr_add(gdb_win, "\r\n"); scr_refresh(gdb_win, 1); */ #endif /* This traverses the input line. It creates a new line with the section * given highlighted. * If a highlight symbol is encountered, the end and/or start position * is incremented because the original match was against only the text, * not against the color embedded text :) */ for (j = 0; j < length; j++) { if (orig[j] == HL_CHAR) { if (j <= start) start += 2; if (j <= end) end += 2; cur_color = orig[j + 1]; } /* Mark when the search is started and when it ends */ if (j == start) { syn_search_recieved = 1; new_line[pos++] = HL_CHAR; new_line[pos++] = HLG_SEARCH; } else if (j == end) { syn_search_recieved = 0; new_line[pos++] = HL_CHAR; new_line[pos++] = cur_color; } new_line[pos++] = orig[j]; /* If the search has started, then make all the colors the * highlighted colors */ if (syn_search_recieved && orig[j] == HL_CHAR) { ++j; new_line[pos++] = HLG_SEARCH; } } new_line[pos] = '\0'; #ifdef HIGHLIGHT_DEBUG for (j = 0; j < strlen(new_line); j++) { char temp[100]; fprintf(stderr, "(%d:%c)\r\n", new_line[j], new_line[j]); } #endif /* Now the line has new information in it. * Lets traverse it again and correct the highlighting to be the * reverse. */ return new_line; } void hl_wprintw(WINDOW * win, const char *line, int width, int offset) { int length; /* Length of the line passed in */ enum hl_group_kind color; /* Color used to print current char */ int i; /* Loops through the line char by char */ int j; /* General iterator */ int p; /* Count of chars printed to screen */ int pad; /* Used to pad partial tabs */ int attr; /* A temp variable used for attributes */ int highlight_tabstop = cgdbrc_get(CGDBRC_TABSTOP)->variant.int_val; /* Jump ahead to the character at offset (process color commands too) */ length = strlen(line); color = HLG_TEXT; for (i = 0, j = 0; i < length && j < offset; i++) { if (line[i] == HL_CHAR && i + 1 < length) { /* Even though we're not printing anything in this loop, * the color attribute needs to be maintained for when we * start printing in the loop below. This way the text * printed will be done in the correct color. */ color = (int) line[++i]; } else if (line[i] == '\t') { /* Tab character, expand to size set by user */ j += highlight_tabstop - (j % highlight_tabstop); } else { /* Normal character, just increment counter by one */ j++; } } pad = j - offset; /* Pad tab spaces if offset is less than the size of a tab */ for (j = 0, p = 0; j < pad && p < width; j++, p++) wprintw(win, " "); /* Set the color appropriately */ if (hl_groups_get_attr(hl_groups_instance, color, &attr) == -1) { logger_write_pos(logger, __FILE__, __LINE__, "hl_groups_get_attr error"); return; } wattron(win, attr); /* Print string 1 char at a time */ for (; i < length && p < width; i++) { if (line[i] == HL_CHAR) { if (++i < length) { wattroff(win, attr); color = (int) line[i]; if (hl_groups_get_attr(hl_groups_instance, color, &attr) == -1) { logger_write_pos(logger, __FILE__, __LINE__, "hl_groups_get_attr error"); return; } wattron(win, attr); } } else { switch (line[i]) { case '\t': do { wprintw(win, " "); p++; } while ((p + offset) % highlight_tabstop > 0 && p < width); break; default: wprintw(win, "%c", line[i]); p++; } } } /* Shut off color attribute */ wattroff(win, attr); for (; p < width; p++) wprintw(win, " "); } int hl_regex(const char *regex, const char **hl_lines, const char **tlines, const int length, char **cur_line, int *sel_line, int *sel_rline, int *sel_col_rbeg, int *sel_col_rend, int opt, int direction, int icase) { regex_t t; /* Regular expression */ regmatch_t pmatch[1]; /* Indexes of matches */ int i = 0, result = 0; char *local_cur_line; int success = 0; int offset = 0; int config_wrapscan = cgdbrc_get(CGDBRC_WRAPSCAN)->variant.int_val; if (tlines == NULL || tlines[0] == NULL || cur_line == NULL || sel_line == NULL || sel_rline == NULL || sel_col_rbeg == NULL || sel_col_rend == NULL) return -1; /* Clear last highlighted line */ if (*cur_line != NULL) { free(*cur_line); *cur_line = NULL; } /* If regex is empty, set current line to original line */ if (regex == NULL || *regex == '\0') { *sel_line = *sel_rline; return -2; } /* Compile the regular expression */ if (regcomp(&t, regex, REG_EXTENDED & (icase) ? REG_ICASE : 0) != 0) { regfree(&t); return -3; } /* Forward search */ if (direction) { int start = *sel_rline; int end = length; offset = *sel_col_rend; while (!success) { for (i = start; i < end; i++) { int local_cur_line_length; local_cur_line = (char *) tlines[i]; local_cur_line_length = strlen(local_cur_line); /* Add the position of the current line's last match */ if (i == *sel_rline) { if (offset >= local_cur_line_length) continue; local_cur_line += offset; } /* Found a match */ if ((result = regexec(&t, local_cur_line, 1, pmatch, 0)) == 0) { success = 1; break; } } if (success || start == 0 || !config_wrapscan) { break; } else { end = start; start = 0; } } } else { /* Reverse search */ int j, pos; int start = *sel_rline; int end = 0; offset = *sel_col_rbeg; /* Try each line */ while (!success) { for (i = start; i >= end; i--) { local_cur_line = (char *) tlines[i]; pos = strlen(local_cur_line) - 1; if (pos < 0) continue; if (i == *sel_rline) pos = offset - 1; /* Try each line, char by char starting from the end */ for (j = pos; j >= 0; j--) { if ((result = regexec(&t, local_cur_line + j, 1, pmatch, 0)) == 0) { if (i == *sel_rline && pmatch[0].rm_so > pos - j) continue; /* Found a match */ success = 1; offset = j; break; } } if (success) break; } if (success || start == length - 1 || !config_wrapscan) { break; } else { end = start; start = length - 1; } } } if (success) { /* The offset is 0 if the line was not on the original line */ if (direction && *sel_rline != i) offset = 0; /* If final match ( user hit enter ) make position perminant */ if (opt == 2) { *sel_col_rbeg = pmatch[0].rm_so + offset; *sel_col_rend = pmatch[0].rm_eo + offset; *sel_rline = i; } /* Keep the new line as the selected line */ *sel_line = i; /* If the match is not perminant then give cur_line highlighting */ if (opt != 2 && pmatch[0].rm_so != -1 && pmatch[0].rm_eo != -1) *cur_line = highlight_line_segment(hl_lines[i], pmatch[0].rm_so + offset, pmatch[0].rm_eo + offset); } else { /* On failure, the current line goes to the original line */ *sel_line = *sel_rline; } regfree(&t); return success; } cgdb-0.6.7/cgdb/highlight.h000644 000765 000024 00000004224 12074441140 016426 0ustar00mmuellerstaff000000 000000 #ifndef _HIGHLIGHT_H_ #define _HIGHLIGHT_H_ /* highlight.h: * ------------ * * Syntax highlighting routines. * */ #if HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #if HAVE_CURSES_H #include #elif HAVE_NCURSES_CURSES_H #include #endif /* HAVE_CURSES_H */ /* Local Includes */ #include "sources.h" /* --------- */ /* Functions */ /* --------- */ /* highlight: Inserts the highlighting tags into the buffer. Lines in * ---------- this file should be displayed with hl_wprintw from now on... * * node: The node containing the file buffer to highlight. */ void highlight(struct list_node *node); /* hl_wprintw: Prints a given line using the embedded highlighting commands * ----------- to dictate how to color the given line. * * win: The ncurses window to which the line will be written * line: The line to print * width: The maximum width of a line * offset: Character (in line) to start at (0..length-1) */ void hl_wprintw(WINDOW * win, const char *line, int width, int offset); /* hl_regex: Matches a regular expression to some lines. * --------- * * regex: The regular expression to match. * tlines: The lines of text to search. * length: The number of lines. * cur_line: This line is returned with highlighting embedded into it. * sel_line: The current line the user is on. * sel_rline: The current line the regular expression is on. * sel_col_rbeg: The beggining index of the last match. * sel_col_rend: The ending index of the last match. * opt: 1 -> incremental match, 2 -> perminant match * direction: 1 if forward, 0 if reverse * icase: 1 if case insensitive, 0 otherwise */ int hl_regex(const char *regex, const char **highlighted_lines, const char **tlines, const int length, char **cur_line, /* Returns the correct highlighted line */ int *sel_line, /* Returns new cur line if regex matches */ int *sel_rline, /* Used for internal purposes */ int *sel_col_rbeg, int *sel_col_rend, int opt, int direction, int icase); #endif /* _HIGHLIGHT_H_ */ cgdb-0.6.7/cgdb/highlight_groups.c000644 000765 000024 00000045402 12074441140 020023 0ustar00mmuellerstaff000000 000000 #if HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include "highlight_groups.h" #include "command_lexer.h" #include "logger.h" #if HAVE_CURSES_H #include #elif HAVE_NCURSES_CURSES_H #include #endif /* HAVE_CURSES_H */ #include #include /* term.h prototypes */ extern int tgetnum(); /* internal {{{*/ #define UNSPECIFIED_COLOR (-2) /** This represents all the data for a particular highlighting group. */ struct hl_group_info { /** The kind of group */ enum hl_group_kind kind; /** The attributes for a terminal, if it has no color support. */ int mono_attrs; /** The attributes for a terminal, if it has color support. */ int color_attrs; /** The id ncurses uses to represent a color-pair */ int color_pair; }; /** The main context used to represent all of the highlighting groups. */ struct hl_groups { /** If 0 then the terminal doesn't support colors, otherwise it does. */ int in_color; /** maximum numbers of colors on screen */ int more_colors; /** This is the data for each highlighting group. */ struct hl_group_info groups[HLG_LAST]; }; static struct hl_group_info *lookup_group_info_by_key(struct hl_groups *groups, enum hl_group_kind kind) { struct hl_group_info *lgroups; int i; for (i = 0; i < HLG_LAST; ++i) { lgroups = &groups->groups[i]; if (kind == lgroups->kind) return lgroups; } return NULL; } /** The global instance, this is used externally */ hl_groups_ptr hl_groups_instance = NULL; /** * This describes all the attributes that a highlighting group can represent. * It is used to represent the default value for a group. */ struct default_hl_group_info { /** The kind of group */ enum hl_group_kind kind; /** Same as description above. */ int mono_attrs; /** Same as description above. */ int color_attrs; /** The foreground number, representing the color. */ int fore_color; /** The background number, representing the color. */ int back_color; }; /** * The default colors and attributes when use_default_colors is not available. * This means that -1 can not be used to represent the default color * background. Currently, in this case, black is used as the color. This * could eventually be configurable. */ static const struct default_hl_group_info default_groups_for_curses[] = { {HLG_KEYWORD, A_BOLD, A_BOLD, COLOR_BLUE, COLOR_BLACK}, {HLG_TYPE, A_BOLD, A_BOLD, COLOR_GREEN, COLOR_BLACK}, {HLG_LITERAL, A_BOLD, A_BOLD, COLOR_RED, COLOR_BLACK}, {HLG_COMMENT, A_NORMAL, A_NORMAL, COLOR_YELLOW, COLOR_BLACK}, {HLG_DIRECTIVE, A_BOLD, A_BOLD, COLOR_CYAN, COLOR_BLACK}, {HLG_TEXT, A_NORMAL, A_NORMAL, COLOR_WHITE, COLOR_BLACK}, {HLG_SEARCH, A_NORMAL, A_NORMAL, COLOR_BLACK, COLOR_WHITE}, {HLG_STATUS_BAR, A_NORMAL, A_NORMAL, COLOR_BLACK, COLOR_WHITE}, {HLG_ARROW, A_BOLD, A_BOLD, COLOR_GREEN, COLOR_BLACK}, {HLG_LINE_HIGHLIGHT, A_BOLD, A_BOLD, COLOR_BLACK, COLOR_GREEN}, {HLG_ENABLED_BREAKPOINT, A_BOLD, A_BOLD, COLOR_RED, COLOR_BLACK}, {HLG_DISABLED_BREAKPOINT, A_BOLD, A_BOLD, COLOR_YELLOW, COLOR_BLACK}, {HLG_SELECTED_LINE_NUMBER, A_BOLD, A_BOLD, COLOR_WHITE, COLOR_BLACK}, {HLG_LOGO, A_BOLD, A_BOLD, COLOR_BLUE, COLOR_BLACK}, {HLG_LAST, A_NORMAL, A_NORMAL, -1, -1} }; /** * The default colors and attributes for each type of token. * This is used when ncurses is available. */ static const struct default_hl_group_info default_groups_for_background_dark[] = { {HLG_KEYWORD, A_BOLD, A_BOLD, COLOR_BLUE, -1}, {HLG_TYPE, A_BOLD, A_BOLD, COLOR_GREEN, -1}, {HLG_LITERAL, A_BOLD, A_BOLD, COLOR_RED, -1}, {HLG_COMMENT, A_NORMAL, A_NORMAL, COLOR_YELLOW, -1}, {HLG_DIRECTIVE, A_BOLD, A_BOLD, COLOR_CYAN, -1}, {HLG_TEXT, A_NORMAL, A_NORMAL, -1, -1}, {HLG_SEARCH, A_REVERSE, A_REVERSE, -1, -1}, {HLG_STATUS_BAR, A_REVERSE, A_REVERSE, -1, -1}, {HLG_ARROW, A_BOLD, A_BOLD, COLOR_GREEN, -1}, {HLG_LINE_HIGHLIGHT, A_BOLD, A_BOLD, COLOR_BLACK, COLOR_GREEN}, {HLG_ENABLED_BREAKPOINT, A_BOLD, A_BOLD, COLOR_RED, -1}, {HLG_DISABLED_BREAKPOINT, A_BOLD, A_BOLD, COLOR_YELLOW, -1}, {HLG_SELECTED_LINE_NUMBER, A_BOLD, A_BOLD, -1, -1}, {HLG_LOGO, A_BOLD, A_BOLD, COLOR_BLUE, -1}, {HLG_LAST, A_NORMAL, A_NORMAL, -1, -1} }; struct hl_group_name { /** The kind of group */ enum hl_group_kind kind; /** The name of the group */ const char *name; }; static struct hl_group_name hl_group_names[] = { {HLG_KEYWORD, "Statement"}, {HLG_TYPE, "Type"}, {HLG_LITERAL, "Constant"}, {HLG_COMMENT, "Comment"}, {HLG_DIRECTIVE, "PreProc"}, {HLG_TEXT, "Normal"}, {HLG_SEARCH, "IncSearch"}, {HLG_STATUS_BAR, "StatusLine"}, {HLG_ARROW, "Arrow"}, {HLG_LINE_HIGHLIGHT, "LineHighlight"}, {HLG_ENABLED_BREAKPOINT, "Breakpoint"}, {HLG_DISABLED_BREAKPOINT, "DisabledBreakpoint"}, {HLG_SELECTED_LINE_NUMBER, "SelectedLineNr"}, {HLG_LOGO, "Logo"}, {HLG_LAST, NULL} }; /** * Simply lookup the hl_group_kind from the name. * * \param name * The name to look up. * * \param kind * If the name is valid, kind will be returned as the group kind. * * \return * 0 on success, -1 on error. */ static int get_hl_group_kind_from_name(const char *name, enum hl_group_kind *kind) { int i; if (!name || !kind) return -1; for (i = 0; hl_group_names[i].name != NULL; ++i) if (strcasecmp(name, hl_group_names[i].name) == 0) { *kind = hl_group_names[i].kind; return 0; } return -1; } /** This maps a particular attribute to a name. */ struct attr_pair { /** The name of the attribute. */ const char *name; /** The attribute value */ int value; }; /** The list of terminal attributes that CGDB supports */ static const struct attr_pair attr_names[] = { {"bold", A_BOLD}, {"underline", A_UNDERLINE}, {"reverse", A_REVERSE}, {"inverse", A_REVERSE}, {"standout", A_STANDOUT}, {"NONE", A_NORMAL}, {"normal", A_NORMAL}, {"blink", A_BLINK}, {"dim", A_DIM}, {NULL, 0} }; const struct attr_pair *lookup_attr_pair_by_name(const char *name) { int i; for (i = 0; attr_names[i].name != NULL; ++i) if (strcasecmp(name, attr_names[i].name) == 0) return &attr_names[i]; return NULL; } /** A structure to represent a specific color. */ struct color_info { /* The name of the color */ const char *name; /* The number this color represents if the terminal supports 16 colors. */ int nr16Color; /* The number this color represents if the terminal supports 8 colors. */ int nr8Color; /* If the terminal has 8 colors, they could be bold. */ int nr8ForegroundBold; }; /** A list of all the default colors and their values */ static const struct color_info hl_color_names[] = { {"Black", 0, 0, 0}, {"DarkBlue", 1, 4, 0}, {"DarkGreen", 2, 2, 0}, {"DarkCyan", 3, 6, 0}, {"DarkRed", 4, 1, 0}, {"DarkMagenta", 5, 5, 0}, {"Brown", 6, 3, 0}, {"DarkYellow", 6, 3, 0}, {"LightGray", 7, 7, 0}, {"LightGrey", 7, 7, 0}, {"Gray", 7, 7, 0}, {"Grey", 7, 7, 0}, {"DarkGray", 8, 0, 1}, {"DarkGrey", 8, 0, 1}, {"Blue", 9, 4, 1}, {"LightBlue", 9, 4, 1}, {"Green", 10, 2, 1}, {"LightGreen", 10, 2, 1}, {"Cyan", 11, 6, 1}, {"LightCyan", 11, 6, 1}, {"Red", 12, 1, 1}, {"LightRed", 12, 1, 1}, {"Magenta", 13, 5, 1}, {"LightMagenta", 13, 5, 1}, {"Yellow", 14, 3, 1}, {"LightYellow", 14, 3, 1}, {"White", 15, 7, 1}, {NULL, 0, 0, 0} }; static const struct color_info *color_spec_for_name(const char *name) { int i; for (i = 0; hl_color_names[i].name != NULL; ++i) { if (strcasecmp(name, hl_color_names[i].name) == 0) return &hl_color_names[i]; } return NULL; } /** * Set up a highlighting group to be displayed as the user wishes. * * \param group * The highlighting group * * \param mono_attrs * Attributes avialable in mono mode * * \param color_attrs * Attributes available during color mode * * \param fore_color * The foreground color * * \param back_color * The backgroud color * * \return * 0 on success, -1 on error. */ static int setup_group(hl_groups_ptr hl_groups, enum hl_group_kind group, int mono_attrs, int color_attrs, int fore_color, int back_color) { /** Starts creating new colors at 1, and then is incremented each time. */ static int next_color_pair = 1; struct hl_group_info *info; if (!hl_groups) return -1; info = lookup_group_info_by_key(hl_groups, group); if (!info) return -1; if (mono_attrs != UNSPECIFIED_COLOR) info->mono_attrs = mono_attrs; if (color_attrs != UNSPECIFIED_COLOR) info->color_attrs = color_attrs; /* The rest of this function sets up the colors, so we can stop here * if color isn't used. */ if (!hl_groups->in_color) return 0; /* If no colors are specified, we're done. */ if (fore_color == UNSPECIFIED_COLOR && back_color == UNSPECIFIED_COLOR) return 0; /* Don't allow -1 to be used in curses mode */ #ifndef NCURSES_VERSION if (fore_color < 0 || back_color < 0) return 0; #endif /* If either the foreground or background color is unspecified, we * need to read the other so we don't clobber it. */ if (fore_color == UNSPECIFIED_COLOR) { short old_fore_color, old_back_color; pair_content(info->color_pair, &old_fore_color, &old_back_color); fore_color = old_fore_color; } else if (back_color == UNSPECIFIED_COLOR) { short old_fore_color, old_back_color; pair_content(info->color_pair, &old_fore_color, &old_back_color); back_color = old_back_color; } /* If the group is already using the default colors, and we're not changing * it, don't consume a color pair. */ if (fore_color < 0 && back_color < 0 && info->color_pair == 0) return 0; /* Allocate a new color pair if the group doesn't have one yet. */ if (info->color_pair == 0) { info->color_pair = next_color_pair; next_color_pair += 1; } /* Set up the color pair. */ if (info->color_pair < COLOR_PAIRS) { if (init_pair(info->color_pair, fore_color, back_color) != OK) return -1; } else return -1; return 0; } /* }}}*/ /* Creating and Destroying a hl_groups context. {{{*/ /*@{*/ hl_groups_ptr hl_groups_initialize(void) { int i; hl_groups_ptr hl_groups = (hl_groups_ptr) malloc(sizeof (struct hl_groups)); if (!hl_groups) return NULL; hl_groups->in_color = 0; hl_groups->more_colors = 0; for (i = 0; i < HLG_LAST; ++i) { struct hl_group_info *info; info = &hl_groups->groups[i]; info->kind = i + 1; info->mono_attrs = 0; info->mono_attrs = 0; info->color_pair = 0; } return hl_groups; } int hl_groups_shutdown(hl_groups_ptr hl_groups) { if (hl_groups) { free(hl_groups); hl_groups = NULL; } return 0; } /*@}*/ /* }}}*/ /* Functional commands {{{*/ /*@{*/ int hl_groups_setup(hl_groups_ptr hl_groups) { int i; const struct default_hl_group_info *ginfo; if (!hl_groups) return -1; #ifdef NCURSES_VERSION ginfo = default_groups_for_background_dark; #else ginfo = default_groups_for_curses; #endif hl_groups->in_color = has_colors(); if (hl_groups->in_color) hl_groups->more_colors = (tgetnum("Co") >= 16); /* Set up the default groups. */ for (i = 0; ginfo[i].kind != HLG_LAST; ++i) { int val; const struct default_hl_group_info *spec = &ginfo[i]; val = setup_group(hl_groups, spec->kind, spec->mono_attrs, spec->color_attrs, spec->fore_color, spec->back_color); if (val == -1) { logger_write_pos(logger, __FILE__, __LINE__, "setup group."); return -1; } } return 0; } int hl_groups_get_attr(hl_groups_ptr hl_groups, enum hl_group_kind kind, int *attr) { struct hl_group_info *info = lookup_group_info_by_key(hl_groups, kind); if (!hl_groups || !info || !attr) return -1; if (!hl_groups->in_color) *attr = info->mono_attrs; else { *attr = info->color_attrs; if (info->color_pair) *attr |= COLOR_PAIR(info->color_pair); } return 0; } int hl_groups_parse_config(hl_groups_ptr hl_groups) { int token, val; const char *name; int mono_attrs = UNSPECIFIED_COLOR, color_attrs = UNSPECIFIED_COLOR; int fg_color = UNSPECIFIED_COLOR, bg_color = UNSPECIFIED_COLOR; int key, attrs, color; const struct color_info *color_spec; enum hl_group_kind group_kind; const struct attr_pair *pair; enum { TERM, CTERM, FG, BG, IGNORE }; if (!hl_groups) return 1; /* First, get the "group", that is, the group. */ token = yylex(); if (token != IDENTIFIER) { #ifdef LOG_HIGHLIGHT_COMMAND_ERRORS logger_write_pos(logger, __FILE__, __LINE__, "Missing group name."); #endif return 1; } name = get_token(); val = get_hl_group_kind_from_name(name, &group_kind); if (val == -1) { #ifdef LOG_HIGHLIGHT_COMMAND_ERRORS logger_write_pos(logger, __FILE__, __LINE__, "Bad parameter name (\"%s\").", name); #endif return 1; } if (group_kind < 0) { /* Just ignore groups we don't know about (or "link", which is not * a group, but which could appear here too). */ return 0; } /* Now parse the settings for the group. */ /* At the end of each key/value(s) pair, "token" will be set to the *next* * token. That's because we have to deal with comma-separated lists. */ token = yylex(); while (1) { /* Get the next key. */ if (token == 0 || token == EOL) break; if (token != IDENTIFIER) { #ifdef LOG_HIGHLIGHT_COMMAND_ERRORS logger_write_pos(logger, __FILE__, __LINE__, "Bad parameter name (\"%s\").", get_token()); #endif return 1; } name = get_token(); /* What type of key is it? */ if (strcasecmp(name, "term") == 0) key = TERM; else if (strcasecmp(name, "cterm") == 0) key = CTERM; else if (strcasecmp(name, "ctermfg") == 0) key = FG; else if (strcasecmp(name, "ctermbg") == 0) key = BG; else key = IGNORE; /* A '=' must come next. */ if (yylex() != '=') { #ifdef LOG_HIGHLIGHT_COMMAND_ERRORS logger_write_pos(logger, __FILE__, __LINE__, "Missing '=' in \"highlight\" command."); #endif return 1; } /* Process the settings. */ token = yylex(); switch (key) { case TERM: case CTERM: attrs = 0; while (1) { /* Add in the attribute. */ if (token != IDENTIFIER) { #ifdef LOG_HIGHLIGHT_COMMAND_ERRORS logger_write_pos(logger, __FILE__, __LINE__, "Bad attribute name: \"%s\".", get_token()); #endif return 1; } name = get_token(); pair = lookup_attr_pair_by_name(name); if (!pair) { #ifdef LOG_HIGHLIGHT_COMMAND_ERRORS logger_write_pos(logger, __FILE__, __LINE__, "Unknown attribute name"); #endif return 1; } if (pair->value == -1) { #ifdef LOG_HIGHLIGHT_COMMAND_ERRORS logger_write_pos(logger, __FILE__, __LINE__, "Unknown attribute name: \"%s\".", name); #endif return 1; } attrs |= pair->value; /* Are there more attributes? */ token = yylex(); if (token != ',') break; token = yylex(); } if (key == TERM) { if (mono_attrs == UNSPECIFIED_COLOR) mono_attrs = attrs; else mono_attrs |= attrs; } else { if (color_attrs == UNSPECIFIED_COLOR) color_attrs = attrs; else color_attrs |= attrs; } break; case FG: case BG: attrs = 0; switch (token) { case NUMBER: color = atoi(get_token()); break; case IDENTIFIER: name = get_token(); color_spec = color_spec_for_name(name); if (color_spec == NULL) { #ifdef LOG_HIGHLIGHT_COMMAND_ERRORS logger_write_pos(logger, __FILE__, __LINE__, "Unknown color: \"%s\".", name); #endif return 1; } if (hl_groups->more_colors) color = color_spec->nr16Color; else { color = color_spec->nr8Color; if (color_spec->nr8ForegroundBold) { if (color_attrs == UNSPECIFIED_COLOR) color_attrs = A_BOLD; else color_attrs |= A_BOLD; } } break; default: #ifdef LOG_HIGHLIGHT_COMMAND_ERRORS logger_write_pos(logger, __FILE__, __LINE__, "Bad token for color (\"%s\").", get_token()); #endif return 1; } if (key == FG) fg_color = color; else bg_color = color; token = yylex(); break; case IGNORE: default: /* Ignore the value(s) (potentially a comma-separated list). */ while (1) { if (token != IDENTIFIER && token != NUMBER) return 1; token = yylex(); if (token != ',') break; } break; } } val = setup_group(hl_groups, group_kind, mono_attrs, color_attrs, fg_color, bg_color); if (val == -1) { return 1; } return 0; } /*@}*/ /* }}}*/ cgdb-0.6.7/cgdb/highlight_groups.h000644 000765 000024 00000007561 12074441140 020034 0ustar00mmuellerstaff000000 000000 #ifndef __HIGHLIGHT_GROUPS_H__ #define __HIGHLIGHT_GROUPS_H__ /*! * \file * highlight_group.h * * \brief * This file is dedicated to abstracting away the attributes and colors that * are used to draw particular characters on the terminal. Each group has its * own characteristics, and can be configured by the user from the cgdbrc file. * * Basically, manages the colors and attributes (bold, reverse) etc. of text on * the screen. */ /* hl_group_kind {{{*/ /** * This is all of the different syntax highlighting color possibilities. * Each enumeration value represents a highlighting group. The rest of CGDB * can use these group names to represent which attributes the user wants to * use when drawing this particular group. Each highlighting group has * default values that CGDB assigns to it. However, each of them are also * configurable. * * If you modify this enumeration, update the manual! */ enum hl_group_kind { HLG_KEYWORD = 1, HLG_TYPE, HLG_LITERAL, HLG_COMMENT, HLG_DIRECTIVE, HLG_TEXT, HLG_SEARCH, HLG_STATUS_BAR, HLG_ARROW, HLG_LINE_HIGHLIGHT, HLG_ENABLED_BREAKPOINT, HLG_DISABLED_BREAKPOINT, HLG_SELECTED_LINE_NUMBER, HLG_LOGO, HLG_LAST }; /* }}}*/ /* Createing and Destroying a hl_groups context. {{{*/ /******************************************************************************/ /** * @name Createing and Destroying a hl_groups context. * These functions are for createing and destroying a hl_groups context. */ /******************************************************************************/ /*@{*/ /** * This struct is a reference to a hl_groups instance. */ struct hl_groups; typedef struct hl_groups *hl_groups_ptr; /** * Currently, there is only a single instance. This is used (init/destroyed) * externally to this file. The entire application can use this to represent * the current highlighting groups. In the future, it's possible each window * could have there own * instance. */ extern hl_groups_ptr hl_groups_instance; /** * This initializes an hl_groups instance. * * The client must call this function before any other function in the * hl_groups library. * * @return * NULL on error, a valid context on success. */ hl_groups_ptr hl_groups_initialize(void); /** * This will terminate a hl_groups session. No functions should be called on * the hl_groups context passed into this function after this call. * * \param hl_groups * An instance of hl_groups to operate on. * * @return * 0 on success or -1 on error */ int hl_groups_shutdown(hl_groups_ptr hl_groups); /*@}*/ /* }}}*/ /* Functional commands {{{*/ /******************************************************************************/ /** * @name Functional commands * These functinos are used to ask the hl_groups context to perform a task. */ /******************************************************************************/ /*@{*/ /** * Setup the highlighting group to have all of the default values. * * \param hl_groups * An instance of hl_groups to operate on. * * \return * 0 on success or -1 on error */ int hl_groups_setup(hl_groups_ptr hl_groups); /** * Get the attributes that may be passed to wattron to tell the curses library * how to print this particular group. * * \param hl_groups * An instance of hl_groups to operate on. * * \param kind * The particular group to get the attributes for. * * \param attr * The attributes associated with this pair. * * \return * 0 on success or -1 on error */ int hl_groups_get_attr(hl_groups_ptr hl_groups, enum hl_group_kind kind, int *attr); /** * Parse a particular command. This may move into the cgdbrc file later on. * * \param hl_groups * An instance of hl_groups to operate on. * * \return * 0 on success or -1 on error */ int hl_groups_parse_config(hl_groups_ptr hl_groups); /*@}*/ /* }}}*/ #endif /* __HIGHLIGHT_GROUPS_H__ */ cgdb-0.6.7/cgdb/interface.c000644 000765 000024 00000124710 12074441140 016415 0ustar00mmuellerstaff000000 000000 /* interface.c: * ------------ * * Provides the routines for displaying the interface, and interacting with * the user via keystrokes. */ #if HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ /* System Includes */ #if HAVE_CURSES_H #include #elif HAVE_NCURSES_CURSES_H #include #endif /* HAVE_CURSES_H */ #if HAVE_SIGNAL_H #include #endif #if HAVE_STDARG_H #include #endif /* HAVE_STDARG_H */ #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #if HAVE_SYS_IOCTL_H #include #endif /* HAVE_SYS_IOCTL_H */ #if HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #if HAVE_TERMIOS_H #include #endif /* HAVE_TERMIOS_H */ #if HAVE_CTYPE_H #include #endif /* Local Includes */ #include "cgdb.h" #include "config.h" #include "logger.h" #include "interface.h" #include "kui_term.h" #include "scroller.h" #include "sources.h" #include "tgdb.h" #include "filedlg.h" #include "cgdbrc.h" #include "highlight.h" #include "highlight_groups.h" #include "fs_util.h" /* ----------- */ /* Prototypes */ /* ----------- */ /* ------------ */ /* Declarations */ /* ------------ */ extern struct tgdb *tgdb; /* ----------- */ /* Definitions */ /* ----------- */ /* This determines the minimum number of rows wants to close a window too * A window should never become smaller than this size */ static int interface_winminheight = 0; /* The offset that determines allows gdb/sources window to grow or shrink */ static int window_height_shift; /* This is for the tty I/O window */ #define TTY_WIN_DEFAULT_HEIGHT ((interface_winminheight>4)?interface_winminheight:4) static int tty_win_height_shift = 0; #define TTY_WIN_OFFSET ( TTY_WIN_DEFAULT_HEIGHT + tty_win_height_shift ) /* Height and width of the terminal */ #define HEIGHT (screen_size.ws_row) #define WIDTH (screen_size.ws_col) /* Current window split state */ WIN_SPLIT_TYPE cur_win_split = WIN_SPLIT_EVEN; /* --------------- */ /* Local Variables */ /* --------------- */ static int curses_initialized = 0; /* Flag: Curses has been initialized */ static int curses_colors = 0; /* Flag: Terminal supports colors */ static struct scroller *gdb_win = NULL; /* The GDB input/output window */ static struct scroller *tty_win = NULL; /* The tty input/output window */ static int tty_win_on = 0; /* Flag: tty window being shown */ static struct sviewer *src_win = NULL; /* The source viewer window */ static WINDOW *status_win = NULL; /* The status line */ static WINDOW *tty_status_win = NULL; /* The tty status line */ static enum Focus focus = GDB; /* Which pane is currently focused */ static struct winsize screen_size; /* Screen size */ struct filedlg *fd; /* The file dialog structure */ /* The regex the user is entering */ static struct ibuf *regex_cur = NULL; /* The last regex the user searched for */ static struct ibuf *regex_last = NULL; /* Direction to search */ static int regex_direction_cur; static int regex_direction_last; /* The position of the source file, before regex was applied. */ static int orig_line_regex; static char last_key_pressed = 0; /* Last key user entered in cgdb mode */ /* The cgdb status bar command */ static struct ibuf *cur_sbc = NULL; enum StatusBarCommandKind { /* This is represented by a : */ SBC_NORMAL, /* This is set when a regular expression is being entered */ SBC_REGEX }; static enum StatusBarCommandKind sbc_kind; /* --------------- */ /* Local Functions */ /* --------------- */ /* init_curses: Initializes curses and sets up the terminal properly. * ------------ * * Return Value: Zero on success, non-zero on failure. */ static int init_curses() { if (putenv("ESCDELAY=0") == -1) fprintf(stderr, "(%s:%d) putenv failed\r\n", __FILE__, __LINE__); initscr(); /* Start curses mode */ if ((curses_colors = has_colors())) { start_color(); #ifdef NCURSES_VERSION use_default_colors(); #else bkgdset(0); bkgd(COLOR_WHITE); #endif } refresh(); /* Refresh the initial window once */ curses_initialized = 1; return 0; } /* -------------------------------------- * Theses get the position of each window * -------------------------------------- */ /* These are for the source window */ static int get_src_row(void) { return 0; } static int get_src_col(void) { return 0; } static int get_src_height(void) { return ((int) (((screen_size.ws_row + 0.5) / 2) + window_height_shift)); } static int get_src_width(void) { return (screen_size.ws_col); } /* This is for the source window status bar */ static int get_src_status_row(void) { /* Usually would be 'get_src_row() + get_src_height()' but * the row is 0 */ return get_src_height(); } static int get_src_status_col(void) { return 0; } static int get_src_status_height(void) { return 1; } static int get_src_status_width(void) { return (screen_size.ws_col); } /* This is for the tty I/O window */ static int get_tty_row(void) { return get_src_status_row() + get_src_status_height(); } static int get_tty_col(void) { return 0; } static int get_tty_height(void) { return TTY_WIN_OFFSET; } static int get_tty_width(void) { return (screen_size.ws_col); } /* This is for the tty I/O status bar line */ static int get_tty_status_row(void) { return get_tty_row() + get_tty_height(); } static int get_tty_status_col(void) { return 0; } static int get_tty_status_height(void) { return 1; } static int get_tty_status_width(void) { return (screen_size.ws_col); } /* This is for the debugger window */ static int get_gdb_row(void) { if (tty_win_on) return get_tty_status_row() + get_tty_status_height(); return get_src_status_row() + get_src_status_height(); } static int get_gdb_col(void) { return 0; } int get_gdb_height(void) { int window_size = ((screen_size.ws_row / 2) - window_height_shift - 1); int odd_screen_size = (screen_size.ws_row % 2); if (tty_win_on) return window_size - TTY_WIN_OFFSET + odd_screen_size - 1; return window_size + odd_screen_size; } static int get_gdb_width(void) { return (screen_size.ws_col); } /* --------------------------------------- * Below is the core body of the interface * --------------------------------------- */ /* Updates the status bar */ static void update_status_win(void) { int pos; char filename[FSUTIL_PATH_MAX]; int attr; if (hl_groups_get_attr(hl_groups_instance, HLG_STATUS_BAR, &attr) == -1) return; /* Update the tty status bar */ if (tty_win_on) { wattron(tty_status_win, attr); for (pos = 0; pos < WIDTH; pos++) mvwprintw(tty_status_win, 0, pos, " "); mvwprintw(tty_status_win, 0, 0, (char *) tgdb_tty_name(tgdb)); wattroff(tty_status_win, attr); } /* Print white background */ wattron(status_win, attr); for (pos = 0; pos < WIDTH; pos++) mvwprintw(status_win, 0, pos, " "); if (tty_win_on) wattron(tty_status_win, attr); /* Show the user which window is focused */ if (focus == GDB) mvwprintw(status_win, 0, WIDTH - 1, "*"); else if (focus == TTY && tty_win_on) mvwprintw(tty_status_win, 0, WIDTH - 1, "*"); else if (focus == CGDB || focus == CGDB_STATUS_BAR) mvwprintw(status_win, 0, WIDTH - 1, " "); wattroff(status_win, attr); if (tty_win_on) wattroff(tty_status_win, attr); /* Print the regex that the user is looking for Forward */ if (focus == CGDB_STATUS_BAR && sbc_kind == SBC_REGEX && regex_direction_cur) { if_display_message("/", WIDTH - 1, "%s", ibuf_get(regex_cur)); curs_set(1); } /* Regex backwards */ else if (focus == CGDB_STATUS_BAR && sbc_kind == SBC_REGEX) { if_display_message("?", WIDTH - 1, "%s", ibuf_get(regex_cur)); curs_set(1); } /* A colon command typed at the status bar */ else if (focus == CGDB_STATUS_BAR && sbc_kind == SBC_NORMAL) { char *command = ibuf_get(cur_sbc); if (!command) command = ""; if_display_message(":", WIDTH - 1, "%s", command); curs_set(1); } /* Default: Current Filename */ else { /* Print filename */ if (src_win != NULL && source_current_file(src_win, filename) != NULL) if_display_message("", WIDTH - 1, "%s", filename); } wrefresh(status_win); } void if_display_message(const char *msg, int width, const char *fmt, ...) { va_list ap; char va_buf[MAXLINE]; char buf_display[MAXLINE]; int pos, error_length, length; int attr; if (hl_groups_get_attr(hl_groups_instance, HLG_STATUS_BAR, &attr) == -1) return; curs_set(0); if (!width) width = WIDTH; /* Get the buffer with format */ va_start(ap, fmt); #ifdef HAVE_VSNPRINTF vsnprintf(va_buf, sizeof (va_buf), fmt, ap); /* this is safe */ #else vsprintf(va_buf, fmt, ap); /* this is not safe */ #endif va_end(ap); error_length = strlen(msg); length = strlen(va_buf); if (error_length > width) strcat(strncpy(buf_display, msg, width - 1), ">"); else if (error_length + length > width) sprintf(buf_display, "%s>%s", msg, va_buf + (length - (width - error_length) + 1)); else sprintf(buf_display, "%s%s", msg, va_buf); /* Print white background */ wattron(status_win, attr); for (pos = 0; pos < WIDTH; pos++) mvwprintw(status_win, 0, pos, " "); mvwprintw(status_win, 0, 0, "%s", buf_display); wattroff(status_win, attr); wrefresh(status_win); } /* if_draw: Draws the interface on the screen. * -------- */ void if_draw(void) { /* Only redisplay the filedlg if it is up */ if (focus == FILE_DLG) { filedlg_display(fd); return; } update_status_win(); if (get_src_height() != 0 && get_gdb_height() != 0) wrefresh(status_win); if (tty_win_on) wrefresh(tty_status_win); if (get_src_height() > 0) source_display(src_win, focus == CGDB); if (tty_win_on && get_tty_height() > 0) scr_refresh(tty_win, focus == TTY); if (get_gdb_height() > 0) scr_refresh(gdb_win, focus == GDB); /* This check is here so that the cursor goes to the * cgdb window. The cursor would stay in the gdb window * on cygwin */ if (get_src_height() > 0 && focus == CGDB) wrefresh(src_win->win); } /* validate_window_sizes: * ---------------------- * * This will make sure that the gdb_window, status_bar and source window * have appropriate sizes. Each of the windows will not be able to grow * smaller than INTERFACE_WINMINHEIGHT in size. It will also restrict the * size of windows to being within the size of the terminal. */ static void validate_window_sizes(void) { int tty_window_offset = (tty_win_on) ? TTY_WIN_OFFSET + 1 : 0; int odd_height = (HEIGHT + 1) % 2; int max_window_height_shift = (HEIGHT / 2) - tty_window_offset - odd_height; int min_window_height_shift = -(HEIGHT / 2); /* update max and min based off of users winminheight request */ min_window_height_shift += interface_winminheight; max_window_height_shift -= interface_winminheight; /* Make sure that the windows offset is within its bounds: * This checks the window offset. * */ if (window_height_shift > max_window_height_shift) window_height_shift = max_window_height_shift; else if (window_height_shift < min_window_height_shift) window_height_shift = min_window_height_shift; } /* if_layout: Update the layout of the screen based on current terminal size. * ---------- * * Return Value: Zero on success, non-zero on failure. */ static int if_layout() { /* Verify the window size is reasonable */ validate_window_sizes(); /* Initialize the GDB I/O window */ if (gdb_win == NULL) { gdb_win = scr_new(get_gdb_row(), get_gdb_col(), get_gdb_height(), get_gdb_width()); if (gdb_win == NULL) return 2; } else { /* Resize the GDB I/O window */ if (get_gdb_height() > 0) scr_move(gdb_win, get_gdb_row(), get_gdb_col(), get_gdb_height(), get_gdb_width()); } /* Initialize TTY I/O window */ if (tty_win == NULL) { tty_win = scr_new(get_tty_row(), get_tty_col(), get_tty_height(), get_tty_width()); if (tty_win == NULL) return 2; } else { /* Resize the GDB I/O window */ if (get_tty_height() > 0) scr_move(tty_win, get_tty_row(), get_tty_col(), get_tty_height(), get_tty_width()); } /* Initialize the source viewer window */ if (src_win == NULL) { src_win = source_new(get_src_row(), get_src_col(), get_src_height(), get_src_width()); if (src_win == NULL) return 3; } else { /* Resize the source viewer window */ if (get_src_height() > 0) source_move(src_win, get_src_row(), get_src_col(), get_src_height(), get_src_width()); } /* Initialize the status bar window */ status_win = newwin(get_src_status_height(), get_src_status_width(), get_src_status_row(), get_src_status_col()); /* Initialize the tty status bar window */ if (tty_win_on) tty_status_win = newwin(get_tty_status_height(), get_tty_status_width(), get_tty_status_row(), get_tty_status_col()); if_draw(); return 0; } /* if_resize: Checks if a resize event occurred, and updates display if so. * ---------- * * Return Value: Zero on success, non-zero on failure. */ void rl_resize(int rows, int cols); static int if_resize() { if (ioctl(fileno(stdout), TIOCGWINSZ, &screen_size) != -1) { #ifdef NCURSES_VERSION if (screen_size.ws_row != LINES || screen_size.ws_col != COLS) { resizeterm(screen_size.ws_row, screen_size.ws_col); refresh(); rl_resize(screen_size.ws_row, screen_size.ws_col); return if_layout(); } #else /* Stupid way to resize - should work on most systems */ endwin(); LINES = screen_size.ws_row; COLS = screen_size.ws_col; refresh(); source_hscroll(src_win, 0); #endif rl_resize(screen_size.ws_row, screen_size.ws_col); return if_layout(); } return 0; } int if_resize_term(void) { if (if_resize()) return -1; return 0; } /* * increase_win_height: Increase size of source or tty window * ____________________ * * Param jump_or_tty - if 0, increase source window by 1 * if 1, if tty window is visible, increase it by 1 * else jump source window to next biggest quarter * */ static void increase_win_height(int jump_or_tty) { int height = (HEIGHT / 2) - ((tty_win_on) ? TTY_WIN_OFFSET + 1 : 0); int old_window_height_shift = window_height_shift; int old_tty_win_height_shift = tty_win_height_shift; if (jump_or_tty) { /* user input: '+' */ if (tty_win_on) { /* tty window is visible */ height = get_gdb_height() + get_tty_height(); if (tty_win_height_shift + TTY_WIN_DEFAULT_HEIGHT < height - interface_winminheight) { /* increase tty window size by 1 */ tty_win_height_shift++; } } else { /* no tty window */ if (cur_win_split == WIN_SPLIT_FREE) { /* cur position is not on mark, find nearest mark */ cur_win_split = (int) (2 * window_height_shift) / height; /* handle rounding on either side of mid-way mark */ if (window_height_shift > 0) { cur_win_split++; } } else { /* increase to next mark */ cur_win_split++; } /* check split bounds */ if (cur_win_split > WIN_SPLIT_TOP_FULL) { cur_win_split = WIN_SPLIT_TOP_FULL; } /* set window height to specified quarter mark */ window_height_shift = (int) (height * (cur_win_split / 2.0)); } } else { /* user input: '=' */ cur_win_split = WIN_SPLIT_FREE; /* cur split is not on a mark */ window_height_shift++; /* increase src window size by 1 */ } /* reduce flicker by avoiding unnecessary redraws */ if (window_height_shift != old_window_height_shift || tty_win_height_shift != old_tty_win_height_shift) { if_layout(); } } /* * decrease_win_height: Decrease size of source or tty window * ____________________ * * Param jump_or_tty - if 0, decrease source window by 1 * if 1, if tty window is visible, decrease it by 1 * else jump source window to next smallest quarter * */ static void decrease_win_height(int jump_or_tty) { int height = HEIGHT / 2; int old_window_height_shift = window_height_shift; int old_tty_win_height_shift = tty_win_height_shift; if (jump_or_tty) { /* user input: '_' */ if (tty_win_on) { /* tty window is visible */ if (tty_win_height_shift > -(TTY_WIN_DEFAULT_HEIGHT - interface_winminheight)) { /* decrease tty window size by 1 */ tty_win_height_shift--; } } else { /* no tty window */ if (cur_win_split == WIN_SPLIT_FREE) { /* cur position is not on mark, find nearest mark */ cur_win_split = (int) (2 * window_height_shift) / height; /* handle rounding on either side of mid-way mark */ if (window_height_shift < 0) { cur_win_split--; } } else { /* decrease to next mark */ cur_win_split--; } /* check split bounds */ if (cur_win_split < WIN_SPLIT_BOTTOM_FULL) { cur_win_split = WIN_SPLIT_BOTTOM_FULL; } /* set window height to specified quarter mark */ window_height_shift = (int) (height * (cur_win_split / 2.0)); } } else { /* user input: '-' */ cur_win_split = WIN_SPLIT_FREE; /* cur split is not on a mark */ window_height_shift--; /* decrease src window size by 1 */ } /* reduce flicker by avoiding unnecessary redraws */ if (window_height_shift != old_window_height_shift || tty_win_height_shift != old_tty_win_height_shift) { if_layout(); } } /* signal_handler: Handles the WINCH signal (xterm resize). * --------------- */ void rl_sigint_recved(void); static void signal_handler(int signo) { extern int resize_pipe[2]; if (signo == SIGWINCH) { int c = CGDB_KEY_RESIZE; if (write(resize_pipe[1], &c, sizeof (int)) < sizeof (int)) { logger_write_pos(logger, __FILE__, __LINE__, "write resize pipe"); } } else if (signo == SIGINT || signo == SIGTERM || signo == SIGQUIT || signo == SIGCHLD) { rl_sigint_recved(); tgdb_signal_notification(tgdb, signo); } } static void if_run_command(struct sviewer *sview, struct ibuf *ibuf_command) { char *command = ibuf_get(ibuf_command); /* refresh and return if the user entered no data */ if (ibuf_length(ibuf_command) == 0) { if_draw(); return; } if (command_parse_string(command)) { if_display_message("Unknown command: ", 0, "%s", command); } else { update_status_win(); } if_draw(); } /* tty_input: Handles user input to the tty I/O window. * ---------- * * key: Keystroke received. * * Return Value: 0 if internal key was used, * 2 if input to tty, * -1 : Error resizing terminal -- terminal too small */ static int tty_input(int key) { /* Handle special keys */ switch (key) { case CGDB_KEY_PPAGE: scr_up(tty_win, get_tty_height() - 1); break; case CGDB_KEY_NPAGE: scr_down(tty_win, get_tty_height() - 1); break; case CGDB_KEY_F11: scr_home(tty_win); break; case CGDB_KEY_F12: scr_end(tty_win); break; default: return 2; } if_draw(); return 0; } /* gdb_input: Handles user input to the GDB window. * ---------- * * key: Keystroke received. * * Return Value: 0 if internal key was used, * 1 if input to gdb or ... * -1 : Error resizing terminal -- terminal too small */ static int gdb_input(int key) { /* Handle special keys */ switch (key) { case CGDB_KEY_PPAGE: scr_up(gdb_win, get_gdb_height() - 1); break; case CGDB_KEY_NPAGE: scr_down(gdb_win, get_gdb_height() - 1); break; case CGDB_KEY_F11: scr_home(gdb_win); break; case CGDB_KEY_F12: scr_end(gdb_win); break; #if 0 /* I would like to add better support for control-l in the GDB * window, but this patch didn't make me happy enough to release it. * The problem is, when it clears the screen, it adds a lot of * whitespace in the buffer. If you hit page-up to look back in * the buffer, it's visible. This is really unacceptable. * * The approach I believe I would like to take with this, is to * have the GDB window behave more like the terminal. That is, * have GDB start at the top line, and move down as input * becomes available. Then, when you hit ctrl-l, you just move * the prompt to the top line. */ case CGDB_KEY_CTRL_L: { int height = get_gdb_height(), i; /* Allocate and print enough newlines to clear the gdb buffer. */ char *buf = (char *) cgdb_malloc(sizeof (char *) * height); for (i = 0; i < height - 1; ++i) { buf[i] = '\n'; } buf[i] = '\0'; if_print(buf); free(buf); /* Sneaky return 1 here. Basically, this allows tricks readline to think * that gdb did not handle the Ctrl-l. That way readline will also handle * it. Because readline uses TERM=dumb, that means that it will clear a * single line and put out the prompt. */ return 1; break; } #endif default: return 1; } if_draw(); return 0; } /** * Capture a regular expression from the user, one key at a time. * This modifies the global variables regex_cur and regex_last. * * \param sview * The source viewer. * * \return * 0 if user gave a regex, otherwise 1. */ static int status_bar_regex_input(struct sviewer *sview, int key) { int regex_icase = cgdbrc_get(CGDBRC_IGNORECASE)->variant.int_val; /* Flag to indicate we're done with regex mode, need to switch back */ int done = 0; /* Recieve a regex from the user. */ switch (key) { case '\r': case '\n': case CGDB_KEY_CTRL_M: /* Save for future searches via 'n' or 'N' */ if (regex_last != NULL) { ibuf_free(regex_last); } regex_last = ibuf_dup(regex_cur); regex_direction_last = regex_direction_cur; source_search_regex(sview, ibuf_get(regex_last), 2, regex_direction_last, regex_icase); if_draw(); done = 1; break; case 8: case 127: /* Backspace or DEL key */ if (ibuf_length(regex_cur) == 0) { done = 1; } else { ibuf_delchar(regex_cur); source_search_regex(sview, ibuf_get(regex_cur), 1, regex_direction_cur, regex_icase); if_draw(); update_status_win(); } break; default: if (kui_term_is_cgdb_key(key)) { const char *keycode = kui_term_get_keycode_from_cgdb_key(key); int length = strlen(keycode), i; for (i = 0; i < length; i++) ibuf_addchar(regex_cur, keycode[i]); } else { ibuf_addchar(regex_cur, key); } source_search_regex(sview, ibuf_get(regex_cur), 1, regex_direction_cur, regex_icase); if_draw(); update_status_win(); }; if (done) { ibuf_free(regex_cur); regex_cur = NULL; if_set_focus(CGDB); } return 0; } static int status_bar_normal_input(int key) { /* Flag to indicate we're done with status mode, need to switch back */ int done = 0; /* The goal of this state is to recieve a command from the user. */ switch (key) { case '\r': case '\n': case CGDB_KEY_CTRL_M: /* Found a command */ if_run_command(src_win, cur_sbc); done = 1; break; case 8: case 127: /* Backspace or DEL key */ if (ibuf_length(cur_sbc) == 0) { done = 1; } else { ibuf_delchar(cur_sbc); update_status_win(); } break; default: if (kui_term_is_cgdb_key(key)) { const char *keycode = kui_term_get_keycode_from_cgdb_key(key); int length = strlen(keycode), i; for (i = 0; i < length; i++) ibuf_addchar(cur_sbc, keycode[i]); } else { ibuf_addchar(cur_sbc, key); } update_status_win(); break; }; if (done) { ibuf_free(cur_sbc); cur_sbc = NULL; if_set_focus(CGDB); } return 0; } static int status_bar_input(struct sviewer *sview, int key) { switch (sbc_kind) { case SBC_NORMAL: return status_bar_normal_input(key); case SBC_REGEX: return status_bar_regex_input(sview, key); }; return -1; } /** * toggle a breakpoint * * \param sview * The source view * * \param t * The action to take * * \return * 0 on success, -1 on error. */ static int toggle_breakpoint(struct sviewer *sview, enum tgdb_breakpoint_action t) { char *path; int line; tgdb_request_ptr request_ptr; if (!sview || !sview->cur || !sview->cur->path) return 0; line = sview->cur->sel_line; /* Get filename (strip path off -- GDB is dumb) */ path = strrchr(sview->cur->path, '/') + 1; if (path == NULL + 1) path = sview->cur->path; /* delete an existing breakpoint */ if (sview->cur->buf.breakpts[line]) t = TGDB_BREAKPOINT_DELETE; request_ptr = tgdb_request_modify_breakpoint(tgdb, path, line + 1, t); if (!request_ptr) return -1; handle_request(tgdb, request_ptr); return 0; } /* source_input: Handles user input to the source window. * ------------- * * sview: Source viewer object * key: Keystroke received. */ static void source_input(struct sviewer *sview, int key) { switch (key) { case CGDB_KEY_UP: case 'k': /* VI-style up-arrow */ source_vscroll(sview, -1); break; case CGDB_KEY_DOWN: case 'j': /* VI-style down-arrow */ source_vscroll(sview, 1); break; case CGDB_KEY_LEFT: case 'h': source_hscroll(sview, -1); break; case CGDB_KEY_RIGHT: case 'l': source_hscroll(sview, 1); break; case CGDB_KEY_CTRL_U: /* VI-style 1/2 page up */ source_vscroll(sview, -(get_src_height() / 2)); break; case CGDB_KEY_PPAGE: case CGDB_KEY_CTRL_B: /* VI-style page up */ source_vscroll(sview, -(get_src_height() - 1)); break; case CGDB_KEY_CTRL_D: /* VI-style 1/2 page down */ source_vscroll(sview, (get_src_height() / 2)); break; case CGDB_KEY_NPAGE: case CGDB_KEY_CTRL_F: /* VI-style page down */ source_vscroll(sview, get_src_height() - 1); break; case 'g': /* beggining of file */ if (last_key_pressed == 'g') source_set_sel_line(sview, 1); break; case 'G': /* end of file */ source_set_sel_line(sview, 10000000); break; case '=': /* inc window by 1 */ increase_win_height(0); break; case '-': /* dec window by 1 */ decrease_win_height(0); break; case '+': /* inc to jump or inc tty */ increase_win_height(1); break; case '_': /* dec to jump or dec tty */ decrease_win_height(1); break; case 'o': /* Causes file dialog to be opened */ { extern int kui_input_acceptable; kui_input_acceptable = 0; tgdb_request_ptr request_ptr; request_ptr = tgdb_request_inferiors_source_files(tgdb); handle_request(tgdb, request_ptr); } break; case ' ': { enum tgdb_breakpoint_action t = TGDB_BREAKPOINT_ADD; toggle_breakpoint(sview, t); } break; case 't': { enum tgdb_breakpoint_action t = TGDB_TBREAKPOINT_ADD; toggle_breakpoint(sview, t); } break; default: break; } /* Some extended features that are set by :set sc */ if_draw(); } /* Sets up the signal handler for SIGWINCH * Returns -1 on error. Or 0 on success */ static int set_up_signal(void) { struct sigaction action; action.sa_handler = signal_handler; sigemptyset(&action.sa_mask); action.sa_flags = 0; if (sigaction(SIGWINCH, &action, NULL) < 0) { logger_write_pos(logger, __FILE__, __LINE__, "sigaction failed "); return -1; } if (sigaction(SIGINT, &action, NULL) < 0) { logger_write_pos(logger, __FILE__, __LINE__, "sigaction failed "); return -1; } if (sigaction(SIGTERM, &action, NULL) < 0) { logger_write_pos(logger, __FILE__, __LINE__, "sigaction failed "); return -1; } if (sigaction(SIGQUIT, &action, NULL) < 0) { logger_write_pos(logger, __FILE__, __LINE__, "sigaction failed "); return -1; } if (sigaction(SIGCHLD, &action, NULL) < 0) { logger_write_pos(logger, __FILE__, __LINE__, "sigaction failed "); return -1; } return 0; } /* ----------------- */ /* Exposed Functions */ /* ----------------- */ /* See interface.h for function descriptions. */ int if_init(void) { if (init_curses()) return 1; hl_groups_instance = hl_groups_initialize(); if (!hl_groups_instance) return 3; if (hl_groups_setup(hl_groups_instance) == -1) return 3; /* Set up the signal handler to catch SIGWINCH */ if (set_up_signal() == -1) return 2; if (ioctl(fileno(stdout), TIOCGWINSZ, &screen_size) == -1) { screen_size.ws_row = LINES; screen_size.ws_col = COLS; } /* Create the file dialog object */ if ((fd = filedlg_new(0, 0, HEIGHT, WIDTH)) == NULL) return 5; /* Set up window layout */ window_height_shift = (int) ((HEIGHT / 2) * (cur_win_split / 2.0)); switch (if_layout()) { case 2: return 4; } return 0; } int internal_if_input(int key) { int regex_icase = cgdbrc_get(CGDBRC_IGNORECASE)->variant.int_val; /* Normally, CGDB_KEY_ESC, but can be configured by the user */ int cgdb_mode_key = cgdbrc_get(CGDBRC_CGDB_MODE_KEY)->variant.int_val; /* The cgdb mode key, puts the debugger into command mode */ if (focus != CGDB && key == cgdb_mode_key) { /* Depending on which cgdb was in, it can free some memory here that * it was previously using. */ if (focus == CGDB_STATUS_BAR && sbc_kind == SBC_NORMAL) { ibuf_free(cur_sbc); cur_sbc = NULL; } else if (focus == CGDB_STATUS_BAR && sbc_kind == SBC_REGEX) { ibuf_free(regex_cur); regex_cur = NULL; free(src_win->cur->buf.cur_line); src_win->cur->buf.cur_line = NULL; src_win->cur->sel_rline = orig_line_regex; src_win->cur->sel_line = orig_line_regex; } if_set_focus(CGDB); return 0; } /* If you are already in cgdb mode, the cgdb mode key does nothing */ else if (key == cgdb_mode_key) return 0; /* Check for global keystrokes */ switch (focus) { case CGDB: switch (key) { case 'i': if_set_focus(GDB); return 0; case 'I': if_set_focus(TTY); return 0; case ':': /* Set the type of the command the user is typing in the status bar */ sbc_kind = SBC_NORMAL; if_set_focus(CGDB_STATUS_BAR); /* Since the user is about to type in a command, allocate a buffer * in which this command can be stored. */ cur_sbc = ibuf_init(); return 0; case '/': case '?': if (src_win->cur != NULL) { regex_cur = ibuf_init(); regex_direction_cur = ('/' == key); orig_line_regex = src_win->cur->sel_line; sbc_kind = SBC_REGEX; if_set_focus(CGDB_STATUS_BAR); /* Capturing regular expressions */ source_search_regex_init(src_win); /* Initialize the function for finding a regex and tell user */ if_draw(); } return 0; case 'n': source_search_regex(src_win, ibuf_get(regex_last), 2, regex_direction_last, regex_icase); if_draw(); break; case 'N': source_search_regex(src_win, ibuf_get(regex_last), 2, !regex_direction_last, regex_icase); if_draw(); break; case 'T': if (tty_win_on) { tty_win_on = 0; focus = CGDB; } else { tty_win_on = 1; focus = TTY; } if_layout(); break; case CGDB_KEY_CTRL_T: if (tgdb_tty_new(tgdb) == -1) { /* Error */ } else { scr_free(tty_win); tty_win = NULL; if_layout(); } break; case CGDB_KEY_F1: if_display_help(); return 0; case CGDB_KEY_F5: /* Issue GDB run command */ { tgdb_request_ptr request_ptr; request_ptr = tgdb_request_run_debugger_command(tgdb, TGDB_RUN); handle_request(tgdb, request_ptr); } return 0; case CGDB_KEY_F6: /* Issue GDB continue command */ { tgdb_request_ptr request_ptr; request_ptr = tgdb_request_run_debugger_command(tgdb, TGDB_CONTINUE); handle_request(tgdb, request_ptr); } return 0; case CGDB_KEY_F7: /* Issue GDB finish command */ { tgdb_request_ptr request_ptr; request_ptr = tgdb_request_run_debugger_command(tgdb, TGDB_FINISH); handle_request(tgdb, request_ptr); } return 0; case CGDB_KEY_F8: /* Issue GDB next command */ { tgdb_request_ptr request_ptr; request_ptr = tgdb_request_run_debugger_command(tgdb, TGDB_NEXT); handle_request(tgdb, request_ptr); } return 0; case CGDB_KEY_F10: /* Issue GDB step command */ { tgdb_request_ptr request_ptr; request_ptr = tgdb_request_run_debugger_command(tgdb, TGDB_STEP); handle_request(tgdb, request_ptr); } return 0; case CGDB_KEY_CTRL_L: if_layout(); return 0; } source_input(src_win, key); return 0; break; case TTY: return tty_input(key); case GDB: return gdb_input(key); case FILE_DLG: { static char filedlg_file[MAX_LINE]; int ret = filedlg_recv_char(fd, key, filedlg_file); /* The user cancelled */ if (ret == -1) { if_set_focus(CGDB); return 0; /* Needs more data */ } else if (ret == 0) { return 0; /* The user picked a file */ } else if (ret == 1) { tgdb_request_ptr request_ptr; request_ptr = tgdb_request_filename_pair(tgdb, filedlg_file); handle_request(tgdb, request_ptr); if_set_focus(CGDB); return 0; } } return 0; case CGDB_STATUS_BAR: return status_bar_input(src_win, key); } /* Never gets here */ return 0; } int if_input(int key) { int result = internal_if_input(key); last_key_pressed = key; return result; } void if_tty_print(const char *buf) { /* If the tty I/O window is not open send output to gdb window */ if (!tty_win_on) if_print(buf); /* Print it to the scroller */ scr_add(tty_win, buf); /* Only need to redraw if tty_win is being displayed */ if (tty_win_on && get_gdb_height() > 0) { scr_refresh(tty_win, focus == TTY); /* Make sure cursor reappears in source window if focus is there */ if (focus == CGDB) wrefresh(src_win->win); } } void if_print(const char *buf) { /* Print it to the scroller */ scr_add(gdb_win, buf); if (get_gdb_height() > 0) { scr_refresh(gdb_win, focus == GDB); /* Make sure cursor reappears in source window if focus is there */ if (focus == CGDB) wrefresh(src_win->win); } } void if_print_message(const char *fmt, ...) { va_list ap; char va_buf[MAXLINE]; /* Get the buffer with format */ va_start(ap, fmt); #ifdef HAVE_VSNPRINTF vsnprintf(va_buf, sizeof (va_buf), fmt, ap); /* this is safe */ #else vsprintf(va_buf, fmt, ap); /* this is not safe */ #endif va_end(ap); if_print(va_buf); } void if_show_file(char *path, int line) { if (source_set_exec_line(src_win, path, line) == 0) if_draw(); } void if_display_help(void) { char cgdb_help_file[MAXLINE]; int ret_val = 0; fs_util_get_path(PKGDATADIR, "cgdb.txt", cgdb_help_file); ret_val = source_set_exec_line(src_win, cgdb_help_file, 1); if (ret_val == 0) if_draw(); else if (ret_val == 5) /* File does not exist */ if_display_message("No such file: %s", 0, cgdb_help_file); } struct sviewer *if_get_sview() { return src_win; } void if_clear_filedlg(void) { filedlg_clear(fd); } void if_add_filedlg_choice(const char *filename) { filedlg_add_file_choice(fd, filename); } void if_filedlg_display_message(char *message) { filedlg_display_message(fd, message); } void if_shutdown(void) { /* Shut down curses cleanly */ if (curses_initialized) endwin(); if (status_win != NULL) delwin(status_win); if (tty_status_win != NULL) delwin(tty_status_win); if (gdb_win != NULL) scr_free(gdb_win); if (tty_win != NULL) scr_free(tty_win); if (src_win != NULL) source_free(src_win); } void if_set_focus(Focus f) { switch (f) { case GDB: focus = f; if_draw(); break; case TTY: if (tty_win_on) { focus = f; if_draw(); } break; case CGDB: focus = f; if_draw(); break; case FILE_DLG: focus = f; if_draw(); break; case CGDB_STATUS_BAR: focus = f; if_draw(); default: return; } } Focus if_get_focus(void) { return focus; } void if_set_winsplit(WIN_SPLIT_TYPE new_split) { cur_win_split = new_split; window_height_shift = (int) ((HEIGHT / 2) * (cur_win_split / 2.0)); if_layout(); } void if_highlight_sviewer(enum tokenizer_language_support l) { /* src_win->cur is NULL when reading cgdbrc */ if (src_win->cur) { src_win->cur->language = l; highlight(src_win->cur); if_draw(); } } int if_change_winminheight(int value) { if (value < 0) return -1; else if (tty_win_on && value > HEIGHT / 3) return -1; else if (value > HEIGHT / 2) return -1; interface_winminheight = value; if_layout(); return 0; } int if_clear_line() { int width = get_gdb_width(); int i; char line[width + 3]; line[0] = '\r'; for (i = 1; i <= width; ++i) line[i] = ' '; line[i] = '\r'; line[i + 1] = '\0'; if_print(line); return 0; } cgdb-0.6.7/cgdb/interface.h000644 000765 000024 00000012153 12074441140 016417 0ustar00mmuellerstaff000000 000000 /* interface.h: * ------------ * * Provides the routines for displaying the interface, and interacting with * the user via keystrokes. */ #ifndef _INTERFACE_H_ #define _INTERFACE_H_ /* Local Includes */ #include "sources.h" #include "cgdbrc.h" /* --------- */ /* Functions */ /* --------- */ /* if_init: Initializes the interface. * -------- * * Return Value: Zero on success, or... * 1: Initializing curses failed * 2: Signal handler install failed * 3: hl groups couldn't be setup * 4: Can't create new GDB scroller * 5: Can not init the file dialog */ int if_init(void); /* if_input: Handles special input keys from user. * --------- * * key: Key code that was received. * * Return Value: 0 if internal key was used, * 1 if input to gdb, * 2 if input to tty or ... * -1 : Quit cgdb */ /* if_resize_term: Resizes the application to the current term size. * -------------- * * Return Value: -1 on error, 0 on success */ int if_resize_term(void); int if_input(int key); /* if_print: Prints data to the GDB input/output window. * --------- * * buf: NULL-terminated buffer to display. */ void if_print(const char *buf); /* if_print_message: Prints data to the GDB input/output window. * ----------------- * * fmt: The message to display */ void if_print_message(const char *fmt, ...); /* if_tty_print: Prints data to the tty input/output window. * ------------- * * buf: NULL-terminated buffer to display. */ void if_tty_print(const char *buf); /* if_show_file: Displays the requested file in the source display window. * ------------- * * path: Full path to the file to display * line: Current line of the file being executed */ void if_show_file(char *path, int line); /* if_get_sview: Return a pointer to the source viewer object. * ------------- */ struct sviewer *if_get_sview(); /* if_display_message: Displays a message on the source window status bar. * ------------------- * * msg: A message to the user. This will not be truncated unless the width * of the terminal is smaller than this message. * msg should never be NULL. use "" instead. * * width: The width of the status bar to use up before truncating. * If width is 0 then if_display_message will assume the whole width * of the terminal. * * fmt: The message to display */ void if_display_message(const char *msg, int width, const char *fmt, ...); /* if_clear_filedlg: Clears all the files the file dialog has to show the user. * ----------------- */ void if_clear_filedlg(void); /* if_add_fildlg_choice: adds the file filename to the choices the user gets. * --------------------- * * filename: a file the user can choose to open. */ void if_add_filedlg_choice(const char *filename); /* if_filedlg_display_message: Displays a message on the filedlg window status bar. * --------------------------- * * message: The message to display */ void if_filedlg_display_message(char *message); /* if_shutdown: Cleans up, and restores the terminal (shuts off curses). * ------------ */ void if_shutdown(void); /* enum Focus: An enumeration representing a focus state. * ------------ * GDB: focus on the gdb i/o window * TTY: focus on the debugged program i/o window * CGDB: focus on source window, accepts command input. * CGDB_STATUS_BAR: focus on the status bar, accepts commands. * FILE_DLG: focus on file dialog window */ typedef enum Focus { GDB, TTY, CGDB, CGDB_STATUS_BAR, FILE_DLG } Focus; /* if_set_focus: Sets the current input focus to a different window * ------------ * f: The region to focus */ void if_set_focus(Focus f); /* if_get_focus: Sets the current input focus to a different window * ------------ * Return: The region thats focused */ Focus if_get_focus(void); /* if_display_help: Displays the help on the screen. * ------------ */ void if_display_help(void); /* if_search_next: finds the next match in a given direction. * ------------ */ void if_search_next(void); /* if_tty_toggle: * ------------ */ void if_tty_toggle(void); /* if_draw: * ----------- */ void if_draw(void); /* if_set_winsplit: * ________________ */ void if_set_winsplit(WIN_SPLIT_TYPE newSplit); /* if_highlight_sviewer: * --------------------- * * Highlights the current node of the source viewer to be the * new language type. * * l The new langugage type to highlight. */ void if_highlight_sviewer(enum tokenizer_language_support l); /* if_change_winminheight: * ----------------------- * * This sets the minimal height of a window. Windows will never become smaller. * * Returns -1 if value is not acceptable. Otherwise, 0. */ int if_change_winminheight(int value); /** * This get's the height size of the GDB window. * * \return * The size of the window. */ int get_gdb_height(void); /** * Will clear the last line in the GDB window. This function is slightly slow * as it writes spaces all the way, if it's necessary or not. * * \return * 0 on success or -1 on error */ int if_clear_line(void); #endif cgdb-0.6.7/cgdb/logo.c000644 000765 000024 00000011062 12074441140 015410 0ustar00mmuellerstaff000000 000000 /* logo.c * ------ * Data for ASCII logos. * * These logos were generated thanks to Jörg Seyfferth and his web-based * ASCII-text generator: http://www.network-science.de/ascii/ */ #if HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ /* System Includes */ #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #if HAVE_TIME_H #include #endif /* HAVE_TIME_H */ #ifdef HAVE_SYS_TIME_H #include #endif /* HAVE_SYS_TIME_H */ /* Local Includes */ #include "cgdb.h" #include "logo.h" #include "highlight_groups.h" /* ----------- */ /* Definitions */ /* ----------- */ #define CGDB_NUM_LOGOS 4 /* --------------- */ /* Data Structures */ /* --------------- */ struct Logo{ int h; /* Height of logo */ char *data[11]; /* Increase the array size as necessary */ }; static struct Logo CGDB_LOGO[CGDB_NUM_LOGOS] = { { 6, { " .______. ", " ____ ____ __| _/\\_ |__ ", "_/ ___\\ / ___\\ / __ | | __ \\ ", "\\ \\___/ /_/ > /_/ | | \\_\\ \\", " \\___ >___ /\\____ | |___ /", " \\/_____/ \\/ \\/ " } }, { 7, { " _| _| ", " _|_|_| _|_|_| _|_|_| _|_|_| ", "_| _| _| _| _| _| _|", "_| _| _| _| _| _| _|", " _|_|_| _|_|_| _|_|_| _|_|_| ", " _| ", " _|_| " } }, { 11, { "============================", "================== == ====", "================== == ====", "================== == ====", "== ==== ====== == ====", "= = == = === == ==", "= ====== == = == = =", "= ======== == = == = =", "= = == = == = == = =", "== ==== ==== == ==", "============================" } }, { 6, { "_______________________________/\\/\\__/\\/\\_______", "___/\\/\\/\\/\\____/\\/\\/\\/\\________/\\/\\__/\\/\\_______", "_/\\/\\________/\\/\\__/\\/\\____/\\/\\/\\/\\__/\\/\\/\\/\\___", "_/\\/\\__________/\\/\\/\\/\\__/\\/\\__/\\/\\__/\\/\\__/\\/\\_", "___/\\/\\/\\/\\________/\\/\\____/\\/\\/\\/\\__/\\/\\/\\/\\___", "_____________/\\/\\/\\/\\___________________________" } } }; static char *usage[] = { "type q to exit ", "type help for GDB help ", "type :help for CGDB help" }; /* --------- */ /* Functions */ /* --------- */ static void center_line(WINDOW *win, int row, int width, char *data) { mvwprintw(win, row, (width - strlen(data))/2, data); } void logo_display(WINDOW *win) { static int logo = -1; /* Logo index */ int height, width; /* Dimensions of the window */ int line; /* Starting line */ int usage_height; /* Height of the usage message */ int i, j; /* Iterators */ int attr; if (hl_groups_get_attr (hl_groups_instance, HLG_LOGO, &attr) == -1) return; /* Get dimensions */ getmaxyx(win, height, width); usage_height = sizeof(usage)/sizeof(char *); /* Clear the window */ wmove(win, 0, 0); for (i = 0; i < height; i++){ for (j = 0; j < width; j++) wprintw(win, " "); wprintw(win, "\n"); } /* Display cgdb logo */ wattron(win, attr); /* Pick a random logo */ if (logo == -1){ srand(time(NULL)); logo = rand() % CGDB_NUM_LOGOS; } /* If the logo fits on the screen, draw it */ if (CGDB_LOGO[logo].h <= height - usage_height - 4){ line = (height - CGDB_LOGO[logo].h - usage_height - 4)/2; wmove(win, line, 0); for(i = 0; i < CGDB_LOGO[logo].h; i++) center_line(win, i+line, width, CGDB_LOGO[logo].data[i]); center_line(win, ++i + line, width, "a curses debugger"); } else{ line = (height - usage_height - 4)/2; center_line(win, line, width, "CGDB: a curses debugger"); i = 0; } center_line(win, ++i + line, width, "version " VERSION); i++; /* Show simple usage info */ for (j = 0; j < sizeof(usage)/sizeof(char *); j++) center_line(win, ++i + line, width, usage[j]); wattroff(win, attr); curs_set(0); /* Hide the cursor */ } cgdb-0.6.7/cgdb/logo.h000644 000765 000024 00000001161 12074441140 015414 0ustar00mmuellerstaff000000 000000 /* logo.h: Routine for displaying an ASCII-art CGDB logo on screen. * ------- */ #ifndef _LOGO_H_ #define _LOGO_H_ #if HAVE_CURSES_H #include #elif HAVE_NCURSES_CURSES_H #include #endif /* HAVE_CURSES_H */ /* ------------------- */ /* Function Prototypes */ /* ------------------- */ /* logo_display: Chooses a random CGDB logo (only once) and displays it with * ------------- some basic help text for first-time users. * * win: The curses window to use. If the logo won't fit in the given * window, only the title is shown. */ void logo_display(WINDOW * win); #endif cgdb-0.6.7/cgdb/Makefile.am000644 000765 000024 00000002664 12074441140 016350 0ustar00mmuellerstaff000000 000000 DEFS += -DPKGDATADIR=\"$(pkgdatadir)\" AM_CFLAGS = \ -I$(top_srcdir)/lib/adt \ -I$(top_srcdir)/lib/kui \ -I$(top_srcdir)/lib/rline \ -I$(top_srcdir)/lib/util \ -I$(top_srcdir)/lib/tgdb/tgdb-base \ -I$(top_srcdir)/lib/tgdb/annotate-two \ -I$(top_srcdir)/lib/tgdb/gdbmi \ -I$(top_srcdir)/lib/tokenizer bin_PROGRAMS = cgdb cgdb_LDFLAGS = \ -L$(top_builddir)/lib/adt \ -L$(top_builddir)/lib/kui \ -L$(top_builddir)/lib/rline \ -L$(top_builddir)/lib/tokenizer \ -L$(top_builddir)/lib/util \ -L$(top_builddir)/lib/tgdb/annotate-two \ -L$(top_builddir)/lib/tgdb/gdbmi \ -L$(top_builddir)/lib/tgdb/tgdb-base cgdb_LDADD = \ $(top_builddir)/lib/tgdb/tgdb-base/libtgdb.a \ $(top_builddir)/lib/tgdb/annotate-two/libtgdb_a2.a \ $(top_builddir)/lib/tgdb/gdbmi/libtgdb_mi.a \ $(top_builddir)/lib/tokenizer/libtokenizer.a \ $(top_builddir)/lib/kui/libkui.a \ $(top_builddir)/lib/rline/librline.a \ $(top_builddir)/lib/adt/libadt.a \ $(top_builddir)/lib/util/libutil.a noinst_HEADERS = \ command_lexer.h cgdb_SOURCES = \ cgdb.c \ cgdb.h \ cgdbrc.c \ cgdbrc.h \ command_lexer.l \ filedlg.c \ filedlg.h \ highlight.c \ highlight.h \ highlight_groups.c \ highlight_groups.h \ interface.c \ interface.h \ logo.c \ logo.h \ scroller.c \ scroller.h \ sources.c \ sources.h \ usage.c \ usage.h cgdb-0.6.7/cgdb/Makefile.in000644 000765 000024 00000046004 12074766252 016373 0ustar00mmuellerstaff000000 000000 # Makefile.in generated by automake 1.13.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ bin_PROGRAMS = cgdb$(EXEEXT) subdir = cgdb DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ command_lexer.c $(top_srcdir)/config/depcomp \ $(top_srcdir)/config/ylwrap $(noinst_HEADERS) TODO ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/config/readline_check_version.m4 \ $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" PROGRAMS = $(bin_PROGRAMS) am_cgdb_OBJECTS = cgdb.$(OBJEXT) cgdbrc.$(OBJEXT) \ command_lexer.$(OBJEXT) filedlg.$(OBJEXT) highlight.$(OBJEXT) \ highlight_groups.$(OBJEXT) interface.$(OBJEXT) logo.$(OBJEXT) \ scroller.$(OBJEXT) sources.$(OBJEXT) usage.$(OBJEXT) cgdb_OBJECTS = $(am_cgdb_OBJECTS) cgdb_DEPENDENCIES = $(top_builddir)/lib/tgdb/tgdb-base/libtgdb.a \ $(top_builddir)/lib/tgdb/annotate-two/libtgdb_a2.a \ $(top_builddir)/lib/tgdb/gdbmi/libtgdb_mi.a \ $(top_builddir)/lib/tokenizer/libtokenizer.a \ $(top_builddir)/lib/kui/libkui.a \ $(top_builddir)/lib/rline/librline.a \ $(top_builddir)/lib/adt/libadt.a \ $(top_builddir)/lib/util/libutil.a cgdb_LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(cgdb_LDFLAGS) $(LDFLAGS) \ -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = LEXCOMPILE = $(LEX) $(AM_LFLAGS) $(LFLAGS) AM_V_LEX = $(am__v_LEX_@AM_V@) am__v_LEX_ = $(am__v_LEX_@AM_DEFAULT_V@) am__v_LEX_0 = @echo " LEX " $@; am__v_LEX_1 = YLWRAP = $(top_srcdir)/config/ylwrap SOURCES = $(cgdb_SOURCES) DIST_SOURCES = $(cgdb_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac HEADERS = $(noinst_HEADERS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ -DPKGDATADIR=\"$(pkgdatadir)\" DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ RL_MAJOR = @RL_MAJOR@ RL_MINOR = @RL_MINOR@ RL_VERSION = @RL_VERSION@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ YACC = @YACC@ YFLAGS = @YFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CFLAGS = \ -I$(top_srcdir)/lib/adt \ -I$(top_srcdir)/lib/kui \ -I$(top_srcdir)/lib/rline \ -I$(top_srcdir)/lib/util \ -I$(top_srcdir)/lib/tgdb/tgdb-base \ -I$(top_srcdir)/lib/tgdb/annotate-two \ -I$(top_srcdir)/lib/tgdb/gdbmi \ -I$(top_srcdir)/lib/tokenizer cgdb_LDFLAGS = \ -L$(top_builddir)/lib/adt \ -L$(top_builddir)/lib/kui \ -L$(top_builddir)/lib/rline \ -L$(top_builddir)/lib/tokenizer \ -L$(top_builddir)/lib/util \ -L$(top_builddir)/lib/tgdb/annotate-two \ -L$(top_builddir)/lib/tgdb/gdbmi \ -L$(top_builddir)/lib/tgdb/tgdb-base cgdb_LDADD = \ $(top_builddir)/lib/tgdb/tgdb-base/libtgdb.a \ $(top_builddir)/lib/tgdb/annotate-two/libtgdb_a2.a \ $(top_builddir)/lib/tgdb/gdbmi/libtgdb_mi.a \ $(top_builddir)/lib/tokenizer/libtokenizer.a \ $(top_builddir)/lib/kui/libkui.a \ $(top_builddir)/lib/rline/librline.a \ $(top_builddir)/lib/adt/libadt.a \ $(top_builddir)/lib/util/libutil.a noinst_HEADERS = \ command_lexer.h cgdb_SOURCES = \ cgdb.c \ cgdb.h \ cgdbrc.c \ cgdbrc.h \ command_lexer.l \ filedlg.c \ filedlg.h \ highlight.c \ highlight.h \ highlight_groups.c \ highlight_groups.h \ interface.c \ interface.h \ logo.c \ logo.h \ scroller.c \ scroller.h \ sources.c \ sources.h \ usage.c \ usage.h all: all-am .SUFFIXES: .SUFFIXES: .c .l .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu cgdb/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu cgdb/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ fi; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p \ ; then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' \ -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' \ `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) cgdb$(EXEEXT): $(cgdb_OBJECTS) $(cgdb_DEPENDENCIES) $(EXTRA_cgdb_DEPENDENCIES) @rm -f cgdb$(EXEEXT) $(AM_V_CCLD)$(cgdb_LINK) $(cgdb_OBJECTS) $(cgdb_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cgdb.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cgdbrc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/command_lexer.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filedlg.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/highlight.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/highlight_groups.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/interface.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/logo.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scroller.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sources.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/usage.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .l.c: $(AM_V_LEX)$(am__skiplex) $(SHELL) $(YLWRAP) $< $(LEX_OUTPUT_ROOT).c $@ -- $(LEXCOMPILE) ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(bindir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -rm -f command_lexer.c clean: clean-am clean-am: clean-binPROGRAMS clean-generic mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-binPROGRAMS install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-binPROGRAMS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \ clean-binPROGRAMS clean-generic cscopelist-am ctags ctags-am \ distclean distclean-compile distclean-generic distclean-tags \ distdir dvi dvi-am html html-am info info-am install \ install-am install-binPROGRAMS install-data install-data-am \ install-dvi install-dvi-am install-exec install-exec-am \ install-html install-html-am install-info install-info-am \ install-man install-pdf install-pdf-am install-ps \ install-ps-am install-strip installcheck installcheck-am \ installdirs maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \ ps ps-am tags tags-am uninstall uninstall-am \ uninstall-binPROGRAMS # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: cgdb-0.6.7/cgdb/scroller.c000644 000765 000024 00000021623 12074441140 016301 0ustar00mmuellerstaff000000 000000 /* scroller.c: * ----------- * * A scrolling buffer utility. Able to add and subtract to the buffer. * All routines that would require a screen update will automatically refresh * the scroller. */ /* Local Includes */ #if HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ /* System Includes */ #if HAVE_CTYPE_H #include #endif #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ /* Local Includes */ #include "cgdb.h" #include "scroller.h" /* --------------- */ /* Local Functions */ /* --------------- */ /* count: Count the occurrences of a character c in a string s. * ------ * * s: String to search * c: Character to search for * * Return Value: Number of occurrences of c in s. */ static int count(const char *s, char c) { int rv = 0; char *x = strchr(s, c); while (x) { rv++; x = strchr(x + 1, c); } return rv; } /* parse: Translates special characters in a string. (i.e. backspace, tab...) * ------ * * buf: The string to parse * * Return Value: A newly allocated copy of buf, with modifications made. */ static char *parse(struct scroller *scr, const char *orig, const char *buf) { const int tab_size = 8; int length = strlen(orig) + strlen(buf) + (tab_size - 1) * count(buf, '\t'); char *rv = (char *) malloc(length + 1); int i, j; /* Zero out the string */ memset(rv, 0, length + 1); strcpy(rv, orig); i = scr->current.pos; /* Expand special characters */ for (j = 0; j < strlen(buf); j++) { switch (buf[j]) { /* Backspace/Delete -> Erase last character */ case 8: case 127: if (i > 0) i--; break; /* Tab -> Translating to spaces */ case '\t': do rv[i++] = ' '; while (i % tab_size != 0); break; /* Carriage return -> Move back to the beginning of the line */ case '\r': i = 0; break; /* Default case -> Only keep printable characters */ default: if (isprint((int) buf[j])) { rv[i] = buf[j]; i++; } break; } } scr->current.pos = i; /* Remove trailing space from the line */ for (j = strlen(rv) - 1; j > i && isspace((int) rv[j]); j--); rv[j + 1] = 0; return realloc(rv, strlen(rv) + 1); } /* ----------------- */ /* Exposed Functions */ /* ----------------- */ /* See scroller.h for function descriptions. */ struct scroller *scr_new(int pos_r, int pos_c, int height, int width) { struct scroller *rv; if ((rv = malloc(sizeof (struct scroller))) == NULL) return NULL; rv->current.r = 0; rv->current.c = 0; rv->current.pos = 0; rv->win = newwin(height, width, pos_r, pos_c); /* Start with a single (blank) line */ rv->buffer = malloc(sizeof (char *)); rv->buffer[0] = strdup(""); rv->length = 1; return rv; } void scr_free(struct scroller *scr) { int i; /* Release the buffer */ if (scr->length) { for (i = 0; i < scr->length; i++) free(scr->buffer[i]); free(scr->buffer); } delwin(scr->win); /* Release the scroller object */ free(scr); } void scr_up(struct scroller *scr, int nlines) { int height, width; int length; int i; /* Sanity check */ getmaxyx(scr->win, height, width); if (scr->current.c > 0) { if (scr->current.c % width != 0) scr->current.c = (scr->current.c / width) * width; } for (i = 0; i < nlines; i++) { /* If current column is positive, drop it by 'width' */ if (scr->current.c > 0) scr->current.c -= width; /* Else, decrease the current row number, and set column accordingly */ else { if (scr->current.r > 0) { scr->current.r--; if ((length = strlen(scr->buffer[scr->current.r])) > width) scr->current.c = ((length - 1) / width) * width; } else { /* At top */ break; } } } } void scr_down(struct scroller *scr, int nlines) { int height, width; int length; int i; /* Sanity check */ getmaxyx(scr->win, height, width); if (scr->current.c > 0) { if (scr->current.c % width != 0) scr->current.c = (scr->current.c / width) * width; } for (i = 0; i < nlines; i++) { /* If the current line wraps to the next, then advance column number */ length = strlen(scr->buffer[scr->current.r]); if (scr->current.c < length - width) scr->current.c += width; /* Otherwise, advance row number, and set column number to 0. */ else { if (scr->current.r < scr->length - 1) { scr->current.r++; scr->current.c = 0; } else { /* At bottom */ break; } } } } void scr_home(struct scroller *scr) { scr->current.r = 0; scr->current.c = 0; } void scr_end(struct scroller *scr) { int height, width; getmaxyx(scr->win, height, width); scr->current.r = scr->length - 1; scr->current.c = (strlen(scr->buffer[scr->current.r]) / width) * width; } void scr_add(struct scroller *scr, const char *buf) { int distance; /* Distance to next new line character */ int length; /* Length of the current line */ char *x; /* Pointer to next new line character */ /* Find next newline in the string */ x = strchr(buf, '\n'); length = strlen(scr->buffer[scr->length - 1]); distance = x ? x - buf : strlen(buf); /* Append to the last line in the buffer */ if (distance > 0) { char *temp = scr->buffer[scr->length - 1]; char *buf2 = malloc(distance + 1); strncpy(buf2, buf, distance); buf2[distance] = 0; scr->buffer[scr->length - 1] = parse(scr, temp, buf2); free(temp); free(buf2); } /* Create additional lines if buf contains newlines */ while (x != NULL) { char *newbuf; buf = x + 1; x = strchr(buf, '\n'); distance = x ? x - buf : strlen(buf); /* Create a new buffer that stops at the next newline */ newbuf = malloc(distance + 1); memset(newbuf, 0, distance + 1); strncpy(newbuf, buf, distance); /* Expand the buffer */ scr->length++; scr->buffer = realloc(scr->buffer, sizeof (char *) * scr->length); scr->current.pos = 0; /* Add the new line */ scr->buffer[scr->length - 1] = parse(scr, "", newbuf); free(newbuf); } scr_end(scr); } void scr_move(struct scroller *scr, int pos_r, int pos_c, int height, int width) { delwin(scr->win); scr->win = newwin(height, width, pos_r, pos_c); wclear(scr->win); } void scr_refresh(struct scroller *scr, int focus) { int length; /* Length of current line */ int nlines; /* Number of lines written so far */ int r; /* Current row in scroller */ int c; /* Current column in row */ int width, height; /* Width and height of window */ char *buffer; /* Current line segment to print */ /* Sanity check */ getmaxyx(scr->win, height, width); if (scr->current.c > 0) { if (scr->current.c % width != 0) scr->current.c = (scr->current.c / width) * width; } r = scr->current.r; c = scr->current.c; buffer = malloc(width + 1); buffer[width] = 0; /* Start drawing at the bottom of the viewable space, and work our way up */ for (nlines = 1; nlines <= height; nlines++) { /* Print the current line [segment] */ memset(buffer, ' ', width); if (r >= 0) { length = strlen(scr->buffer[r] + c); memcpy(buffer, scr->buffer[r] + c, length < width ? length : width); } mvwprintw(scr->win, height - nlines, 0, "%s", buffer); /* Update our position */ if (c >= width) c -= width; else { r--; if (r >= 0) { length = strlen(scr->buffer[r]); if (length > width) c = ((length - 1) / width) * width; } } } length = strlen(scr->buffer[scr->current.r] + scr->current.c); if (focus && scr->current.r == scr->length - 1 && length <= width) { /* We're on the last line, draw the cursor */ curs_set(1); wmove(scr->win, height - 1, scr->current.pos % width); } else { /* Hide the cursor */ curs_set(0); } free(buffer); wrefresh(scr->win); } cgdb-0.6.7/cgdb/scroller.h000644 000765 000024 00000006426 12074441140 016312 0ustar00mmuellerstaff000000 000000 /* scroller.h: * ----------- * * A scrolling buffer utility. Able to add and subtract to the buffer. * All routines that would require a screen update will automatically redraw * the scroller. There is no "draw" function. */ #ifndef _SCROLLER_H_ #define _SCROLLER_H_ /* Local Includes */ #if HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #if HAVE_CURSES_H #include #elif HAVE_NCURSES_CURSES_H #include #endif /* HAVE_CURSES_H */ /* --------------- */ /* Data Structures */ /* --------------- */ struct scroller { char **buffer; /* The text buffer */ int length; /* Number of lines in buffer */ struct { int r; /* Current line (row) number */ int c; /* Current column number */ int pos; /* Cursor position in last line */ } current; WINDOW *win; /* The scoller's own window */ }; /* --------- */ /* Functions */ /* --------- */ /* scr_new: Creates and initializes a new scroller * -------- * * pos_r: Position on screen -- row * pos_c: Position on screen -- column * height: Height of the scroller on the screen (rows) * width: Width of the scroller on the screen (columns) * * Return Value: A pointer to a new scroller, or NULL on error. */ struct scroller *scr_new(int pos_r, int pos_c, int height, int width); /* scr_free: Releases the memory allocated by a scroller * --------- * * scr: Pointer to the scroller object */ void scr_free(struct scroller *scr); /* scr_up: Move up a number of lines * ------- * * scr: Pointer to the scroller object * nlines: Number of lines to scroll back; will not scroll past beginning */ void scr_up(struct scroller *scr, int nlines); /* scr_down: Move down a number of lines * --------- * * scr: Pointer to the scroller object * nlines: Number of lines to scroll down; will not scroll past end */ void scr_down(struct scroller *scr, int nlines); /* scr_home: Jump to the top line of the buffer * --------- * * scr: Pointer to the scroller object */ void scr_home(struct scroller *scr); /* scr_end: Jump to the bottom line of the buffer * -------- * * scr: Pointer to the scroller object */ void scr_end(struct scroller *scr); /* scr_add: Append a string to the buffer. * -------- * * scr: Pointer to the scroller object * buf: Buffer to append -- \b characters will be treated as backspace! */ void scr_add(struct scroller *scr, const char *buf); /* scr_move: Reposition the buffer on the screen * --------- * * scr: Pointer to the scroller object * pos_r: Position on screen -- row * pos_c: Position on screen -- column * height: Height of the scroller on the screen (rows) * width: Width of the scroller on the screen (columns) */ void scr_move(struct scroller *scr, int pos_r, int pos_c, int height, int width); /* scr_refresh: Refreshes the scroller on the screen, in case the caller * ------------ damages the screen area where the scroller is written (or, * perhaps the terminal size has changed, and you wish to redraw). * * scr: Pointer to the scroller object * focus: If the window has focus */ void scr_refresh(struct scroller *scr, int focus); #endif cgdb-0.6.7/cgdb/sources.c000644 000765 000024 00000064232 12074711250 016144 0ustar00mmuellerstaff000000 000000 /* sources.c: * ---------- * * Source file management routines for the GUI. Provides the ability to * add files to the list, load files, and display within a curses window. * Files are buffered in memory when they are displayed, and held in * memory for the duration of execution. If memory consumption becomes a * problem, this can be optimized to unload files which have not been * displayed recently, or only load portions of large files at once. (May * affect syntax hilighting.) * */ #if HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ /* System Includes */ #if HAVE_MATH_H #include #endif #if HAVE_STDIO_H #include #endif /* HAVE_STDIO_H */ #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #ifdef HAVE_SYS_TIME_H #include #endif #if HAVE_SYS_STAT_H #include #endif #if HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #if HAVE_CTYPE_H #include #endif /* Local Includes */ #include "highlight.h" #include "sources.h" #include "cgdb.h" #include "logo.h" #include "sys_util.h" #include "cgdbrc.h" #include "highlight_groups.h" int sources_syntax_on = 1; /* --------------- */ /* Local Functions */ /* --------------- */ /* verify_file_exists: Checks to see if a file exists * ------------------- * * Return Value: 0 if does not exist, 1 if exists */ static int verify_file_exists(const char *path) { struct stat st; /* Check for read permission of file, already exists */ if (stat(path, &st) == -1) return 0; return 1; } /* get_relative_node: Returns a pointer to the node that matches the * ------------------ given relative path. * lpath: Full path to source file * * Return Value: Pointer to the matching node, or NULL if not found. */ static struct list_node *get_relative_node(struct sviewer *sview, const char *lpath) { struct list_node *cur; for (cur = sview->list_head; cur != NULL; cur = cur->next) if (cur->lpath) if (strcmp(lpath, cur->lpath) == 0) return cur; return NULL; } /* get_node: Returns a pointer to the node that matches the given path. * --------- * path: Full path to source file * * Return Value: Pointer to the matching node, or NULL if not found. */ static struct list_node *get_node(struct sviewer *sview, const char *path) { struct list_node *cur; for (cur = sview->list_head; cur != NULL; cur = cur->next) if (cur->path) if (strcmp(path, cur->path) == 0) return cur; return NULL; } /** * Get's the timestamp of a particular file. * * \param path * The path to the file to get the timestamp of * * \param timestamp * The timestamp of the file, or 0 on error. * * \return * 0 on success, -1 on error. */ static int get_timestamp(const char *path, time_t * timestamp) { struct stat s; int val; if (!path) return -1; if (!timestamp) return -1; *timestamp = 0; val = stat(path, &s); if (val) /* Error on timestamp */ return -1; *timestamp = s.st_mtime; return 0; } static int release_file_buffer(struct buffer *buf) { int i; /* Nothing to free */ if (!buf) return 0; for (i = 0; i < buf->length; ++i) { free(buf->tlines[i]); buf->tlines[i] = NULL; } free(buf->tlines); buf->tlines = NULL; buf->length = 0; buf->cur_line = NULL; buf->max_width = 0; free(buf->breakpts); buf->breakpts = NULL; return 0; } /** * Remove's the memory related to a file. * * \param node * The node who's file buffer data needs to be freed. * * \return * 0 on success, or -1 on error. */ static int release_file_memory(struct list_node *node) { if (!node) return -1; /* Free the buffer */ if (release_file_buffer(&node->buf) == -1) return -1; if (release_file_buffer(&node->orig_buf) == -1) return -1; return 0; } /* load_file: Loads the file in the list_node into its memory buffer. * ---------- * * node: The list node to work on * * Return Value: Zero on success, non-zero on error. */ static int load_file(struct list_node *node) { FILE *file; char line[MAX_LINE]; int i; node->buf.length = 0; node->buf.tlines = NULL; node->buf.breakpts = NULL; node->buf.cur_line = NULL; node->buf.max_width = 0; /* Open file and save in original buffer. * I am not sure if this should be done this way in the future. * Maybe this data should be recieved from flex. */ node->orig_buf.length = 0; node->orig_buf.tlines = NULL; node->orig_buf.breakpts = NULL; node->orig_buf.cur_line = NULL; node->orig_buf.max_width = 0; /* Stat the file to get the timestamp */ if (get_timestamp(node->path, &(node->last_modification)) == -1) return 2; if (!(file = fopen(node->path, "r"))) return 1; while (!feof(file)) { if (fgets(line, MAX_LINE, file)) { int length = strlen(line); if (length > 0) { if (line[length - 1] == '\n') line[length - 1] = 0; if (line[length - 1] == '\r') line[length - 1] = 0; } if (strlen(line) > node->orig_buf.max_width) node->orig_buf.max_width = strlen(line); /* Inefficient - Reallocates memory at each line */ node->orig_buf.length++; node->orig_buf.tlines = realloc(node->orig_buf.tlines, sizeof (char *) * node->orig_buf.length); node->orig_buf.tlines[node->orig_buf.length - 1] = strdup(line); } } fclose(file); node->language = tokenizer_get_default_file_type(strrchr(node->path, '.')); /* Add the highlighted lines */ if (has_colors()) { highlight(node); } else { /* Just copy the lines from the original buffer if no highlighting * is possible */ int i; node->buf.length = node->orig_buf.length; node->buf.max_width = node->orig_buf.max_width; node->buf.tlines = cgdb_malloc(sizeof (char *) * node->orig_buf.length); for (i = 0; i < node->orig_buf.length; i++) node->buf.tlines[i] = cgdb_strdup(node->orig_buf.tlines[i]); } /* Allocate the breakpoints array */ node->buf.breakpts = malloc(sizeof (char) * node->buf.length); for (i = 0; i < node->buf.length; i++) node->buf.breakpts[i] = 0; return 0; } /* draw_current_line: Draws the currently executing source line on the screen * ------------------ including the user-selected marker (arrow, highlight, * etc) indicating this is the executing line. * * sview: The current source viewer * line: The line number * lwidth: The width of the line number, used to limit printing to the width * of the screen. Kinda ugly. */ static void draw_current_line(struct sviewer *sview, int line, int lwidth) { int height = 0; /* Height of curses window */ int width = 0; /* Width of curses window */ int i = 0, j = 0; /* Iterators */ struct buffer *buf = NULL; /* Pointer to the source buffer */ char *text = NULL; /* The current line (highlighted) */ char *otext = NULL; /* The current line (unhighlighted) */ unsigned int length = 0; /* Length of the line */ int column_offset = 0; /* Text to skip due to arrow */ int arrow_attr; int highlight_attr; enum ArrowStyle config_arrowstyle = cgdbrc_get(CGDBRC_ARROWSTYLE)->variant.arrow_style; int highlight_tabstop = cgdbrc_get(CGDBRC_TABSTOP)->variant.int_val; if (hl_groups_get_attr(hl_groups_instance, HLG_ARROW, &arrow_attr) == -1) return; if (hl_groups_get_attr(hl_groups_instance, HLG_LINE_HIGHLIGHT, &highlight_attr) == -1) return; /* Initialize height and width */ getmaxyx(sview->win, height, width); /* If syntax highlighting is on, point to the colored buffer. */ if (sources_syntax_on) { buf = &(sview->cur->buf); } else { buf = &(sview->cur->orig_buf); } /* If the current selected line is the line executing, use cur_line */ if (line == sview->cur->sel_line && buf->cur_line != NULL) { text = buf->cur_line; } else { text = buf->tlines[line]; } otext = sview->cur->orig_buf.tlines[line]; length = strlen(otext); /* Draw the appropriate arrow, if applicable */ switch (config_arrowstyle) { case ARROWSTYLE_SHORT: wattron(sview->win, arrow_attr); waddch(sview->win, ACS_LTEE); waddch(sview->win, '>'); wattroff(sview->win, arrow_attr); break; case ARROWSTYLE_LONG: wattron(sview->win, arrow_attr); waddch(sview->win, ACS_LTEE); /* Compute the length of the arrow, respecting tab stops, etc. */ for (i = 0; i < length - 1 && isspace(otext[i]); i++) { /* Oh so cryptic */ int offset = otext[i] != '\t' ? 1 : highlight_tabstop - (column_offset % highlight_tabstop); if (!isspace(otext[i + 1])) { offset--; } column_offset += offset; } column_offset -= sview->cur->sel_col; if (column_offset < 0) { column_offset = 0; } /* Now actually draw the arrow */ for (j = 0; j < column_offset; j++) { waddch(sview->win, ACS_HLINE); } waddch(sview->win, '>'); wattroff(sview->win, arrow_attr); break; case ARROWSTYLE_HIGHLIGHT: waddch(sview->win, VERT_LINE); waddch(sview->win, ' '); wattron(sview->win, highlight_attr); for (i = 0; i < width - lwidth - 2; i++) { if (i < length) { waddch(sview->win, otext[i]); } else { waddch(sview->win, ' '); } } wattroff(sview->win, highlight_attr); return; } /* Finally, print the source line */ hl_wprintw(sview->win, text, width - lwidth - 2, sview->cur->sel_col + column_offset); } /* --------- */ /* Functions */ /* --------- */ /* Descriptive comments found in header file: sources.h */ struct sviewer *source_new(int pos_r, int pos_c, int height, int width) { struct sviewer *rv; /* Allocate a new structure */ if ((rv = malloc(sizeof (struct sviewer))) == NULL) return NULL; /* Initialize the structure */ rv->win = newwin(height, width, pos_r, pos_c); rv->cur = NULL; rv->list_head = NULL; return rv; } int source_add(struct sviewer *sview, const char *path) { struct list_node *new_node; new_node = malloc(sizeof (struct list_node)); new_node->path = strdup(path); new_node->lpath = NULL; new_node->buf.length = 0; new_node->buf.tlines = NULL; /* This signals an empty buffer */ new_node->sel_line = 0; new_node->sel_col = 0; new_node->sel_col_rbeg = 0; new_node->sel_col_rend = 0; new_node->sel_rline = 0; new_node->exe_line = 0; new_node->last_modification = 0; /* No timestamp yet */ if (sview->list_head == NULL) { /* List is empty, this is the first node */ new_node->next = NULL; sview->list_head = new_node; } else { /* Insert at the front of the list (easy) */ new_node->next = sview->list_head; sview->list_head = new_node; } return 0; } int source_set_relative_path(struct sviewer *sview, const char *path, const char *lpath) { struct list_node *node = sview->list_head; while (node != NULL) { if (strcmp(node->path, path) == 0) { node->lpath = strdup(lpath); return 0; } node = node->next; } return -1; } int source_del(struct sviewer *sview, const char *path) { struct list_node *cur; struct list_node *prev = NULL; int i; /* Find the target node */ for (cur = sview->list_head; cur != NULL; cur = cur->next) { if (strcmp(path, cur->path) == 0) break; prev = cur; } if (cur == NULL) return 1; /* Node not found */ /* Release file buffer, if one is in memory */ if (cur->buf.tlines) { for (i = 0; i < cur->buf.length; i++) { free(cur->buf.tlines[i]); if (cur->buf.cur_line) { free(cur->buf.cur_line); cur->buf.cur_line = NULL; } free(cur->orig_buf.tlines[i]); } } free(cur->buf.tlines); free(cur->orig_buf.tlines); /* Release the breakpoints */ if (cur->buf.breakpts) { free(cur->buf.breakpts); cur->buf.breakpts = NULL; } /* Release file name */ free(cur->path); cur->path = NULL; /* Release local file name */ if (cur->lpath) { free(cur->lpath); cur->lpath = NULL; } /* Remove link from list */ if (cur == sview->list_head) sview->list_head = sview->list_head->next; else prev->next = cur->next; /* Free the node */ free(cur); return 0; } int source_length(struct sviewer *sview, const char *path) { struct list_node *cur = get_node(sview, path); if (!cur) { /* Load the file if it's not already */ if (!cur->buf.tlines && load_file(cur)) return -1; } return cur->buf.length; } char *source_current_file(struct sviewer *sview, char *path) { if (sview == NULL || sview->cur == NULL) return NULL; strcpy(path, sview->cur->path); return path; } int source_display(struct sviewer *sview, int focus) { char fmt[5]; int width, height; int lwidth; int line; int i; int attr = 0, sellineno; if (hl_groups_get_attr(hl_groups_instance, HLG_SELECTED_LINE_NUMBER, &sellineno) == -1) return -1; /* Check that a file is loaded */ if (sview->cur == NULL || sview->cur->buf.tlines == NULL) { logo_display(sview->win); wrefresh(sview->win); return 0; } /* Make sure cursor is visible */ if (focus) curs_set(1); else curs_set(0); /* Initialize variables */ getmaxyx(sview->win, height, width); /* Set starting line number (center source file if it's small enough) */ if (sview->cur->buf.length < height) line = (sview->cur->buf.length - height) / 2; else { line = sview->cur->sel_line - height / 2; if (line > sview->cur->buf.length - height) line = sview->cur->buf.length - height; else if (line < 0) line = 0; } /* Print 'height' lines of the file, starting at 'line' */ lwidth = (int) log10(sview->cur->buf.length) + 1; sprintf(fmt, "%%%dd", lwidth); for (i = 0; i < height; i++, line++) { wmove(sview->win, i, 0); if (has_colors()) { /* Outside of file, just finish drawing the vertical line */ if (line < 0 || line >= sview->cur->buf.length) { int j; for (j = 1; j < lwidth; j++) waddch(sview->win, ' '); waddch(sview->win, '~'); if (focus) wattron(sview->win, A_BOLD); waddch(sview->win, VERT_LINE); if (focus) wattroff(sview->win, A_BOLD); for (j = 2 + lwidth; j < width; j++) waddch(sview->win, ' '); /* Mark the current line with an arrow */ } else if (line == sview->cur->exe_line) { switch (sview->cur->buf.breakpts[line]) { case 0: if (hl_groups_get_attr(hl_groups_instance, HLG_ARROW, &attr) == -1) return -1; break; case 1: if (hl_groups_get_attr(hl_groups_instance, HLG_ENABLED_BREAKPOINT, &attr) == -1) return -1; break; case 2: if (hl_groups_get_attr(hl_groups_instance, HLG_DISABLED_BREAKPOINT, &attr) == -1) return -1; break; } wattron(sview->win, attr); wprintw(sview->win, fmt, line + 1); wattroff(sview->win, attr); draw_current_line(sview, line, lwidth); /* Look for breakpoints */ } else if (sview->cur->buf.breakpts[line]) { if (sview->cur->buf.breakpts[line] == 1) { if (hl_groups_get_attr(hl_groups_instance, HLG_ENABLED_BREAKPOINT, &attr) == -1) return -1; } else { if (hl_groups_get_attr(hl_groups_instance, HLG_DISABLED_BREAKPOINT, &attr) == -1) return -1; } wattron(sview->win, attr); wprintw(sview->win, fmt, line + 1); wattroff(sview->win, attr); if (focus) wattron(sview->win, A_BOLD); waddch(sview->win, VERT_LINE); if (focus) wattroff(sview->win, A_BOLD); waddch(sview->win, ' '); /* I know this is rediculous, it needs to be reimplemented */ if (sources_syntax_on) { if (line == sview->cur->sel_line && sview->cur->buf.cur_line != NULL) { hl_wprintw(sview->win, sview->cur->buf.cur_line, width - lwidth - 2, sview->cur->sel_col); } else { hl_wprintw(sview->win, sview->cur->buf.tlines[line], width - lwidth - 2, sview->cur->sel_col); } } else { if (line == sview->cur->sel_line && sview->cur->buf.cur_line != NULL) { hl_wprintw(sview->win, sview->cur->orig_buf.cur_line, width - lwidth - 2, sview->cur->sel_col); } else { hl_wprintw(sview->win, sview->cur->orig_buf.tlines[line], width - lwidth - 2, sview->cur->sel_col); } } } /* Ordinary lines */ else { if (focus && sview->cur->sel_line == line) wattron(sview->win, sellineno); wprintw(sview->win, fmt, line + 1); if (focus && sview->cur->sel_line == line) wattroff(sview->win, sellineno); if (focus) wattron(sview->win, A_BOLD); waddch(sview->win, VERT_LINE); if (focus) wattroff(sview->win, A_BOLD); waddch(sview->win, ' '); /* I know this is rediculous, it needs to be reimplemented */ if (sources_syntax_on) { /* No special line information */ if (line == sview->cur->sel_line && sview->cur->buf.cur_line != NULL) { hl_wprintw(sview->win, sview->cur->buf.cur_line, width - lwidth - 2, sview->cur->sel_col); } else { hl_wprintw(sview->win, sview->cur->buf.tlines[line], width - lwidth - 2, sview->cur->sel_col); } } else { /* No special line information */ if (line == sview->cur->sel_line && sview->cur->buf.cur_line != NULL) { hl_wprintw(sview->win, sview->cur->orig_buf.cur_line, width - lwidth - 2, sview->cur->sel_col); } else { hl_wprintw(sview->win, sview->cur->orig_buf.tlines[line], width - lwidth - 2, sview->cur->sel_col); } } } } else { wprintw(sview->win, "%s\n", sview->cur->buf.tlines[line]); } } wmove(sview->win, height - (line - sview->cur->sel_line), lwidth + 2); wrefresh(sview->win); return 0; } void source_move(struct sviewer *sview, int pos_r, int pos_c, int height, int width) { delwin(sview->win); sview->win = newwin(height, width, pos_r, pos_c); wclear(sview->win); } void source_vscroll(struct sviewer *sview, int offset) { if (sview->cur) { sview->cur->sel_line += offset; if (sview->cur->sel_line < 0) sview->cur->sel_line = 0; if (sview->cur->sel_line >= sview->cur->buf.length) sview->cur->sel_line = sview->cur->buf.length - 1; sview->cur->sel_rline = sview->cur->sel_line; } } void source_hscroll(struct sviewer *sview, int offset) { int lwidth; int max_width; if (sview->cur) { lwidth = (int) log10(sview->cur->buf.length) + 1; max_width = sview->cur->buf.max_width - COLS + lwidth + 6; sview->cur->sel_col += offset; if (sview->cur->sel_col > max_width) sview->cur->sel_col = max_width; if (sview->cur->sel_col < 0) sview->cur->sel_col = 0; } } void source_set_sel_line(struct sviewer *sview, int line) { if (sview->cur) { /* Set line (note correction for 0-based line counting) */ sview->cur->sel_line = line - 1; if (sview->cur->sel_line < 0) sview->cur->sel_line = 0; if (sview->cur->sel_line >= sview->cur->buf.length) sview->cur->sel_line = sview->cur->buf.length - 1; sview->cur->sel_rline = sview->cur->sel_line; } } int source_set_exec_line(struct sviewer *sview, const char *path, int line) { if (path && !verify_file_exists(path)) return 5; /* Locate node, if path has changed */ if (path != NULL && !(sview->cur = get_node(sview, path))) { /* Not found -- attempt to add */ if (source_add(sview, path)) return 1; else if (!(sview->cur = get_node(sview, path))) return 2; } else if (path == NULL && sview->cur == NULL) return 3; /* Buffer the file if it's not already */ if (!sview->cur->buf.tlines && load_file(sview->cur)) return 4; /* Update line, if set */ if (line--) { /* Check bounds of line */ if (line < 0) line = 0; if (line >= sview->cur->buf.length) line = sview->cur->buf.length - 1; sview->cur->sel_line = sview->cur->exe_line = line; } return 0; } void source_free(struct sviewer *sview) { /* Free all file buffers */ while (sview->list_head != NULL) source_del(sview, sview->list_head->path); delwin(sview->win); } void source_search_regex_init(struct sviewer *sview) { if (sview == NULL || sview->cur == NULL) return; /* Start from beginning of line if not at same line */ if (sview->cur->sel_rline != sview->cur->sel_line) { sview->cur->sel_col_rend = 0; sview->cur->sel_col_rbeg = 0; } /* Start searching at the beginning of the selected line */ sview->cur->sel_rline = sview->cur->sel_line; } int source_search_regex(struct sviewer *sview, const char *regex, int opt, int direction, int icase) { if (sview == NULL || sview->cur == NULL || regex == NULL || strlen(regex) == 0) { if (sview && sview->cur) sview->cur->buf.cur_line = NULL; return -1; } return hl_regex(regex, (const char **) sview->cur->buf.tlines, (const char **) sview->cur->orig_buf.tlines, sview->cur->orig_buf.length, &sview->cur->buf.cur_line, &sview->cur->sel_line, &sview->cur->sel_rline, &sview->cur->sel_col_rbeg, &sview->cur->sel_col_rend, opt, direction, icase); } void source_disable_break(struct sviewer *sview, const char *path, int line) { struct list_node *node; if ((node = get_relative_node(sview, path)) == NULL) return; if (node->buf.tlines == NULL) if (load_file(node)) return; if (line > 0 && line <= node->buf.length) node->buf.breakpts[line - 1] = 2; } void source_enable_break(struct sviewer *sview, const char *path, int line) { struct list_node *node; if ((node = get_relative_node(sview, path)) == NULL) return; if (node->buf.tlines == NULL) if (load_file(node)) return; if (line > 0 && line <= node->buf.length) { node->buf.breakpts[line - 1] = 1; } } void source_clear_breaks(struct sviewer *sview) { struct list_node *node; for (node = sview->list_head; node != NULL; node = node->next) memset(node->buf.breakpts, 0, node->buf.length); } int source_reload(struct sviewer *sview, const char *path, int force) { time_t timestamp; struct list_node *cur; struct list_node *prev = NULL; int auto_source_reload = cgdbrc_get(CGDBRC_AUTOSOURCERELOAD)->variant.int_val; if (!path) return -1; if (get_timestamp(path, ×tamp) == -1) return -1; /* Find the target node */ for (cur = sview->list_head; cur != NULL; cur = cur->next) { if (strcmp(path, cur->path) == 0) break; prev = cur; } if (cur == NULL) return 1; /* Node not found */ if ((auto_source_reload || force) && cur->last_modification < timestamp) { if (release_file_memory(sview->cur) == -1) return -1; if (load_file(cur)) return -1; } return 0; } cgdb-0.6.7/cgdb/sources.h000644 000765 000024 00000022231 12074441140 016140 0ustar00mmuellerstaff000000 000000 /* sources.h: * ---------- * * Source file management routines for the GUI. Provides the ability to * add files to the list, load files, and display within a curses window. * Files are buffered in memory when they are displayed, and held in * memory for the duration of execution. If memory consumption becomes a * problem, this can be optimized to unload files which have not been * displayed recently, or only load portions of large files at once. (May * affect syntax highlighting.) * */ #ifndef _SOURCES_H_ #define _SOURCES_H_ #if HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ /* System Includes */ #if HAVE_CURSES_H #include #elif HAVE_NCURSES_CURSES_H #include #endif /* HAVE_CURSES_H */ /* System Includes */ #if HAVE_TIME_H #include #endif /* HAVE_TIME_H */ #include "tokenizer.h" /* ----------- */ /* Definitions */ /* ----------- */ /* Max length of a line */ #define MAX_LINE 4096 #define MAX_TITLE 40 #define SRC_WINDOW_NAME "Source" #define QUEUE_SIZE 10 /* --------------- */ /* Data Structures */ /* --------------- */ /* Source viewer object */ struct sviewer { struct list_node *list_head; /* File list */ struct list_node *cur; /* Current node we're displaying */ WINDOW *win; /* Curses window */ }; struct buffer { int length; /* Number of lines in buffer */ char **tlines; /* Array containing file ( lines of text ) */ char *cur_line; /* cur line may have unique color */ char *breakpts; /* Breakpoints */ int max_width; /* Width of longest line in file */ }; struct list_node; struct list_node { char *path; /* Full path to source file */ char *lpath; /* Relative path to source file */ struct buffer buf; /* File buffer */ struct buffer orig_buf; /* Original File buffer ( no color ) */ int sel_line; /* Current line selected in viewer */ int sel_col; /* Current column selected in viewer */ int exe_line; /* Current line executing */ int sel_col_rbeg; /* Current beg column matched in regex */ int sel_col_rend; /* Current end column matched in regex */ int sel_rline; /* Current line used by regex */ enum tokenizer_language_support language; /* The language type of this file */ time_t last_modification; /* timestamp of last modification */ struct list_node *next; /* Pointer to next link in list */ }; /* --------- */ /* Functions */ /* --------- */ /* source_new: Create a new source viewer object. * ----------- * * pos_r: Position of the viewer (row) * pos_c: Position of the viewer (column) * height: Height (in lines) of the viewer * width: Width (in columns) of the viewer * * Return Value: A new sviewer object on success, NULL on failure. */ struct sviewer *source_new(int pos_r, int pos_c, int height, int width); /* source_add: Add a file to the list of source files. * ----------- * * sview: Source viewer object * path: Full path to the source file (this is considered to be a * unique identifier -- no duplicate paths in the list!) * * Return Value: Zero on success, non-zero on error. */ int source_add(struct sviewer *sview, const char *path); /* source_set_relative_path: Sets the path that gdb uses for breakpoints * ------------------------- * * sview: Source viewer object * path: Full path to the source file (this is considered to be a * unique identifier -- no duplicate paths in the list!) * lpath: * * Return Value: Zero on success, non-zero on error. */ int source_set_relative_path(struct sviewer *sview, const char *path, const char *lpath); /* source_del: Remove a file from the list of source files. * ----------- * * sview: Source viewer object * path: Full path to the source file to remove from the list. If the * file is buffered in memory, it'll be freed. * * Return Value: Zero on success, non-zero on error. */ int source_del(struct sviewer *sview, const char *path); /* source_length: Get the length of a source file. If the source file hasn't * -------------- been buffered already, it will be loaded into memory. * * sview: Source viewer object * path: Full path to the source file * * Return Value: Length of file on success, -1 on error. */ int source_length(struct sviewer *sview, const char *path); /* source_current_file: Get the name of the current file being displayed. * -------------------- * * path: The path to the current file being displayed. * * Return Value: NULL if no file is being displayed, otherwise a pointer to * the current path of the file being displayed. */ char *source_current_file(struct sviewer *sview, char *path); /* source_display: Display a portion of a file in a curses window. * --------------- * * sview: Source viewer object * focus: If the window should have focus * * Return Value: Zero on success, non-zero on error. */ int source_display(struct sviewer *sview, int focus); /* source_move: Relocate the source window. * ------------ * * sview: Source viewer object * pos_r: Position of the viewer (row) * pos_c: Position of the viewer (column) * height: Height (in lines) of the viewer * width: Width (in columns) of the viewer */ void source_move(struct sviewer *sview, int pos_r, int pos_c, int height, int width); /* source_vscroll: Change current position in source file. * -------------- * * sview: Source viewer object * offset: Plus or minus number of lines to move */ void source_vscroll(struct sviewer *sview, int offset); /* source_hscroll: Scroll the source file right or left in the window. * --------------- * * sview: Source viewer object * offset: Plus or minus number of lines to move */ void source_hscroll(struct sviewer *sview, int offset); /* source_set_sel_line: Set current user-selected line * -------------------- * * sview: Source viewer object * line: Current line number * */ void source_set_sel_line(struct sviewer *sview, int line); /* source_set_exec_line: Set currently executing line * --------------- * * sview: Source viewer object * path: Full path to the source file (may be NULL to leave unchanged) * line: Current line number (0 to leave unchanged) * * Return Value: Zero on success, non-zero on failure. * 5 -> file does not exist */ int source_set_exec_line(struct sviewer *sview, const char *path, int line); /* source_search_regex_init: Should be called before source_search_regex * ------------------------- * This function initializes sview before it can search for a regex * It should be called every time a regex will be applied to sview before * source_search_regex is called. * * sview: Source viewer object */ void source_search_regex_init(struct sviewer *sview); /* source_search_regex: Searches for regex in current file and displays line. * --------------- * * sview: Source viewer object * regex: The regular expression to search for * If NULL, then no regex will be tried, but the state can still * be put back to its old self! * opt: If 1, Then the search is temporary ( User has not hit enter ) * If 2, The search is perminant * * direction: If 0 then forward, else reverse * icase: If 0 ignore case. * * Return Value: Zero on match, * -1 if sview->cur is NULL * -2 if regex is NULL * -3 if regcomp fails * non-zero on failure. */ int source_search_regex(struct sviewer *sview, const char *regex, int opt, int direction, int icase); /* source_free: Release the memory associated with a source viewer. * ------------ * * sview: The source viewer to free. */ void source_free(struct sviewer *sview); /* ----------- */ /* Breakpoints */ /* ----------- */ /* source_disable_break: Disable a given breakpoint. * --------------------- * * sview: The source viewer object * path: Full path to the source file * line: Line number of breakpoint */ void source_disable_break(struct sviewer *sview, const char *path, int line); /* source_enable_break: Enable a given breakpoint. * -------------------- * * sview: The source viewer object * path: Full path to the source file * line: Line number of breakpoint */ void source_enable_break(struct sviewer *sview, const char *path, int line); /* source_clear_breaks: Clear all breakpoints from all files. * -------------------- * * sview: The source viewer object */ void source_clear_breaks(struct sviewer *sview); /** * Check's to see if the current source file has changed. If it has it loads * the new source file up. * * \param sview * The source viewer object * * \param path * The path to the file to reload into memory * * \param force * Force the file to be reloaded, even if autosourcereload option is off. * * \return * 0 on success or -1 on error */ int source_reload(struct sviewer *sview, const char *path, int force); #endif cgdb-0.6.7/cgdb/TODO000644 000765 000024 00000006632 12074441140 015003 0ustar00mmuellerstaff000000 000000 ------------------------------------------- Current To Do List (in no particular order) ------------------------------------------- o Set the terminal size so that GDB: - Paginates after the correct number of lines. This must be modified any time the GDB window is resized. Or, should we just disable GDB's pager, since the user can scroll back in the curses GUI? Maybe that should be configurable. - Thinks the terminal is *very* wide. This is so it does not try to force its ideas of how lines should wrap on us. The curses GUI should be free to manipulate lines however it sees fit. o Resizing issues: - Resize events don't occur while GDB (or debugged program) is outputting massive amounts of data. Doing a CTRL+W causes a resize, however. Is there ANY way to simulate input on stdin? - Eventually... flicker reduction? o Support monochrome terminals (vt100, etc.) o Support terminals that don't handle the ACS lines o Investigate nocbreak problem on Solaris o Optimize display of GDB output -- it's currently quite slow o Add a feature to open an editor using the CGDB_EDITOR env var when the user hits ^E. It opens the current file in the source windows, or does nothing. o Investigate removing log10 function calls from sources.c. o Allow the user to open a new window for child input/output. Although this is only useful in a windowing environment, it is much nicer. Most people probably only use it in a windowing environment anyways. The tty window will still stay supported. ------ BUGS ------ o Open: - CTRL+C can cause problems - Cursor vanishes when breakpoints are set/unset o Closed: - DOS source files make cgdb barf - Syntax highlighting for C breaks on '\\' - Pressing CTRL+SPACE crashes cgdb (see interface.c for fix) For some reason, cgdb no longer crashes, when the user hits CTRL+SPACE, the last char the user typed is repeated. The fix to interface.c was removed. - Arrow keys still not working properly (left, right, CTRL+A/E, etc.) - TAB character messing up with horizontal scrolling (source window) o Resizing issues: - Resizing the terminal a lot sends a signal to cgdb to resize. CGDB should not buffer these signals like it does. If the user sends multiple resizes, only the last one should be serviced. ------------- Nice Features ------------- o Highlight GDB window, maybe with different colors for: - User input - Standard output - Standard error o Make config file (~/.tgdb/cgdbrc). Configurable items: - Syntax highlighting colors - GUI style (size, colors, etc.) - Key bindings ---------------------------- Done (moved from To Do List) ---------------------------- o Track the current position of the cursor in the input line so that the user can use the left and right arrow keys (as well as CTRL+U and CTRL+K). If any of these currently work, it's by sheer luck. o Scrolling in the source window (arrow keys, PGUP, PGDN, HOME, END) o Setting breakpoints via the source window o Ada syntax highlighting o Allow source window to scroll left/right for source files with long lines o Allow user to open source files for perusal/breakpoint setting (Popup window with a list of files) o Fix resizing issues. Is cgdb resizing? cgdb-0.6.7/cgdb/usage.c000644 000765 000024 00000001360 12074441140 015554 0ustar00mmuellerstaff000000 000000 #if HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #if HAVE_STDIO_H #include #endif /* HAVE_STDIO_H */ #include "usage.h" void usage(void) { printf("CGDB Usage:\n" " cgdb [cgdb options] [--] [gdb options]\n" "\n" "CGDB Options:\n" #ifdef HAVE_GETOPT_H " --version Print version information and then exit.\n" #else " -v Print version information and then exit.\n" #endif #ifdef HAVE_GETOPT_H " --help Print help (this message) and then exit.\n" #else " -h Print help (this message) and then exit.\n" #endif " -d Set debugger to use.\n" " -- Marks the end of CGDB's options.\n"); } cgdb-0.6.7/cgdb/usage.h000644 000765 000024 00000000217 12074441140 015561 0ustar00mmuellerstaff000000 000000 #ifndef __USAGE_H__ #define __USAGE_H__ /** * This will generate the usage message for CGDB. */ void usage(void); #endif /* __USAGE_H__ */