cgdb-0.8.0/0000775000175000017500000000000014171036467007432 500000000000000cgdb-0.8.0/config/0000775000175000017500000000000014171036466010676 500000000000000cgdb-0.8.0/config/install-sh0000755000175000017500000003546314171036447012632 00000000000000#!/bin/sh # install - install a program, script, or datafile scriptversion=2014-09-12.12; # 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. tab=' ' nl=' ' IFS=" $tab$nl" # Set DOITPROG to "echo" to test this script. doit=${DOITPROG-} doit_exec=${doit:-exec} # 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_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 is_target_a_directory=possibly 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 *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) is_target_a_directory=always dst_arg=$2 # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac shift;; -T) is_target_a_directory=never;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done # We allow the use of options -d and -T together, by making -d # take the precedence; this is for compatibility with GNU install. if test -n "$dir_arg"; then if test -n "$dst_arg"; then echo "$0: target directory not allowed when installing a directory." >&2 exit 1 fi fi 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 if test $# -gt 1 || test "$is_target_a_directory" = always; then if test ! -d "$dst_arg"; then echo "$0: $dst_arg: Is not a directory." >&2 exit 1 fi fi 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 "$is_target_a_directory" = never; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dst=$dstdir/`basename "$src"` dstdir_status=0 else dstdir=`dirname "$dst"` 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. ;; *) # $RANDOM is not portable (e.g. dash); use it when possible to # lower collision chance tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null; exit $ret' 0 # As "mkdir -p" follows symlinks and we work in /tmp possibly; so # create the $tmpdir first (and fail if unsuccessful) to make sure # that nobody tries to guess the $tmpdir name. if (umask $mkdir_umask && $mkdirprog $mkdir_mode "$tmpdir" && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/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. test_tmpdir="$tmpdir/a" ls_ld_tmpdir=`ls -ld "$test_tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 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 oIFS=$IFS IFS=/ set -f set fnord $dstdir shift 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` && set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && 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.8.0/config/ylwrap0000755000175000017500000001531214171036447012061 00000000000000#! /bin/sh # ylwrap - wrapper for lex/yacc invocations. scriptversion=2013-01-12.17; # UTC # Copyright (C) 1996-2014 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 x"$1" = x"--"; 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 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.8.0/config/missing0000755000175000017500000001533014171036447012214 00000000000000#! /bin/sh # Common wrapper for a few potentially missing GNU programs. scriptversion=2013-10-28.13; # UTC # Copyright (C) 1996-2014 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 'autom4te' 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.8.0/config/texinfo.tex0000644000175000017500000116703614171036447013027 00000000000000% 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{2013-02-01.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, 2013 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 Exception is an additional permission under section 7 % of the GNU General Public License, version 3 ("GPLv3"). % % 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-\normaldash \let_\realunder \fi \codex } } \def\codex #1{\tclose{#1}\endgroup} \def\normaldash{-} \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 bad. % @allowcodebreaks provides a document-level way to turn breaking at - % and _ on and off. % \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-\normaldash \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 `\'. Also revert - to its normal character, in % case the active - from code has slipped in. % {@catcode`- = @active @gdef@normalturnoffactive{% @let-=@normaldash @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.8.0/config/config.sub0000755000175000017500000010646014171036447012605 00000000000000#! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2015 Free Software Foundation, Inc. timestamp='2015-08-20' # 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 to . # # 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 1992-2015 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* | netbsd*-eabi* | \ 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 | arceb \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | avr | avr32 \ | ba \ | be32 | be64 \ | bfin \ | c4x | c8051 | clipper \ | d10v | d30v | dlx | dsp16xx \ | e2k | epiphany \ | fido | fr30 | frv | ft32 \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | k1om \ | 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 \ | mipsisa32r6 | mipsisa32r6el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64r6 | mipsisa64r6el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipsr5900 | mipsr5900el \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ | open8 | or1k | or1knd | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ | riscv32 | riscv64 \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]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 \ | visium \ | 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 ;; leon|leon[3-9]) basic_machine=sparc-$basic_machine ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | 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-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | ba-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | c8051-* | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | e2k-* | 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-* \ | k1om-* \ | 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-* \ | mipsisa32r6-* | mipsisa32r6el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64r6-* | mipsisa64r6el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipsr5900-* | mipsr5900el-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* | nios2eb-* | nios2el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ | or1k*-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pyramid-* \ | riscv32-* | riscv64-* \ | 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-* \ | visium-* \ | 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 ;; asmjs) basic_machine=asmjs-unknown ;; 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 ;; leon-*|leon[3-9]-*) basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'` ;; 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=i686-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 ;; moxiebox) basic_machine=moxie-unknown os=-moxiebox ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; msys) basic_machine=i686-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* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* | -cloudabi* | -sortix* \ | -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* | -moxiebox* \ | -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* | -tirtos*) # 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 ;; -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 ;; c8051-*) os=-elf ;; 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.8.0/config/config.guess0000755000175000017500000012475314171036447013147 00000000000000#! /bin/sh # Attempt to guess a canonical system name. # Copyright 1992-2015 Free Software Foundation, Inc. timestamp='2015-08-20' # 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; maintained since 2000 by Ben Elliston. # # 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 to . 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 1992-2015 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 case "${UNAME_SYSTEM}" in Linux|GNU|GNU/*) # If the system lacks a compiler, then just pick glibc. # We could probably try harder. LIBC=gnu eval $set_cc_for_build cat <<-EOF > $dummy.c #include #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc #else LIBC=gnu #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` ;; esac # 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=`(uname -p 2>/dev/null || \ /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 ;; earmv*) arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'` endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'` machine=${arch}${endian}-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*|earm*|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 # Determine ABI tags. case "${UNAME_MACHINE_ARCH}" in earm*) expr='s/^earmv[0-9]/-eabi/;s/eb$//' abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"` ;; 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/[-_].*//' | cut -d. -f1,2` ;; 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}${abi}" 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 ;; *:Sortix:*:*) echo ${UNAME_MACHINE}-unknown-sortix 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/lslpp ] ; then IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` 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 ;; *: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-${LIBC}`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/[-(].*//'`-${LIBC} exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; aarch64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be echo ${UNAME_MACHINE}-unknown-linux-${LIBC} 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="gnulibc1" ; fi echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arc:Linux:*:* | arceb:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${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-${LIBC} else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi else echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf fi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; cris:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; crisv32:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; e2k:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; frv:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; hexagon:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:Linux:*:*) echo ${UNAME_MACHINE}-pc-linux-${LIBC} exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} 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-${LIBC}"; exit; } ;; openrisc*:Linux:*:*) echo or1k-unknown-linux-${LIBC} exit ;; or32:Linux:*:* | or1k*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; padre:Linux:*:*) echo sparc-unknown-linux-${LIBC} exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-${LIBC} 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-${LIBC} ;; PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; *) echo hppa-unknown-linux-${LIBC} ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-${LIBC} exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-${LIBC} exit ;; ppc64le:Linux:*:*) echo powerpc64le-unknown-linux-${LIBC} exit ;; ppcle:Linux:*:*) echo powerpcle-unknown-linux-${LIBC} exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux-${LIBC} exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; tile*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-${LIBC} exit ;; x86_64:Linux:*:*) echo ${UNAME_MACHINE}-pc-linux-${LIBC} exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} 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 eval $set_cc_for_build if test "$UNAME_PROCESSOR" = unknown ; then UNAME_PROCESSOR=powerpc fi if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then 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 case $UNAME_PROCESSOR in i386) UNAME_PROCESSOR=x86_64 ;; powerpc) UNAME_PROCESSOR=powerpc64 ;; esac fi fi elif test "$UNAME_PROCESSOR" = i386 ; then # Avoid executing cc on OS X 10.9, as it ships with a stub # that puts up a graphical alert prompting to install # developer tools. Any system running Mac OS X 10.7 or # later (Darwin 11 and later) is required to have a 64-bit # processor. This is not true of the ARM version of Darwin # that Apple uses in portable devices. UNAME_PROCESSOR=x86_64 fi 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 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.8.0/config/readline_check_version.m40000664000175000017500000001243713641763411015552 00000000000000AC_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_FUNC(tgetent, bash_cv_termcap_lib=libc, if test "$curses_lib_name" = "ncursesw"; then [AC_CHECK_LIB(ncursesw, tgetent, bash_cv_termcap_lib=libncursesw, [AC_CHECK_LIB(tinfow, tgetent, bash_cv_termcap_lib=libtinfow)] )] elif test "$curses_lib_name" = "ncurses"; then [AC_CHECK_LIB(ncurses, tgetent, bash_cv_termcap_lib=libncurses, [AC_CHECK_LIB(tinfo, tgetent, bash_cv_termcap_lib=libtinfo)] )] elif test "$curses_lib_name" = "curses"; then [AC_CHECK_LIB(curses, tgetent, bash_cv_termcap_lib=libcurses)] else [AC_CHECK_LIB(termcap, tgetent, bash_cv_termcap_lib=libtermcap, bash_cv_termcap_lib=gnutermcap )] fi )]) 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 = libtinfow; then TERMCAP_LIB=-ltinfow TERMCAP_DEP= 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 #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.8.0/config/compile0000755000175000017500000001624514171036447012201 00000000000000#! /bin/sh # Wrapper for compilers which do not understand '-c -o'. scriptversion=2012-10-14.11; # UTC # Copyright (C) 1999-2014 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.8.0/config/mdate-sh0000755000175000017500000001372614171036447012254 00000000000000#!/bin/sh # Get modification time of a file or directory and pretty-print it. scriptversion=2015-04-09.19; # UTC # Copyright (C) 1995-2014 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 # Use UTC to get reproducible result TZ=UTC export TZ # 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.8.0/config/depcomp0000755000175000017500000005601614171036450012172 00000000000000#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2013-05-30.07; # UTC # Copyright (C) 1999-2014 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" echo >> "$depfile" # make sure the fragment doesn't end with a backslash 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.8.0/AUTHORS0000664000175000017500000000314013046227664010421 00000000000000Active Maintainers Bob Rossi is a co founder of cgdb and the main developer. He can be reached at "bob *at* brasko *dot* net". Mike Mueller is a co founder of cgdb. He can be reached at "mmueller *at* cs *dot* uri *dot* edu". Michael Sartain is a core developer of CGDB and can be reached at "mikesart *at* fastmail *dot* com". 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". Li Jia submitted fixes for two serious bugs, including a long-standing hang issue on MacOS. He can be reached at "tiwb *at* msn *dot* com". Andy Song provided a syntax highlighter for Go language. He can be reached at "wsong.cn *at* gmail *dot* com" Armin Widegreen provided a syntax highlighter for the Rust programming language. He can be reached at "armin.widegreen *at* gmail *dot* com" For more information please see https://cgdb.github.io/ cgdb-0.8.0/configure.ac0000664000175000017500000002473114134377055011647 00000000000000dnl Process this file with autoconf to produce a configure script. AC_PREREQ(2.5) AC_INIT(cgdb, [m4_esyscmd_s([cat VERSION])]) 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_CXX 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 determine if /proc/self/status is available for checking TracerPid AC_CHECK_FILE([/proc/self/status], [AC_DEFINE(HAVE_PROC_SELF_STATUS_FILE, 1, have /proc/self/status file)]) dnl Check for pty.h AC_CHECK_HEADERS([pty.h], [AC_DEFINE(HAVE_PTY_H, 1, have pty.h)]) AC_CHECK_LIB(util,openpty, [AC_DEFINE(HAVE_OPENPTY, 1, Define to 1 if you have the openpty function) LIBS="$LIBS -lutil"]) 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_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([ttyname_r],[AC_DEFINE(HAVE_TTYNAME_R, 1, [Define to 1 if you have the ttyname_r function])],) dnl define HAVE_PTSNAME_R if we have reentrant version of ptsname. AC_TRY_LINK([#ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #include ], [char buf[10]; ptsname_r(0, buf, sizeof(buf));], [AC_DEFINE(HAVE_PTSNAME_R, 1, Define to 1 if you have a re-entrant version of ptsname)]) dnl program checks AC_CHECK_PROG([HAS_MAKEINFO], [makeinfo], [yes], [no]) 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 make sure that (f)lex is available if test "$LEX" != "flex" -a "$LEX" != "lex"; then AC_MSG_ERROR([Please install flex before installing]) fi dnl check that the required tools are available to generate documentation if test "$HAS_MAKEINFO" != "yes" ; then AC_MSG_ERROR([Please install makeinfo before installing]) fi 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, ["yes"], ncurses library)]) AC_CHECK_LIB(ncursesw, initscr, [AC_DEFINE(HAVE_NCURSES, ["yes"], ncursesw library)]) if test "$ac_cv_lib_ncursesw_initscr" = "yes"; then curses_lib_name="ncursesw" elif test "$ac_cv_lib_ncurses_initscr" = "yes"; then curses_lib_name="ncurses" else 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.]) fi 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 Detect __attribute__( ( __format__( __printf__ ) ) ) support AC_MSG_CHECKING([Checking attribute printf support]) AC_TRY_LINK([#include static void test(const char *fmt, ...) __attribute__((format(__printf__, 1, 2))); static void test(const char *fmt, ...) { (void)fmt; }], [test("foobar");], [AC_MSG_RESULT([yes]) AC_DEFINE(HAVE_ATTRIBUTE_PRINTF, 1, Define to 1 if compiler supports attribute format printf)], [AC_MSG_RESULT([no])]) dnl Make sure there is a version of readline that CGDB supports. dnl Simply putting 5.1* -> 5.9* just to take into account 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 AH_BOTTOM([#include ]) AC_OUTPUT( cgdb_custom_config.h \ Makefile \ lib/Makefile \ lib/kui/Makefile \ lib/rline/Makefile \ lib/tgdb/Makefile \ lib/tokenizer/Makefile \ lib/util/Makefile \ lib/vterm/Makefile \ doc/Makefile \ cgdb/Makefile \ test/Makefile ) cgdb-0.8.0/doc/0000775000175000017500000000000014171036467010177 500000000000000cgdb-0.8.0/doc/version.texi0000664000175000017500000000014314171033553012466 00000000000000@set UPDATED 16 January 2022 @set UPDATED-MONTH January 2022 @set EDITION 0.8.0 @set VERSION 0.8.0 cgdb-0.8.0/doc/Makefile.in0000664000175000017500000006316314171036447012173 00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/config/readline_check_version.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/version.texi \ $(srcdir)/stamp-vti $(dist_pkgdata_DATA) $(am__DIST_COMMON) 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.texi 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)$(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; }; \ } DATA = $(dist_pkgdata_DATA) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(cgdb_TEXINFOS) $(srcdir)/Makefile.in \ $(top_srcdir)/config/mdate-sh $(top_srcdir)/config/texinfo.tex 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@ CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ 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@ HAS_MAKEINFO = @HAS_MAKEINFO@ 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@ ac_ct_CXX = @ac_ct_CXX@ 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@ runstatedir = @runstatedir@ 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.texi cgdb_TEXINFOS = gpl.texi 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 .texi .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) --foreign doc/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign doc/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): .texi.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 .texi.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) \ $< .texi.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) \ $< .texi.html: $(AM_V_MAKEINFO)rm -rf $(@:.html=.htp) $(AM_V_at)if $(MAKEINFOHTML) $(AM_MAKEINFOHTMLFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \ -o $(@:.html=.htp) $<; \ then \ rm -rf $@ && mv $(@:.html=.htp) $@; \ else \ rm -rf $(@:.html=.htp); exit 1; \ fi $(srcdir)/cgdb.info: cgdb.texi $(srcdir)/version.texi $(cgdb_TEXINFOS) cgdb.dvi: cgdb.texi $(srcdir)/version.texi $(cgdb_TEXINFOS) cgdb.pdf: cgdb.texi $(srcdir)/version.texi $(cgdb_TEXINFOS) cgdb.html: cgdb.texi $(srcdir)/version.texi $(cgdb_TEXINFOS) $(srcdir)/version.texi: $(srcdir)/stamp-vti $(srcdir)/stamp-vti: cgdb.texi $(top_srcdir)/configure @(dir=.; test -f ./cgdb.texi || dir=$(srcdir); \ set `$(SHELL) $(top_srcdir)/config/mdate-sh $$dir/cgdb.texi`; \ 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.tmp$$$$ && \ mv $(srcdir)/version.texi.tmp$$$$ $(srcdir)/version.texi)) && \ rm -f vti.tmp$$$$ $(srcdir)/version.texi.$$$$ @cp $(srcdir)/version.texi $@ mostlyclean-vti: -rm -f vti.tmp* $(srcdir)/version.texi.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-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) $(DATA) installdirs: for dir in "$(DESTDIR)$(infodir)" "$(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-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-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-pdf-am \ uninstall-ps-am .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-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-pdf-am uninstall-ps-am .PRECIOUS: Makefile cgdb.txt: cgdb.texi $(srcdir)/version.texi $(cgdb_TEXINFOS) text-am: $(TEXTS) .texi.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.8.0/doc/Makefile.am0000664000175000017500000000137513056152001012141 00000000000000info_TEXINFOS = cgdb.texi cgdb_TEXINFOS = gpl.texi EXTRA_DIST = cgdb.txt dist_pkgdata_DATA = cgdb.txt cgdb.txt: cgdb.texi $(srcdir)/version.texi $(cgdb_TEXINFOS) TEXTS = cgdb.txt text-am: $(TEXTS) MAKEINFOTXT = $(MAKEINFO) --plaintext AM_MAKEINFOTXTFLAGS = $(AM_MAKEINFOFLAGS) .texi.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.8.0/doc/cgdb.info0000664000175000017500000021541314171036466011700 00000000000000This is cgdb.info, produced by makeinfo version 6.1 from cgdb.texi. This manual is for GNU CGDB (version 0.8.0, 16 January 2022), the GNU ncurses based front end to GDB. Copyright (C) 2019 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.8.0, 16 January 2022), the GNU ncurses based front end to GDB. Copyright (C) 2019 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 * 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 gdbwire. Those wanting to develop other interfaces to GDB are welcome to use gdbwire 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 and "GDB mode" is when the GDB 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. * 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 display CGDB uses with the ':set executinglinedisplay' configuration option. By default, the 'longarrow' display is used. As you navigate through the source window, the current line the cursor is on will be highlighted with a block. This simply helps you keep track of where you are in the file. You can configure what type of display CGDB uses with the ':set selectedlinedisplay' configuration option. By deafult, the 'block' display is used. 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. CGDB also supports regular expression searching within the GDB window.  File: cgdb.info, Node: File Dialog Window, Next: Status Bar, 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: Status Bar, Next: Switching Windows, Prev: File Dialog Window, Up: Understanding CGDB 2.4 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.5 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  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". 's' Puts the user into scroll mode in the "GDB mode". 'Ctrl-T' Opens a new tty for the debugged program. 'Ctrl-W' Toggle the window orientation (horizontal <-> vertical). '[]k' '[]up arrow' Move up a line or up '' lines. '[]j' '[]down arrow' Move down a line or down '' lines. '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 or to a line number within the file. 'm[a-zA-Z]' Set a mark at the cursor position. A lower case letter sets a local mark that is valid within one file. An upper case letter sets a global mark valid between files. If there are ten files, each file can have a mark 'a', but only one can have a mark 'A'. ''[a-zA-Z]' Jump to the corresponding local or global mark. '''' Jump to the last jump location. ''.' Jump to the currently executing line. '/' 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 or column (depending on split orientation). '=' Grow source window 1 line or column (depending on split orientation). '_' Shrink source window 25% '+' Grow source window 25% '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 in command mode or scroll mode. When in command mode, the user is typing in commands to interact with GDB. When in scroll mode, the user can scroll through the GDB output. You can enter scroll mode by typing 'page up' and quit scroll mode by typing 'q', 'i' or 'enter'. The commands available in *note GDB Mode:: when in command mode are: 'cgdbmodekey' Switch back to source window. This is defaulted to the key. 'page up' Move up a page and enter scroll mode. When in command mode, CGDB will pass along any other 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. The commands available in *note GDB Mode:: when in scroll mode are: 'cgdbmodekey' Switch back to source window. This is defaulted to the key. 'page up' Move up a page. 'page down' Move down a page. 'Ctrl-u' Move up 1/2 a page. 'Ctrl-d' Move down 1/2 a page. 'F11' 'home key' 'gg' Go to the beginning of the GDB buffer. 'F12' 'end key' 'G' Go to the end of the GDB buffer. 'k' 'up arrow' 'Ctrl-p' Move up a line. 'j' 'down arrow' 'Ctrl-n' Move down a line. '/' search from current cursor position. '?' reverse search from current cursor position. 'n' next forward search. 'N' next reverse search. ''.' Jump to the last line. 'q' 'i' 'enter' Exit scroll mode.  File: cgdb.info, Node: File Dialog 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-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 the file dialog. '[]G' Move to the bottom of the file dialog or to a line number within the file dialog. '/' 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: Configuring CGDB, Next: Highlighting Groups, Prev: Controlling CGDB, Up: Top 4 CGDB configuration commands ***************************** By default, CGDB stores its user-specific files (such as command history, program logs, and config files) in the '~/.cgdb/' directory. This location is configurable; if the environment variable 'CGDB_DIR' is set to a directory name, CGDB will use the specified directory instead of '~/.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 'cgdbrc'. It looks in '$CGDB_DIR' for that file, or in 'HOME''/.cgdb/' if the 'CGDB_DIR' environment variable is not set. If the 'cgdbrc' file exists, CGDB executes each one of its lines 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 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 color' This option is used to enable or disable color support in CGDB. The default is on. When enabled, CGDB can display color when appropriate. This typically occurs when syntax highlighting source files in the source viewer. When disabled, CGDB will not display colors. It may instead use other terminal attributes for syntax highlighting, including bold and reverse attributes. See the 'highlight' commamnd and look for the 'cterm' option. It should be noted that even when color is enabled in CGDB, if ncurses declares that the terminal does not support colors, CGDB will not use colors. ':set dwc' ':set debugwincolor' This option controls if the debug window will display colors or not. The default value is on. When enabled, if GDB or the program being debugged output an ANSI escape code representing color, then CGDB will display the corresponding color instead of the escape code. When disabled, CGDB will display the ANSI escape code in the debug window. See to learn more about ANSI escape codes. ':set dis' ':set disasm' This option is used to enable or disable showing assembly code in cgdb. The default value is off. When off, CGDB will display the source code to the user. When no source code is available, CGDB will display the assembly code. When this option is enabled, CGDB will display the mixed source and assembly when the source code is enabled and assembly code when the source code is not available. Please note that when assembly mode is displayed, it's displayed per function instead of per file. ':set eld=STYLE' ':set executinglinedisplay=STYLE' Set the executing line display to STYLE. Possible values for STYLE are 'shortarrow', 'longarrow', 'highlight', and 'block'. Changes the display that is used to indicate the currently executing line in the source viewer. The default value is 'longarrow'. The 'shortarrow' option draws an arrow next to the source line number. The 'longarrow' option also draws an arrow next to the source line number, but extends the arrow until the source code. The 'highlight' option draws the entire line in inverse video and the 'block' option draws an inverse block (cursor) next to the source code being executed. ':set hls' ':set hlsearch' When enabled, if there is a previous search pattern, highlight all its matches. The default is disabled. ':set ic' ':set ignorecase' Sets searching case insensitive. The default is off. ':set sbbs' ':set scrollbackbuffersize' Set the size of the scrollback buffer for the gdb window to num lines. The default scrollback is 10000 lines. ':set sld=STYLE' ':set selectedlinedisplay=STYLE' Set the selected line display to STYLE. Possible values for STYLE are 'shortarrow', 'longarrow', 'highlight', and 'block'. Changes the display that is used to indicate the currently selected line in the source viewer. The default value is 'block'. The 'shortarrow' option draws an arrow next to the source line number. The 'longarrow' option also draws an arrow next to the source line number, but extends the arrow until the source code. The 'highlight' option draws the entire line in inverse video and the 'block' option draws an inverse block (cursor) next to the source code being selected. ':set showmarks' This option controls if the source window will show marks or not. The default value is on. When enabled, CGDB will show the marks that the user has set in the vertical bar in the source window separating the line number from the source code. ':set sdc' ':set showdebugcommands' 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', 'asm', 'd', 'go', 'ada', 'rust', 'off', 'no', 'on' or 'yes'. 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. 'on' and 'yes' enable syntax highlighting based on the source files extension. 'off' and 'no' disable syntax highlighting. The remaining values set the specific language highlighters independent of the source files extension. ':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. This is useful when WINSPLITORIENTATION is set to 'horizontal'. ':set wmw=NUMBER' ':set winminwidth=NUMBER' The minimal width of a window. Windows will never become smaller than this value. The default value for NUMBER is 0. This is useful when WINSPLITORIENTATION is set to 'vertical'. ':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 'src_full', 'src_big', 'even', 'gdb_big', and 'gdb_full'. ':set wso=STYLE' ':set winsplitorientation=STYLE' Sets the window split orientation to either 'horizontal' (which places the source window above and the GDB window below), or 'vertical' ( hich places the source window on the left and the GDB window on the right). *Note Configuring CGDB::. ':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". ':logo' This will display one of CGDB's logos 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. ':nexti' Send a nexti 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. ':stepi' Send a stepi command to GDB. ':syntax' Turn the syntax on or off. ':u' ':until' Send an until command to GDB. ':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. 'Search' This represents the group used when displaying the previous search in either the source window, the GDB window in scroll mode, or the "file dialog window". This is only used when the HLSEARCH option is enabled. 'IncSearch' This represents the group used when the user is searching in either the source window, the GDB window in scroll mode, or the "file dialog window". 'SelectedLineArrow' This represents the group used when the user has the 'selectedlinedisplay' set to 'shortarrow' or 'longarrow'. 'ExecutingLineArrow' This represents the group used when the user has the 'executinglinedisplay' set to 'shortarrow' or 'longarrow'. 'SelectedLineHighlight' This represents the group used when the user has the 'selectedlinedisplay' option set to 'highlight'. 'ExecutingLineHighlight' This represents the group used when the user has the 'executinglinedisplay' option set to 'highlight'. 'SelectedLineBlock' This represents the group used when the user has the 'selectedlinedisplay' option set to 'block'. 'ExecutingLineBlock' This represents the group used when the user has the 'executinglinedisplay' option set to 'block'. '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. 'ExecutingLineNr' This represents the group that is used when CGDB is displaying the currently executing line. 'ScrollModeStatus' This represents the group that is used when CGDB is displaying the currently selected line number when in *note GDB Mode:: and the user is scrolling through the GDB buffer. 'Logo' This is the group CGDB uses to display its logo on startup when no source file can be auto detected. 'Mark' This is the group CGDB uses to display a mark in the source window. Marks are displayed when the 'showmarks' option is enabled. See the 'showmarks' option for more detail.  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 values for each color represent the defines from the curses header file passed to init_pair() to ask curses to create a new color. 'COLOR NAME' 'Color' 'Bold attribute' Black COLOR_BLACK No DarkBlue COLOR_BLUE No DarkGreen COLOR_GREEN No DarkCyan COLOR_CYAN No DarkRed COLOR_RED No DarkMagenta COLOR_MAGENTA No Brown, DarkYellow COLOR_YELLOW No LightGray, LightGrey, Gray, COLOR_WHITE No Grey DarkGray, DarkGrey COLOR_BLACK Yes Blue, LightBlue COLOR_BLUE Yes Green, LightGreen COLOR_GREEN Yes Cyan, LightCyan COLOR_CYAN Yes Red, LightRed COLOR_RED Yes Magenta, LightMagenta COLOR_MAGENTA Yes Yellow, LightYellow COLOR_YELLOW Yes White COLOR_WHITE Yes  File: cgdb.info, Node: Key User Interface, Next: Terminal Control Flow, 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 key code delay 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: Terminal Control Flow, Next: Building CGDB, Prev: Key User Interface, Up: Top 7 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 8 Building CGDB from source *************************** Building CGDB from source requires several packages. First, CGDB is hosted at GitHub. You can determine how to get CGDB from source by looking here: https://cgdb.github.io/ 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. 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) * configuring CGDB: Configuring CGDB. (line 6) * controlling CGDB: Controlling CGDB. (line 6) * file dialog window: File Dialog Window. (line 6) * file dialog window <1>: File Dialog Window. (line 6) * GDB mode: Understanding CGDB. (line 6) * GDB window: GDB Window. (line 6) * GDB window <1>: GDB Window. (line 6) * highlighting groups: Highlighting Groups. (line 6) * highlighting groups <1>: Available Highlighting Groups. (line 6) * invocation CGDB: Invocation. (line 6) * regular expression search: Source Window. (line 43) * regular expression search <1>: GDB Window. (line 21) * source window: Source Window. (line 6) * status bar: Understanding CGDB. (line 6) * status bar <1>: Status Bar. (line 6) * status bar <2>: Status Bar. (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) * understanding CGDB: Understanding CGDB. (line 6)  Tag Table: Node: Top1099 Node: Summary2632 Node: Invocation3619 Node: Understanding CGDB4074 Node: Source Window5359 Node: GDB Window8013 Node: File Dialog Window9054 Node: Status Bar10097 Node: Switching Windows11227 Node: Controlling CGDB11971 Node: CGDB Mode12613 Node: GDB Mode15173 Node: File Dialog Mode16834 Node: Configuring CGDB18331 Node: Highlighting Groups32399 Node: Available Highlighting Groups33974 Node: Available Attributes37142 Node: Available Colors38233 Node: Key User Interface39544 Node: Configuring the KUI Time Out Options42179 Node: Using Maps44608 Node: Understanding Keycodes45676 Node: Terminal Control Flow46985 Node: Building CGDB47749 Node: Copying This Manual49622 Node: Index68878  End Tag Table cgdb-0.8.0/doc/gpl.texi0000644000175000017500000004364512303175461011577 00000000000000@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.8.0/doc/cgdb.txt0000664000175000017500000020341414171036466011562 00000000000000CGDB 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 status bar. 2.5 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 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 Allowing terminal control flow in CGDB 8 Building CGDB from source Appendix A Copying This Manual Index CGDB **** This manual is for GNU CGDB (version 0.8.0, 16 January 2022), the GNU ncurses based front end to GDB. Copyright (C) 2019 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 gdbwire. Those wanting to develop other interfaces to GDB are welcome to use gdbwire 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 and "GDB mode" is when the GDB 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 display CGDB uses with the ':set executinglinedisplay' configuration option. By default, the 'longarrow' display is used. As you navigate through the source window, the current line the cursor is on will be highlighted with a block. This simply helps you keep track of where you are in the file. You can configure what type of display CGDB uses with the ':set selectedlinedisplay' configuration option. By deafult, the 'block' display is used. 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. CGDB also supports regular expression searching within the GDB window. 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 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.5 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". 's' Puts the user into scroll mode in the "GDB mode". 'Ctrl-T' Opens a new tty for the debugged program. 'Ctrl-W' Toggle the window orientation (horizontal <-> vertical). '[]k' '[]up arrow' Move up a line or up '' lines. '[]j' '[]down arrow' Move down a line or down '' lines. '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 or to a line number within the file. 'm[a-zA-Z]' Set a mark at the cursor position. A lower case letter sets a local mark that is valid within one file. An upper case letter sets a global mark valid between files. If there are ten files, each file can have a mark 'a', but only one can have a mark 'A'. ''[a-zA-Z]' Jump to the corresponding local or global mark. '''' Jump to the last jump location. ''.' Jump to the currently executing line. '/' 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 or column (depending on split orientation). '=' Grow source window 1 line or column (depending on split orientation). '_' Shrink source window 25% '+' Grow source window 25% '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 in command mode or scroll mode. When in command mode, the user is typing in commands to interact with GDB. When in scroll mode, the user can scroll through the GDB output. You can enter scroll mode by typing 'page up' and quit scroll mode by typing 'q', 'i' or 'enter'. The commands available in *note GDB Mode:: when in command mode are: 'cgdbmodekey' Switch back to source window. This is defaulted to the key. 'page up' Move up a page and enter scroll mode. When in command mode, CGDB will pass along any other 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. The commands available in *note GDB Mode:: when in scroll mode are: 'cgdbmodekey' Switch back to source window. This is defaulted to the key. 'page up' Move up a page. 'page down' Move down a page. 'Ctrl-u' Move up 1/2 a page. 'Ctrl-d' Move down 1/2 a page. 'F11' 'home key' 'gg' Go to the beginning of the GDB buffer. 'F12' 'end key' 'G' Go to the end of the GDB buffer. 'k' 'up arrow' 'Ctrl-p' Move up a line. 'j' 'down arrow' 'Ctrl-n' Move down a line. '/' search from current cursor position. '?' reverse search from current cursor position. 'n' next forward search. 'N' next reverse search. ''.' Jump to the last line. 'q' 'i' 'enter' Exit scroll mode. 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-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 the file dialog. '[]G' Move to the bottom of the file dialog or to a line number within the file dialog. '/' search from current cursor position. '?' reverse search from current cursor position. 'n' next forward search. 'N' next reverse search. 'enter' Select the current file. 4 CGDB configuration commands ***************************** By default, CGDB stores its user-specific files (such as command history, program logs, and config files) in the '~/.cgdb/' directory. This location is configurable; if the environment variable 'CGDB_DIR' is set to a directory name, CGDB will use the specified directory instead of '~/.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 'cgdbrc'. It looks in '$CGDB_DIR' for that file, or in 'HOME''/.cgdb/' if the 'CGDB_DIR' environment variable is not set. If the 'cgdbrc' file exists, CGDB executes each one of its lines 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 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 color' This option is used to enable or disable color support in CGDB. The default is on. When enabled, CGDB can display color when appropriate. This typically occurs when syntax highlighting source files in the source viewer. When disabled, CGDB will not display colors. It may instead use other terminal attributes for syntax highlighting, including bold and reverse attributes. See the 'highlight' commamnd and look for the 'cterm' option. It should be noted that even when color is enabled in CGDB, if ncurses declares that the terminal does not support colors, CGDB will not use colors. ':set dwc' ':set debugwincolor' This option controls if the debug window will display colors or not. The default value is on. When enabled, if GDB or the program being debugged output an ANSI escape code representing color, then CGDB will display the corresponding color instead of the escape code. When disabled, CGDB will display the ANSI escape code in the debug window. See to learn more about ANSI escape codes. ':set dis' ':set disasm' This option is used to enable or disable showing assembly code in cgdb. The default value is off. When off, CGDB will display the source code to the user. When no source code is available, CGDB will display the assembly code. When this option is enabled, CGDB will display the mixed source and assembly when the source code is enabled and assembly code when the source code is not available. Please note that when assembly mode is displayed, it's displayed per function instead of per file. ':set eld=STYLE' ':set executinglinedisplay=STYLE' Set the executing line display to STYLE. Possible values for STYLE are 'shortarrow', 'longarrow', 'highlight', and 'block'. Changes the display that is used to indicate the currently executing line in the source viewer. The default value is 'longarrow'. The 'shortarrow' option draws an arrow next to the source line number. The 'longarrow' option also draws an arrow next to the source line number, but extends the arrow until the source code. The 'highlight' option draws the entire line in inverse video and the 'block' option draws an inverse block (cursor) next to the source code being executed. ':set hls' ':set hlsearch' When enabled, if there is a previous search pattern, highlight all its matches. The default is disabled. ':set ic' ':set ignorecase' Sets searching case insensitive. The default is off. ':set sbbs' ':set scrollbackbuffersize' Set the size of the scrollback buffer for the gdb window to num lines. The default scrollback is 10000 lines. ':set sld=STYLE' ':set selectedlinedisplay=STYLE' Set the selected line display to STYLE. Possible values for STYLE are 'shortarrow', 'longarrow', 'highlight', and 'block'. Changes the display that is used to indicate the currently selected line in the source viewer. The default value is 'block'. The 'shortarrow' option draws an arrow next to the source line number. The 'longarrow' option also draws an arrow next to the source line number, but extends the arrow until the source code. The 'highlight' option draws the entire line in inverse video and the 'block' option draws an inverse block (cursor) next to the source code being selected. ':set showmarks' This option controls if the source window will show marks or not. The default value is on. When enabled, CGDB will show the marks that the user has set in the vertical bar in the source window separating the line number from the source code. ':set sdc' ':set showdebugcommands' 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', 'asm', 'd', 'go', 'ada', 'rust', 'off', 'no', 'on' or 'yes'. 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. 'on' and 'yes' enable syntax highlighting based on the source files extension. 'off' and 'no' disable syntax highlighting. The remaining values set the specific language highlighters independent of the source files extension. ':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. This is useful when WINSPLITORIENTATION is set to 'horizontal'. ':set wmw=NUMBER' ':set winminwidth=NUMBER' The minimal width of a window. Windows will never become smaller than this value. The default value for NUMBER is 0. This is useful when WINSPLITORIENTATION is set to 'vertical'. ':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 'src_full', 'src_big', 'even', 'gdb_big', and 'gdb_full'. ':set wso=STYLE' ':set winsplitorientation=STYLE' Sets the window split orientation to either 'horizontal' (which places the source window above and the GDB window below), or 'vertical' ( hich places the source window on the left and the GDB window on the right). *Note Configuring CGDB::. ':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". ':logo' This will display one of CGDB's logos 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. ':nexti' Send a nexti 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. ':stepi' Send a stepi command to GDB. ':syntax' Turn the syntax on or off. ':u' ':until' Send an until command to GDB. ':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. 'Search' This represents the group used when displaying the previous search in either the source window, the GDB window in scroll mode, or the "file dialog window". This is only used when the HLSEARCH option is enabled. 'IncSearch' This represents the group used when the user is searching in either the source window, the GDB window in scroll mode, or the "file dialog window". 'SelectedLineArrow' This represents the group used when the user has the 'selectedlinedisplay' set to 'shortarrow' or 'longarrow'. 'ExecutingLineArrow' This represents the group used when the user has the 'executinglinedisplay' set to 'shortarrow' or 'longarrow'. 'SelectedLineHighlight' This represents the group used when the user has the 'selectedlinedisplay' option set to 'highlight'. 'ExecutingLineHighlight' This represents the group used when the user has the 'executinglinedisplay' option set to 'highlight'. 'SelectedLineBlock' This represents the group used when the user has the 'selectedlinedisplay' option set to 'block'. 'ExecutingLineBlock' This represents the group used when the user has the 'executinglinedisplay' option set to 'block'. '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. 'ExecutingLineNr' This represents the group that is used when CGDB is displaying the currently executing line. 'ScrollModeStatus' This represents the group that is used when CGDB is displaying the currently selected line number when in *note GDB Mode:: and the user is scrolling through the GDB buffer. 'Logo' This is the group CGDB uses to display its logo on startup when no source file can be auto detected. 'Mark' This is the group CGDB uses to display a mark in the source window. Marks are displayed when the 'showmarks' option is enabled. See the 'showmarks' option for more detail. 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 values for each color represent the defines from the curses header file passed to init_pair() to ask curses to create a new color. 'COLOR NAME' 'Color' 'Bold attribute' Black COLOR_BLACK No DarkBlue COLOR_BLUE No DarkGreen COLOR_GREEN No DarkCyan COLOR_CYAN No DarkRed COLOR_RED No DarkMagenta COLOR_MAGENTA No Brown, DarkYellow COLOR_YELLOW No LightGray, LightGrey, Gray, COLOR_WHITE No Grey DarkGray, DarkGrey COLOR_BLACK Yes Blue, LightBlue COLOR_BLUE Yes Green, LightGreen COLOR_GREEN Yes Cyan, LightCyan COLOR_CYAN Yes Red, LightRed COLOR_RED Yes Magenta, LightMagenta COLOR_MAGENTA Yes Yellow, LightYellow COLOR_YELLOW Yes White COLOR_WHITE 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 key code delay 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 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. 8 Building CGDB from source *************************** Building CGDB from source requires several packages. First, CGDB is hosted at GitHub. You can determine how to get CGDB from source by looking here: https://cgdb.github.io/ 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. 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 ***** * Menu: * attributes: Available Attributes. (line 948) * building CGDB: Building CGDB. (line 1173) * CGDB key user interface: Key User Interface. (line 1005) * CGDB mode: Understanding CGDB. (line 91) * colors: Available Colors. (line 977) * commands, in CGDB mode: CGDB Mode. (line 240) * commands, in File Dialog mode: File Dialog Mode. (line 446) * commands, in GDB mode: GDB Mode. (line 368) * configuring CGDB: Configuring CGDB. (line 515) * controlling CGDB: Controlling CGDB. (line 232) * file dialog window: File Dialog Window. (line 178) * file dialog window <1>: File Dialog Window. (line 178) * GDB mode: Understanding CGDB. (line 91) * GDB window: GDB Window. (line 157) * GDB window <1>: GDB Window. (line 157) * highlighting groups: Highlighting Groups. (line 847) * highlighting groups <1>: Available Highlighting Groups. (line 872) * invocation CGDB: Invocation. (line 79) * regular expression search: Source Window. (line 146) * regular expression search <1>: GDB Window. (line 172) * source window: Source Window. (line 109) * status bar: Understanding CGDB. (line 91) * status bar <1>: Status Bar. (line 197) * status bar <2>: Status Bar. (line 197) * switch between windows: Switching Windows. (line 218) * terminal control flow: Terminal Control Flow. (line 1160) * timeout: Configuring the KUI Time Out Options. (line 1049) * timeoutlen: Configuring the KUI Time Out Options. (line 1049) * ttimeout: Configuring the KUI Time Out Options. (line 1049) * ttimeoutlen: Configuring the KUI Time Out Options. (line 1049) * understanding CGDB: Understanding CGDB. (line 91) cgdb-0.8.0/doc/cgdb.texi0000664000175000017500000013723114171036446011715 00000000000000\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{} 2019 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 * 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 gdbwire. Those wanting to develop other interfaces to GDB are welcome to use gdbwire 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 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 and @dfn{GDB mode} is when the GDB 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. * 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 display CGDB uses with the @code{:set executinglinedisplay} configuration option. By default, the @code{longarrow} display is used. As you navigate through the source window, the current line the cursor is on will be highlighted with a block. This simply helps you keep track of where you are in the file. You can configure what type of display CGDB uses with the @code{:set selectedlinedisplay} configuration option. By deafult, the @code{block} display is used. 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. @cindex regular expression search CGDB also supports regular expression searching within the GDB window. @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 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 @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 s Puts the user into scroll mode in the @dfn{GDB mode}. @item Ctrl-T Opens a new tty for the debugged program. @item Ctrl-W Toggle the window orientation (horizontal <-> vertical). @item []k @itemx []up arrow Move up a line or up @samp{} lines. @item []j @itemx []down arrow Move down a line or down @samp{} lines. @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 or to a line number within the file. @item m[a-zA-Z] Set a mark at the cursor position. A lower case letter sets a local mark that is valid within one file. An upper case letter sets a global mark valid between files. If there are ten files, each file can have a mark @samp{a}, but only one can have a mark @samp{A}. @item '[a-zA-Z] Jump to the corresponding local or global mark. @item '' Jump to the last jump location. @item '. Jump to the currently executing line. @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 or column (depending on split orientation). @item = Grow source window 1 line or column (depending on split orientation). @item _ Shrink source window 25% @item + Grow source window 25% @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 in command mode or scroll mode. When in command mode, the user is typing in commands to interact with GDB. When in scroll mode, the user can scroll through the GDB output. You can enter scroll mode by typing @kbd{page up} and quit scroll mode by typing @kbd{q}, @kbd{i} or @kbd{enter}. The commands available in @ref{GDB Mode} when in command mode are: @table @kbd @item cgdbmodekey Switch back to source window. This is defaulted to the @key{ESC} key. @item page up Move up a page and enter scroll mode. @end table When in command mode, CGDB will pass along any other 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. The commands available in @ref{GDB Mode} when in scroll mode are: @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 Ctrl-u Move up 1/2 a page. @item Ctrl-d Move down 1/2 a page. @item F11 @itemx home key @itemx gg Go to the beginning of the GDB buffer. @item F12 @itemx end key @itemx G Go to the end of the GDB buffer. @item k @itemx up arrow @itemx Ctrl-p Move up a line. @item j @itemx down arrow @itemx Ctrl-n Move down a line. @item / search from current cursor position. @item ? reverse search from current cursor position. @item n next forward search. @item N next reverse search. @item '. Jump to the last line. @item q @itemx i @itemx enter Exit scroll mode. @end table @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-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 the file dialog. @item []G Move to the bottom of the file dialog or to a line number within the file dialog. @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 Configuring CGDB @chapter CGDB configuration commands @cindex configuring CGDB By default, CGDB stores its user-specific files (such as command history, program logs, and config files) in the @file{~/.cgdb/} directory. This location is configurable; if the environment variable @env{CGDB_DIR} is set to a directory name, CGDB will use the specified directory instead of @file{~/.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{$CGDB_DIR} for that file, or in @env{HOME}@file{/.cgdb/} if the @env{CGDB_DIR} environment variable is not set. If the @file{cgdbrc} file exists, CGDB executes each one of its lines 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 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 color This option is used to enable or disable color support in CGDB. The default is on. When enabled, CGDB can display color when appropriate. This typically occurs when syntax highlighting source files in the source viewer. When disabled, CGDB will not display colors. It may instead use other terminal attributes for syntax highlighting, including bold and reverse attributes. See the @code{highlight} commamnd and look for the @samp{cterm} option. It should be noted that even when color is enabled in CGDB, if ncurses declares that the terminal does not support colors, CGDB will not use colors. @item :set dwc @itemx :set debugwincolor This option controls if the debug window will display colors or not. The default value is on. When enabled, if GDB or the program being debugged output an ANSI escape code representing color, then CGDB will display the corresponding color instead of the escape code. When disabled, CGDB will display the ANSI escape code in the debug window. See @uref{https://en.wikipedia.org/wiki/ANSI_escape_code#Colors} to learn more about ANSI escape codes. @item :set dis @item :set disasm This option is used to enable or disable showing assembly code in cgdb. The default value is off. When off, CGDB will display the source code to the user. When no source code is available, CGDB will display the assembly code. When this option is enabled, CGDB will display the mixed source and assembly when the source code is enabled and assembly code when the source code is not available. Please note that when assembly mode is displayed, it's displayed per function instead of per file. @item :set eld=@var{style} @itemx :set executinglinedisplay=@var{style} Set the executing line display to @var{style}. Possible values for @var{style} are @samp{shortarrow}, @samp{longarrow}, @samp{highlight}, and @samp{block}. Changes the display that is used to indicate the currently executing line in the source viewer. The default value is @samp{longarrow}. The @samp{shortarrow} option draws an arrow next to the source line number. The @samp{longarrow} option also draws an arrow next to the source line number, but extends the arrow until the source code. The @samp{highlight} option draws the entire line in inverse video and the @samp{block} option draws an inverse block (cursor) next to the source code being executed. @item :set hls @itemx :set hlsearch When enabled, if there is a previous search pattern, highlight all its matches. The default is disabled. @item :set ic @itemx :set ignorecase Sets searching case insensitive. The default is off. @item :set sbbs @itemx :set scrollbackbuffersize Set the size of the scrollback buffer for the gdb window to num lines. The default scrollback is 10000 lines. @item :set sld=@var{style} @itemx :set selectedlinedisplay=@var{style} Set the selected line display to @var{style}. Possible values for @var{style} are @samp{shortarrow}, @samp{longarrow}, @samp{highlight}, and @samp{block}. Changes the display that is used to indicate the currently selected line in the source viewer. The default value is @samp{block}. The @samp{shortarrow} option draws an arrow next to the source line number. The @samp{longarrow} option also draws an arrow next to the source line number, but extends the arrow until the source code. The @samp{highlight} option draws the entire line in inverse video and the @samp{block} option draws an inverse block (cursor) next to the source code being selected. @item :set showmarks This option controls if the source window will show marks or not. The default value is on. When enabled, CGDB will show the marks that the user has set in the vertical bar in the source window separating the line number from the source code. @item :set sdc @itemx :set showdebugcommands 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{asm}, @samp{d}, @samp{go}, @samp{ada}, @samp{rust}, @samp{off}, @samp{no}, @samp{on} or @samp{yes}. 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. @samp{on} and @samp{yes} enable syntax highlighting based on the source files extension. @samp{off} and @samp{no} disable syntax highlighting. The remaining values set the specific language highlighters independent of the source files extension. @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. This is useful when @var{winsplitorientation} is set to @samp{horizontal}. @item :set wmw=@var{number} @itemx :set winminwidth=@var{number} The minimal width of a window. Windows will never become smaller than this value. The default value for @var{number} is 0. This is useful when @var{winsplitorientation} is set to @samp{vertical}. @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{src_full}, @samp{src_big}, @samp{even}, @samp{gdb_big}, and @samp{gdb_full}. @item :set wso=@var{style} @itemx :set winsplitorientation=@var{style} Sets the window split orientation to either @samp{horizontal} (which places the source window above and the GDB window below), or @samp{vertical} ( hich places the source window on the left and the GDB window on the right). @xref{Configuring CGDB}. @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. @item :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 :logo This will display one of CGDB's logos 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 :nexti Send a nexti 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 :stepi Send a stepi command to GDB. @item :syntax Turn the syntax on or off. @item :u @itemx :until Send an until command to GDB. @item :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 Search This represents the group used when displaying the previous search in either the source window, the GDB window in scroll mode, or the @dfn{file dialog window}. This is only used when the @var{hlsearch} option is enabled. @item IncSearch This represents the group used when the user is searching in either the source window, the GDB window in scroll mode, or the @dfn{file dialog window}. @item SelectedLineArrow This represents the group used when the user has the @code{selectedlinedisplay} set to @code{shortarrow} or @code{longarrow}. @item ExecutingLineArrow This represents the group used when the user has the @code{executinglinedisplay} set to @code{shortarrow} or @code{longarrow}. @item SelectedLineHighlight This represents the group used when the user has the @code{selectedlinedisplay} option set to @code{highlight}. @item ExecutingLineHighlight This represents the group used when the user has the @code{executinglinedisplay} option set to @code{highlight}. @item SelectedLineBlock This represents the group used when the user has the @code{selectedlinedisplay} option set to @code{block}. @item ExecutingLineBlock This represents the group used when the user has the @code{executinglinedisplay} option set to @code{block}. @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 ExecutingLineNr This represents the group that is used when CGDB is displaying the currently executing line. @item ScrollModeStatus This represents the group that is used when CGDB is displaying the currently selected line number when in @ref{GDB Mode} and the user is scrolling through the GDB buffer. @item Logo This is the group CGDB uses to display its logo on startup when no source file can be auto detected. @item Mark This is the group CGDB uses to display a mark in the source window. Marks are displayed when the @code{showmarks} option is enabled. See the @code{showmarks} option for more detail. @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 values for each color represent the defines from the curses header file passed to init_pair() to ask curses to create a new color. @multitable @columnfractions .4 .2 .2 .2 @item @code{COLOR NAME} @tab @code{Color} @tab @code{Bold attribute} @item Black @tab COLOR_BLACK @tab No @item DarkBlue @tab COLOR_BLUE @tab No @item DarkGreen @tab COLOR_GREEN @tab No @item DarkCyan @tab COLOR_CYAN @tab No @item DarkRed @tab COLOR_RED @tab No @item DarkMagenta @tab COLOR_MAGENTA @tab No @item Brown, DarkYellow @tab COLOR_YELLOW @tab No @item LightGray, LightGrey, Gray, Grey @tab COLOR_WHITE @tab No @item DarkGray, DarkGrey @tab COLOR_BLACK @tab Yes @item Blue, LightBlue @tab COLOR_BLUE @tab Yes @item Green, LightGreen @tab COLOR_GREEN @tab Yes @item Cyan, LightCyan @tab COLOR_CYAN @tab Yes @item Red, LightRed @tab COLOR_RED @tab Yes @item Magenta, LightMagenta @tab COLOR_MAGENTA @tab Yes @item Yellow, LightYellow @tab COLOR_YELLOW @tab Yes @item White @tab COLOR_WHITE @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 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 GitHub. You can determine how to get CGDB from source by looking here: https://cgdb.github.io/ 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. @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.8.0/doc/stamp-vti0000644000175000017500000000014314171036465011760 00000000000000@set UPDATED 16 January 2022 @set UPDATED-MONTH January 2022 @set EDITION 0.8.0 @set VERSION 0.8.0 cgdb-0.8.0/NEWS0000664000175000017500000010774314171036450010055 00000000000000cgdb-0.8.0 (01/16/2022) * Fix issue #298 - CGDB now exits when gdb exits Previously if gdb exited but the inferior, or child of the inferior was still running, cgdb would possibly continue running in a non responsive state. Now cgdb exits when gdb does. * Fix issue #278, Single stepping through disassembly without debug symbols does not move arrow in source window. Now the arrow moves in the source window as expected. * Fix issue #135 CGDB freezes when pressing "o" to open the file dialog Previously, if you attempted to open the file dialog, cgdb would sometimes hang, due to a gdbwire parsing bug from the gdb response. This has been resolved. * Fix issue #152, breakpoint handling is broken in disasembly view Previously, if you set a breakpoint in the source view, it would not be reflected in the disassembly view, and vice versa. Now if you set a breakpoint in either view, it should be reflected in the other. * Fix issue #260, CGDB would not process commands after F5, F6, etc If F5, F6, F7, F8, F10 were hit, CGDB would no longer process GDB commands, like setting breakpoints, etc. Now CGDB works as expected. * CGDB implements a virtual terminal in the GDB window - The GDB scroller is now a virtual terminal (using libvterm) - The scrollback buffer has been reimplemented using libvterm The cursor row/col position is now known, rather than just the row - Searching in the scrollback buffer is improved - The scrollback buffer size is configurable with a new option, scrollbackbuffersize (sbbs) and is defaulted to 10000. - Mark commands in the GDB scroller have been removed - Unicode is now fully supported in the gdb window - libvterm does not support reflow yet, so resizing the terminal or switching the window orientation (winsplitorientation) after startup may cause the text in the GDB window to not be as expected - Colors in the GDB window are not fully supported yet. Ncurses is difficult to work with, considering switching. RGB vterm colors are unsupported at the moment. Fix the following github issues - When I use set wso=vertical, I use the GDB window to print the variable value, which will overflow the rightboundary #274 - Long lines from GDB output are not wrapped #265 - Some characters in the editor are incorrect #261 - Setting prompt to unicode character doesn't work as expected #257 - cgdb prints '[?2004h' in xfce4 terminal #256 - [regression] prefixing "04h" characters in the gdb prompt since fixing #255 - GDB console does not display color #251 - gdb ANSI escape codes only in cgdb #189 - Cursor offset gets lost when typing UTF-8 characters in the gdb window #121 * CGDB implements GDB/MI in favor of GDB/Annotations - CGDB now communicates with GDB using MI only (instead of Annotations) using the new-ui GDB command - CGDB now requires GDB 7.12 or newer - CGDB now fully supports the GDB console, including readline and communicating with the inferior (the program being debugged) - CGDB no longer uses the inferior tty option to talk to the inferior Fix the following github issues - Messed up input with latest gdb #247 - press T, it cannot open I/O window #244 (no longer necessary) - Support disabling the inferior pty #241 - Any plan to add tty window back? #209 - Debugging a forking program fails on first run #204 - Ctrl - T doesn't seem to work (cgdb 0.7.0) #193 - inputrc enable-keypad messing with readline #190 - GDB command-line options not working #160 - Logging output uses machine interface? #158 - Pagination of long output is not properly handled #145 - cgdb stucks on fgets #130 - Autocompletion on directories failes to append '/' #96 - GDB Prompt Hangs after Pressing Tab in a "Command List" #67 * Add the nexti and stepi configuration commands * Fix issue #239, ANSI escape issues with GDB-9 Color sequences like, [?1l,[?1h,=,>" are now ignored by CGDB rather than producing garbage looking text in the gdb terminal. * Fix auto source reload issue, issue #235 and #221 Occasionally, CGDB would not properly reload source files when they had changed. Now CGDB will reload them on change. * CGDB works again with newer versions of GDB (gdb 8.3 and above) CGDB annotation support was broken by the following GDB issue, https://sourceware.org/bugzilla/show_bug.cgi?id=25190 Changing CGDB from 'set height 0' to 'set pagination off' works around the issue, even though I thought they were identical commands. * CGDB now supports a configurable home directory. If the environment variable 'CGDB_DIR' is set to a directory name, CGDB will use the specified directory instead of '~/.cgdb/'. * Fix issue #219 - CGDB users on Gentoo were experiencing segfaults at startup due to mismatched wide-character support between the ncurses and tinfo libraries. The build system has been updated to correctly pair the versions of these libraries. cgdb-0.7.1 (08/04/2019) * Status bar messages are now displayed properly in veritical mode. The message is now truncated according to the status bar width instead of the width of the terminal. * Fix spurious error from CGDB on shutdown. You may have seen, CGDB had unexpected results. Search the logs for more details. In the log there was a waitpid error. CGDB was using the API wrong. * Fix issue #161 - CGDB would lock up when doing a regex search from the status bar if the file was just opened from the file dialog and the search did not match any text in the file. Now the search fails to match text as expected. * Status bar commands and gdb console commands now both show gdb output in the gdb window (instead of only the gdb console commands). This fixed issue #154 on github. * Fixed issue where typing F8 would do a 'next', 'step' and screen refresh instead of just doing a 'next' command. * Fix issue #139 - Show appropriate logos when color disabled Previously, if the user had colors disabled, CGDB would still show logos that had ansi escape color sequences in them. * Fixed :highlight regression introduced in 0.7.0. In 0.6.8, if the user entered a :highlight command from the CGDB status bar, for instance: :highlight Comment ctermfg=Blue CGDB would updated the currently displayed source file with the requested highlighting changes. In 0.7.0 this would not occur. Both versions honored :highlight in the .cgdbrc file. * Fix issue #125 - CGDB can cross compile again. * The rust syntax highlighter is now case sensitive instead of case insensitive. * Fix issue #129. CGDB with old versions of ncurses (5.6 or before) would not display colors. Now it will display colors, but will not support ansi colors in the GDB window. * Fix issue #137. rustlexer.lpp fails to compile with some versions of GNU autotools. * Fix issue #135. CGDB would "freeze" when opening the file dialog if the number of files was very large. Updating the gdbwire parser resolved the issue. * Add support for readline's backward-kill-word and kill-word at gdb prompt cgdb-0.7.0 (03/21/2017) * Remove help2man dependency. CGDB has a good info page which should suffice. * The hlsearch option has been added to CGDB. This improves the searching and displaying of searching functionality within CGDB. By default the option is off. When enabled, and there exists a previous search, CGDB will display the search results using the Search highlighting group. The IncSearch highlighting group is used to display the active search. The hlsearch option highlights previous searches in the source window, the gdb window when in scroll mode and the file dialog window. * CGDB now supports showing assembly code! By default, CGDB will display source code when it is available and assembly code when no source code is available. The option 'set disasm' allows you to show mixed source/assembly when both are available. * Add support to enable/disable showing assembly code in CGDB. The default is disabled. The 'set disasm' enables showing mixed assembly mode by default. See the documentation for more information. * Add the :logo command to cgdb. This tells CGDB to display a logo in the source window. * Add an initial Rust syntax highlighter. * Support vi type j and k motions. Previously only typing j or k with out a number was supported. * Add support for marks. m[a-z] will set a local file mark and m[A-Z] will set a global mark. '[a-z] will jump to the corresponding local mark and '[A-Z] will jump to the corresponding global mark. As an added bonus '' will jump to the last jump location and '. will jump to the last executing line. The showmarks option was introduced to show the marks in the source window. It defaults to true. You can disable the viewing of marks using 'set noshowmarks'. * Add support to enable or disable color in the source window. The default is enabled. See the documentation for more information. * Add support for showing colors in the debug window. If gdb or the program being debugged output an ansi escape code representing color, https://en.wikipedia.org/wiki/ANSI_escape_code#Colors then CGDB will display the corresponding color instead of the escape code. This option is configurable with the set debugwincolor option. * Add the winminwidth option to CGDB. It controls the minimum width that a window can be resized. It corresponds to the winminheight option. This was introduced now that CGDB can have vertically split windows. * Add support for vertical or horizontal splitting of the CGDB/GDB windows. Thanks to Daniel Cohen for the original implementation of this idea! You can change the window orientation by using the command 'set winsplitorientation=horizontal or vertical'. horizontal is the default orientation. Type Ctrl-w to switch between vertical and horizontal viewing. * Remove the TTY mode and TTY window from CGDB. This previously allowed you to send input to the program being debugged through the TTY window in CGDB. It is better for the user to run their program in one terminal and attach to it with CGDB from another terminal in order to get terminal input and terminal output working correctly. * Add the -w command line option to CGDB. It directs CGDB to wait to start until either a debugger is attached to it, or until a key is written to it's stdin. This helps simplify debugging CGDB itself. * Added GDB scroll mode in addition to the existing GDB command mode. To enter scroll mode, type 'page up' when in GDB mode and to exit type 'q', 'i' or 'Enter'. In scroll mode, you can scroll through the GDB output. You can also search the GDB output with the /, ?, n and N keys. Marks are also supported. You can set a mark by typing m[a-z] and you can jump to a mark by typing '[a-z]. See the documentation for more details. * Extended support for the G command when in CGDB mode. The new supported syntax is []G, allowing users to jump to a specific line within the source file, rather than just the end of the source file. This is identical to the : command. * Added support for 'executinglinedisplay' and 'selectedlinedisplay' configuration options. See documentation for full explanation. This allows you to configure how CGDB displays both the currently executing line and the currently selected line. The default for executing line is set to longarrow. The default for selected line is set to block. The 'arrowstyle' option has been deprecated (but still supported) and users should use the 'executinglinedisplay' option instead. * CGDB now only supports ncurses. Support for curses was removed. The curses support was previously very out of date and untested. If curses support is needed, please let us know. cgdb-0.6.8 (11/13/2014) * Fix issue #40, the map commands were adding additional new lines to the mappings. For instance, 'imap a b' in the ~/.cgdb/cgdbrc file would cause a to map to 'b' instead of just 'b'. * Added feature from issue #29, added 'until' command to CGDB. * Updated autotools configuration files to satisfy warnings and recommendations produced by autotools when run. * Fix issue #49, a gcc compiler warning. * Fixed a hang consuming 100% CPU usage on OS X Mavericks (github #48). * Fixed a hang when quitting cgdb while inferior is running (github #1 and #5 and #46). This was believed to be fixed in the last release but I've finally reproduced the issue and fixed it for good. 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 pseudo 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.8.0/cgdb/0000775000175000017500000000000014171036467010331 500000000000000cgdb-0.8.0/cgdb/cgdb.h0000664000175000017500000000055114134376364011324 00000000000000/* cgdb.h: * ------- * * Contains macros for any of the sources here to use. */ #ifndef _CGDB_H_ #define _CGDB_H_ /* ----------- */ /* Definitions */ /* ----------- */ #define MAXLINE 4096 /* Clean cgdb up (when exiting) */ void cgdb_cleanup_and_exit(int val); /* * See documentation in cgdb.c. */ int run_shell_command(const char *command); #endif cgdb-0.8.0/cgdb/vterminal.h0000664000175000017500000001117514134377055012430 00000000000000#ifndef VTERMINAL_H #define VTERMINAL_H #include #include // A virtual terminal based on vterm struct VTerminal; struct VTerminalOptions { // An opaque pointer for callbacks void *data; // The height of the virtual terminal int height; // The width of the virtual terminal int width; // The size (number of rows) of the scrollback buffer int scrollback_buffer_size; // A function to ring the bell void (*ring_bell)(void *data); }; // Create a new virtual terminal // // @param options // The options to use when creating the virtual terminal VTerminal *vterminal_new(VTerminalOptions options); // Free a virtual terminal // // @param terminal // The terminal to operate on void vterminal_free(VTerminal *terminal); // Write data to the virtual terminal // // @param terminal // The terminal to operate on // // @param data // The data to write to the virtual terminal // // @param len // The number of characters in data to write void vterminal_write(VTerminal *terminal, const char *data, size_t len); // Get the height and width of the terminal // // @param terminal // The terminal to operate on // // @param height // The height of the virtual terminal // // @param width // The width of the virtual terminal void vterminal_get_height_width(VTerminal *terminal, int &height, int &width); // Fetch the text and attributes for a row and column // // @param terminal // The terminal to operate on // // @param row // The row to fetch at // // @param col // The column to fetch at // // @param utf8text // Will return the text at the row/col // // @param attr // Will return the attributes at the row/col // // @param width // Will return the width of the row/col. // An ascii character is size 1, width == 1 // A wide unicode character is size 2, width == 2 // The next column you access should be col + width void vterminal_fetch_row_col(VTerminal *terminal, int row, int col, std::string &utf8text, int &attr, int &width); // Fetch the text for a row and column range // // @param terminal // The terminal to operate on // // @param row // The row to fetch at // // @param col // The starting column to fetch at // // @param end_col // The ending column to fetch up to (end_col itself is not included) // // @param utf8text // Will return the text between the start and end column void vterminal_fetch_row(VTerminal *terminal, int row, int start_col, int end_col, std::string &utf8text); // Get the position of the cursor in the terminal // // @param terminal // The terminal to operate on // // @param row // The row the cursor is on // // @param col // The column the cursor is on void vterminal_get_cursor_pos(VTerminal *terminal, int &row, int &col); // Get the number of rows in the scrollback buffer // // @param terminal // The terminal to operate on // // @param num // The number of rows in the scrollback buffer void vterminal_scrollback_num_rows(VTerminal *terminal, int &num); // Adjust the scrollback buffer position // // @param terminal // The terminal to operate on // // @param delta // The amount to adjust the scrollback buffer // A positives number scrolls "up", you can see more of the scrollback buffer. // A negative number scrolls "down", you see more of the active terminal. // No matter the delta passed, this constraint will be followed internally: // 0 >= active delta <= vterminal_scrollback_num_rows() void vterminal_scroll_delta(VTerminal *terminal, int delta); // Get the current scrollback delta // // @param terminal // The terminal to operate on // // @param delta // The current scrollback delta in the terminal // The delta return value will be constrained as follows: // 0 >= delta <= vterminal_scrollback_num_rows() void vterminal_scroll_get_delta(VTerminal *terminal, int &delta); // Set the current scrollback delta // // @param terminal // The terminal to operate on // // @param delta // The scrollback delta // When delta is 0, the terminal is not scrolling. // When delta is 1, the terminal scrolls back 1 line. // When delta is 2, the terminal scrolls back 2 lines. // The terminal can be scrolled back to vterminal_scrollback_num_rows(). void vterminal_scroll_set_delta(VTerminal *terminal, int delta); // Push the terminal screen contents to the scrollback buffer // // This is generally useful when the user types ctrl-l to clear the screen. // Traditionally vterm would clear the screen, but not push the contents // of the screen to the scrollback buffer. This allows the terminal contents // to be pushed to the scrollback buffer before clearing it. // // @param terminal // The terminal to operate on void vterminal_push_screen_to_scrollback(VTerminal *terminal); #endif cgdb-0.8.0/cgdb/highlight.h0000664000175000017500000000335014135136636012371 00000000000000#ifndef _HIGHLIGHT_H_ #define _HIGHLIGHT_H_ #include "highlight_groups.h" /** * Syntax highlighting routines. */ struct hl_regex_info; /** * Do a regex search. * * @param info * The regular expression structure. Pass in the address of a NULL pointer * the first time. Afterwards, reuse the same pointer. Call hl_regex_free * when done. * * @param line * The line to search. * * @param regex * The regular expression to search the line with. * * @param icase * Non-zero to be case insensitive, otherwise 0 for case sensitivity. * * @param start * If a match is found (this function returns non-zero), the starting * character for the match. Otherwise, if no match found, -1. * * @param end * If a match is found (this function returns non-zero), the ending * character for the match. Otherwise, if no match found, -1. */ int hl_regex_search(struct hl_regex_info **info, const char *line, const char *regex, int icase, int *start, int *end); /** * Free the regular expression context. * * @param info * The regular expression context to free. */ void hl_regex_free(struct hl_regex_info **info); /** * Highlight the regular expressions found. * * @param info * A regular expression context previously created in hl_regex_search. * * @param line * A line of text to highlight based on the regular expression. * * @param group_kind * The group_kind to use for highlighting. * * @return * A list of line attributes corresponding to the positions in the * line that matched the regular expression and should be highlighted. * Will return NULL if no matches were found. */ struct hl_line_attr *hl_regex_highlight(struct hl_regex_info **info, char *line, enum hl_group_kind group_kind); #endif /* _HIGHLIGHT_H_ */ cgdb-0.8.0/cgdb/sources.h0000664000175000017500000002370614136113161012101 00000000000000/* 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_ #include "sys_win.h" /* ----------- */ /* Definitions */ /* ----------- */ /* Max length of a line */ #define MAX_LINE 4096 /* Count of marks */ #define MARK_COUNT 26 /* --------------- */ /* Data Structures */ /* --------------- */ /* Global mark: source file and line number */ struct sviewer_mark { struct list_node *node; int line; }; /* Source viewer object */ struct sviewer { struct list_node *list_head; /* File list */ struct list_node *cur; /* Current node we're displaying */ sviewer_mark global_marks[MARK_COUNT]; /* Global A-Z marks */ sviewer_mark jump_back_mark; /* Location where last jump occurred from */ SWINDOW *win; /* Curses window */ uint64_t addr_frame; /* Current frame address Zero if unknown. */ /** * The last regular expression searched for. * * This is useful with the hlsearch option. In this case, * CGDB will display all of the matches to the last regular * expression searched for. */ struct hl_regex_info *last_hlregex; /** * The current regular expression being searched for. * * This is the active regular expression being searched for. It is * interactive, as the user updates the regular expression they * would like to use for searching, CGDB highlights the text in * the source that represents the next match. */ struct hl_regex_info *hlregex; }; struct source_line { char *line; int len; struct hl_line_attr *attrs; }; struct buffer { struct source_line *lines; /* Stretch buffer array with line information */ uint64_t *addrs; /* The list of corresponding addresses */ int max_width; /* Width of longest line in file */ char *file_data; /* Entire file pointer if read in that way */ int tabstop; /* Tabstop value used to load file */ enum tokenizer_language_support language; /* The language type of this file */ }; struct line_flags { unsigned char breakpt : 2; unsigned char has_mark : 1; }; struct list_node { char *path; /* Full path to source file */ struct buffer file_buf; /* File buffer */ line_flags *lflags; /* Breakpoints */ int sel_line; /* Current line selected in viewer */ int sel_col; /* Current column selected in viewer */ int exe_line; /* Current line executing, or -1 if not set */ 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 */ int local_marks[MARK_COUNT];/* Line numbers for local (a..z) marks */ uint64_t addr_start; /* Disassembly start address */ uint64_t addr_end; /* Disassembly end address */ struct list_node *next; /* Pointer to next link in list */ }; /* --------- */ /* Functions */ /* --------- */ /* source_new: Create a new source viewer object. * ----------- * * Return Value: A new sviewer object on success. */ struct sviewer *source_new(SWINDOW *window); /* 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: pointer to your brand new node. */ struct list_node *source_add(struct sviewer *sview, const char *path); void source_add_disasm_line(struct list_node *node, const char *line); int source_highlight(struct list_node *node); struct list_node *source_get_node(struct sviewer *sview, const char *path); /* 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); /* 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, enum win_refresh dorefresh); /* Relocate the source window. * * @param sview * Source viewer object * * @param win * The new window */ void source_move(struct sviewer *sview, SWINDOW *win); /* 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, or -1 for the last line * */ void source_set_sel_line(struct sviewer *sview, int line); /* source_set_exec_line: Set currently selected line and executing line * --------------- * * sview: Source viewer object * path: Full path to the source file (may be NULL to leave unchanged) * sel_line: Current selected line number (0 to leave unchanged) * exe_line: Current executing 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 sel_line, int exe_line); int source_set_exec_addr(struct sviewer *sview, uint64_t addr); /** * Initialize a regular expression search in the source viewer. * * This function should be called during the start of a regular expression * search and before source_search_regex is called. * * @param sview * The source viewer object */ void source_search_regex_init(struct sviewer *sview); /** * Allows the user to search for a regular expression. * * @param sview * The source viewer object * * @param regex * The regular expression to search for. If NULL, then no regex will be * tried, but the state can still put back to its old self! * * @param opt * If 1, Then the search is temporary ( User has not hit enter ) * If 2, The search is perminant * * @param direction * If 0 then forward, else reverse * * @param icase * If 0 ignore case. * * @return * Zero on match and 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_enable_break: Enable a given breakpoint. * -------------------- * * sview: The source viewer object * path: The path to the source file, absolute if available * line: Line number of breakpoint * enabled: 0 for disabled, otherwise enabled */ void source_enable_break(struct sviewer *sview, const char *path, int line, int enabled); /** * Replace all existing breakpoints with the breakpoints provided. * * @param sview * The source viewer object * * @param breakpoints * The new breakpoints to set */ void source_set_breakpoints(struct sviewer *sview, struct tgdb_breakpoint *breakpoints); /** * 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); /* ----- */ /* Marks */ /* ----- */ /* source_set_mark: Set mark at current selected line. * -------------------- * * sview: The source viewer object * key: local mark char: a..z or global mark: A..Z * return: 1 if a mark was set, 0 otherwise */ int source_set_mark(struct sviewer *sview, int key); /* source_goto_mark: Goto mark specified at key. * -------------------- * * sview: The source viewer object * key: local mark char: a..z or global mark: A..Z * return: 1 if a jump was successful, 0 otherwise */ int source_goto_mark(struct sviewer *sview, int key); #endif cgdb-0.8.0/cgdb/filedlg.cpp0000664000175000017500000004401214135136636012363 00000000000000#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 */ #include #include "fs_util.h" #include "sys_util.h" #include "stretchy.h" #include "sys_win.h" #include "filedlg.h" #include "cgdb.h" #include "cgdbrc.h" #include "highlight.h" #include "sources.h" #include "kui_term.h" #include "highlight_groups.h" struct file_buffer { char **files; /* Array containing file */ 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_rline; /* Current line used by regex */ }; struct filedlg { struct file_buffer *buf; /* All of the widget's data ( files ) */ struct hl_regex_info *last_hlregex; struct hl_regex_info *hlregex; SWINDOW *win; /* Curses window */ std::string G_line_number; /* Line number user wants to 'G' to */ }; 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(SWINDOW *win, int line, int width, const char *string) { int x, y; int j; int length = strlen(string); y = swin_getcury(win); x = swin_getcurx(win); x = (int) ((width - length) / 2); swin_wmove(win, line, 0); for (j = 0; j < x; j++) swin_waddch(win, ' '); swin_mvwprintw(win, line, x, "%s", string); for (j = x + length; j < width; j++) swin_waddch(win, ' '); } struct filedlg *filedlg_new(int pos_r, int pos_c, int height, int width) { struct filedlg *fd; /* Allocate a new structure */ fd = new filedlg(); /* Initialize the structure */ fd->win = swin_newwin(height, width, pos_r, pos_c); /* Initialize the buffer */ fd->buf = (struct file_buffer *)cgdb_malloc(sizeof(struct file_buffer)); fd->last_hlregex = NULL; fd->hlregex = NULL; fd->buf->files = NULL; fd->buf->max_width = 0; fd->buf->sel_line = 0; fd->buf->sel_col = 0; fd->buf->sel_rline = 0; return fd; } void filedlg_free(struct filedlg *fdlg) { filedlg_clear(fdlg); hl_regex_free(&fdlg->last_hlregex); fdlg->last_hlregex = NULL; hl_regex_free(&fdlg->hlregex); fdlg->hlregex = NULL; swin_delwin(fdlg->win); fdlg->win = NULL; free(fdlg->buf); fdlg->buf = NULL; delete 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; /* Make sure file exists. If temp files are used to create an * executable, and the temp files are deleted, they pollute the * file open dialog with files you can't actually open. * * The downside to not showing them all is that a user might * not understand why certain files aren't showing up. O well. */ if (file_choice[0] != '*') { if (fs_verify_file_exists(file_choice) == 0) return -4; } /* find index to insert by comparing: * Absolute paths go to the end * Relative paths go before the absolute paths */ for (i = 0; i < sbcount(fd->buf->files); 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; sbpush(fd->buf->files, NULL); /* shift everything down and then insert into index */ for (i = sbcount(fd->buf->files) - 1; i > index; i--) fd->buf->files[i] = fd->buf->files[i - 1]; fd->buf->files[index] = cgdb_strdup(file_choice); if ((length = strlen(file_choice)) > fd->buf->max_width) fd->buf->max_width = length; return 0; } void filedlg_clear(struct filedlg *fd) { int i; fd->G_line_number.clear(); for (i = 0; i < sbcount(fd->buf->files); i++) free(fd->buf->files[i]); sbfree(fd->buf->files); fd->buf->files = NULL; fd->buf->max_width = 0; fd->buf->sel_line = 0; fd->buf->sel_col = 0; fd->buf->sel_rline = 0; } static int clamp_line(struct filedlg *fd, int line) { if (line < 0) line = 0; if (line >= sbcount(fd->buf->files)) line = sbcount(fd->buf->files) - 1; return line; } static void filedlg_vscroll(struct filedlg *fd, int offset) { if (fd->buf) fd->buf->sel_line = clamp_line(fd, fd->buf->sel_line + offset); } static void filedlg_hscroll(struct filedlg *fd, int offset) { int lwidth; int max_width; int width; if (fd->buf) { width = swin_getmaxx(fd->win); lwidth = log10_uint(sbcount(fd->buf->files)) + 1; max_width = fd->buf->max_width - width + 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_set_sel_line(struct filedlg *fd, int line) { if (fd->buf) fd->buf->sel_line = clamp_line(fd, line); } static void filedlg_search_regex_init(struct filedlg *fd) { if (!fd || !fd->buf) return; /* Start searching at the beginning of the selected line */ fd->buf->sel_rline = fd->buf->sel_line; } static int wrap_line(struct file_buffer *buffer, int line) { int count = sbcount(buffer->files); if (line < 0) line = count - 1; else if (line >= count) line = 0; return line; } static int filedlg_search_regex(struct filedlg *fd, const char *regex, int opt, int direction, int icase) { if (!fd || !fd->buf) return -1; if (regex && regex[0]) { int line; int line_end; int line_inc = direction ? +1 : -1; int line_start = fd->buf->sel_rline; line = wrap_line(fd->buf, line_start + line_inc); if (cgdbrc_get_int(CGDBRC_WRAPSCAN)) { // Wrapping is on so stop at the line we started on. line_end = line_start; } else { // No wrapping. Stop at line 0 if searching down and last line // if searching up. line_end = direction ? 0 : sbcount(fd->buf->files) - 1; } for(;;) { int ret; int start, end; char *file = fd->buf->files[line]; ret = hl_regex_search(&fd->hlregex, file, regex, icase, &start, &end); if (ret > 0) { /* Got a match */ fd->buf->sel_line = line; /* Finalized match - move to this location */ if (opt == 2) { fd->buf->sel_rline = line; fd->last_hlregex = fd->hlregex; fd->hlregex = 0; } return 1; } line = wrap_line(fd->buf, line + line_inc); if (line == line_end) break; } } /* Nothing found - go back to original line */ fd->buf->sel_line = fd->buf->sel_rline; return 0; } int filedlg_display(struct filedlg *fd) { char fmt[16]; int width, height; int lwidth; int file; int i; int statusbar; int arrow_attr; int count = sbcount(fd->buf->files); int hlsearch = cgdbrc_get_int(CGDBRC_HLSEARCH); static const char label[] = "Select a file or press q to cancel."; swin_curs_set(0); statusbar = hl_groups_get_attr(hl_groups_instance, HLG_STATUS_BAR); arrow_attr = hl_groups_get_attr(hl_groups_instance, HLG_SELECTED_LINE_ARROW); /* Check that a file is loaded */ if (fd == NULL || fd->buf == NULL || fd->buf->files == NULL) { swin_wrefresh(fd->win); return 0; } /* Initialize variables */ height = swin_getmaxy(fd->win); width = swin_getmaxx(fd->win); /* 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 (count < height) file = (count - height) / 2; else { file = fd->buf->sel_line - height / 2; if (file > count - height) file = count - height; else if (file < 0) file = 0; } /* Print 'height' lines of the file, starting at 'file' */ lwidth = log10_uint(count) + 1; snprintf(fmt, sizeof(fmt), "%%%dd", lwidth); print_in_middle(fd->win, 0, width, label); swin_wmove(fd->win, 0, 0); for (i = 1; i < height + 1; i++, file++) { swin_wmove(fd->win, i, 0); /* Outside of filename, just finish drawing the vertical file */ if (file < 0 || file >= count) { int j; for (j = 1; j < lwidth; j++) swin_waddch(fd->win, ' '); swin_waddch(fd->win, '~'); swin_wattron(fd->win, SWIN_A_BOLD); swin_waddch(fd->win, SWIN_SYM_VLINE); swin_wattroff(fd->win, SWIN_A_BOLD); for (j = 2 + lwidth; j < width; j++) swin_waddch(fd->win, ' '); continue; } int x, y; char *filename = fd->buf->files[file]; /* Mark the current file with an arrow */ if (file == fd->buf->sel_line) { swin_wattron(fd->win, SWIN_A_BOLD); swin_wprintw(fd->win, fmt, file + 1); swin_wattroff(fd->win, SWIN_A_BOLD); swin_wattron(fd->win, arrow_attr); swin_waddch(fd->win, '-'); swin_waddch(fd->win, '>'); swin_wattroff(fd->win, arrow_attr); } else { /* Ordinary file */ swin_wprintw(fd->win, fmt, file + 1); swin_wattron(fd->win, SWIN_A_BOLD); swin_waddch(fd->win, SWIN_SYM_VLINE); swin_wattroff(fd->win, SWIN_A_BOLD); swin_waddch(fd->win, ' '); } y = swin_getcury(fd->win); x = swin_getcurx(fd->win); hl_printline(fd->win, filename, strlen(filename), NULL, -1, -1, fd->buf->sel_col, width - lwidth - 2); if (hlsearch && fd->last_hlregex) { struct hl_line_attr *attrs = hl_regex_highlight( &fd->last_hlregex, filename, HLG_SEARCH); if (sbcount(attrs)) { hl_printline_highlight(fd->win, filename, strlen(filename), attrs, x, y, fd->buf->sel_col, width - lwidth - 2); sbfree(attrs); } } if (regex_search && file == fd->buf->sel_line) { struct hl_line_attr *attrs = hl_regex_highlight( &fd->hlregex, filename, HLG_INCSEARCH); if (sbcount(attrs)) { hl_printline_highlight(fd->win, filename, strlen(filename), attrs, x, y, fd->buf->sel_col, width - lwidth - 2); sbfree(attrs); } } } /* Add the 2 lines back in so the status bar can be drawn */ height += 2; /* Update status bar */ swin_wmove(fd->win, height, 0); /* Print white background */ swin_wattron(fd->win, statusbar); for (i = 0; i < width; i++) swin_mvwprintw(fd->win, height - 1, i, " "); if (regex_search && regex_direction) swin_mvwprintw(fd->win, height - 1, 0, "Search:%s", regex_line); else if (regex_search) swin_mvwprintw(fd->win, height - 1, 0, "RSearch:%s", regex_line); swin_wattroff(fd->win, statusbar); swin_wmove(fd->win, height - (file - fd->buf->sel_line) - 1, lwidth + 2); swin_wrefresh(fd->win); return 0; } void filedlg_display_message(struct filedlg *fd, char *message) { int height, width, i; int attr; attr = hl_groups_get_attr(hl_groups_instance, HLG_STATUS_BAR); height = swin_getmaxy(fd->win); width = swin_getmaxx(fd->win); /* Print white background */ swin_wattron(fd->win, attr); for (i = 0; i < width; i++) swin_mvwprintw(fd->win, height - 1, i, " "); swin_mvwprintw(fd->win, height - 1, 0, "%s", message); swin_wattroff(fd->win, attr); swin_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 received */ 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 (c == 8 || c == 127) { 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 last_key_pressed) { /* Initialize size variables */ int height = swin_getmaxy(fd->win); 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_CTRL_D: /* VI-style 1/2 page down */ filedlg_vscroll(fd, height / 2); break; case CGDB_KEY_CTRL_U: /* VI-style 1/2 page up */ filedlg_vscroll(fd, -height / 2); 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; case 'g': /* beginning of file */ if (last_key_pressed == 'g') filedlg_set_sel_line(fd, 0); break; case 'G': { /* end of file, or a line number*/ int lineno = -1, result; result = cgdb_string_to_int(fd->G_line_number.c_str(), &lineno); if (result == 0) { filedlg_set_sel_line(fd, lineno -1); } break; } default: break; } /* Store digits into G_line_number for 'G' command. */ if (key >= '0' && key <= '9') { fd->G_line_number.push_back(key); } else { fd->G_line_number.clear(); } filedlg_display(fd); return 0; } cgdb-0.8.0/cgdb/cgdbrc.h0000664000175000017500000001631114134377055011650 00000000000000#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 the 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(const char *config_file); /* }}} */ /* Options types {{{ */ /** * The different ways to display a line in the CGDB window. */ enum LineDisplayStyle { LINE_DISPLAY_SHORT_ARROW, LINE_DISPLAY_LONG_ARROW, LINE_DISPLAY_HIGHLIGHT, LINE_DISPLAY_BLOCK }; /** window split type enumeration*/ typedef enum { WIN_SPLIT_FREE = -3, /* split point not on quarter mark */ WIN_SPLIT_GDB_FULL = -2, /* src window is 0% of screen */ WIN_SPLIT_GDB_BIG = -1, /* src window is 25% of screen */ WIN_SPLIT_EVEN = 0, /* src window is 50% of screen */ WIN_SPLIT_SRC_BIG = 1, /* src window is 75% of screen */ WIN_SPLIT_SRC_FULL = 2 /* src window is 100% of screen */ } WIN_SPLIT_TYPE; /** window split orientation type enumeration * * SPLIT_VERTICAL and SPLIT_HORIZONTAL refer to the orientation * of the split between the source and GDB windows. */ typedef enum { WSO_HORIZONTAL, /* source above and GDB below (default) */ WSO_VERTICAL /* source left and GDB right */ } WIN_SPLIT_ORIENTATION_TYPE; /** All of the different configuration options */ enum cgdbrc_option_kind { /* Arrow style is deprecated, use CGDBRC_EXECUTING_LINE_DISPLAY instead */ CGDBRC_ARROWSTYLE, CGDBRC_AUTOSOURCERELOAD, CGDBRC_CGDB_MODE_KEY, CGDBRC_COLOR, CGDBRC_DEBUGWINCOLOR, CGDBRC_DISASM, CGDBRC_EXECUTING_LINE_DISPLAY, CGDBRC_HLSEARCH, CGDBRC_IGNORECASE, CGDBRC_SCROLLBACK_BUFFER_SIZE, CGDBRC_SELECTED_LINE_DISPLAY, CGDBRC_SHOWMARKS, CGDBRC_SYNTAX, CGDBRC_TABSTOP, CGDBRC_TIMEOUT, CGDBRC_TIMEOUT_LEN, CGDBRC_TTIMEOUT, CGDBRC_TTIMEOUT_LEN, CGDBRC_WINMINHEIGHT, CGDBRC_WINMINWIDTH, CGDBRC_WINSPLIT, CGDBRC_WINSPLITORIENTATION, CGDBRC_WRAPSCAN }; /** This represents a single configuration option. */ struct cgdbrc_config_option { enum cgdbrc_option_kind option_kind; union { /* option_kind == CGDBRC_ARROWSTYLE */ /* option_kind == CGDBRC_EXECUTING_LINE_DISPLAY */ /* option_kind == CGDBRC_SELECTED_LINE_DISPLAY */ enum LineDisplayStyle line_display_style; /* option_kind == CGDBRC_AUTOSOURCERELOAD */ /* option_kind == CGDBRC_CGDB_MODE_KEY */ /* option_kind == CGDBRC_COLOR */ /* option_kind == CGDBRC_DEBUGWINCOLOR */ /* option_kind == CGDBRC_DISASM */ /* option_kind == CGDBRC_HLSEARCH */ /* option_kind == CGDBRC_IGNORECASE */ /* option_kind == CGDBRC_SCROLLBACK_BUFFER_SIZE */ /* option_kind == CGDBRC_SHOWMARKS */ /* 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_WINMINWIDTH */ /* 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; /* option_kind == CGDBRC_WINSPLITORIENTATION */ WIN_SPLIT_ORIENTATION_TYPE win_split_orientation_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. * * \param option * The new option to attach a callback to. * * \param notify * The callback function to call when the state of the data changes. * * \return * 0 on success or -1 on error */ int cgdbrc_attach(enum cgdbrc_option_kind option, cgdbrc_notify notify); /* }}} */ /* 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); int cgdbrc_get_int(enum cgdbrc_option_kind option); enum LineDisplayStyle cgdbrc_get_displaystyle(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.8.0/cgdb/usage.cpp0000664000175000017500000000147412755663236012075 00000000000000#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" " -w Wait for debugger to attach before starting.\n" " -- Marks the end of CGDB's options.\n"); } cgdb-0.8.0/cgdb/sources.cpp0000664000175000017500000011615514136115345012443 00000000000000/* 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 highlighting.) * */ #if HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ /* System Includes */ #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 #ifdef HAVE_STDINT_H #include #endif /* Local Includes */ #include "sys_util.h" #include "stretchy.h" #include "sys_win.h" #include "cgdb.h" #include "highlight.h" #include "tokenizer.h" #include "sources.h" #include "logo.h" #include "fs_util.h" #include "cgdbrc.h" #include "highlight_groups.h" #include "interface.h" #include "tgdb.h" int sources_syntax_on = 1; // This speeds up loading sqlite.c from 2:48 down to ~2 seconds. // sqlite3 is 6,596,401 bytes, 188,185 lines. /* --------------- */ /* Local Functions */ /* --------------- */ /* source_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. */ struct list_node *source_get_node(struct sviewer *sview, const char *path) { if (sview && path && path[0]) { struct list_node *cur; for (cur = sview->list_head; cur != NULL; cur = cur->next) { if (cur->path && (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) { int val; struct stat s; /* Special buffer not backed by file */ if (path[0] == '*') { *timestamp = 0; return 0; } val = path ? stat(path, &s) : -1; *timestamp = val ? 0 : s.st_mtime; return val; } static void init_file_buffer(struct buffer *buf) { buf->lines = NULL; buf->addrs = NULL; buf->max_width = 0; buf->file_data = NULL; buf->tabstop = cgdbrc_get_int(CGDBRC_TABSTOP); buf->language = TOKENIZER_LANGUAGE_UNKNOWN; } static void release_file_buffer(struct buffer *buf) { if (buf) { int i; for (i = 0; i < sbcount(buf->lines); i++) { sbfree(buf->lines[i].attrs); buf->lines[i].attrs = NULL; sbfree(buf->lines[i].line); buf->lines[i].line = NULL; } /* Free entire file buffer */ sbfree(buf->file_data); buf->file_data = NULL; sbfree(buf->lines); buf->lines = NULL; sbfree(buf->addrs); buf->addrs = NULL; buf->max_width = 0; buf->language = TOKENIZER_LANGUAGE_UNKNOWN; } } /** * 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; /* Release file buffers */ release_file_buffer(&node->file_buf); return 0; } static char *detab_buffer(char *buffer, int tabstop) { int i; int dst = 0; char *newbuf = NULL; int size = sbcount(buffer); char *tab = strchr(buffer, '\t'); if (!tab) return buffer; for (i = 0; i < size; i++) { if (buffer[i] == '\t') { int spaces = tabstop - dst % tabstop; while(spaces--) { sbpush(newbuf, ' '); dst++; } } else { sbpush(newbuf, buffer[i]); dst++; } if (buffer[i] == '\n' || buffer[i] == '\r') dst = 0; } sbfree(buffer); return newbuf; } /** * Load file and fill tlines line pointers. * * \param buf * struct buffer pointer * * \param filename * name of file to load * * \return * 0 on sucess, -1 on error */ static int load_file_buf(struct buffer *buf, const char *filename) { FILE *file; long file_size; int ret = -1; /* Special buffer not backed by file */ if (filename[0] == '*') return 0; file = fopen(filename, "rb"); if (!file) return -1; file_size = get_file_size(file); if (file_size > 0) { size_t bytes_read; /* Set the stretchy buffer size to our file size plus one for nil */ sbsetcount(buf->file_data, file_size + 1); /* Read in the entire file */ bytes_read = fread(buf->file_data, 1, file_size, file); /* If we had a partial read, bail */ if (bytes_read != file_size) { sbfree(buf->file_data); buf->file_data = NULL; fclose(file); return -1; } /* Zero terminate buffer */ buf->file_data[bytes_read] = 0; /* Convert tabs to spaces */ buf->tabstop = cgdbrc_get_int(CGDBRC_TABSTOP); buf->file_data = detab_buffer(buf->file_data, buf->tabstop); { char *line_start = buf->file_data; char *line_feed = strchr(line_start, '\n'); while (line_feed) { size_t line_len; char *line_end = line_feed; /* Trim trailing cr-lfs */ while (line_end >= line_start && (*line_end == '\n' || *line_end == '\r')) line_end--; /* Update max length string found */ line_len = line_end - line_start + 1; if (line_len > buf->max_width) buf->max_width = line_len; struct source_line sline; sline.line = NULL; sbsetcount(sline.line, line_len + 1); strncpy(sline.line, line_start, line_len); sline.len = line_len; sline.attrs = NULL; /* Add this line to lines array */ sbpush(buf->lines, sline); line_start = line_feed + 1; line_feed = strchr(line_start, '\n'); } if (*line_start) { struct source_line sline; int len = strlen(line_start); sline.line = NULL; sbsetcount(sline.line, len + 1); strncpy(sline.line, line_start, len); sline.len = len; sline.attrs = NULL; sbpush(buf->lines, sline); } ret = 0; } } fclose(file); return ret; } /* 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) { /* No node pointer? */ if (!node) return -1; /* File already loaded - success! */ if (node->file_buf.lines) return 0; /* Stat the file to get the timestamp */ if (get_timestamp(node->path, &(node->last_modification)) == -1) return -1; node->language = tokenizer_get_default_file_type(strrchr(node->path, '.')); /* Add the highlighted lines */ return source_highlight(node); } /* --------- */ /* Functions */ /* --------- */ /* Descriptive comments found in header file: sources.h */ /* Returns HLG_LAST on error */ static enum hl_group_kind hlg_from_tokenizer_type(enum tokenizer_type type, const char *tok_data) { switch(type) { case TOKENIZER_KEYWORD: return HLG_KEYWORD; case TOKENIZER_TYPE: return HLG_TYPE; case TOKENIZER_LITERAL: return HLG_LITERAL; case TOKENIZER_NUMBER: return HLG_TEXT; case TOKENIZER_COMMENT: return HLG_COMMENT; case TOKENIZER_DIRECTIVE: return HLG_DIRECTIVE; case TOKENIZER_TEXT: return HLG_TEXT; case TOKENIZER_NEWLINE: return HLG_LAST; case TOKENIZER_ERROR: return HLG_TEXT; case TOKENIZER_SEARCH: return HLG_SEARCH; case TOKENIZER_STATUS_BAR: return HLG_STATUS_BAR; case TOKENIZER_EXECUTING_LINE_ARROW: return HLG_EXECUTING_LINE_ARROW; case TOKENIZER_SELECTED_LINE_ARROW: return HLG_SELECTED_LINE_ARROW; case TOKENIZER_EXECUTING_LINE_HIGHLIGHT: return HLG_EXECUTING_LINE_HIGHLIGHT; case TOKENIZER_SELECTED_LINE_HIGHLIGHT: return HLG_SELECTED_LINE_HIGHLIGHT; case TOKENIZER_EXECUTING_LINE_BLOCK: return HLG_EXECUTING_LINE_BLOCK; case TOKENIZER_SELECTED_LINE_BLOCK: return HLG_SELECTED_LINE_BLOCK; case TOKENIZER_ENABLED_BREAKPOINT: return HLG_ENABLED_BREAKPOINT; case TOKENIZER_DISABLED_BREAKPOINT: return HLG_DISABLED_BREAKPOINT; case TOKENIZER_SELECTED_LINE_NUMBER: return HLG_SELECTED_LINE_NUMBER; case TOKENIZER_SCROLL_MODE_STATUS: return HLG_SCROLL_MODE_STATUS; case TOKENIZER_LOGO: return HLG_LOGO; case TOKENIZER_COLOR: return hl_get_color_group(tok_data); } return HLG_TEXT; } static int highlight_node(struct list_node *node) { int i; int ret; int line = 0; int length = 0; int lasttype = -1; struct token_data tok_data; struct tokenizer *t = tokenizer_init(); struct buffer *buf = &node->file_buf; for (i = 0; i < sbcount(buf->lines); i++) { sbfree(buf->lines[i].attrs); buf->lines[i].attrs = NULL; } if (!buf->file_data) { for (line = 0; line < sbcount(buf->lines); line++) { struct source_line *sline = &buf->lines[line]; tokenizer_set_buffer(t, sline->line, buf->language); length = 0; lasttype = -1; while ((ret = tokenizer_get_token(t, &tok_data)) > 0) { if (tok_data.e == TOKENIZER_NEWLINE) break; enum hl_group_kind hlg = hlg_from_tokenizer_type(tok_data.e, tok_data.data); /* Add attribute if highlight group has changed */ if (lasttype != hlg) { sbpush(buf->lines[line].attrs, hl_line_attr(length, hlg)); lasttype = hlg; } /* Add the text and bump our length */ length += strlen(tok_data.data); } } } else { if (tokenizer_set_buffer(t, buf->file_data, buf->language) == -1) { if_print_message("%s:%d tokenizer_set_buffer error", __FILE__, __LINE__); return -1; } while ((ret = tokenizer_get_token(t, &tok_data)) > 0) { if (tok_data.e == TOKENIZER_NEWLINE) { if (length > buf->max_width) buf->max_width = length; length = 0; lasttype = -1; line++; } else { enum hl_group_kind hlg = hlg_from_tokenizer_type(tok_data.e, tok_data.data); if (hlg == HLG_LAST) { clog_error(CLOG_CGDB, "Bad hlg_type for '%s', e==%d\n", tok_data.data, tok_data.e); hlg = HLG_TEXT; } /* Add attribute if highlight group has changed */ if (lasttype != hlg) { sbpush(buf->lines[line].attrs, hl_line_attr(length, hlg)); lasttype = hlg; } /* Add the text and bump our length */ length += strlen(tok_data.data); } } } tokenizer_destroy(t); return 0; } int source_highlight(struct list_node *node) { int do_color = sources_syntax_on && (node->language != TOKENIZER_LANGUAGE_UNKNOWN) && swin_has_colors(); /* Load the entire file */ if (!sbcount(node->file_buf.lines)) load_file_buf(&node->file_buf, node->path); /* If we're doing color and we haven't already loaded this file * with this language, then load and highlight it. */ if (do_color && (node->file_buf.language != node->language)) { node->file_buf.language = node->language; highlight_node(node); } /* Allocate the breakpoints array */ if (!node->lflags) { int count = sbcount(node->file_buf.lines); sbsetcount(node->lflags, count); memset(node->lflags, 0, sbcount(node->lflags)); } if (node->file_buf.lines) return 0; return -1; } struct sviewer *source_new(SWINDOW *win) { struct sviewer *rv; /* Allocate a new structure */ rv = (struct sviewer *)cgdb_malloc(sizeof (struct sviewer)); /* Initialize the structure */ rv->win = win; rv->cur = NULL; rv->list_head = NULL; /* Initialize global marks */ memset(rv->global_marks, 0, sizeof(rv->global_marks)); rv->jump_back_mark.node = NULL; rv->jump_back_mark.line = -1; rv->addr_frame = 0; rv->hlregex = NULL; rv->last_hlregex = NULL; return rv; } struct list_node *source_add(struct sviewer *sview, const char *path) { struct list_node *new_node; new_node = source_get_node(sview, path); if (new_node) return new_node; new_node = (struct list_node *)cgdb_malloc(sizeof (struct list_node)); new_node->path = strdup(path); init_file_buffer(&new_node->file_buf); new_node->lflags = NULL; new_node->sel_line = 0; new_node->sel_col = 0; new_node->sel_rline = 0; new_node->exe_line = -1; new_node->last_modification = 0; /* No timestamp yet */ new_node->language = TOKENIZER_LANGUAGE_UNKNOWN; new_node->addr_start = 0; new_node->addr_end = 0; /* Initialize all local marks to -1 */ memset(new_node->local_marks, 0xff, sizeof(new_node->local_marks)); 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 new_node; } void source_add_disasm_line(struct list_node *node, const char *line) { uint64_t addr = 0; struct source_line sline; char *colon = 0, colon_char = 0; sline.line = NULL; sbsetcount(sline.line, strlen(line) + 1); strcpy(sline.line, line); sline.line = detab_buffer(sline.line, node->file_buf.tabstop); sline.attrs = NULL; sline.len = sbcount(sline.line); colon = strchr((char*)line, ':'); if (colon) { colon_char = *colon; *colon = 0; } cgdb_hexstr_to_u64(line, &addr); if (colon) { *colon = colon_char; } sbpush(node->file_buf.addrs, addr); struct line_flags lf = { 0, 0 }; sbpush(node->file_buf.lines, sline); sbpush(node->lflags, lf); } int source_del(struct sviewer *sview, const char *path) { int i; struct list_node *cur; struct list_node *prev = NULL; /* 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 buffers */ release_file_buffer(&cur->file_buf); /* Release file name */ free(cur->path); cur->path = NULL; sbfree(cur->lflags); cur->lflags = 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); /* Free any global marks pointing to this bugger */ for (i = 0; i < sizeof(sview->global_marks) / sizeof(sview->global_marks[0]); i++) { if (sview->global_marks[i].node == cur) sview->global_marks[i].node = NULL; } return 0; } int source_length(struct sviewer *sview, const char *path) { struct list_node *cur = source_get_node(sview, path); /* Load the file if it's not already */ if (load_file(cur)) return -1; return sbcount(cur->file_buf.lines); } char *source_current_file(struct sviewer *sview) { return (sview && sview->cur) ? sview->cur->path : NULL; } /* source_get_mark_char: Return mark char for line. * -------------------- * * sview: The source viewer object * node: * line: line to check for mark * return: -1 on error, 0 if no char exists on line, otherwise char */ static int source_get_mark_char(struct sviewer *sview, struct list_node *node, int line) { if (!node || (line < 0) || (line >= sbcount(node->lflags))) return -1; if (node->lflags[line].has_mark) { int i; for (i = 0; i < MARK_COUNT; i++) { if (sview->global_marks[i].line == line) return 'A' + i; } for (i = 0; i < MARK_COUNT; i++) { if (node->local_marks[i] == line) return 'a' + i; } } return 0; } int source_set_mark(struct sviewer *sview, int key) { int ret = 0; int old_line; struct list_node *old_node; int sel_line = sview->cur->sel_line; if (key >= 'a' && key <= 'z') { /* Local buffer mark */ old_line = sview->cur->local_marks[key - 'a']; old_node = sview->cur; sview->cur->local_marks[key - 'a'] = sel_line; ret = 1; } else if (key >= 'A' && key <= 'Z') { /* Global buffer mark */ old_line = sview->global_marks[key - 'A'].line; old_node = sview->global_marks[key - 'A'].node; sview->global_marks[key - 'A'].line = sel_line; sview->global_marks[key - 'A'].node = sview->cur; ret = 1; } if (ret) { /* Just added a mark to the selected line, flag it */ sview->cur->lflags[sel_line].has_mark = 1; /* Check if the old line still has a mark */ if (source_get_mark_char(sview, old_node, old_line) == 0) old_node->lflags[old_line].has_mark = 0; } return ret; } int source_goto_mark(struct sviewer *sview, int key) { int line; struct list_node *node = NULL; if (key >= 'a' && key <= 'z') { /* Local buffer mark */ line = sview->cur->local_marks[key - 'a']; node = (line >= 0) ? sview->cur : NULL; } else if (key >= 'A' && key <= 'Z') { /* Global buffer mark */ line = sview->global_marks[key - 'A'].line; node = sview->global_marks[key - 'A'].node; } else if (key == '\'' ) { /* Jump back to where we jumped from */ line = sview->jump_back_mark.line; node = sview->jump_back_mark.node; } else if (key == '.') { /* Jump to currently executing line if it's set */ line = sview->cur->exe_line; node = (line >= 0) ? sview->cur : NULL; } if (node) { sview->jump_back_mark.line = sview->cur->sel_line; sview->jump_back_mark.node = sview->cur; sview->cur = node; source_set_sel_line(sview, line + 1); return 1; } return 0; } static int get_line_leading_ws_count(const char *otext, int length) { int i; int column_offset = 0; /* Text to skip due to arrow */ for (i = 0; i < length - 1; i++) { /* Bail if we hit a non whitespace character */ if (!isspace(otext[i])) break; column_offset++; } return column_offset; } /** * Display the source. * * A line in the source viewer looks like, * # │ marker text * where, * # is the line number to display or ~ if no line number * │ is the divider between the line number or it is a mark * marker is shortarrow, longarrow, highlight, block, etc * text is the source code to display * * The syntax highlighting works as follows, * * The # * - If breakpoint is set, use Breakpoint * - If breakpoint is disabled, use DisabledBreakpoint * - If selected line, use SelectedLineNr * - If executing line, use ExecutingLineNr * - Otherwise, no highlighting group * * The │ * - When source window is in focus, the character is bolded, otherwise normal * - If the user has a mark set, the mark will be displayed instead of any * other character. * - Edge case: When the marker is long or short arrow, CGDB prints ├ * instead of │ the ├ is colored based on highlighting group for * the selected or executing arrow. * * The marker * - The marker is the shortarrow, longarrow, highlight or block * - The color is based off the corresponding highlighting group * * The text * - The syntax highlighting source code to display * - Will be colored with SelectedLineHighlight or ExecutingLineHighlight * if the line is the selected or executing line and the display is set * to highlight. */ int source_display(struct sviewer *sview, int focus, enum win_refresh dorefresh) { int i; int lwidth; int line; int count; enum LineDisplayStyle exe_display_style, sel_display_style; int sellineno, exelineno; int enabled_bp, disabled_bp; int exe_line_display_is_arrow, sel_line_display_is_arrow; int exe_arrow_attr, sel_arrow_attr; int exe_block_attr, sel_block_attr; char fmt[16]; int width, height; int focus_attr = focus ? SWIN_A_BOLD : 0; int showmarks = cgdbrc_get_int(CGDBRC_SHOWMARKS); int hlsearch = cgdbrc_get_int(CGDBRC_HLSEARCH); int mark_attr; struct hl_line_attr *sel_highlight_attrs = 0; struct hl_line_attr *exe_highlight_attrs = 0; /* Check that a file is loaded */ if (!sview->cur || !sview->cur->file_buf.lines) { logo_display(sview->win); if (dorefresh == WIN_REFRESH) swin_wrefresh(sview->win); else swin_wnoutrefresh(sview->win); return 0; } sellineno = hl_groups_get_attr( hl_groups_instance, HLG_SELECTED_LINE_NUMBER); exelineno = hl_groups_get_attr( hl_groups_instance, HLG_EXECUTING_LINE_NUMBER); enabled_bp = hl_groups_get_attr( hl_groups_instance, HLG_ENABLED_BREAKPOINT); disabled_bp = hl_groups_get_attr( hl_groups_instance, HLG_DISABLED_BREAKPOINT); exe_display_style = cgdbrc_get_displaystyle(CGDBRC_EXECUTING_LINE_DISPLAY); exe_arrow_attr = hl_groups_get_attr( hl_groups_instance, HLG_EXECUTING_LINE_ARROW); exe_block_attr = hl_groups_get_attr( hl_groups_instance, HLG_EXECUTING_LINE_BLOCK); sel_display_style = cgdbrc_get_displaystyle(CGDBRC_SELECTED_LINE_DISPLAY); sel_arrow_attr = hl_groups_get_attr( hl_groups_instance, HLG_SELECTED_LINE_ARROW); sel_block_attr = hl_groups_get_attr( hl_groups_instance, HLG_SELECTED_LINE_BLOCK); exe_line_display_is_arrow = exe_display_style == LINE_DISPLAY_SHORT_ARROW || exe_display_style == LINE_DISPLAY_LONG_ARROW; sel_line_display_is_arrow = sel_display_style == LINE_DISPLAY_SHORT_ARROW || sel_display_style == LINE_DISPLAY_LONG_ARROW; mark_attr = hl_groups_get_attr(hl_groups_instance, HLG_MARK); sbpush(sel_highlight_attrs, hl_line_attr(0, HLG_SELECTED_LINE_HIGHLIGHT)); sbpush(exe_highlight_attrs, hl_line_attr(0, HLG_EXECUTING_LINE_HIGHLIGHT)); /* Make sure cursor is visible */ swin_curs_set(!!focus); /* Initialize variables */ height = swin_getmaxy(sview->win); width = swin_getmaxx(sview->win); /* Set starting line number (center source file if it's small enough) */ count = sbcount(sview->cur->file_buf.lines); if (count < height) { line = (count - height) / 2; } else { line = sview->cur->sel_line - height / 2; if (line > count - height) line = count - height; else if (line < 0) line = 0; } /* Print 'height' lines of the file, starting at 'line' */ lwidth = log10_uint(count) + 1; snprintf(fmt, sizeof(fmt), "%%%dd", lwidth); for (i = 0; i < height; i++, line++) { int column_offset = 0; /* Is this the current selected line? */ int is_sel_line = (line >= 0 && sview->cur->sel_line == line); /* Is this the current executing line */ int is_exe_line = (line >= 0 && sview->cur->exe_line == line); struct source_line *sline = (line < 0 || line >= count)? NULL:&sview->cur->file_buf.lines[line]; struct hl_line_attr *printline_attrs = (sline)?sline->attrs:0; swin_wmove(sview->win, i, 0); /* Print the line number */ if (line < 0 || line >= count) { for (int j = 1; j < lwidth; j++) swin_waddch(sview->win, ' '); swin_waddch(sview->win, '~'); } else { int line_attr = 0; int bp_val = sview->cur->lflags[line].breakpt; if (bp_val == 1) { line_attr = enabled_bp; } else if (bp_val == 2) { line_attr = disabled_bp; } else if (bp_val == 0 && is_exe_line) { line_attr = exelineno; } else if (bp_val == 0 && is_sel_line) { line_attr = sellineno; } swin_wattron(sview->win, line_attr); swin_wprintw(sview->win, fmt, line + 1); swin_wattroff(sview->win, line_attr); } if (!swin_has_colors()) { /* TODO: swin_wprintw(sview->win, "%.*s\n", sview->cur->file_buf.lines[line].line, sview->cur->file_buf.lines[line].len); */ continue; } /* Print the vertical bar or mark */ { SWIN_CHTYPE vert_bar_char; int vert_bar_attr; int mc; if (showmarks && ((mc = source_get_mark_char(sview, sview->cur, line)) > 0)) { vert_bar_char = mc; vert_bar_attr = mark_attr; } else if (is_exe_line && exe_line_display_is_arrow) { vert_bar_attr = exe_arrow_attr; vert_bar_char = SWIN_SYM_LTEE; } else if (is_sel_line && sel_line_display_is_arrow) { vert_bar_attr = sel_arrow_attr; vert_bar_char = SWIN_SYM_LTEE; } else { vert_bar_attr = focus_attr; vert_bar_char = SWIN_SYM_VLINE; } swin_wattron(sview->win, vert_bar_attr); swin_waddch(sview->win, vert_bar_char); swin_wattroff(sview->win, vert_bar_attr); } /* Print the marker */ if (is_exe_line || is_sel_line) { enum LineDisplayStyle display_style; int arrow_attr, block_attr; struct hl_line_attr *highlight_attr; if (is_exe_line) { display_style = exe_display_style; arrow_attr = exe_arrow_attr; block_attr = exe_block_attr; highlight_attr = exe_highlight_attrs; } else { display_style = sel_display_style; arrow_attr = sel_arrow_attr; block_attr = sel_block_attr; highlight_attr = sel_highlight_attrs; } switch (display_style) { case LINE_DISPLAY_SHORT_ARROW: swin_wattron(sview->win, arrow_attr); swin_waddch(sview->win, '>'); swin_wattroff(sview->win, arrow_attr); break; case LINE_DISPLAY_LONG_ARROW: swin_wattron(sview->win, arrow_attr); column_offset = get_line_leading_ws_count( sline->line, sline->len); column_offset -= (sview->cur->sel_col + 1); if (column_offset < 0) column_offset = 0; /* Now actually draw the arrow */ for (int j = 0; j < column_offset; j++) swin_waddch(sview->win, SWIN_SYM_HLINE); swin_waddch(sview->win, '>'); swin_wattroff(sview->win, arrow_attr); break; case LINE_DISPLAY_HIGHLIGHT: swin_waddch(sview->win, ' '); printline_attrs = highlight_attr; break; case LINE_DISPLAY_BLOCK: column_offset = get_line_leading_ws_count( sline->line, sline->len); column_offset -= (sview->cur->sel_col + 1); if (column_offset < 0) column_offset = 0; /* Now actually draw the space to the block */ for (int j = 0; j < column_offset; j++) swin_waddch(sview->win, ' '); /* Draw the block */ swin_wattron(sview->win, block_attr); swin_waddch(sview->win, ' '); swin_wattroff(sview->win, block_attr); break; } } else { swin_waddch(sview->win, ' '); } /* Print the text */ if (line < 0 || line >= count) { for (int j = 2 + lwidth; j < width; j++) swin_waddch(sview->win, ' '); } else { int x, y; y = swin_getcury(sview->win); x = swin_getcurx(sview->win); hl_printline(sview->win, sline->line, sline->len, printline_attrs, -1, -1, sview->cur->sel_col + column_offset, width - lwidth - 2); if (hlsearch && sview->last_hlregex) { struct hl_line_attr *attrs = hl_regex_highlight( &sview->last_hlregex, sline->line, HLG_SEARCH); if (sbcount(attrs)) { hl_printline_highlight(sview->win, sline->line, sline->len, attrs, x, y, sview->cur->sel_col + column_offset, width - lwidth - 2); sbfree(attrs); } } if (is_sel_line && sview->hlregex) { struct hl_line_attr *attrs = hl_regex_highlight( &sview->hlregex, sline->line, HLG_INCSEARCH); if (sbcount(attrs)) { hl_printline_highlight(sview->win, sline->line, sline->len, attrs, x, y, sview->cur->sel_col + column_offset, width - lwidth - 2); sbfree(attrs); } } } } switch(dorefresh) { case WIN_NO_REFRESH: swin_wnoutrefresh(sview->win); break; case WIN_REFRESH: swin_wrefresh(sview->win); break; } sbfree(sel_highlight_attrs); sbfree(exe_highlight_attrs); return 0; } void source_move(struct sviewer *sview, SWINDOW *win) { swin_delwin(sview->win); sview->win = win; } static int clamp_line(struct sviewer *sview, int line) { if (line < 0) line = 0; if (line >= sbcount(sview->cur->file_buf.lines)) line = sbcount(sview->cur->file_buf.lines) - 1; return line; } void source_vscroll(struct sviewer *sview, int offset) { if (sview->cur) { sview->cur->sel_line = clamp_line(sview, sview->cur->sel_line + offset); sview->cur->sel_rline = sview->cur->sel_line; } } void source_hscroll(struct sviewer *sview, int offset) { int lwidth; int max_width; int width, height; if (sview->cur) { height = swin_getmaxy(sview->win); width = swin_getmaxx(sview->win); lwidth = log10_uint(sbcount(sview->cur->file_buf.lines)) + 1; max_width = sview->cur->file_buf.max_width - width + 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) { if (line == -1) { sview->cur->sel_line = sbcount(sview->cur->file_buf.lines) - 1; } else { /* Set line (note correction for 0-based line counting) */ sview->cur->sel_line = clamp_line(sview, line - 1); } sview->cur->sel_rline = sview->cur->sel_line; } } static struct list_node *source_get_asmnode(struct sviewer *sview, uint64_t addr, int *line) { struct list_node *node = NULL; if (addr) { /* Search for a node which contains this address */ for (node = sview->list_head; node; node = node->next) { if (addr >= node->addr_start && addr <= node->addr_end) break; } } if (node && line) { int i; for (i = 0; i < sbcount(node->file_buf.addrs); i++) { if (node->file_buf.addrs[i] == addr) { *line = i; break; } } } return node; } int source_set_exec_line(struct sviewer *sview, const char *path, int sel_line, int exe_line) { if (path) { /* If they passed us a path, try to locate that node */ sview->cur = source_get_node(sview, path); /* Not found.... */ if (!sview->cur) { /* Check that the file exists */ if (!fs_verify_file_exists(path)) return 5; /* Add a new node for this file */ sview->cur = source_add(sview, path); } } /* Buffer the file if it's not already */ if (load_file(sview->cur)) return 4; /* Update line, if set */ if (sel_line > 0) sview->cur->sel_line = clamp_line(sview, sel_line - 1); /* Set executing line if passed a valid value */ if (exe_line == -1) { sview->cur->exe_line = -1; } else if (exe_line > 0) { sview->cur->exe_line = clamp_line(sview, exe_line - 1); } return 0; } int source_set_exec_addr(struct sviewer *sview, uint64_t addr) { int line = -1; if (!addr) addr = sview->addr_frame; /* Search for a node which contains this address */ sview->cur = source_get_asmnode(sview, addr, &line); if (!sview->cur) return -1; sview->cur->sel_line = clamp_line(sview, line); sview->cur->exe_line = clamp_line(sview, line); return 0; } void source_free(struct sviewer *sview) { /* Free all file buffers */ while (sview->list_head) source_del(sview, sview->list_head->path); hl_regex_free(&sview->hlregex); sview->hlregex = NULL; hl_regex_free(&sview->last_hlregex); sview->last_hlregex = NULL; swin_delwin(sview->win); sview->win = NULL; free(sview); } void source_search_regex_init(struct sviewer *sview) { if (!sview || !sview->cur) return; /* Start searching at the beginning of the selected line */ sview->cur->sel_rline = sview->cur->sel_line; } static int wrap_line(struct list_node *node, int line) { int count = sbcount(node->file_buf.lines); if (line < 0) line = count - 1; else if (line >= count) line = 0; return line; } int source_search_regex(struct sviewer *sview, const char *regex, int opt, int direction, int icase) { struct list_node *node = sview ? sview->cur : NULL; if (!node) return -1; if (regex && *regex) { int line; int line_end; int line_inc = direction ? +1 : -1; int line_start = node->sel_rline; line = wrap_line(node, line_start + line_inc); if (cgdbrc_get_int(CGDBRC_WRAPSCAN)) { // Wrapping is on so stop at the line we started on. line_end = line_start; } else { // No wrapping. Stop at line 0 if searching down and last line // if searching up. line_end = direction ? 0 : sbcount(node->file_buf.lines) - 1; } for(;;) { int ret; int start, end; char *line_str = node->file_buf.lines[line].line; ret = hl_regex_search(&sview->hlregex, line_str, regex, icase, &start, &end); if (ret > 0) { /* Got a match */ node->sel_line = line; /* Finalized match - move to this location */ if (opt == 2) { node->sel_rline = line; hl_regex_free(&sview->last_hlregex); sview->last_hlregex = sview->hlregex; sview->hlregex = 0; } return 1; } line = wrap_line(node, line + line_inc); if (line == line_end) break; } } /* Nothing found - go back to original line */ node->sel_line = node->sel_rline; return 0; } static void source_clear_breaks(struct sviewer *sview) { struct list_node *node; for (node = sview->list_head; node != NULL; node = node->next) { int i; for (i = 0; i < sbcount(node->lflags); i++) node->lflags[i].breakpt = 0; } } void source_set_breakpoints(struct sviewer *sview, struct tgdb_breakpoint *breakpoints) { int i; struct list_node *node; source_clear_breaks(sview); // Loop over each breakpoint and let the source view and the // disassembly view know about them. This way if you set a breakpoint // in one mode, then switch modes, the other mode will know about // it as well. for (i = 0; i < sbcount(breakpoints); i++) { if (breakpoints[i].path) { node = source_get_node(sview, breakpoints[i].path); if (!load_file(node)) { int line = breakpoints[i].line; int enabled = breakpoints[i].enabled; if (line > 0 && line <= sbcount(node->lflags)) { node->lflags[line - 1].breakpt = enabled ? 1 : 2; } } } if (breakpoints[i].addr) { int line = 0; node = source_get_asmnode(sview, breakpoints[i].addr, &line); if (node) { node->lflags[line].breakpt = breakpoints[i].enabled ? 1 : 2; } } } } 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_int(CGDBRC_AUTOSOURCERELOAD); 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 the file timestamp or tab size changed, reload the file */ int dirty = cur->last_modification < timestamp; dirty |= cgdbrc_get_int(CGDBRC_TABSTOP) != cur->file_buf.tabstop; if ((auto_source_reload || force) && dirty) { if (release_file_memory(cur) == -1) return -1; if (load_file(cur)) return -1; } return 0; } cgdb-0.8.0/cgdb/highlight_groups.cpp0000664000175000017500000010462114135136636014326 00000000000000#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 */ #include "sys_util.h" #include "stretchy.h" #include "sys_win.h" #include "highlight_groups.h" #include "command_lexer.h" #include "sys_util.h" #include "cgdbrc.h" /* 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 { /** * True if the terminal is can display ansi colors, otherwise False. * * Please note, this just determines if CGDB believes the terminal is * capable of displaying ansi colors. CGDB's configuration will * determine if colors should be displayed at all. */ bool ansi_color_support; /** 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) { if (groups) { int i; for (i = 0; i < HLG_LAST; ++i) { struct hl_group_info *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 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, SWIN_A_BOLD, SWIN_A_BOLD, COLOR_BLUE, -1}, {HLG_TYPE, SWIN_A_BOLD, SWIN_A_BOLD, COLOR_GREEN, -1}, {HLG_LITERAL, SWIN_A_BOLD, SWIN_A_BOLD, COLOR_RED, -1}, {HLG_COMMENT, SWIN_A_NORMAL, SWIN_A_NORMAL, COLOR_YELLOW, -1}, {HLG_DIRECTIVE, SWIN_A_BOLD, SWIN_A_BOLD, COLOR_CYAN, -1}, {HLG_TEXT, SWIN_A_NORMAL, SWIN_A_NORMAL, -1, -1}, {HLG_INCSEARCH, SWIN_A_REVERSE, SWIN_A_REVERSE, -1, -1}, {HLG_SEARCH, SWIN_A_NORMAL, SWIN_A_NORMAL, COLOR_BLACK, COLOR_YELLOW}, {HLG_STATUS_BAR, SWIN_A_REVERSE, SWIN_A_REVERSE, -1, -1}, {HLG_EXECUTING_LINE_ARROW, SWIN_A_BOLD, SWIN_A_BOLD, COLOR_GREEN, -1}, {HLG_SELECTED_LINE_ARROW, SWIN_A_BOLD, SWIN_A_BOLD, COLOR_WHITE, -1}, {HLG_EXECUTING_LINE_HIGHLIGHT, SWIN_A_BOLD, SWIN_A_BOLD, COLOR_BLACK, COLOR_GREEN}, {HLG_SELECTED_LINE_HIGHLIGHT, SWIN_A_BOLD, SWIN_A_BOLD, COLOR_BLACK, COLOR_WHITE}, {HLG_EXECUTING_LINE_BLOCK, SWIN_A_REVERSE, SWIN_A_REVERSE, COLOR_GREEN, -1}, {HLG_SELECTED_LINE_BLOCK, SWIN_A_REVERSE, SWIN_A_REVERSE, COLOR_WHITE, -1}, {HLG_ENABLED_BREAKPOINT, SWIN_A_BOLD, SWIN_A_BOLD, COLOR_RED, -1}, {HLG_DISABLED_BREAKPOINT, SWIN_A_BOLD, SWIN_A_BOLD, COLOR_YELLOW, -1}, {HLG_SELECTED_LINE_NUMBER, SWIN_A_BOLD, SWIN_A_BOLD, COLOR_WHITE, -1}, {HLG_EXECUTING_LINE_NUMBER, SWIN_A_BOLD, SWIN_A_BOLD, COLOR_GREEN, -1}, {HLG_SCROLL_MODE_STATUS, SWIN_A_BOLD, SWIN_A_BOLD, -1, -1}, {HLG_LOGO, SWIN_A_BOLD, SWIN_A_BOLD, COLOR_BLUE, -1}, {HLG_MARK, SWIN_A_BOLD, SWIN_A_BOLD, COLOR_WHITE, -1}, {HLG_LAST, SWIN_A_NORMAL, SWIN_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_INCSEARCH, "IncSearch"}, {HLG_SEARCH, "Search"}, {HLG_STATUS_BAR, "StatusLine"}, /* Legacy option that is now represented by ExecutingLineArrow */ {HLG_EXECUTING_LINE_ARROW, "Arrow"}, {HLG_EXECUTING_LINE_ARROW, "ExecutingLineArrow"}, {HLG_SELECTED_LINE_ARROW, "SelectedLineArrow"}, /* Legacy option that is now represented by ExecutingLineHighlight */ {HLG_EXECUTING_LINE_HIGHLIGHT, "LineHighlight"}, {HLG_EXECUTING_LINE_HIGHLIGHT, "ExecutingLineHighlight"}, {HLG_SELECTED_LINE_HIGHLIGHT, "SelectedLineHighlight"}, {HLG_EXECUTING_LINE_BLOCK, "ExecutingLineBlock"}, {HLG_SELECTED_LINE_BLOCK, "SelectedLineBlock"}, {HLG_ENABLED_BREAKPOINT, "Breakpoint"}, {HLG_DISABLED_BREAKPOINT, "DisabledBreakpoint"}, {HLG_SELECTED_LINE_NUMBER, "SelectedLineNr"}, {HLG_EXECUTING_LINE_NUMBER, "ExecutingLineNr"}, {HLG_SCROLL_MODE_STATUS, "ScrollModeStatus"}, {HLG_LOGO, "Logo"}, {HLG_MARK, "Mark"}, {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", SWIN_A_BOLD}, {"underline", SWIN_A_UNDERLINE}, {"reverse", SWIN_A_REVERSE}, {"inverse", SWIN_A_REVERSE}, {"standout", SWIN_A_STANDOUT}, {"NONE", SWIN_A_NORMAL}, {"normal", SWIN_A_NORMAL}, {"blink", SWIN_A_BLINK}, {"dim", SWIN_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 8 colors. */ int nr8Color; /* If the terminal has 8 colors, they could be bold. */ int nr8ForegroundBold; /* HLG group id for this color */ enum hl_group_kind hlg_type; }; /** A list of all the default colors and their values */ static const struct color_info hl_color_names[] = { {"Black", COLOR_BLACK, 0, HLG_BLACK}, {"DarkBlue", COLOR_BLUE, 0, HLG_BLUE}, {"DarkGreen", COLOR_GREEN, 0, HLG_GREEN}, {"DarkCyan", COLOR_CYAN, 0, HLG_CYAN}, {"DarkRed", COLOR_RED, 0, HLG_RED}, {"DarkMagenta", COLOR_MAGENTA, 0, HLG_MAGENTA}, {"Brown", COLOR_YELLOW, 0, HLG_YELLOW}, {"DarkYellow", COLOR_YELLOW, 0, HLG_YELLOW}, {"LightGray", COLOR_WHITE, 0, HLG_WHITE}, {"LightGrey", COLOR_WHITE, 0, HLG_WHITE}, {"Gray", COLOR_WHITE, 0, HLG_WHITE}, {"Grey", COLOR_WHITE, 0, HLG_WHITE}, // Bold/high-intensity colors {"DarkGray", COLOR_BLACK, 1, HLG_BOLD_BLACK}, {"DarkGrey", COLOR_BLACK, 1, HLG_BOLD_BLACK}, {"Blue", COLOR_BLUE, 1, HLG_BOLD_BLUE}, {"LightBlue", COLOR_BLUE, 1, HLG_BOLD_BLUE}, {"Green", COLOR_GREEN, 1, HLG_BOLD_GREEN}, {"LightGreen", COLOR_GREEN, 1, HLG_BOLD_GREEN}, {"Cyan", COLOR_CYAN, 1, HLG_BOLD_CYAN}, {"LightCyan", COLOR_CYAN, 1, HLG_BOLD_CYAN}, {"Red", COLOR_RED, 1, HLG_BOLD_RED}, {"LightRed", COLOR_RED, 1, HLG_BOLD_RED}, {"Magenta", COLOR_MAGENTA, 1, HLG_BOLD_MAGENTA}, {"LightMagenta", COLOR_MAGENTA, 1, HLG_BOLD_MAGENTA}, {"Yellow", COLOR_YELLOW, 1, HLG_BOLD_YELLOW}, {"LightYellow", COLOR_YELLOW, 1, HLG_BOLD_YELLOW}, {"White", COLOR_WHITE, 1, HLG_BOLD_WHITE}, {NULL, 0, 0, HLG_LAST} }; 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; } enum hl_group_kind hl_get_color_group(const char *color) { const struct color_info *color_info = color_spec_for_name(color); return color_info ? color_info->hlg_type : HLG_LAST; } /** * Determine if color should be used. * * @return * True if color should be used, false otherwise. */ static bool hl_color_support(void) { return cgdbrc_get_int(CGDBRC_COLOR) && swin_has_colors(); } bool hl_ansi_color_support(hl_groups *h) { return hl_color_support() && h && h->ansi_color_support; } /* Given an ncurses COLOR_XX background and foreground color, return an ncurses * color pair index for that color. */ static int hl_get_ansicolor_pair(hl_groups_ptr hl_groups, int bgcolor, int fgcolor) { static int color_pairs_inited = 0; static int color_pair_table[9][9]; /* If ansi colors aren't enabled, return default color pair 0 */ if (hl_groups && !hl_ansi_color_support(hl_groups)) return 0; if (!color_pairs_inited) { int fg, bg; int color_pair = 1; /* Initialize 64 [1..8][1..8] color entries */ for (fg = COLOR_BLACK; fg <= COLOR_WHITE; fg++) { for (bg = COLOR_BLACK; bg <= COLOR_WHITE; bg++) { swin_init_pair(color_pair, fg, bg); color_pair_table[bg + 1][fg + 1] = color_pair++; } } /* swin_init_pair: * The value of the first argument must be between 1 and COLOR_PAIRS-1, * except that if default colors are used (see use_default_colors) the * upper limit is adjusted to allow for extra pairs which use a default * color in foreground and/or background. */ /* Initialize colors with default bg: [0][1..8] */ for (fg = COLOR_BLACK; fg <= COLOR_WHITE; fg++) { swin_init_pair(color_pair, fg, -1); color_pair_table[0][fg + 1] = color_pair++; } /* Initialize colors with default fg: [1..8][0] */ for (bg = COLOR_BLACK; bg <= COLOR_WHITE; bg++) { swin_init_pair(color_pair, -1, bg); color_pair_table[bg + 1][0] = color_pair++; } color_pairs_inited = 1; } fgcolor = MAX(0, fgcolor + 1); bgcolor = MAX(0, bgcolor + 1); return color_pair_table[bgcolor][fgcolor]; } /** * 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 background 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; 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_color_support()) return 0; /* If no colors are specified, we're done. */ if (fore_color == UNSPECIFIED_COLOR && back_color == UNSPECIFIED_COLOR) return 0; if (hl_ansi_color_support(hl_groups)) { /* Ansi mode is enabled so we've got 16 colors and 64 color pairs. Set the color_pair index for this bg / fg color combination. */ info->color_pair = hl_get_ansicolor_pair(hl_groups, back_color, fore_color); return 0; } /* 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) { int old_fore_color, old_back_color; swin_pair_content(info->color_pair, &old_fore_color, &old_back_color); fore_color = old_fore_color; } else if (back_color == UNSPECIFIED_COLOR) { int old_fore_color, old_back_color; swin_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 < swin_color_pairs()) { if (swin_init_pair(info->color_pair, fore_color, back_color) != 0) return -1; } else return -1; return 0; } static int hl_groups_setup(hl_groups_ptr hl_groups) { int i; int val; const struct default_hl_group_info *ginfo; int colors = swin_colors(); int color_pairs = swin_color_pairs(); bool color_pairs_extension = swin_supports_default_color_pairs_extension(); bool in_color = hl_color_support(); if (!hl_groups) return -1; ginfo = default_groups_for_background_dark; hl_groups->ansi_color_support = (colors >= 8) && (color_pairs >= 64) && color_pairs_extension; clog_info(CLOG_CGDB, "Color support: %s", (in_color) ? "Enabled" : "Disabled"); clog_info(CLOG_CGDB, "ANSI color support: %s", (hl_groups->ansi_color_support) ? "Enabled" : "Disabled"); clog_info(CLOG_CGDB, "Number colors: %d", colors); clog_info(CLOG_CGDB, "Number color pairs: %d", color_pairs); clog_info(CLOG_CGDB, "Extended color pair support: %s", (color_pairs_extension) ? "Yes" : "No"); /* Set up the default groups. */ for (i = 0; ginfo[i].kind != HLG_LAST; ++i) { 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) { clog_error(CLOG_CGDB, "setup group."); return -1; } } return 0; } hl_groups_ptr hl_groups_initialize(void) { int i; hl_groups_ptr hl_groups; hl_groups = (hl_groups_ptr) cgdb_malloc(sizeof (struct hl_groups)); hl_groups->ansi_color_support = false; for (i = 0; i < HLG_LAST; ++i) { struct hl_group_info *info; info = &hl_groups->groups[i]; info->kind = (enum hl_group_kind) (i + 1); info->mono_attrs = 0; info->color_attrs = 0; info->color_pair = 0; } if (hl_groups_setup(hl_groups) == -1) { hl_groups_shutdown(hl_groups); hl_groups = NULL; } 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_get_attr(hl_groups_ptr hl_groups, enum hl_group_kind kind) { struct hl_group_info *info = lookup_group_info_by_key(hl_groups, kind); int attr = (kind == HLG_EXECUTING_LINE_HIGHLIGHT) ? SWIN_A_BOLD : SWIN_A_NORMAL; switch(kind) { case HLG_BLACK: case HLG_RED: case HLG_GREEN: case HLG_YELLOW: case HLG_BLUE: case HLG_MAGENTA: case HLG_CYAN: case HLG_WHITE: attr = swin_color_pair(hl_get_ansicolor_pair( hl_groups, -1, kind - HLG_BLACK)); return attr; case HLG_BOLD_BLACK: case HLG_BOLD_RED: case HLG_BOLD_GREEN: case HLG_BOLD_YELLOW: case HLG_BOLD_BLUE: case HLG_BOLD_MAGENTA: case HLG_BOLD_CYAN: case HLG_BOLD_WHITE: attr = SWIN_A_BOLD | swin_color_pair( hl_get_ansicolor_pair(hl_groups, -1, kind - HLG_BOLD_BLACK)); return attr; case HLG_TYPE: case HLG_KEYWORD: case HLG_LITERAL: case HLG_COMMENT: case HLG_DIRECTIVE: case HLG_TEXT: case HLG_SEARCH: case HLG_STATUS_BAR: case HLG_EXECUTING_LINE_ARROW: case HLG_SELECTED_LINE_ARROW: case HLG_EXECUTING_LINE_HIGHLIGHT: case HLG_SELECTED_LINE_HIGHLIGHT: case HLG_EXECUTING_LINE_BLOCK: case HLG_SELECTED_LINE_BLOCK: case HLG_ENABLED_BREAKPOINT: case HLG_DISABLED_BREAKPOINT: case HLG_SELECTED_LINE_NUMBER: case HLG_EXECUTING_LINE_NUMBER: case HLG_SCROLL_MODE_STATUS: case HLG_LOGO: case HLG_MARK: case HLG_LAST: case HLG_INCSEARCH: break; } if (hl_groups && info) { if (!hl_color_support()) attr = info->mono_attrs; else { attr = info->color_attrs; if (info->color_pair) attr |= swin_color_pair(info->color_pair); } } return attr; } 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 }; /* First, get the "group", that is, the group. */ token = yylex(); if (token != IDENTIFIER) { #ifdef LOG_HIGHLIGHT_COMMAND_ERRORS clog_error(CLOG_CGDB, "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 clog_error(CLOG_CGDB, "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 clog_error(CLOG_CGDB, "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 clog_error(CLOG_CGDB, "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 clog_error(CLOG_CGDB, "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 clog_error(CLOG_CGDB, "Unknown attribute name"); #endif return 1; } if (pair->value == -1) { #ifdef LOG_HIGHLIGHT_COMMAND_ERRORS clog_error(CLOG_CGDB, "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 clog_error(CLOG_CGDB, "Unknown color: \"%s\".", name); #endif return 1; } color = color_spec->nr8Color; if (color_spec->nr8ForegroundBold) { if (color_attrs == UNSPECIFIED_COLOR) color_attrs = SWIN_A_BOLD; else color_attrs |= SWIN_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; } /* Given 24-bit rgb value, calculate closest color in our 16 entry color table */ int ansi_get_closest_color_value(int r, int g, int b) { static const struct { int r, g, b; } standard_ansi_colors[] = { // standard colors { 0, 0, 0 }, // COLOR_BLACK { 224, 0, 0 }, // COLOR_RED { 0, 224, 0 }, // COLOR_GREEN { 224, 224, 0 }, // COLOR_YELLOW { 0, 0, 224 }, // COLOR_BLUE { 224, 0, 224 }, // COLOR_MAGENTA { 0, 224, 224 }, // COLOR_CYAN { 224, 224, 224 }, // COLOR_WHITE // High intensity colors { 128, 128, 128 }, // COLOR_BLACK { 255, 64, 64 }, // COLOR_RED { 64, 255, 64 }, // COLOR_GREEN { 255, 255, 64 }, // COLOR_YELLOW { 64, 64, 255 }, // COLOR_BLUE { 255, 64, 255 }, // COLOR_MAGENTA { 64, 255, 255 }, // COLOR_CYAN { 255, 255, 255 }, // COLOR_WHITE }; int i; int index = 0; int distance = -1; for (i = 0; i < sizeof(standard_ansi_colors) / sizeof(standard_ansi_colors[0]); i++) { int r2 = standard_ansi_colors[i].r; int g2 = standard_ansi_colors[i].g; int b2 = standard_ansi_colors[i].b; /* Distance in rgb space. Not all that accurate, but should work for this. */ int d = (r2-r)*(r2-r) + (g2-g)*(g2-g) + (b2-b)*(b2-b); if ((distance == -1) || (d < distance)) { distance = d; index = i; } } return index; } /* In 256-color mode, the color-codes are the following: 0x00-0x07: standard colors (as in ESC [ 30;37 m) 0x08-0x0F: high intensity colors (as in ESC [ 90;97 m) 0x10-0xE7: 6 * 6 * 6 = 216 colors: 16 + 36 * r + 6 * g + b (0 ? r, g, b ? 5) 0xE8-0xFF: grayscale from black to white in 24 steps Set the foreground color to index N: \033[38;5;${N}m Set the background color to index M: \033[48;5;${M}m */ static int ansi_get_color_code_index(const char *buf, int *index) { int i = 0; if (buf[i] == ';' && buf[i+1] == '5' && buf[i+2] == ';') { int num = 0; i += 3; while (isdigit(buf[i])) { num = num * 10 + buf[i] - '0'; i++; } if (num >= 232) { /* Convert grayscale 232 - 255 value to 0 - 255 rgb value */ int gray = 255 * (MIN(num, 255) - 232) / (255 - 232); num = ansi_get_closest_color_value( gray, gray, gray ); } else if (num >= 16) { /* Convert 0-6 component values to 0 - 255 rgb values */ int red = ((num - 16) / 36); int green = (((num - 16) - red * 36) / 6); int blue = ((num - 16) % 6); num = ansi_get_closest_color_value( red * 255 / 6, green * 255 / 6, blue * 255 / 6 ); } *index = num; return i; } *index = -1; return 0; } /* Parse ansi color escape sequence in buf, return ncurses attribute and esc length */ int hl_ansi_get_color_attrs(hl_groups_ptr hl_groups, const char *buf, int *attr) { int i = 0; int fg = -1; int bg = -1; int a = SWIN_A_NORMAL; *attr = 0; /* If we're not in ansi mode, just return default color pair 0 and * don't parse the string. */ if (!hl_ansi_color_support(hl_groups)) return 0; if ((buf[i++] == '\033') && (buf[i++] == '[')) { /* Check for reset attributes. Ie: \033[m or \033[0m */ if (buf[i] == 'm') return 3; else if (buf[i] == '0' && buf[i+1] == 'm') return 4; /* Parse number;number;number;m sequences */ for (;;) { int num = 0; /* Should have a number here */ if (!isdigit(buf[i])) return 0; while (isdigit(buf[i])) { num = num * 10 + buf[i] - '0'; i++; } /* https://conemu.github.io/en/AnsiEscapeCodes.html#SGR_Select_Graphic_Rendition_parameters */ switch(num) { case 0: /* Reset current attributes */ a = SWIN_A_NORMAL; fg = -1; bg = -1; break; case 1: /* Set BrightOrBold */ a |= SWIN_A_BOLD; break; case 2: /* Unset BrightOrBold */ case 22: /* Unset BrightOrBold */ a &= ~SWIN_A_BOLD; break; case 4: /* SetBackOrUnderline */ case 5: /* SetBackOrUnderline */ a |= SWIN_A_UNDERLINE; break; case 3: /* SetItalicOrInverse */ case 7: /* Use inverse colors */ a |= SWIN_A_REVERSE; break; case 23: /*Unset ItalicOrInverse */ a &= ~SWIN_A_REVERSE; break; case 24: /* UnsetBackOrUnderline */ a &= ~SWIN_A_UNDERLINE; break; case 27: /* Use normal colors */ case 39: /* Reset text color to defaults */ fg = -1; bg = -1; break; case 49: /* Reset background color to defaults */ bg = -1; break; case 38: /* Foreground xterm color code index */ i += ansi_get_color_code_index(buf + i, &num); if (num >= 0 && num < 16) { fg = num & 7; a |= ((num & 0x8) ? SWIN_A_BOLD : 0); } else { a |= SWIN_A_REVERSE | SWIN_A_BOLD; } break; case 48: /* Background xterm color code index */ i += ansi_get_color_code_index(buf + i, &num); if (num >= 0 && num < 16) { bg = num & 7; a |= ((num & 0x8) ? SWIN_A_BOLD : 0); } else { a |= SWIN_A_REVERSE | SWIN_A_BOLD; } break; /* Set ANSI text color */ case 30: case 31: case 32: case 33: case 34: case 35: case 36: case 37: fg = num - 30; break; /* Set ANSI background color */ case 40: case 41: case 42: case 43: case 44: case 45: case 46: case 47: bg = num - 40; break; /* Set bright ANSI text color */ case 90: case 91: case 92: case 93: case 94: case 95: case 96: case 97: fg = num - 90; a |= SWIN_A_BOLD; break; /* Set bright ANSI background color */ case 100: case 101: case 102: case 103: case 104: case 105: case 106: case 107: bg = num - 100; a |= SWIN_A_BOLD; break; } if (buf[i] == 'm') { int color_pair = hl_get_ansicolor_pair(hl_groups, bg, fg); *attr = a | swin_color_pair(color_pair); return i + 1; } if (buf[i] != ';') return 0; i++; } } return 0; } static void hl_printspan(SWINDOW *win, const char *line, int line_len, int attr) { swin_wattron(win, attr); swin_waddnstr(win, line, line_len); swin_wattroff(win, attr); } hl_line_attr::hl_line_attr(int col, int attr) : m_col(col), m_is_group(false), m_attr(attr) {} hl_line_attr::hl_line_attr(int col, enum hl_group_kind kind) : m_col(col), m_is_group(true), m_attr((int)kind) {} int hl_line_attr::col(void) const { return m_col; } int hl_line_attr::as_attr(void) const { int attr; if (m_is_group) { attr = hl_groups_get_attr(hl_groups_instance, (enum hl_group_kind)m_attr); } else { attr = m_attr; } return attr; } void hl_printline(SWINDOW *win, const char *line, int line_len, const hl_line_attr *attrs, int x, int y, int col, int width) { int count; int attr = 0; int use_current_pos = (x == -1) && (y == -1); if (!use_current_pos) { if (y < 0) return; else if (x < 0) { col -= x; x = 0; } swin_wmove(win, y, x); } count = MIN(line_len - col, width); if (count <= 0) { swin_wclrtoeol(win); return; } if (attrs) { int i; for (i = 0; i < sbcount(attrs); i++) { if (attrs[i].col() <= col) { attr = attrs[i].as_attr(); } else if (attrs[i].col() < col + count) { int len = attrs[i].col() - col; hl_printspan(win, line + col, len, attr); col += len; count -= len; width -= len; attr = attrs[i].as_attr(); } else { hl_printspan(win, line + col, count, attr); width -= count; count = 0; } } } if (count) { hl_printspan(win, line + col, count, attr); width -= count; } if (width) swin_wclrtoeol(win); } void hl_printline_highlight(SWINDOW *win, const char *line, int line_len, const hl_line_attr *attrs, int x, int y, int col, int width) { int count; int attr = 0; int use_current_pos = (x == -1) && (y == -1); if (!use_current_pos) { if (y < 0) return; else if (x < 0) { col -= x; x = 0; } swin_wmove(win, y, x); } count = MIN(line_len - col, width); if (count <= 0) return; if (attrs) { int i; for (i = 0; i < sbcount(attrs); i++) { if (attrs[i].col() <= col) { attr = attrs[i].as_attr(); } else if (attrs[i].col() < col + count) { int len = attrs[i].col() - col; if (attr) hl_printspan(win, line + col, len, attr); else swin_wmove(win, y, swin_getcurx(win) + len); col += len; count -= len; width -= len; attr = attrs[i].as_attr(); } else { if (attr) hl_printspan(win, line + col, count, attr); else swin_wmove(win, y, swin_getcurx(win) + count); width -= count; count = 0; } } } if (count && attr) hl_printspan(win, line + col, count, attr); } void hl_get_color_attr_from_index(int fg_index, int bg_index, int &attr) { int color_pair = hl_get_ansicolor_pair(NULL, bg_index, fg_index); attr = swin_color_pair(color_pair); } /*@}*/ /* }}}*/ cgdb-0.8.0/cgdb/scroller.h0000664000175000017500000001216414171031270012236 00000000000000// A GDB scroller #ifndef _SCROLLER_H_ #define _SCROLLER_H_ #include "sys_win.h" struct scroller; // Creates and initializes a new scroller // // @return // A pointer to a new scroller. struct scroller *scr_new(SWINDOW *window); // Releases the memory allocated by a scroller // // @param scr // The scroller to operate on void scr_free(struct scroller *scr); // Enable or disable the scroll mode // // @param scr // The scroller to operate on // // @param mode // When true, scroll mode is enabled. When false, scroll mode is disabled void scr_set_scroll_mode(struct scroller *scr, bool mode); // Determine the scroll mode // // @param scr // The scroller to operate on // // @return // True in scroll mode, otherwise false bool scr_scroll_mode(struct scroller *scr); // Move up a number of lines in scroll mode. Scroll mode must be enabled. // // @param scr // The scroller to operate on // // @nlines // Number of lines to scroll back; will not scroll past beginning void scr_up(struct scroller *scr, int nlines); // Move down a number of lines in scroll mode. Scroll mode must be enabled. // // @param scr // The scroller to operate on // // @nlines // Number of lines to scroll down; will not scroll past end void scr_down(struct scroller *scr, int nlines); // Jump to the beginning (the top) of the scrollback buffer in scroll mode // Scroll mode must be enabled. // // @param scr // The scroller to operate on void scr_home(struct scroller *scr); // Jump to the end (the bottom) of the scrollback buffer in scroll mode // Scroll mode must be enabled. // // @param scr // The scroller to operate on void scr_end(struct scroller *scr); // Move the cursor left a position in scroll mode. Scroll mode must be enabled. // // @param scr // The scroller to operate on void scr_left(struct scroller *scr); // Move the cursor right a position in scroll mode. Scroll mode must be enabled. // // @param scr // The scroller to operate on void scr_right(struct scroller *scr); // Move the cursor to the beginning of the row in scroll mode // Scroll mode must be enabled // // @param scr // The scroller to operate on void scr_beginning_of_row(struct scroller *scr); // Move the cursor to the end of the row in scroll mode // Scroll mode must be enabled // // @param scr // The scroller to operate on void scr_end_of_row(struct scroller *scr); // Enable the search mode. Scroll mode must be enabled. // // The current cursor location and delta within the scrollback mode are saved. // Once enabled, you can incrementally search by calling scr_search_regex // repeatedly, and then cancel/accept the search via scr_disable_search. // You cancel cancel the search without calling scr_search_regex as well. // // @param scr // The scroller to operate on // // @param forward // If true then forward, else in reverse // // @param icase // If true then ignore case, else consider case void scr_enable_search(struct scroller *scr, bool forward, bool icase); // Disable the search mode. Search mode must be enabled. // // @param scr // The scroller to operate on // // @param accept // True to accept the search position/cursor found by scr_search_regex // False will reset to the original position/cursor position void scr_disable_search(struct scroller *scr, bool accept); // Determine the search mode // // @param scr // The scroller to operate on // // @return // True in search mode, otherwise false bool scr_search_mode(struct scroller *scr); // Searches for regex in current scroller and displays line. // Search mode must be enabled. // // @param scr // Pointer to the scroller object // // @param regex // The regular expression to search for. If NULL, then no regex will be tried. // // @return // Zero on success with no match, 1 on success with match or -1 on error int scr_search_regex(struct scroller *scr, const char *regex); // Repeat the last search made. Search mode must be enabled. // // This requires at least one call to scr_disable_search with accept=true. // If this hasn't occured yet, than this will be a no-op. // // @param scr // Pointer to the scroller object // // @param forward // If true then forward, else in reverse // // @param icase // If true then ignore case, else consider case void scr_search_next(struct scroller *scr, bool forward, bool icase); // Push the contents of the screen into the scrollback buffer // This is used when the user types control-l // // @param scr // Pointer to the scroller object void scr_push_screen_to_scrollback(struct scroller *scr); // Add output from gdb to the scroller buffer // // @param scr // The scroller to operate on // // @param buf // The buffer to append void scr_add(struct scroller *scr, const char *buf); // Give the scroller a new window to display itself in // // @param scr // The scroller to operate on // // @param win // The window to place the scroller into void scr_move(struct scroller *scr, SWINDOW *win); // Refreshes the scroller on the screen // // @param scr // The scroller to operate on // // @param focus // True if the scroller has focus, false otherwise // // @param dorefresh // Controls how the scroller should update the screen void scr_refresh(struct scroller *scr, int focus, enum win_refresh dorefresh); #endif cgdb-0.8.0/cgdb/logo.cpp0000664000175000017500000003052414135136636011720 00000000000000/* logo.c * ------ * Data for ASCII logos. * * These logos were generated thanks to Jorg 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 "sys_util.h" #include "stretchy.h" #include "sys_win.h" #include "cgdb.h" #include "logo.h" #include "highlight_groups.h" /* Logo index */ static int logoindex = -1; /* --------------- */ /* Data Structures */ /* --------------- */ struct Logo { bool ansi_escapes; /* True if contains ansi color escape sequences */ int h; /* Height of logo */ int w; /* Width of logo */ const char *data[15]; /* Increase the array size as necessary */ }; /* With vim (note: check 'stty -a' for lnext if Ctrl+V doesn't work) :read !figlet -f colossal cgdb | toilet -f term -F metal --export ansi s/\\/\\\\/g ; replace all \ with \\ s/"/\\"/g ; replace all " with \" s/^[/\\033/g ; replace ^[ with \033, hit Ctrl+V,Ctrl+[ to get ^[ s/^/"/ ; add " at start of lines s/$/",/ ; add ", at end of lines Please put all the logos with ansi color escape sequences last. Logos with ansi color escape sequences can only be displayed if CGDB supports ansi colors. */ static struct Logo CGDB_LOGO[] = { { false, 6, 31, { " .______. ", " ____ ____ __| _/\\_ |__ ", "_/ ___\\ / ___\\ / __ | | __ \\ ", "\\ \\___/ /_/ > /_/ | | \\_\\ \\", " \\___ >___ /\\____ | |___ /", " \\/_____/ \\/ \\/ " } }, { false, 6, 49, { "_______________________________/\\/\\__/\\/\\_______", "___/\\/\\/\\/\\____/\\/\\/\\/\\________/\\/\\__/\\/\\_______", "_/\\/\\________/\\/\\__/\\/\\____/\\/\\/\\/\\__/\\/\\/\\/\\___", "_/\\/\\__________/\\/\\/\\/\\__/\\/\\__/\\/\\__/\\/\\__/\\/\\_", "___/\\/\\/\\/\\________/\\/\\____/\\/\\/\\/\\__/\\/\\/\\/\\___", "_____________/\\/\\/\\/\\___________________________" } }, { false, 7, 38, { " _| _| ", " _|_|_| _|_|_| _|_|_| _|_|_| ", "_| _| _| _| _| _| _|", "_| _| _| _| _| _| _|", " _|_|_| _|_|_| _|_|_| _|_|_| ", " _| ", " _|_| " } }, /* echo cgdb | boxes -d peek -a c -s 20x7 | toilet --gay -f term */ { true, 7, 20, { "\033[0;1;35;95m \033[0m \033[0;1;36;96m_\033[0;1;34;94m\\|\033[0;1;35;95m/_\033[0m", " \033[0;1;36;96m(\033[0;1;34;94mo\033[0m \033[0;1;35;95mo)\033[0m", " \033[0;1;35;95m+\033[0;1;31;91m--\033[0;1;33;93m--\033[0;1;32;92moO\033[0;1;36;96mO-\033[0;1;34;94m{_\033[0;1;35;95m}-\033[0;1;31;91mOO\033[0;1;33;93mo-\033[0;1;32;92m-+\033[0m", " \033[0;1;35;95m|\033[0m \033[0;1;32;92m|\033[0m", " \033[0;1;35;95m|\033[0m \033[0;1;36;96mcg\033[0;1;34;94mdb\033[0m \033[0;1;32;92m|\033[0m", " \033[0;1;35;95m|\033[0m \033[0;1;32;92m|\033[0m", " \033[0;1;35;95m+\033[0;1;31;91m--\033[0;1;33;93m--\033[0;1;32;92m--\033[0;1;36;96m--\033[0;1;34;94m--\033[0;1;35;95m--\033[0;1;31;91m--\033[0;1;33;93m--\033[0;1;32;92m*/\033[0m", } }, /* cowsay -f eyes cgdb | toilet --gay -f term --export ansi */ { true, 14, 48, { "\033[0;37m \033[0;1;35m_\033[0;1;31m__\033[0;1;33m__\033[0;1;32m_\033[0m", "\033[0;1;35m<\033[0;37m \033[0;1;31mcg\033[0;1;33mdb\033[0;37m \033[0;1;32m>\033[0m", "\033[0;37m \033[0;1;35m-\033[0;1;31m--\033[0;1;33m--\033[0;1;32m-\033[0m", "\033[0;37m \033[0;1;33m\\\033[0m", "\033[0;37m \033[0;1;33m\\\033[0m", "\033[0;37m \033[0;1;34m.\033[0;1;35m::\033[0;1;31m!!\033[0;1;33m!!\033[0;1;32m!!\033[0;1;36m!:\033[0;1;34m.\033[0m", "\033[0;37m \033[0;1;31m.!\033[0;1;33m!!\033[0;1;32m!!\033[0;1;36m:.\033[0;37m \033[0;1;34m.:\033[0;1;35m!!\033[0;1;31m!!\033[0;1;33m!!\033[0;1;32m!!\033[0;1;36m!!\033[0;1;34m!!\033[0m", "\033[0;37m \033[0;1;31m~~\033[0;1;33m~~\033[0;1;32m!!\033[0;1;36m!!\033[0;1;34m!!\033[0;1;35m.\033[0;37m \033[0;1;32m.:\033[0;1;36m!!\033[0;1;34m!!\033[0;1;35m!!\033[0;1;31m!!\033[0;1;33m!U\033[0;1;32mWW\033[0;1;36mW$\033[0;1;34m$$\033[0;37m \033[0m", "\033[0;37m \033[0;1;32m:$\033[0;1;36m$N\033[0;1;34mWX\033[0;1;35m!!\033[0;1;31m:\033[0;37m \033[0;1;31m.:\033[0;1;33m!!\033[0;1;32m!!\033[0;1;36m!!\033[0;1;34mXU\033[0;1;35mWW\033[0;1;31m$$\033[0;1;33m$$\033[0;1;32m$$\033[0;1;36m$$\033[0;1;34m$P\033[0;37m \033[0m", "\033[0;37m \033[0;1;32m$$\033[0;1;36m$$\033[0;1;34m$#\033[0;1;35m#W\033[0;1;31mX!\033[0;1;33m:\033[0;37m \033[0;1;34m.\033[0;1;35m to exit ", "type help for GDB help ", "type :help for CGDB help" }; #define CGDB_NUM_USAGE (sizeof(usage) / sizeof(usage[0])) /* --------- */ /* Functions */ /* --------- */ static void center_line(SWINDOW *win, int row, int width, const char *data, int datawidth, enum hl_group_kind group_kind) { int i, attr; char *line = NULL; int datalen = strlen(data); hl_line_attr *attrs = NULL; /* Set up default attributes at column 0 */ sbpush(attrs, hl_line_attr(0, group_kind)); /* Parse ansi escape color codes in string */ for (i = 0; i < datalen; i++) { if (data[i] == '\033') { int ansi_count = hl_ansi_get_color_attrs( hl_groups_instance, data + i, &attr); if (ansi_count) { sbpush(attrs, hl_line_attr(sbcount(line), attr)); i += ansi_count - 1; continue; } } sbpush(line, data[i]); } sbpush(line, 0); hl_printline(win, line, strlen(line), attrs, (width - datawidth) / 2, row, 0, width); sbfree(attrs); sbfree(line); } /** * Get the number of logos available for display. * * If ansi color escape sequences are supported, than all logos can * be displayed. Otherwise, only logos with out ansi escape color * sequences can be displayed. * * @return * The number of logos available for display. */ static int logos_available() { int num_logos = 0; if (hl_ansi_color_support(hl_groups_instance)) { num_logos = CGDB_NUM_LOGOS; } else { for (int cur = 0; cur < CGDB_NUM_LOGOS; ++cur, ++num_logos) { if (CGDB_LOGO[cur].ansi_escapes) break; } } return num_logos; } void logo_reset() { logoindex = (logoindex + 1) % logos_available(); } void logo_display(SWINDOW *win) { int height, width; /* Dimensions of the window */ int line; /* Starting line */ int i; /* Iterators */ int usage_height = CGDB_NUM_USAGE; /* Height of the usage message */ /* Pick a random logoindex */ if (logoindex == -1) { srand(time(NULL)); logoindex = rand() % logos_available(); } /* Get dimensions */ height = swin_getmaxy(win); width = swin_getmaxx(win); /* Clear the window */ swin_werase(win); /* If the logo fits on the screen, draw it */ if ((CGDB_LOGO[logoindex].h <= height - usage_height - 2)) { line = (height - CGDB_LOGO[logoindex].h - usage_height - 2) / 2; for(i = 0; i < CGDB_LOGO[logoindex].h; i++) { center_line(win, line++, width, CGDB_LOGO[logoindex].data[i], CGDB_LOGO[logoindex].w, HLG_LOGO); } line++; } else { line = (height - usage_height) / 2; } /* Show simple usage info */ for (i = 0; i < usage_height; i++) center_line(win, line++, width, usage[i], strlen(usage[i]), HLG_LOGO); swin_curs_set(0); /* Hide the cursor */ } cgdb-0.8.0/cgdb/logo.h0000664000175000017500000000114213046227664011361 00000000000000/* logo.h: Routine for displaying an ASCII-art CGDB logo on screen. * ------- */ #ifndef _LOGO_H_ #define _LOGO_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(SWINDOW *win); /** * This chooses another logo to be displayed on the next call to logo_display. */ void logo_reset(); #endif cgdb-0.8.0/cgdb/command_lexer.cpp0000664000175000017500000014042714171036463013576 00000000000000 #line 3 "command_lexer.cpp" #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 6 #define YY_FLEX_SUBMINOR_VERSION 0 #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 yyrestart(yyin ) #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 #ifndef YY_TYPEDEF_YY_SIZE_T #define YY_TYPEDEF_YY_SIZE_T typedef size_t yy_size_t; #endif extern yy_size_t 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) #define YY_LINENO_REWIND_TO(ptr) /* 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) ) #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 */ yy_size_t 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,yy_size_t 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 */ #define yywrap() (/*CONSTCOND*/1) #define YY_SKIP_YYWRAP 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; #ifdef yytext_ptr #undef yytext_ptr #endif #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 ); #if defined(__GNUC__) && __GNUC__ >= 3 __attribute__((__noreturn__)) #endif 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 18 #define YY_END_OF_BUFFER 19 /* 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[58] = { 0, 0, 0, 0, 0, 19, 14, 13, 12, 12, 14, 1, 14, 11, 7, 10, 14, 9, 6, 6, 6, 6, 6, 17, 16, 15, 15, 18, 12, 0, 8, 0, 1, 7, 0, 0, 6, 6, 6, 0, 6, 6, 6, 6, 6, 17, 15, 6, 6, 6, 3, 6, 4, 6, 6, 5, 2, 0 } ; static yyconst YY_CHAR 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, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 1, 17, 1, 1, 16, 1, 18, 19, 20, 21, 22, 16, 16, 16, 23, 16, 16, 16, 24, 25, 26, 16, 16, 27, 28, 29, 30, 16, 16, 16, 16, 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 YY_CHAR yy_meta[31] = { 0, 1, 2, 3, 2, 2, 4, 1, 1, 1, 1, 5, 1, 4, 1, 1, 4, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 } ; static yyconst flex_uint16_t yy_base[64] = { 0, 0, 0, 29, 33, 140, 141, 141, 135, 135, 32, 0, 126, 141, 125, 141, 49, 141, 34, 74, 23, 20, 58, 0, 141, 141, 132, 141, 141, 75, 141, 131, 0, 122, 0, 0, 78, 141, 109, 0, 106, 63, 70, 66, 71, 0, 141, 105, 75, 21, 99, 78, 85, 79, 80, 84, 83, 141, 109, 114, 119, 121, 126, 100 } ; static yyconst flex_int16_t yy_def[64] = { 0, 57, 1, 58, 58, 57, 57, 57, 57, 57, 59, 60, 57, 57, 57, 57, 57, 57, 61, 61, 19, 19, 19, 62, 57, 57, 57, 57, 57, 59, 57, 59, 60, 57, 16, 16, 63, 57, 19, 16, 19, 19, 19, 19, 19, 62, 57, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 0, 57, 57, 57, 57, 57, 57 } ; static yyconst flex_uint16_t yy_nxt[172] = { 0, 6, 7, 8, 9, 7, 6, 10, 11, 12, 13, 14, 15, 16, 17, 6, 18, 6, 18, 19, 18, 18, 18, 18, 20, 18, 18, 18, 21, 18, 22, 24, 25, 26, 27, 24, 25, 26, 27, 30, 37, 42, 43, 40, 40, 38, 40, 39, 53, 31, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 35, 34, 34, 34, 36, 35, 34, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 37, 40, 30, 44, 37, 38, 40, 39, 48, 40, 49, 39, 31, 40, 40, 50, 52, 41, 40, 51, 54, 40, 40, 40, 47, 55, 40, 40, 40, 56, 23, 23, 23, 23, 23, 29, 29, 29, 29, 29, 32, 32, 40, 32, 32, 40, 40, 45, 40, 40, 45, 45, 40, 33, 57, 46, 33, 33, 28, 28, 57, 5, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57 } ; static yyconst flex_int16_t yy_chk[172] = { 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, 3, 3, 3, 3, 4, 4, 4, 4, 10, 18, 20, 21, 21, 49, 18, 20, 18, 49, 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, 19, 22, 29, 22, 36, 19, 41, 19, 41, 43, 42, 36, 29, 42, 44, 43, 48, 19, 48, 44, 51, 51, 53, 54, 63, 53, 56, 55, 52, 54, 58, 58, 58, 58, 58, 59, 59, 59, 59, 59, 60, 60, 50, 60, 60, 61, 61, 62, 47, 40, 62, 62, 38, 33, 31, 26, 14, 12, 9, 8, 5, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57 } ; 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 "/home/bob/rcs/git/cgdb/master/cgdb/cgdb/command_lexer.lpp" #define YY_NO_INPUT 1 #line 9 "/home/bob/rcs/git/cgdb/master/cgdb/cgdb/command_lexer.lpp" /* 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 "command_lexer.cpp" #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 ); /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ int yylex_destroy (void ); int yyget_debug (void ); void yyset_debug (int debug_flag ); YY_EXTRA_TYPE yyget_extra (void ); void yyset_extra (YY_EXTRA_TYPE user_defined ); FILE *yyget_in (void ); void yyset_in (FILE * _in_str ); FILE *yyget_out (void ); void yyset_out (FILE * _out_str ); yy_size_t yyget_leng (void ); char *yyget_text (void ); int yyget_lineno (void ); void yyset_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 yywrap (void ); #else extern int yywrap (void ); #endif #endif #ifndef YY_NO_UNPUT #endif #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( yytext, yyleng, 1, yyout )) {} } 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( 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 /*LINTED*/break; #endif #define YY_RULE_SETUP \ YY_USER_ACTION /** The main scanner function which does all the work. */ YY_DECL { yy_state_type yy_current_state; char *yy_cp, *yy_bp; int yy_act; 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( ); } { #line 30 "/home/bob/rcs/git/cgdb/master/cgdb/cgdb/command_lexer.lpp" if (enter_map_id) BEGIN (MAP_ID); else BEGIN (INITIAL); #line 766 "command_lexer.cpp" while ( /*CONSTCOND*/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 { 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 >= 58 ) 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] != 141 ); 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 38 "/home/bob/rcs/git/cgdb/master/cgdb/cgdb/command_lexer.lpp" { /* ignore comments */ } YY_BREAK case 2: YY_RULE_SETUP #line 39 "/home/bob/rcs/git/cgdb/master/cgdb/cgdb/command_lexer.lpp" { return UNSET; } YY_BREAK case 3: YY_RULE_SETUP #line 40 "/home/bob/rcs/git/cgdb/master/cgdb/cgdb/command_lexer.lpp" { return SET; } YY_BREAK case 4: YY_RULE_SETUP #line 41 "/home/bob/rcs/git/cgdb/master/cgdb/cgdb/command_lexer.lpp" { return BIND; } YY_BREAK case 5: YY_RULE_SETUP #line 42 "/home/bob/rcs/git/cgdb/master/cgdb/cgdb/command_lexer.lpp" { return MACRO; } YY_BREAK case 6: /* rule 6 can match eol */ YY_RULE_SETUP #line 44 "/home/bob/rcs/git/cgdb/master/cgdb/cgdb/command_lexer.lpp" { return IDENTIFIER; } YY_BREAK case 7: YY_RULE_SETUP #line 45 "/home/bob/rcs/git/cgdb/master/cgdb/cgdb/command_lexer.lpp" { return NUMBER; } YY_BREAK case 8: /* rule 8 can match eol */ YY_RULE_SETUP #line 46 "/home/bob/rcs/git/cgdb/master/cgdb/cgdb/command_lexer.lpp" { return STRING; } YY_BREAK case 9: YY_RULE_SETUP #line 48 "/home/bob/rcs/git/cgdb/master/cgdb/cgdb/command_lexer.lpp" { return '='; } YY_BREAK case 10: YY_RULE_SETUP #line 49 "/home/bob/rcs/git/cgdb/master/cgdb/cgdb/command_lexer.lpp" { return ';'; } YY_BREAK case 11: YY_RULE_SETUP #line 50 "/home/bob/rcs/git/cgdb/master/cgdb/cgdb/command_lexer.lpp" { return ','; } YY_BREAK case 12: /* rule 12 can match eol */ YY_RULE_SETUP #line 53 "/home/bob/rcs/git/cgdb/master/cgdb/cgdb/command_lexer.lpp" { return EOL; } YY_BREAK case 13: YY_RULE_SETUP #line 54 "/home/bob/rcs/git/cgdb/master/cgdb/cgdb/command_lexer.lpp" { /* ignore white-space */ } YY_BREAK case 14: YY_RULE_SETUP #line 55 "/home/bob/rcs/git/cgdb/master/cgdb/cgdb/command_lexer.lpp" { /* ignore bad-characters */ } YY_BREAK case 15: /* rule 15 can match eol */ YY_RULE_SETUP #line 60 "/home/bob/rcs/git/cgdb/master/cgdb/cgdb/command_lexer.lpp" { return EOL; } YY_BREAK case 16: YY_RULE_SETUP #line 61 "/home/bob/rcs/git/cgdb/master/cgdb/cgdb/command_lexer.lpp" { /* ignore white space */ } YY_BREAK case 17: YY_RULE_SETUP #line 62 "/home/bob/rcs/git/cgdb/master/cgdb/cgdb/command_lexer.lpp" { return IDENTIFIER; } YY_BREAK case 18: YY_RULE_SETUP #line 65 "/home/bob/rcs/git/cgdb/master/cgdb/cgdb/command_lexer.lpp" ECHO; YY_BREAK #line 921 "command_lexer.cpp" 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 user's declarations */ } /* 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) { char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; char *source = (yytext_ptr); yy_size_t 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 = (yy_size_t) ((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_LVALUE; 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. */ 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), 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; if ((int) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((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) { yy_state_type yy_current_state; char *yy_cp; yy_current_state = (yy_start); for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) { 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 >= 58 ) 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 ) { int yy_is_jam; char *yy_cp = (yy_c_buf_p); 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 >= 58 ) 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 == 57); return yy_is_jam ? 0 : yy_current_state; } #ifndef YY_NO_UNPUT #endif #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. */ 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 = (yy_size_t)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 ); } /* 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) { 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; /* After all that talk, this was set to 1 anyways... */ (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc (num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in yyensure_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. */ yy_size_t 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*) ); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in yyensure_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 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 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 yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len ) { YY_BUFFER_STATE b; char *buf; yy_size_t n; yy_size_t 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. * */ yy_size_t yyget_leng (void) { return yyleng; } /** Get the current token. * */ char *yyget_text (void) { return yytext; } /** Set the current line number. * @param _line_number 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 ) { 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 ) { 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 65 "/home/bob/rcs/git/cgdb/master/cgdb/cgdb/command_lexer.lpp" cgdb-0.8.0/cgdb/Makefile.in0000664000175000017500000005131314171036447012317 00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/config/readline_check_version.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \ $(am__DIST_COMMON) 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) vterminal.$(OBJEXT) sources.$(OBJEXT) \ usage.$(OBJEXT) cgdb_OBJECTS = $(am_cgdb_OBJECTS) cgdb_DEPENDENCIES = $(top_builddir)/lib/tgdb/libtgdb.a \ $(top_builddir)/lib/tokenizer/libtokenizer.a \ $(top_builddir)/lib/kui/libkui.a \ $(top_builddir)/lib/rline/librline.a \ $(top_builddir)/lib/vterm/libcgdbvterm.a \ $(top_builddir)/lib/util/libcgdbutil.a cgdb_LINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(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 CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) AM_V_CXX = $(am__v_CXX_@AM_V@) am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) am__v_CXX_0 = @echo " CXX " $@; am__v_CXX_1 = CXXLD = $(CXX) CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ -o $@ AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) am__v_CXXLD_0 = @echo " CXXLD " $@; am__v_CXXLD_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 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 = $(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 am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/config/depcomp \ $(top_srcdir)/config/ylwrap TODO command_lexer.cpp 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@ CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ -DPKGDATADIR=\"$(pkgdatadir)\" \ -DTOPBUILDDIR=\"$(abs_top_builddir)\" DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ HAS_MAKEINFO = @HAS_MAKEINFO@ 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@ ac_ct_CXX = @ac_ct_CXX@ 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@ runstatedir = @runstatedir@ 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_CXXFLAGS = \ -I$(top_srcdir)/lib/kui \ -I$(top_srcdir)/lib/rline \ -I$(top_srcdir)/lib/util \ -I$(top_srcdir)/lib/tgdb \ -I$(top_srcdir)/lib/tokenizer \ -I$(top_srcdir)/lib/vterm \ -std=c++11 cgdb_LDFLAGS = \ -L$(top_builddir)/lib/kui \ -L$(top_builddir)/lib/rline \ -L$(top_builddir)/lib/tokenizer \ -L$(top_builddir)/lib/util \ -L$(top_builddir)/lib/vterm \ -L$(top_builddir)/lib/tgdb cgdb_LDADD = \ $(top_builddir)/lib/tgdb/libtgdb.a \ $(top_builddir)/lib/tokenizer/libtokenizer.a \ $(top_builddir)/lib/kui/libkui.a \ $(top_builddir)/lib/rline/librline.a \ $(top_builddir)/lib/vterm/libcgdbvterm.a \ $(top_builddir)/lib/util/libcgdbutil.a noinst_HEADERS = \ command_lexer.h cgdb_SOURCES = \ cgdb.cpp \ cgdb.h \ cgdbrc.cpp \ cgdbrc.h \ command_lexer.lpp \ filedlg.cpp \ filedlg.h \ highlight.cpp \ highlight.h \ highlight_groups.cpp \ highlight_groups.h \ interface.cpp \ interface.h \ logo.cpp \ logo.h \ scroller.cpp \ scroller.h \ vterminal.cpp \ vterminal.h \ sources.cpp \ sources.h \ usage.cpp \ usage.h all: all-am .SUFFIXES: .SUFFIXES: .cpp .lpp .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) --foreign cgdb/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign cgdb/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_CXXLD)$(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@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vterminal.Po@am__quote@ .cpp.o: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< .cpp.obj: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .lpp.cpp: $(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.cpp 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 .PRECIOUS: Makefile # 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.8.0/cgdb/usage.h0000644000175000017500000000021712303175461011515 00000000000000#ifndef __USAGE_H__ #define __USAGE_H__ /** * This will generate the usage message for CGDB. */ void usage(void); #endif /* __USAGE_H__ */ cgdb-0.8.0/cgdb/Makefile.am0000664000175000017500000000241214134376364012306 00000000000000DEFS += -DPKGDATADIR=\"$(pkgdatadir)\" -DTOPBUILDDIR=\"$(abs_top_builddir)\" AM_CXXFLAGS = \ -I$(top_srcdir)/lib/kui \ -I$(top_srcdir)/lib/rline \ -I$(top_srcdir)/lib/util \ -I$(top_srcdir)/lib/tgdb \ -I$(top_srcdir)/lib/tokenizer \ -I$(top_srcdir)/lib/vterm \ -std=c++11 bin_PROGRAMS = cgdb cgdb_LDFLAGS = \ -L$(top_builddir)/lib/kui \ -L$(top_builddir)/lib/rline \ -L$(top_builddir)/lib/tokenizer \ -L$(top_builddir)/lib/util \ -L$(top_builddir)/lib/vterm \ -L$(top_builddir)/lib/tgdb cgdb_LDADD = \ $(top_builddir)/lib/tgdb/libtgdb.a \ $(top_builddir)/lib/tokenizer/libtokenizer.a \ $(top_builddir)/lib/kui/libkui.a \ $(top_builddir)/lib/rline/librline.a \ $(top_builddir)/lib/vterm/libcgdbvterm.a \ $(top_builddir)/lib/util/libcgdbutil.a noinst_HEADERS = \ command_lexer.h cgdb_SOURCES = \ cgdb.cpp \ cgdb.h \ cgdbrc.cpp \ cgdbrc.h \ command_lexer.lpp \ filedlg.cpp \ filedlg.h \ highlight.cpp \ highlight.h \ highlight_groups.cpp \ highlight_groups.h \ interface.cpp \ interface.h \ logo.cpp \ logo.h \ scroller.cpp \ scroller.h \ vterminal.cpp \ vterminal.h \ sources.cpp \ sources.h \ usage.cpp \ usage.h cgdb-0.8.0/cgdb/filedlg.h0000664000175000017500000000353414135136636012034 00000000000000#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. */ 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 * last_key_pressed: Last key use hit (for gg support) * * 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, int last_key_pressed); /* 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.8.0/cgdb/command_lexer.h0000664000175000017500000000170613046227664013244 00000000000000#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 * 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, NUMBER, IDENTIFIER, COMMAND, STRING, EOL }; /* yylex: retrieve 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.8.0/cgdb/interface.cpp0000664000175000017500000013204314171031321012700 00000000000000/** * Provides the routines for displaying the interface, and interacting with * the user via keystrokes. * * When the window orientation is set to horizontal, cgdb will displasy as: * --------------- * source window * --------------- * status window * --------------- * gdb window * --------------- * In this mode, the winminheight determines how much a window can * shrink vertically. The window_shfit variable keeps track of how far * the source window has been shifted up or down. * * When the window orientation is set to vertical, cgdb will display as: * * ---------------|------------ * source window | gdb window * | * | * | * | * ---------------| * status window | * ---------------|------------ * In this mode, the winminwidth determines how much a window can * shrink horizontally. The window_shfit variable keeps track of how * far the source window has been shifted left or right. */ #if HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ /* System Includes */ #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 #include #include /* Local Includes */ #include "sys_util.h" #include "sys_win.h" #include "cgdb.h" #include "config.h" #include "tokenizer.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" #include "logo.h" /* ----------- */ /* Prototypes */ /* ----------- */ /* ------------ */ /* Declarations */ /* ------------ */ extern struct tgdb *tgdb; /* ----------- */ /* Definitions */ /* ----------- */ /* The minimum number of rows the user wants a window to shrink. */ static int interface_winminheight = 0; /* The minimum number of columns the user wants a window to shrink. */ static int interface_winminwidth = 0; /* The offset that determines allows gdb/sources window to grow or shrink */ static int window_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; /* Current window orientation state (horizontal or vertical) */ WIN_SPLIT_ORIENTATION_TYPE cur_split_orientation = WSO_HORIZONTAL; /* --------------- */ /* Local Variables */ /* --------------- */ static struct scroller *gdb_scroller = NULL; static struct sviewer *src_viewer = NULL; /* The source viewer window */ static SWINDOW *status_win = NULL; /* The status line */ static SWINDOW *vseparator_win = NULL; /* Separator gets own window */ 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 std::string regex_cur; /* The last regex the user searched for */ static std::string regex_last; /* 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 */ /* Line number user wants to 'G' to */ static std::string G_line_number; /* The cgdb status bar command */ static std::string cur_sbc; 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 = SBC_NORMAL; /* --------------- */ /* Local Functions */ /* --------------- */ /* -------------------------------------- * 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_status_height(void) { return 1; } static int get_src_height(void) { int result; switch (cur_split_orientation) { case WSO_HORIZONTAL: result = ((screen_size.ws_row + 0.5) / 2) + window_shift; break; case WSO_VERTICAL: result = screen_size.ws_row - get_src_status_height(); break; } return result; } static int get_src_width(void) { int result; switch (cur_split_orientation) { case WSO_HORIZONTAL: result = screen_size.ws_col; break; case WSO_VERTICAL: result = ((screen_size.ws_col + 0.5) / 2) + window_shift; break; } return result; } /* This is for the source window status bar */ static int get_src_status_row(void) { return get_src_row() + get_src_height(); } static int get_src_status_col(void) { return get_src_col(); } static int get_src_status_width(void) { return get_src_width(); } /* These are for the separator line in horizontal split mode */ static int get_sep_row(void) { return 0; } static int get_sep_col(void) { return get_src_col() + get_src_width(); } static int get_sep_height(void) { return screen_size.ws_row; } static int get_sep_width(void) { return 1; } /* This is for the debugger window */ static int get_gdb_row(void) { int result; switch (cur_split_orientation) { case WSO_HORIZONTAL: result = get_src_status_row() + get_src_status_height(); break; case WSO_VERTICAL: result = 0; break; } return result; } static int get_gdb_col(void) { int result; switch (cur_split_orientation) { case WSO_HORIZONTAL: result = 0; break; case WSO_VERTICAL: result = get_sep_col() + get_sep_width(); break; } return result; } int get_gdb_height(void) { int result; switch (cur_split_orientation) { case WSO_HORIZONTAL: { int window_size = ((screen_size.ws_row / 2) - window_shift - 1); int odd_screen_size = (screen_size.ws_row % 2); result = window_size + odd_screen_size; break; } case WSO_VERTICAL: result = screen_size.ws_row; break; } return result; } int get_gdb_width(void) { int result; switch (cur_split_orientation) { case WSO_HORIZONTAL: result = screen_size.ws_col; break; case WSO_VERTICAL: { int window_size = ((screen_size.ws_col / 2) - window_shift - 1); int odd_screen_size = (screen_size.ws_col % 2); result = window_size + odd_screen_size; break; } } return result; } /* * create_swindow: (re)create window with specified position and size. */ static void create_swindow(SWINDOW **win, int nlines, int ncols, int begin_y, int begin_x) { if (*win) { int x = swin_getbegx(*win); int y = swin_getbegy(*win); int w = swin_getmaxx(*win); int h = swin_getmaxy(*win); /* If the window position + size hasn't changed, bail */ if (x == begin_x && y == begin_y && w == ncols && h == nlines) return; /* Delete the existing window */ swin_delwin(*win); *win = NULL; } if ((nlines > 0) && (ncols > 0)) { /* Create the ncurses window */ *win = swin_newwin(nlines, ncols, begin_y, begin_x); swin_werase(*win); } } static void separator_display(int draw) { int x = get_sep_col(); int y = get_sep_row(); int h = y + get_sep_height(); int w = draw ? 1 : 0; /* Make sure our window is created at correct location * (or destroyed if draw == 0) */ create_swindow(&vseparator_win, h, w, y, x); if (vseparator_win) { /* Draw vertical line in window */ swin_wmove(vseparator_win, 0, 0); swin_wvline(vseparator_win, SWIN_SYM_VLINE, h); swin_wnoutrefresh(vseparator_win); } } /* --------------------------------------- * Below is the core body of the interface * --------------------------------------- */ /* Updates the status bar */ static void update_status_win(enum win_refresh dorefresh) { int pos; int attr; attr = hl_groups_get_attr(hl_groups_instance, HLG_STATUS_BAR); /* Print white background */ swin_wattron(status_win, attr); for (pos = 0; pos < WIDTH; pos++) swin_mvwprintw(status_win, 0, pos, " "); /* Show the user which window is focused */ if (focus == GDB) swin_mvwprintw(status_win, 0, WIDTH - 1, "*"); else if (focus == CGDB || focus == CGDB_STATUS_BAR) swin_mvwprintw(status_win, 0, WIDTH - 1, " "); swin_wattroff(status_win, attr); /* Print the regex that the user is looking for Forward */ if (sbc_kind == SBC_REGEX && regex_direction_cur) { if_display_message(dorefresh, "/", regex_cur.c_str()); swin_curs_set(1); } /* Regex backwards */ else if (sbc_kind == SBC_REGEX) { if_display_message(dorefresh, "?", regex_cur.c_str()); swin_curs_set(1); } /* A colon command typed at the status bar */ else if (focus == CGDB_STATUS_BAR && sbc_kind == SBC_NORMAL) { if_display_message(dorefresh, ":", cur_sbc.c_str()); swin_curs_set(1); } /* Default: Current Filename */ else { /* Print filename */ const char *filename = source_current_file(src_viewer); if (filename) { if_display_message(dorefresh, "", filename); } } if (dorefresh == WIN_REFRESH) swin_wrefresh(status_win); else swin_wnoutrefresh(status_win); } void if_display_message(enum win_refresh dorefresh, const char *header, const char *msg) { char buf_display[MAXLINE]; int pos, header_length, msg_length; int attr; int width; attr = hl_groups_get_attr(hl_groups_instance, HLG_STATUS_BAR); swin_curs_set(0); width = get_src_status_width(); header_length = strlen(header); msg_length = strlen(msg); if (header_length > width) strcat(strncpy(buf_display, header, width - 1), ">"); else if (header_length + msg_length > width) snprintf(buf_display, sizeof(buf_display), "%s>%s", header, msg + (msg_length - (width - header_length) + 1)); else snprintf(buf_display, sizeof(buf_display), "%s%s", header, msg); /* Print white background */ swin_wattron(status_win, attr); for (pos = 0; pos < WIDTH; pos++) swin_mvwprintw(status_win, 0, pos, " "); swin_mvwprintw(status_win, 0, 0, "%s", buf_display); swin_wattroff(status_win, attr); if (dorefresh == WIN_REFRESH) swin_wrefresh(status_win); else swin_wnoutrefresh(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(WIN_NO_REFRESH); if (get_src_height() != 0 && get_gdb_height() != 0) swin_wnoutrefresh(status_win); if (get_src_height() > 0) source_display(src_viewer, focus == CGDB, WIN_NO_REFRESH); separator_display(cur_split_orientation == WSO_VERTICAL); if (get_gdb_height() > 0) scr_refresh(gdb_scroller, focus == GDB, WIN_NO_REFRESH); /* 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) swin_wnoutrefresh(src_viewer->win); swin_doupdate(); } /* 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 WINMINHEIGHT or WINMINWIDTH 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 h_or_w = cur_split_orientation == WSO_HORIZONTAL ? HEIGHT : WIDTH; int odd_size = (h_or_w + 1) % 2; int max_window_size_shift = (h_or_w / 2) - odd_size; int min_window_size_shift = -(h_or_w / 2); /* update max and min based off of users winminheight request */ switch (cur_split_orientation) { case WSO_HORIZONTAL: min_window_size_shift += interface_winminheight; max_window_size_shift -= interface_winminheight; break; case WSO_VERTICAL: min_window_size_shift += interface_winminwidth; max_window_size_shift -= interface_winminwidth; break; } /* Make sure that the windows offset is within its bounds: * This checks the window offset. * */ if (window_shift > max_window_size_shift) window_shift = max_window_size_shift; else if (window_shift < min_window_size_shift) window_shift = min_window_size_shift; } int if_layout() { SWINDOW *gdb_scroller_win = NULL; SWINDOW *src_viewer_win = NULL; /* Verify the window size is reasonable */ validate_window_sizes(); /* Resize the source viewer window */ create_swindow(&src_viewer_win, get_src_height(), get_src_width(), get_src_row(), get_src_col()); if (src_viewer) { source_move(src_viewer, src_viewer_win); } else { src_viewer = source_new(src_viewer_win); } tgdb_resize_console(tgdb, get_gdb_height(), get_gdb_width()); /* Resize the GDB I/O window */ create_swindow(&gdb_scroller_win, get_gdb_height(), get_gdb_width(), get_gdb_row(), get_gdb_col()); if (gdb_scroller) { scr_move(gdb_scroller, gdb_scroller_win); } else { gdb_scroller = scr_new(gdb_scroller_win); } /* Initialize the status bar window */ create_swindow(&status_win, get_src_status_height(), get_src_status_width(), get_src_status_row(), get_src_status_col()); /* Redraw the interface */ if_draw(); return 0; } /* if_resize_term: Checks if a resize event occurred, and updates display if so. * ---------- * * Return Value: Zero on success, non-zero on failure. */ int if_resize_term(void) { if (ioctl(fileno(stdout), TIOCGWINSZ, &screen_size) != -1) { if (screen_size.ws_row != swin_lines() || screen_size.ws_col != swin_cols()) { swin_resizeterm(screen_size.ws_row, screen_size.ws_col); swin_refresh(); } return if_layout(); } return 0; } /* * increase_win_height: Increase size of the source window * ____________________ * * Param jump - if 0, increase source window by 1 * if 1, jump source window to next biggest quarter * */ static void increase_win_height(int jump) { int height = HEIGHT / 2; int old_window_shift = window_shift; if (jump) { /* user input: '+' */ if (cur_win_split == WIN_SPLIT_FREE) { /* cur position is not on mark, find nearest mark */ cur_win_split = (WIN_SPLIT_TYPE) ((2 * window_shift) / height); /* handle rounding on either side of mid-way mark */ if (window_shift > 0) { cur_win_split = (WIN_SPLIT_TYPE)(cur_win_split + 1); } } else { /* increase to next mark */ cur_win_split = (WIN_SPLIT_TYPE)(cur_win_split + 1); } /* check split bounds */ if (cur_win_split > WIN_SPLIT_SRC_FULL) { cur_win_split = WIN_SPLIT_SRC_FULL; } /* set window height to specified quarter mark */ window_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_shift++; /* increase src window size by 1 */ } /* reduce flicker by avoiding unnecessary redraws */ if (window_shift != old_window_shift) { if_layout(); } } /* * decrease_win_height: Decrease size of the source window * ____________________ * * Param jump - if 0, decrease source window by 1 * if 1, jump source window to next smallest quarter * */ static void decrease_win_height(int jump) { int height = HEIGHT / 2; int old_window_shift = window_shift; if (jump) { /* user input: '_' */ if (cur_win_split == WIN_SPLIT_FREE) { /* cur position is not on mark, find nearest mark */ cur_win_split = (WIN_SPLIT_TYPE) ((2 * window_shift) / height); /* handle rounding on either side of mid-way mark */ if (window_shift < 0) { cur_win_split = (WIN_SPLIT_TYPE)(cur_win_split - 1); } } else { /* decrease to next mark */ cur_win_split = (WIN_SPLIT_TYPE)(cur_win_split - 1); } /* check split bounds */ if (cur_win_split < WIN_SPLIT_GDB_FULL) { cur_win_split = WIN_SPLIT_GDB_FULL; } /* set window height to specified quarter mark */ window_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_shift--; /* decrease src window size by 1 */ } /* reduce flicker by avoiding unnecessary redraws */ if (window_shift != old_window_shift) { if_layout(); } } /** * The signal handler for CGDB. * * Pass any signals along from the signal handler to the main loop by * writing the signal value to a pipe, which is later read and interpreted. * * Since it's non trivial to do error handling from the signal handler if an * error occurs the program will terminate. Hopefully this doesn't occur. */ static void signal_handler(int signo) { extern int resize_pipe[2]; extern int signal_pipe[2]; int fdpipe; if (signo == SIGWINCH) { fdpipe = resize_pipe[1]; } else { fdpipe = signal_pipe[1]; } assert(write(fdpipe, &signo, sizeof(signo)) == sizeof(signo)); } static void if_run_command(struct sviewer *sview, const std::string &command) { /* refresh and return if the user entered no data */ if (command.size() == 0) { if_draw(); return; } if (command_parse_string(command.c_str())) { if_display_message(WIN_NO_REFRESH, "Unknown command: ", command.c_str()); } else { update_status_win(WIN_NO_REFRESH); } if_draw(); } /** * 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 gdb_input_regex_input(struct scroller *scr, int key) { /* Flag to indicate we're done with regex mode, need to switch back */ int done = 0; int matched = 0; /* Receive a regex from the user. */ switch (key) { case '\r': case '\n': case CGDB_KEY_CTRL_M: /* Save for future searches via 'n' or 'N' */ regex_direction_last = regex_direction_cur; matched = scr_search_regex(scr, regex_cur.c_str()); if_draw(); done = 1; break; case 8: case 127: /* Backspace or DEL key */ if (regex_cur.size() == 0) { done = 1; matched = 0; } else { regex_cur.erase(regex_cur.size() - 1); matched = scr_search_regex(scr, regex_cur.c_str()); if_draw(); update_status_win(WIN_REFRESH); } 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++) regex_cur.push_back(keycode[i]); } else { regex_cur.push_back(key); } matched = scr_search_regex(scr, regex_cur.c_str()); if_draw(); update_status_win(WIN_REFRESH); }; if (done) { scr_disable_search(scr, matched == 1); regex_cur.clear(); sbc_kind = SBC_NORMAL; if_set_focus(GDB); } 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, int *last_key) { int result = 0; if (scr_search_mode(gdb_scroller)) return gdb_input_regex_input(gdb_scroller, key); if (scr_scroll_mode(gdb_scroller)) { /* In scroll mode, all extra characters are not passed to * the active GDB command. result = 0 above ensures that. */ switch (key) { case CGDB_KEY_CTRL_U: scr_up(gdb_scroller, get_gdb_height() / 2); break; case CGDB_KEY_PPAGE: scr_up(gdb_scroller, get_gdb_height() - 1); break; case CGDB_KEY_CTRL_D: scr_down(gdb_scroller, get_gdb_height() / 2); break; case CGDB_KEY_NPAGE: scr_down(gdb_scroller, get_gdb_height() - 1); break; case CGDB_KEY_HOME: case CGDB_KEY_F11: scr_home(gdb_scroller); break; case 'G': case CGDB_KEY_END: case CGDB_KEY_F12: scr_end(gdb_scroller); break; case 'k': case CGDB_KEY_UP: case CGDB_KEY_CTRL_P: scr_up(gdb_scroller, 1); break; case 'j': case CGDB_KEY_DOWN: case CGDB_KEY_CTRL_N: scr_down(gdb_scroller, 1); break; case CGDB_KEY_LEFT: case 'h': scr_left(gdb_scroller); break; case CGDB_KEY_RIGHT: case 'l': scr_right(gdb_scroller); break; case '0': scr_beginning_of_row(gdb_scroller); break; case '$': scr_end_of_row(gdb_scroller); break; case 'g': if (last_key_pressed == 'g') { scr_home(gdb_scroller); } break; case 'q': case 'i': case '\r': case '\n': case CGDB_KEY_CTRL_M: scr_end(gdb_scroller); scr_set_scroll_mode(gdb_scroller, false); break; case 'n': scr_search_next(gdb_scroller, regex_direction_last, cgdbrc_get_int(CGDBRC_IGNORECASE)); break; case 'N': scr_search_next(gdb_scroller, !regex_direction_last, cgdbrc_get_int(CGDBRC_IGNORECASE)); break; case '/': case '?': /* Capturing regular expressions */ regex_cur = ""; regex_direction_cur = ('/' == key); sbc_kind = SBC_REGEX; scr_enable_search(gdb_scroller, regex_direction_cur, cgdbrc_get_int(CGDBRC_IGNORECASE)); break; } } else { switch (key) { case CGDB_KEY_PPAGE: scr_set_scroll_mode(gdb_scroller, true); scr_up(gdb_scroller, get_gdb_height() - 1); break; case CGDB_KEY_CTRL_L: // When readline clears the screen with ctrl-l, it clears by // going home and sending EL. // However, it would be nice to save the gdb output in the // scrollback buffer before the line is cleared. // TODO: Implement scr_push_screen_to_scrollback(gdb_scroller); /* The return 1 tells readline that gdb did not handle the * Ctrl-l. That way readline will handle it. Because * readline uses TERM=dumb, that means that it will clear * a single line and put out the prompt. */ result = 1; break; default: /* This tells the input to go to active GDB command */ result = 1; break; } } if_draw(); return result; } /** * 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_int(CGDBRC_IGNORECASE); /* Flag to indicate we're done with regex mode, need to switch back */ int done = 0; /* Receive a regex from the user. */ switch (key) { case '\r': case '\n': case CGDB_KEY_CTRL_M: /* Save for future searches via 'n' or 'N' */ regex_last = regex_cur; regex_direction_last = regex_direction_cur; source_search_regex(sview, regex_last.c_str(), 2, regex_direction_last, regex_icase); if_draw(); done = 1; break; case 8: case 127: /* Backspace or DEL key */ if (regex_cur.size() == 0) { done = 1; source_search_regex(sview, "", 2, regex_direction_cur, regex_icase); } else { regex_cur.erase(regex_cur.size() - 1); source_search_regex(sview, regex_cur.c_str(), 1, regex_direction_cur, regex_icase); if_draw(); update_status_win(WIN_REFRESH); } 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++) regex_cur.push_back(keycode[i]); } else { regex_cur.push_back(key); } source_search_regex(sview, regex_cur.c_str(), 1, regex_direction_cur, regex_icase); if_draw(); update_status_win(WIN_REFRESH); }; if (done) { regex_cur.clear(); sbc_kind = SBC_NORMAL; 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 receive a command from the user. */ switch (key) { case '\r': case '\n': case CGDB_KEY_CTRL_M: /* Found a command */ if_run_command(src_viewer, cur_sbc); done = 1; break; case 8: case 127: /* Backspace or DEL key */ if (cur_sbc.size() == 0) { done = 1; } else { cur_sbc.erase(cur_sbc.size() - 1); update_status_win(WIN_REFRESH); } 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++) cur_sbc.push_back(keycode[i]); } else { cur_sbc.push_back(key); } update_status_win(WIN_REFRESH); break; }; if (done) { cur_sbc.clear(); 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) { int line; uint64_t addr = 0; char *path = NULL; if (!sview || !sview->cur || !sview->cur->path) return -1; line = sview->cur->sel_line; if (sview->cur->path[0] == '*') { addr = sview->cur->file_buf.addrs[line]; if (!addr) return -1; } else { /* Get filename (strip path off -- GDB is dumb) */ path = strrchr(sview->cur->path, '/') + 1; if (path == (char *)NULL + 1) path = sview->cur->path; } /* delete an existing breakpoint */ if (sview->cur->lflags[line].breakpt) t = TGDB_BREAKPOINT_DELETE; tgdb_request_modify_breakpoint(tgdb, path, line + 1, addr, t); 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 */ int lineno = 1; cgdb_string_to_int(G_line_number.c_str(), &lineno); source_vscroll(sview, -lineno); break; } case CGDB_KEY_DOWN: case 'j': { /* VI-style down-arrow */ int lineno = 1; cgdb_string_to_int(G_line_number.c_str(), &lineno); source_vscroll(sview, lineno); 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': /* beginning of file */ if (last_key_pressed == 'g') source_set_sel_line(sview, 1); break; case 'G': { /* end of file or a line number */ int lineno = -1; cgdb_string_to_int(G_line_number.c_str(), &lineno); source_set_sel_line(sview, lineno); break; } case '=': /* inc window by 1 */ increase_win_height(0); break; case '-': /* dec window by 1 */ decrease_win_height(0); break; case '+': increase_win_height(1); break; case '_': decrease_win_height(1); break; case 'o': /* Causes file dialog to be opened */ { extern int kui_input_acceptable; kui_input_acceptable = 0; tgdb_request_inferiors_source_files(tgdb); } 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; } /* Store digits into G_line_number for 'G' command. */ if (key >= '0' && key <= '9') { G_line_number.push_back(key); } else { G_line_number.clear(); } /* 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) { clog_error(CLOG_CGDB, "sigaction failed "); return -1; } if (sigaction(SIGINT, &action, NULL) < 0) { clog_error(CLOG_CGDB, "sigaction failed "); return -1; } if (sigaction(SIGTERM, &action, NULL) < 0) { clog_error(CLOG_CGDB, "sigaction failed "); return -1; } if (sigaction(SIGQUIT, &action, NULL) < 0) { clog_error(CLOG_CGDB, "sigaction failed "); return -1; } if (sigaction(SIGCHLD, &action, NULL) < 0) { clog_error(CLOG_CGDB, "sigaction failed "); return -1; } return 0; } /* ----------------- */ /* Exposed Functions */ /* ----------------- */ /* See interface.h for function descriptions. */ int if_init(void) { /* Set up the signal handler to catch SIGWINCH */ if (set_up_signal() == -1) { clog_error(CLOG_CGDB, "Unable to handle signal: SIGWINCH"); return -1; } if (ioctl(fileno(stdout), TIOCGWINSZ, &screen_size) == -1) { screen_size.ws_row = swin_lines(); screen_size.ws_col = swin_cols(); } /* Create the file dialog object */ fd = filedlg_new(0, 0, HEIGHT, WIDTH); /* Set up window layout */ window_shift = (int) ((HEIGHT / 2) * (cur_win_split / 2.0)); return 0; } /** * Send input to the CGDB source window. * * @param key * The key to send to the CGDB source window. * * @param last_key * An output parameter. When set, that will tell cgdb to use the set value, * instead of the current key, as the "last_key_pressed" in the next * call to cgdb_input. This is useful to set mainly when the current input * has consumed more than one character, and the "last_key_pressed" should * be not set on the next call to cgdb_input. * * @return * Currently only returns 0. */ static int cgdb_input(int key, int *last_key) { int regex_icase = cgdbrc_get_int(CGDBRC_IGNORECASE); if (src_viewer && src_viewer->cur) { int ret = 0; /* Handle setting (mX) and going ('X) to source buffer marks */ if (last_key_pressed == 'm') ret = source_set_mark(src_viewer, key); else if (last_key_pressed == '\'') ret = source_goto_mark(src_viewer, key); if (ret) { /* When m[a-zA-Z] matches, don't let the marker char * be treated as the last key. That would allow the * chars mgg, to set the marker g, and then move to the top * of the file via gg. * CGDB should see those as mg (set a local mark g), and then * an individual g. */ *last_key = 0; if_draw(); return 0; } } switch (key) { case 's': scr_set_scroll_mode(gdb_scroller, true); if_set_focus(GDB); return 0; case 'i': if_set_focus(GDB); 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, clear the buffer * in which this command can be stored. */ cur_sbc.clear(); return 0; case '/': case '?': if (src_viewer->cur) { regex_cur.clear(); regex_direction_cur = ('/' == key); orig_line_regex = src_viewer->cur->sel_line; sbc_kind = SBC_REGEX; if_set_focus(CGDB_STATUS_BAR); /* Capturing regular expressions */ source_search_regex_init(src_viewer); /* Initialize the function for finding a regex and tell user */ if_draw(); } return 0; case 'n': source_search_regex(src_viewer, regex_last.c_str(), 2, regex_direction_last, regex_icase); if_draw(); break; case 'N': source_search_regex(src_viewer, regex_last.c_str(), 2, !regex_direction_last, regex_icase); if_draw(); break; case CGDB_KEY_CTRL_W: switch (cur_split_orientation) { case WSO_HORIZONTAL: cur_split_orientation = WSO_VERTICAL; break; case WSO_VERTICAL: cur_split_orientation = WSO_HORIZONTAL; break; } if_layout(); break; case CGDB_KEY_F1: if_display_help(); return 0; case CGDB_KEY_F5: /* Issue GDB run command */ tgdb_request_run_debugger_command(tgdb, TGDB_RUN); return 0; case CGDB_KEY_F6: /* Issue GDB continue command */ tgdb_request_run_debugger_command(tgdb, TGDB_CONTINUE); return 0; case CGDB_KEY_F7: /* Issue GDB finish command */ tgdb_request_run_debugger_command(tgdb, TGDB_FINISH); return 0; case CGDB_KEY_F8: /* Issue GDB next command */ tgdb_request_run_debugger_command(tgdb, TGDB_NEXT); return 0; case CGDB_KEY_F10: /* Issue GDB step command */ tgdb_request_run_debugger_command(tgdb, TGDB_STEP); return 0; case CGDB_KEY_CTRL_L: if_layout(); return 0; } source_input(src_viewer, key); return 0; } int internal_if_input(int key, int *last_key) { /* Normally, CGDB_KEY_ESC, but can be configured by the user */ int cgdb_mode_key = cgdbrc_get_int(CGDBRC_CGDB_MODE_KEY); /* The cgdb mode key, puts the debugger into command mode */ if (focus != CGDB && key == cgdb_mode_key) { enum Focus new_focus = CGDB; /* 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) { cur_sbc.clear(); } else if (focus == CGDB_STATUS_BAR && sbc_kind == SBC_REGEX) { regex_cur.clear(); hl_regex_free(&src_viewer->hlregex); src_viewer->cur->sel_rline = orig_line_regex; src_viewer->cur->sel_line = orig_line_regex; sbc_kind = SBC_NORMAL; } else if (focus == GDB && sbc_kind == SBC_REGEX) { scr_disable_search(gdb_scroller, false); regex_cur.clear(); sbc_kind = SBC_NORMAL; new_focus = GDB; } if_set_focus(new_focus); 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: return cgdb_input(key, last_key); case GDB: return gdb_input(key, last_key); case FILE_DLG: { char filedlg_file[MAX_LINE]; int ret = filedlg_recv_char(fd, key, filedlg_file, last_key_pressed); /* 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) { if_show_file(filedlg_file, 0, 0); if_set_focus(CGDB); return 0; } } return 0; case CGDB_STATUS_BAR: return status_bar_input(src_viewer, key); } /* Never gets here */ return 0; } int if_input(int key) { int last_key = key; int result = internal_if_input(key, &last_key); last_key_pressed = last_key; return result; } static void if_print_internal(const char *buf) { if (!gdb_scroller) { clog_error(CLOG_CGDB, "%s", buf); return; } /* Print it to the scroller */ scr_add(gdb_scroller, buf); if (get_gdb_height() > 0) { scr_refresh(gdb_scroller, focus == GDB, WIN_NO_REFRESH); /* Make sure cursor reappears in source window if focus is there */ if (focus == CGDB) swin_wnoutrefresh(src_viewer->win); swin_doupdate(); } } void if_print(const char *buf) { if_print_internal(buf); } void if_sdc_print(const char *buf) { if_print_message("cgdb sdc:%s", buf); } 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 sel_line, int exe_line) { if (source_set_exec_line(src_viewer, path, sel_line, exe_line) == 0) if_draw(); } void if_display_help(void) { char cgdb_help_file[FSUTIL_PATH_MAX]; int ret_val = 0; fs_util_get_path(PKGDATADIR, "cgdb.txt", cgdb_help_file); /* File doesn't exist. Try to find cgdb.txt in the build dir in case * the user is running a built cgdb binary directly. */ if (!fs_verify_file_exists(cgdb_help_file)) fs_util_get_path(TOPBUILDDIR, "doc/cgdb.txt", cgdb_help_file); ret_val = source_set_exec_line(src_viewer, cgdb_help_file, 1, 0); if (ret_val == 0) { src_viewer->cur->language = TOKENIZER_LANGUAGE_CGDBHELP; source_highlight(src_viewer->cur); if_draw(); } else if (ret_val == 5) /* File does not exist */ if_display_message(WIN_REFRESH, "No such file: ", cgdb_help_file); } void if_display_logo(int reset) { if (reset) logo_reset(); src_viewer->cur = NULL; } struct sviewer *if_get_sview() { return src_viewer; } 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) { if (status_win) { swin_delwin(status_win); status_win = NULL; } if (gdb_scroller) { scr_free(gdb_scroller); gdb_scroller = NULL; } if (src_viewer) { source_free(src_viewer); src_viewer = NULL; } if (vseparator_win) { swin_delwin(vseparator_win); vseparator_win = NULL; } } void if_set_focus(Focus f) { switch (f) { case GDB: 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 reset_window_shift(void) { int h_or_w = cur_split_orientation == WSO_HORIZONTAL ? HEIGHT : WIDTH; window_shift = (int) ((h_or_w / 2) * (cur_win_split / 2.0)); if_layout(); } void if_set_winsplitorientation(WIN_SPLIT_ORIENTATION_TYPE new_orientation) { cur_split_orientation = new_orientation; reset_window_shift(); } void if_set_winsplit(WIN_SPLIT_TYPE new_split) { cur_win_split = new_split; reset_window_shift(); } void if_highlight_sviewer(enum tokenizer_language_support l) { /* src_viewer->cur is NULL when reading cgdbrc */ if (src_viewer && src_viewer->cur) { if ( l == TOKENIZER_LANGUAGE_UNKNOWN ) l = tokenizer_get_default_file_type(strrchr(src_viewer->cur->path, '.')); src_viewer->cur->language = l; source_highlight(src_viewer->cur); if_draw(); } } int if_change_winminheight(int value) { if (value < 0) return -1; else if (value > HEIGHT / 2) return -1; interface_winminheight = value; if_layout(); return 0; } int if_change_winminwidth(int value) { if (value < 0) return -1; else if (value > WIDTH / 2) return -1; interface_winminwidth = value; if_layout(); return 0; } int if_clear_line() { std::string line; line.push_back('\r'); line.append(get_gdb_width(), ' '); line.push_back('\r'); if_print(line.c_str()); return 0; } cgdb-0.8.0/cgdb/cgdbrc.cpp0000664000175000017500000010637114171031267012202 00000000000000#if HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #include #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 "sys_util.h" #include "cgdb.h" #include "interface.h" #include "tokenizer.h" #include "highlight_groups.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_executing_line_display(const char *value); static int command_set_selected_line_display(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_winminwidth(int value); static int command_set_winsplit(const char *value); static int command_set_winsplitorientation(const char *value); static int command_set_syntax_type(const char *value); static int cgdbrc_set_val(struct cgdbrc_config_option config_option); struct cgdbrc_attach_item { enum cgdbrc_option_kind option; cgdbrc_notify notify_hook; }; static std::list cgdbrc_attach_list; static int command_do_tgdbcommand(enum tgdb_command_type param); static int command_focus_cgdb(int param); static int command_focus_gdb(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_logo(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", (action_t)command_do_bang, 0}, /* edit */ {"edit", (action_t)command_source_reload, 0}, /* edit */ {"e", (action_t)command_source_reload, 0}, /* focus */ {"focus", (action_t)command_do_focus, 0}, /* help */ {"help", (action_t)command_do_help, 0}, /* logo */ {"logo", (action_t)command_do_logo, 0}, /* highlight */ {"highlight", (action_t)command_parse_highlight, 0}, /* highlight */ {"hi", (action_t)command_parse_highlight, 0}, /* imap */ {"imap", (action_t)command_parse_map, 0}, /* imap */ {"im", (action_t)command_parse_map, 0}, /* iunmap */ {"iunmap", (action_t)command_parse_unmap, 0}, /* iunmap */ {"iu", (action_t)command_parse_unmap, 0}, /* insert */ {"insert", (action_t)command_focus_gdb, 0}, /* map */ {"map", (action_t)command_parse_map, 0}, /* quit */ {"quit", (action_t)command_do_quit, 0}, /* quit */ {"q", (action_t)command_do_quit, 0}, /* shell */ {"shell", (action_t)command_do_shell, 0}, /* shell */ {"sh", (action_t)command_do_shell, 0}, /* syntax */ {"syntax", (action_t)command_parse_syntax, 0}, /* unmap */ {"unmap", (action_t)command_parse_unmap, 0}, /* unmap */ {"unm", (action_t)command_parse_unmap, 0}, /* continue */ {"continue", (action_t)command_do_tgdbcommand, TGDB_CONTINUE}, /* continue */ {"c", (action_t)command_do_tgdbcommand, TGDB_CONTINUE}, /* down */ {"down", (action_t)command_do_tgdbcommand, TGDB_DOWN}, /* finish */ {"finish", (action_t)command_do_tgdbcommand, TGDB_FINISH}, /* finish */ {"f", (action_t)command_do_tgdbcommand, TGDB_FINISH}, /* next */ {"next", (action_t)command_do_tgdbcommand, TGDB_NEXT}, /* next */ {"n", (action_t)command_do_tgdbcommand, TGDB_NEXT}, /* nexti */ {"nexti", (action_t)command_do_tgdbcommand, TGDB_NEXTI}, /* run */ {"run", (action_t)command_do_tgdbcommand, TGDB_RUN}, /* run */ {"r", (action_t)command_do_tgdbcommand, TGDB_RUN}, /* kill */ {"kill", (action_t)command_do_tgdbcommand, TGDB_KILL}, /* kill */ {"k", (action_t)command_do_tgdbcommand, TGDB_KILL}, /* step */ {"step", (action_t)command_do_tgdbcommand, TGDB_STEP}, /* step */ {"s", (action_t)command_do_tgdbcommand, TGDB_STEP}, /* stepi */ {"stepi", (action_t)command_do_tgdbcommand, TGDB_STEPI}, /* start */ {"start", (action_t)command_do_tgdbcommand, TGDB_START}, /* until */ {"until", (action_t)command_do_tgdbcommand, TGDB_UNTIL}, /* until */ {"u", (action_t)command_do_tgdbcommand, TGDB_UNTIL}, /* up */ {"up", (action_t)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)) /** * This data structure stores all the active values of all the config options. */ static struct cgdbrc_config_option cgdbrc_config_options[CGDBRC_WRAPSCAN + 1]; /** * Initialize the config options with default values. */ void cgdbrc_init_config_options(void) { int i = 0; struct cgdbrc_config_option option; option.option_kind = CGDBRC_ARROWSTYLE; option.variant.line_display_style = LINE_DISPLAY_SHORT_ARROW; cgdbrc_config_options[i++] = option; option.option_kind = CGDBRC_AUTOSOURCERELOAD; option.variant.int_val = 1; cgdbrc_config_options[i++] = option; option.option_kind = CGDBRC_CGDB_MODE_KEY; option.variant.int_val = CGDB_KEY_ESC; cgdbrc_config_options[i++] = option; option.option_kind = CGDBRC_COLOR; option.variant.int_val = 1; cgdbrc_config_options[i++] = option; option.option_kind = CGDBRC_DEBUGWINCOLOR; option.variant.int_val = 1; cgdbrc_config_options[i++] = option; option.option_kind = CGDBRC_DISASM; option.variant.int_val = 0; cgdbrc_config_options[i++] = option; option.option_kind = CGDBRC_EXECUTING_LINE_DISPLAY; option.variant.line_display_style = LINE_DISPLAY_LONG_ARROW; cgdbrc_config_options[i++] = option; option.option_kind = CGDBRC_HLSEARCH; option.variant.int_val = 0; cgdbrc_config_options[i++] = option; option.option_kind = CGDBRC_IGNORECASE; option.variant.int_val = 0; cgdbrc_config_options[i++] = option; option.option_kind = CGDBRC_SCROLLBACK_BUFFER_SIZE; option.variant.int_val = 10000; cgdbrc_config_options[i++] = option; option.option_kind = CGDBRC_SELECTED_LINE_DISPLAY; option.variant.line_display_style = LINE_DISPLAY_BLOCK; cgdbrc_config_options[i++] = option; option.option_kind = CGDBRC_SHOWMARKS; option.variant.int_val = 1; cgdbrc_config_options[i++] = option; option.option_kind = CGDBRC_SYNTAX; option.variant.language_support_val = TOKENIZER_LANGUAGE_UNKNOWN; cgdbrc_config_options[i++] = option; option.option_kind = CGDBRC_TABSTOP; option.variant.int_val = 8; cgdbrc_config_options[i++] = option; option.option_kind = CGDBRC_TIMEOUT; option.variant.int_val = 1; cgdbrc_config_options[i++] = option; option.option_kind = CGDBRC_TIMEOUT_LEN; option.variant.int_val = 1000; cgdbrc_config_options[i++] = option; option.option_kind = CGDBRC_TTIMEOUT; option.variant.int_val = 1; cgdbrc_config_options[i++] = option; option.option_kind = CGDBRC_TTIMEOUT_LEN; option.variant.int_val = 100; cgdbrc_config_options[i++] = option; option.option_kind = CGDBRC_WINMINHEIGHT; option.variant.int_val = 0; cgdbrc_config_options[i++] = option; option.option_kind = CGDBRC_WINMINWIDTH; option.variant.int_val = 0; cgdbrc_config_options[i++] = option; option.option_kind = CGDBRC_WINSPLIT; option.variant.win_split_val = WIN_SPLIT_EVEN; cgdbrc_config_options[i++] = option; option.option_kind = CGDBRC_WINSPLITORIENTATION; option.variant.win_split_orientation_val = WSO_HORIZONTAL; cgdbrc_config_options[i++] = option; option.option_kind = CGDBRC_WRAPSCAN; option.variant.int_val = 1; cgdbrc_config_options[i++] = option; } /** * A configuration variable. */ struct ConfigVariable { ConfigVariable(const char *name_p, const char *s_name_p, enum ConfigType type_p, void *data_p) : name(name_p), s_name(s_name_p), type(type_p), data(data_p) {} /** * The name and shortname of the configuration variable. */ const char *name, *s_name; /** The type of configuration variable */ enum ConfigType type; /** * The data member or function to set this config variables value. */ void *data; }; typedef std::list ConfigVariableList; /** The list of configuration variables */ static ConfigVariableList cgdbrc_variables; /** * Initialize the configuration variables. */ void cgdbrc_init_config_variables(void) { /* keep this stuff sorted! !sort */ /* arrowstyle */ cgdbrc_variables.push_back(ConfigVariable( "arrowstyle", "as", CONFIG_TYPE_FUNC_STRING, (void *)command_set_arrowstyle)); /* autosourcereload */ cgdbrc_variables.push_back(ConfigVariable( "autosourcereload", "asr", CONFIG_TYPE_BOOL, (void*)&cgdbrc_config_options[ CGDBRC_AUTOSOURCERELOAD].variant.int_val)); /* cgdbmodekey */ cgdbrc_variables.push_back(ConfigVariable( "cgdbmodekey", "cgdbmodekey", CONFIG_TYPE_FUNC_STRING, (void *)command_set_cgdb_mode_key)); /* color */ cgdbrc_variables.push_back(ConfigVariable( "color", "color", CONFIG_TYPE_BOOL, (void *)&cgdbrc_config_options[CGDBRC_COLOR].variant.int_val)); /* debugwincolor */ cgdbrc_variables.push_back(ConfigVariable( "debugwincolor", "dwc", CONFIG_TYPE_BOOL, (void *)&cgdbrc_config_options[CGDBRC_DEBUGWINCOLOR].variant.int_val)); /* disassemble */ cgdbrc_variables.push_back(ConfigVariable( "disasm", "dis", CONFIG_TYPE_BOOL, (void *)&cgdbrc_config_options[CGDBRC_DISASM].variant.int_val)); /* executinglinedisplay */ cgdbrc_variables.push_back(ConfigVariable( "executinglinedisplay", "eld", CONFIG_TYPE_FUNC_STRING, (void *)command_set_executing_line_display)); /* hlsearch */ cgdbrc_variables.push_back(ConfigVariable( "hlsearch", "hls", CONFIG_TYPE_BOOL, (void *)&cgdbrc_config_options[CGDBRC_HLSEARCH].variant.int_val)); /* ignorecase */ cgdbrc_variables.push_back(ConfigVariable( "ignorecase", "ic", CONFIG_TYPE_BOOL, (void *)&cgdbrc_config_options[CGDBRC_IGNORECASE].variant.int_val)); /* scrollbackbuffersize */ cgdbrc_variables.push_back(ConfigVariable( "scrollbackbuffersize", "sbbs", CONFIG_TYPE_INT, (void *)&cgdbrc_config_options[CGDBRC_SCROLLBACK_BUFFER_SIZE].variant.int_val)); /* selectedlinedisplay */ cgdbrc_variables.push_back(ConfigVariable( "selectedlinedisplay", "sld", CONFIG_TYPE_FUNC_STRING, (void *)command_set_selected_line_display)); /* showmarks */ cgdbrc_variables.push_back(ConfigVariable( "showmarks", "showmarks", CONFIG_TYPE_BOOL, (void *)&cgdbrc_config_options[CGDBRC_SHOWMARKS].variant.int_val)); /* syntax */ cgdbrc_variables.push_back(ConfigVariable( "syntax", "syn", CONFIG_TYPE_FUNC_STRING, (void *)command_set_syntax_type)); /* tabstop */ cgdbrc_variables.push_back(ConfigVariable( "tabstop", "ts", CONFIG_TYPE_INT, (void *)&cgdbrc_config_options[CGDBRC_TABSTOP].variant.int_val)); /* timeout */ cgdbrc_variables.push_back(ConfigVariable( "timeout", "to", CONFIG_TYPE_FUNC_BOOL, (void *)&command_set_timeout)); /* timeoutlen */ cgdbrc_variables.push_back(ConfigVariable( "timeoutlen", "tm", CONFIG_TYPE_FUNC_INT, (void *)&command_set_timeoutlen)); /* ttimeout */ cgdbrc_variables.push_back(ConfigVariable( "ttimeout", "ttimeout", CONFIG_TYPE_FUNC_BOOL, (void *)&command_set_ttimeout)); /* ttimeoutlen */ cgdbrc_variables.push_back(ConfigVariable( "ttimeoutlen", "ttm", CONFIG_TYPE_FUNC_INT, (void *)&command_set_ttimeoutlen)); /* winminheight */ cgdbrc_variables.push_back(ConfigVariable( "winminheight", "wmh", CONFIG_TYPE_FUNC_INT, (void *)&command_set_winminheight)); /* winminwidth */ cgdbrc_variables.push_back(ConfigVariable( "winminwidth", "wmw", CONFIG_TYPE_FUNC_INT, (void *)&command_set_winminwidth)); /* winsplit */ cgdbrc_variables.push_back(ConfigVariable( "winsplit", "winsplit", CONFIG_TYPE_FUNC_STRING, (void *)command_set_winsplit)); /* splitorientation */ cgdbrc_variables.push_back(ConfigVariable( "winsplitorientation", "wso", CONFIG_TYPE_FUNC_STRING, (void *)command_set_winsplitorientation)); /* wrapscan */ cgdbrc_variables.push_back(ConfigVariable( "wrapscan", "ws", CONFIG_TYPE_BOOL, (void *)&cgdbrc_config_options[CGDBRC_WRAPSCAN].variant.int_val)); } void cgdbrc_init(void) { cgdbrc_init_config_options(); cgdbrc_init_config_variables(); qsort((void *) commands, COMMANDS_COUNT, COMMANDS_SIZE, command_sort_find); } COMMANDS *get_command(const char *cmd) { COMMANDS command = { cmd, NULL, 0 }; return (COMMANDS *)bsearch((void *) &command, (void *) commands, COMMANDS_COUNT, COMMANDS_SIZE, command_sort_find); } struct ConfigVariable *get_variable(const char *variable) { /* FIXME: replace with binary search */ ConfigVariableList::iterator iter = cgdbrc_variables.begin(); for (; iter != cgdbrc_variables.end(); ++iter) { if (strcmp(variable, iter->name) == 0 || strcmp(variable, iter->s_name) == 0) { return &*iter; } } return NULL; } int command_set_arrowstyle(const char *value) { struct cgdbrc_config_option option; option.option_kind = CGDBRC_EXECUTING_LINE_DISPLAY; if (strcasecmp(value, "short") == 0) option.variant.line_display_style = LINE_DISPLAY_SHORT_ARROW; else if (strcasecmp(value, "long") == 0) option.variant.line_display_style = LINE_DISPLAY_LONG_ARROW; else if (strcasecmp(value, "highlight") == 0) option.variant.line_display_style = LINE_DISPLAY_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); } int command_set_executing_line_display(const char *value) { struct cgdbrc_config_option option; option.option_kind = CGDBRC_EXECUTING_LINE_DISPLAY; if (strcasecmp(value, "shortarrow") == 0) option.variant.line_display_style = LINE_DISPLAY_SHORT_ARROW; else if (strcasecmp(value, "longarrow") == 0) option.variant.line_display_style = LINE_DISPLAY_LONG_ARROW; else if (strcasecmp(value, "highlight") == 0) option.variant.line_display_style = LINE_DISPLAY_HIGHLIGHT; else if (strcasecmp(value, "block") == 0) option.variant.line_display_style = LINE_DISPLAY_BLOCK; else return 1; return cgdbrc_set_val(option); } 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; /* deprecated: use src_big */ if (strcasecmp(value, "top_big") == 0) split_type = WIN_SPLIT_SRC_BIG; /* deprecated: use src_full */ else if (strcasecmp(value, "top_full") == 0) split_type = WIN_SPLIT_SRC_FULL; /* deprecated: use gdb_big */ else if (strcasecmp(value, "bottom_big") == 0) split_type = WIN_SPLIT_GDB_BIG; /* deprecated: use gdb_full */ else if (strcasecmp(value, "bottom_full") == 0) split_type = WIN_SPLIT_GDB_FULL; else if (strcasecmp(value, "src_big") == 0) split_type = WIN_SPLIT_SRC_BIG; else if (strcasecmp(value, "src_full") == 0) split_type = WIN_SPLIT_SRC_FULL; else if (strcasecmp(value, "gdb_big") == 0) split_type = WIN_SPLIT_GDB_BIG; else if (strcasecmp(value, "gdb_full") == 0) split_type = WIN_SPLIT_GDB_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; } int command_set_winsplitorientation(const char *value) { struct cgdbrc_config_option option; WIN_SPLIT_ORIENTATION_TYPE orientation = WSO_HORIZONTAL; option.option_kind = CGDBRC_WINSPLITORIENTATION; if (strcasecmp(value, "horizontal") == 0) orientation = WSO_HORIZONTAL; else if (strcasecmp(value, "vertical") == 0) orientation = WSO_VERTICAL; option.variant.win_split_orientation_val = orientation; if (cgdbrc_set_val(option)) return 1; if_set_winsplitorientation(orientation); 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_winminwidth(int value) { struct cgdbrc_config_option option; option.option_kind = CGDBRC_WINMINWIDTH; if (if_change_winminwidth(value) == -1) return 1; option.variant.int_val = value; return cgdbrc_set_val(option); } int command_set_selected_line_display(const char *value) { struct cgdbrc_config_option option; option.option_kind = CGDBRC_SELECTED_LINE_DISPLAY; if (strcasecmp(value, "shortarrow") == 0) option.variant.line_display_style = LINE_DISPLAY_SHORT_ARROW; else if (strcasecmp(value, "longarrow") == 0) option.variant.line_display_style = LINE_DISPLAY_LONG_ARROW; else if (strcasecmp(value, "highlight") == 0) option.variant.line_display_style = LINE_DISPLAY_HIGHLIGHT; else if (strcasecmp(value, "block") == 0) option.variant.line_display_style = LINE_DISPLAY_BLOCK; else return 1; 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) { /* In sources.c */ extern int sources_syntax_on; struct cgdbrc_config_option option; enum tokenizer_language_support lang = TOKENIZER_LANGUAGE_UNKNOWN; option.option_kind = CGDBRC_SYNTAX; if (strcasecmp(value, "c") == 0) lang = TOKENIZER_LANGUAGE_C; else if (strcasecmp(value, "asm") == 0) lang = TOKENIZER_LANGUAGE_ASM; else if (strcasecmp(value, "d") == 0) lang = TOKENIZER_LANGUAGE_D; else if (strcasecmp(value, "go") == 0) lang = TOKENIZER_LANGUAGE_GO; else if (strcasecmp(value, "ada") == 0) lang = TOKENIZER_LANGUAGE_ADA; else if (strcasecmp(value, "rust") == 0) lang = TOKENIZER_LANGUAGE_RUST; /* If caller specified a language or 'on', enable highlighting */ if (lang != TOKENIZER_LANGUAGE_UNKNOWN || 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; 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_do_bang(int param) { return 0; } int command_do_tgdbcommand(enum tgdb_command_type param) { tgdb_request_run_debugger_command(tgdb, param); 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 return 1; return 0; } int command_do_help(int param) { if_display_help(); return 0; } int command_do_logo(int param) { if_display_logo(1); return 0; } int command_do_quit(int param) { /* FIXME: Test to see if debugged program is still running */ cgdb_cleanup_and_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 IDENTIFIER:{ const char *value = get_token(); command_set_syntax_type(value); 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; } free(key_token); 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; } static void variable_changed_cb(struct ConfigVariable *variable) { /* User switched source/disasm mode. Request a frame update so the appropriate data is displayed in the source window. */ if (!strcmp(variable->name, "disasm")) tgdb_request_current_location(tgdb); } int command_parse_set(void) { /* commands could look like the following: * set ignorecase * set noignorecase * set focus=gdb * set tabstop=8 */ int rv = 1; switch ((rv = yylex())) { case EOL:{ /* TODO: Print out all the variables that have been set. */ } break; case IDENTIFIER:{ int boolean = 1; const char *value = NULL; 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; } /* Tell callback function this variable has changed. */ variable_changed_cb(variable); } } break; default: break; } return rv; } typedef struct yy_buffer_state *YY_BUFFER_STATE; int command_parse_string(const char *buffer) { 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(const char *config_file) { FILE *fp; fp = fopen(config_file, "r"); if (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; } fclose(fp); } 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; cgdbrc_config_options[config_option.option_kind] = config_option; /* Alert anyone that wants to be notified that an option has changed. */ iter = cgdbrc_attach_list.begin(); for (; iter != cgdbrc_attach_list.end(); ++iter) { if (iter->option == config_option.option_kind) { if (iter->notify_hook(&config_option)) return 1; } } return 0; } /* Attach/Detach options {{{ */ int cgdbrc_attach(enum cgdbrc_option_kind option, cgdbrc_notify notify) { struct cgdbrc_attach_item item; item.option = option; item.notify_hook = notify; cgdbrc_attach_list.push_back(item); return 0; } /* }}} */ /* Get options {{{ */ cgdbrc_config_option_ptr cgdbrc_get(enum cgdbrc_option_kind option) { return &cgdbrc_config_options[option]; } int cgdbrc_get_int(enum cgdbrc_option_kind option) { return cgdbrc_get(option)->variant.int_val; } enum LineDisplayStyle cgdbrc_get_displaystyle(enum cgdbrc_option_kind option) { return cgdbrc_get(option)->variant.line_display_style; } int cgdbrc_get_key_code_timeoutlen(void) { int timeout_val = cgdbrc_get_int(CGDBRC_TIMEOUT); int ttimeout_val = cgdbrc_get_int(CGDBRC_TTIMEOUT); /* Do not time out. */ if (timeout_val == 0 && ttimeout_val == 0) return 0; if (cgdbrc_get_int(CGDBRC_TTIMEOUT_LEN) < 0) return cgdbrc_get_int(CGDBRC_TIMEOUT_LEN); else return cgdbrc_get_int(CGDBRC_TTIMEOUT_LEN); } int cgdbrc_get_mapped_key_timeoutlen(void) { /* Do not time out. */ if (cgdbrc_get_int(CGDBRC_TIMEOUT) == 0) return 0; return cgdbrc_get_int(CGDBRC_TIMEOUT_LEN); } /* }}} */ cgdb-0.8.0/cgdb/TODO0000664000175000017500000000652712770244270010747 00000000000000------------------------------------------- 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 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.8.0/cgdb/cgdb.cpp0000664000175000017500000010314314171033763011652 00000000000000#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_SIGNAL_H #include #endif #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STDIO_H #include #endif /* HAVE_STDIO_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 #include #define __STDC_FORMAT_MACROS #include /* Local Includes */ #include "sys_util.h" #include "stretchy.h" #include "sys_win.h" #include "cgdb.h" #include "tokenizer.h" #include "highlight_groups.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 "fork_util.h" #include "terminal.h" #include "rline.h" #include "usage.h" /* --------- */ /* Constants */ /* --------- */ #define GDB_MAXBUF 4096 /* GDB input buffer size */ /* --------------- */ /* Local Variables */ /* --------------- */ struct tgdb *tgdb; /* The main TGDB context */ char cgdb_home_dir[FSUTIL_PATH_MAX]; /* Path to home dir with trailing slash */ char cgdb_log_dir[FSUTIL_PATH_MAX]; /* Path to log dir with trailing slash */ static int gdb_console_fd = -1; /* GDB console descriptor */ static int gdb_mi_fd = -1; /* GDB Machine Interface descriptor */ static bool new_ui_unsupported = false; static char *debugger_path = NULL; /* Path to debugger to use */ /* Set to 1 if the user requested cgdb to wait for the debugger to attach. */ static int wait_for_debugger_to_attach = 0; 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 receive keys from the * user before the input is allowed to hit the file dialog. */ int kui_input_acceptable = 1; /** * This pipe is used for passing SIGWINCH from the handler to the main loop. * * A separate pipe is used for SIGWINCH because when the user resizes the * terminal many signals may be sent to the application. Each time a signal * is received it is written to this pipe to be processed in the main loop. * The main loop is more efficient if it only has to process the last * resize, since all the intermediate signals will be of no use. By creating * a separate pipe, the main loop can easily detect if more SIGWINCH signals * have been received and ignore them. * * I'm not sure if this optimization is still necessary as it was needed * around the year 2005. It may or may not still matter, but the logic * overhead isn't that complex anyways. */ int resize_pipe[2] = { -1, -1 }; /** * This pipe is used for passing signals from the handler to the main loop. * * When a signal is sent to CGDB (ie. SIGINT or SIGQUIT), the signal is * passed to the signal handler. Only certain functions can be called from * a signal handler so some functionality must be handled in the main loop. * * This pipe is the mechanism that is used to pass to the main loop the fact * that a signal was received in a signal handler. This way, when the main * loop detects the signal pipe has information it can read the signal and * process it safely (by calling any necessary functions). */ int signal_pipe[2] = { -1, -1 }; /* Readline interface */ static struct rline *rline; /* Original terminal attributes */ static struct termios term_attributes; /** * 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 */ swin_scrl(1); swin_move(swin_lines() - 1, 0); printf("\n"); /* Put the terminal in cooked mode and turn on echo */ swin_endwin(); tty_set_attributes(STDIN_FILENO, &term_attributes); /* NULL or empty string means invoke user's shell */ if (!command || !command[0]) { /* Check for SHELL environment variable */ char *shell = getenv("SHELL"); rv = system(shell ? shell : "/bin/sh"); } 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; } static void parse_cgdbrc_file() { char config_file[FSUTIL_PATH_MAX]; fs_util_get_path(cgdb_home_dir, "cgdbrc", config_file); command_parse_file(config_file); } /* ------------------------ */ /* 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]; snprintf(buf, sizeof(buf), "%s %s\r\n%s", "CGDB", VERSION, "Copyright 2002-2022 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 = "wd: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 'w': wait_for_debugger_to_attach = 1; n++; break; 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)++; } } /** * Attempts to create a config directory in the user's home directory. * * After being called successfully, both cgdb_home_dir and cgdb_log_dir * are set. * * @return * 0 on success or -1 on error */ static int init_home_dir(void) { /* Check for a nonstandard cgdb dir location */ char *cgdb_home_envvar = getenv("CGDB_DIR"); /* Set the cgdb home directory */ if (cgdb_home_envvar != NULL) { snprintf(cgdb_home_dir, FSUTIL_PATH_MAX, "%s", cgdb_home_envvar); } else { snprintf(cgdb_home_dir, FSUTIL_PATH_MAX, "%s/.cgdb", getenv("HOME")); } /* Make sure the toplevel cgdb dir exists */ if (!fs_util_create_dir(cgdb_home_dir)) { printf("Exiting, could not create home directory:\n %s\n", cgdb_home_dir); return -1; } /* Try to create log directory */ snprintf(cgdb_log_dir, FSUTIL_PATH_MAX, "%s/logs", cgdb_home_dir); if (!fs_util_create_dir(cgdb_log_dir)) { printf("Exiting, could not create log directory:\n %s\n", cgdb_log_dir); return -1; } return 0; } /** * Console output has returned from GDB, show it. * * @param context * Unused at the moment * * @param str * The console output to display */ static void console_output(void *context, const std::string &str) { if_print(str.c_str()); } static void command_response(void *context, struct tgdb_response *response); tgdb_callbacks callbacks = { NULL, console_output, command_response }; /* start_gdb: Starts up libtgdb * Returns: -1 on error, 0 on success */ static int start_gdb(int argc, char *argv[]) { // Note, the 40 height by 80 width size here will be overriden // once cgdb determines the actual size. This is done in main() in // the call to if_layout just after if_init. return tgdb_start_gdb(tgdb, debugger_path, argc, argv, get_gdb_height(), get_gdb_width(), &gdb_console_fd, &gdb_mi_fd); } static void send_key(int focus, char key) { if (focus == 1) { tgdb_send_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; val = kui_manager_clear_map_set(kui_ctx); if (val == -1) { clog_error(CLOG_CGDB, "Could not clear the map set"); return -1; } if (if_get_focus() == CGDB) val = kui_manager_set_map_set(kui_ctx, kui_map); else if (if_get_focus() == GDB) val = kui_manager_set_map_set(kui_ctx, kui_imap); key = kui_manager_getkey(kui_ctx); if (key == -1) { clog_error(CLOG_CGDB, "kui_manager_getkey error"); return -1; } val = if_input(key); if (val == -1) { clog_error(CLOG_CGDB, "if_input error"); return -1; } else if (val != 1 && val != 2) return 0; /* Process the key */ if (kui_term_is_cgdb_key(key)) { const char *seqbuf = kui_term_get_ascii_char_sequence_from_key(key); if (seqbuf == NULL) { clog_error(CLOG_CGDB, "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) { clog_error(CLOG_CGDB, "user_input_loop failed"); return -1; } } while (kui_manager_cangetkey(kui_ctx)); return 0; } /* This updates all the breakpoints */ static void update_breakpoints(struct tgdb_response *response) { source_set_breakpoints(if_get_sview(), response->choice.update_breakpoints.breakpoints); if_show_file(NULL, 0, 0); } /* This means a source file or line number changed */ static void update_file_position(struct tgdb_response *response) { /** * Updating the location that cgdb should point the user to. * * A variety of different locations can come back from gdb. * We currently have the following fields of interest: * path, line number and address. * * The path may be NULL, relative or absolute. When it is * relative or absolute, it might point to a file that does * not exist on disk. * * The address or line number are not always available. * * So currently, our best bet is to * - show the file/line * - if file/line unavailable, show the function disassembly * - if function disassembly unavailable, show disassembly * - if disassembly unavailable, show nothing */ struct tgdb_file_position *tfp; struct sviewer *sview = if_get_sview(); int source_reload_status = -1; tfp = response->choice.update_file_position.file_position; /* Tell source viewer what the current $pc address is. */ sview->addr_frame = tfp->addr; /* If we got a pathname and we're not showing disasm... */ if (tfp->path && !cgdbrc_get_int(CGDBRC_DISASM)) { /** * GDB will provide an executing line number even when the program * has not been started yet. Checking the frame address as well * helps cgdb to not show an executing line unless there is a stack, * which tells us the inferior is running. */ int exe_line = sview->addr_frame ? tfp->line_number : -1; /* Update the file */ source_reload_status = source_reload(if_get_sview(), tfp->path, 0); /* Show the source file at this line number */ if_show_file(tfp->path, tfp->line_number, exe_line); } /** * Sometimes gdb provides a path that can not be found * on disk. For instance, for glibc where the source isn't * available. In this scenario, show the assembly instead. */ if (source_reload_status == -1 && sview->addr_frame) { int ret; /* Try to show the disasm for the current $pc address */ ret = source_set_exec_addr(sview, sview->addr_frame); if (!ret) { if_draw(); } else if (sview->addr_frame) { /* No disasm found - request it */ tgdb_request_disassemble_func(tgdb, DISASSEMBLE_FUNC_SOURCE_LINES); // If the disassembly view was not available and is attempting // to be loaded, then reload the breakpoints afterwards, so they // can be associated with the disassembly view as well tgdb_request_breakpoints(tgdb); } } } /* This is a list of all the source files */ static void update_source_files(struct tgdb_response *response) { char **source_files = response->choice.update_source_files.source_files; sviewer *sview = if_get_sview(); struct list_node *cur; int added_disasm = 0; if_clear_filedlg(); /* Search for a node which contains this address */ for (cur = sview->list_head; cur != NULL; cur = cur->next) { if (cur->path[0] == '*') { added_disasm = 1; if_add_filedlg_choice(cur->path); } } if (!sbcount(source_files) && !added_disasm) { /* No files returned? */ if_display_message(WIN_REFRESH, "Error:", " No sources available! Was the program compiled with debug?"); } else { int i; for (i = 0; i < sbcount(source_files); i++) { if_add_filedlg_choice(source_files[i]); } if_set_focus(FILE_DLG); } kui_input_acceptable = 1; } static void update_disassemble(struct tgdb_response *response) { if (response->choice.disassemble_function.error) { //$ TODO mikesart: Get module name in here somehow? Passed in when calling tgdb_request_disassemble? // or info sharedlibrary? //$ TODO mikesart: Need way to make sure we don't recurse here on error. //$ TODO mikesart: 100 lines? Way to load more at end? if (response->header == TGDB_DISASSEMBLE_PC) { /* Spew out a warning about disassemble failing * and disasm next 100 instructions. */ if_print_message("\nWarning: disassemble address 0x%" PRIx64 " failed.\n", response->choice.disassemble_function.addr_start); } else { tgdb_request_disassemble_pc(tgdb, 100); } } else { uint64_t addr_start = response->choice.disassemble_function.addr_start; uint64_t addr_end = response->choice.disassemble_function.addr_end; char **disasm = response->choice.disassemble_function.disasm; //$ TODO: If addr_start is equal to addr_end of some other // buffer, then append it to that buffer? //$ TODO: If there is a disassembly view, update the location // even if we don't display it? Useful with global marks, etc. if (disasm && disasm[0]) { int i; char *path; struct list_node *node; sviewer *sview = if_get_sview(); if (addr_start) { path = sys_aprintf( "** %s (%" PRIx64 " - %" PRIx64 ") **", disasm[0], addr_start, addr_end); } else { path = sys_aprintf("** %s **", disasm[0]); } node = source_get_node(sview, path); if (!node) { node = source_add(sview, path); //$ TODO mikesart: Add asm colors node->language = TOKENIZER_LANGUAGE_ASM; node->addr_start = addr_start; node->addr_end = addr_end; for (i = 0; i < sbcount(disasm); i++) { source_add_disasm_line(node, disasm[i]); } source_highlight(node); } source_set_exec_addr(sview, sview->addr_frame); if_draw(); free(path); } } } static void command_response(void *context, struct tgdb_response *response) { switch (response->header) { case TGDB_UPDATE_BREAKPOINTS: update_breakpoints(response); break; case TGDB_UPDATE_FILE_POSITION: update_file_position(response); break; case TGDB_UPDATE_SOURCE_FILES: update_source_files(response); break; case TGDB_DISASSEMBLE_PC: case TGDB_DISASSEMBLE_FUNC: update_disassemble(response); break; case TGDB_QUIT: new_ui_unsupported = response->choice.quit.new_ui_unsupported; cgdb_cleanup_and_exit(0); break; } } /* gdb_input: Receives data from tgdb: * * Returns: -1 on error, 0 on success */ static int gdb_input(int fd) { int result; /* Read from GDB */ result = tgdb_process(tgdb, fd); if (result == -1) { clog_error(CLOG_CGDB, "tgdb_process error"); return -1; } return 0; } static int cgdb_resize_term(int fd) { int c, result; if (read(fd, &c, sizeof (int)) < sizeof (int)) { clog_error(CLOG_CGDB, "read from resize pipe"); return -1; } /* If there is more input in the pipe, that means another resize has * been received, and we still have not handled this one. So, skip this * one and only handle the next one. */ result = io_data_ready(fd, 0); if (result == -1) { clog_error(CLOG_CGDB, "io_data_ready"); return -1; } if (result) return 0; if (if_resize_term() == -1) { clog_error(CLOG_CGDB, "if_resize_term error"); return -1; } return 0; } /** * Handles the signals that were received from the main loop. * * Initially the signals are sent to the signal handler. The signal handler * writes those values to a pipe which are detected in the main loop and * sent here. * * @param fd * The file descriptor to read the signal number from. * * @return * 0 on success or -1 on error */ static int cgdb_handle_signal_in_main_loop(int fd) { int signo; if (read(fd, &signo, sizeof(int)) < sizeof(int)) { clog_error(CLOG_CGDB, "read from signal pipe"); return -1; } tgdb_signal_notification(tgdb, signo); return 0; } static int main_loop(void) { fd_set rset; int max; /* 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 (;;) { max = (gdb_console_fd > STDIN_FILENO) ? gdb_console_fd : STDIN_FILENO; max = (max > resize_pipe[0]) ? max : resize_pipe[0]; max = (max > signal_pipe[0]) ? max : signal_pipe[0]; max = (max > gdb_mi_fd) ? max :gdb_mi_fd; /* Reset the fd_set, and watch for input from GDB or stdin */ FD_ZERO(&rset); FD_SET(STDIN_FILENO, &rset); FD_SET(gdb_console_fd, &rset); FD_SET(resize_pipe[0], &rset); FD_SET(signal_pipe[0], &rset); FD_SET(gdb_mi_fd, &rset); /* Wait for input */ if (select(max + 1, &rset, NULL, NULL, NULL) == -1) { if (errno == EINTR) continue; else { clog_error(CLOG_CGDB, "select failed: %s", strerror(errno)); return -1; } } /* A signal occurred (besides SIGWINCH) */ if (FD_ISSET(signal_pipe[0], &rset)) if (cgdb_handle_signal_in_main_loop(signal_pipe[0]) == -1) return -1; /* A resize signal occurred */ if (FD_ISSET(resize_pipe[0], &rset)) if (cgdb_resize_term(resize_pipe[0]) == -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; } /* gdb's output -> stdout */ if (FD_ISSET(gdb_console_fd, &rset)) { if (gdb_input(gdb_console_fd) == -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(); } } if (FD_ISSET(gdb_mi_fd, &rset)) { if (gdb_input(gdb_mi_fd) == -1) { return -1; } } } return 0; } /* ----------------- */ /* Exposed Functions */ /* ----------------- */ /* cgdb_cleanup_and_exit: Invoked by the various err_xxx funtions when dying. * -------- */ void cgdb_cleanup_and_exit(int val) { /* Cleanly scroll the screen up for a prompt */ swin_scrl(1); swin_move(swin_lines() - 1, 0); printf("\n"); /* 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 */ swin_endwin(); /* Shut down interface */ if_shutdown(); hl_groups_shutdown(hl_groups_instance); /* Finally, should display the errors. * TGDB guarantees the logger to be open at this point. * So, we can get the filename directly from the logger */ /* Shut down debugger */ tgdb_shutdown(tgdb); if (tty_set_attributes(STDIN_FILENO, &term_attributes) == -1) clog_error(CLOG_CGDB, "tty_reset error"); /* Close our logfiles */ tgdb_close_logfiles(); /** * If the cgdb log file has non-zero size, alert the user. */ if (clog_did_error_occur()) { fprintf(stderr, "CGDB had unexpected results." " Search the logs for more details.\n" " CGDB log directory: %s\n" " Lines beginning with ERROR: are an issue.\n", cgdb_log_dir); } if (new_ui_unsupported) { fprintf(stderr, "cgdb requires gdb 7.12 or later\n"); } exit(val); } int init_resize_pipe(void) { if (pipe(resize_pipe) == -1) { clog_error(CLOG_CGDB, "pipe error"); return -1; } return 0; } int init_signal_pipe(void) { int result = pipe(signal_pipe); if (result == -1) { clog_error(CLOG_CGDB, "pipe error"); } return result; } static void rlctx_send_user_command(char *line) { } static int tab_completion(int a, int b) { return 0; } int init_readline(void) { rline = rline_initialize(rlctx_send_user_command, tab_completion, "dumb"); 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; } int add_readline_key_sequence(const char *readline_str, enum cgdb_key key) { int result; std::list keyseq; result = rline_get_keyseq(rline, readline_str, keyseq); if (result == 0) { result = kui_manager_get_terminal_keys_kui_map(kui_ctx, key, keyseq); } return result; } int init_kui(void) { kui_ctx = kui_manager_create(STDIN_FILENO, cgdbrc_get_key_code_timeoutlen(), cgdbrc_get_mapped_key_timeoutlen()); if (!kui_ctx) { clog_error(CLOG_CGDB, "Unable to initialize input library"); cgdb_cleanup_and_exit(-1); } kui_map = kui_ms_create(); if (!kui_map) { clog_error(CLOG_CGDB, "Unable to initialize input library"); cgdb_cleanup_and_exit(-1); } kui_imap = kui_ms_create(); if (!kui_imap) { clog_error(CLOG_CGDB, "Unable to initialize input library"); cgdb_cleanup_and_exit(-1); } if (kui_manager_set_map_set(kui_ctx, kui_map) == -1) { clog_error(CLOG_CGDB, "Unable to initialize input library"); cgdb_cleanup_and_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); cgdbrc_attach(CGDBRC_TIMEOUT_LEN, &update_kui); cgdbrc_attach(CGDBRC_TTIMEOUT, &update_kui); cgdbrc_attach(CGDBRC_TTIMEOUT_LEN, &update_kui); /* 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 modifying /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); /* Backword-Word */ add_readline_key_sequence("backward-word", CGDB_KEY_BACKWARD_WORD); /* Forward-word */ add_readline_key_sequence("forward-word", CGDB_KEY_FORWARD_WORD); /* Backword-Kill-Word */ add_readline_key_sequence( "backward-kill-word", CGDB_KEY_BACKWARD_KILL_WORD); /* Forward-Kill-word */ add_readline_key_sequence( "kill-word", CGDB_KEY_FORWARD_KILL_WORD); return 0; } /** * Create the log files. */ static void cgdb_start_logging() { /* Open our cgdb and tgdb io logfiles */ clog_open(CLOG_CGDB_ID, "%s/cgdb_log%d.txt", cgdb_log_dir); clog_open(CLOG_GDBIO_ID, "%s/cgdb_gdb_console_io_log%d.txt", cgdb_log_dir); clog_open(CLOG_GDBMIIO_ID, "%s/cgdb_gdb_mi_io_log%d.txt", cgdb_log_dir); clog_set_level(CLOG_GDBMIIO_ID, CLOG_DEBUG); clog_set_fmt(CLOG_GDBMIIO_ID, CGDB_CLOG_FORMAT); /* Puts cgdb 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 useful in determining what is going on under tgdb * since the gui is good at hiding that info from the user. * * Change level to CLOG_ERROR to write only error messages. * clog_set_level(CLOG_GDBIO, CLOG_ERROR); */ clog_set_level(CLOG_GDBIO_ID, CLOG_DEBUG); clog_set_fmt(CLOG_GDBIO_ID, CGDB_CLOG_FORMAT); /* General cgdb logging. Only logging warnings and debug messages by default. */ clog_set_level(CLOG_CGDB_ID, CLOG_DEBUG); clog_set_fmt(CLOG_CGDB_ID, CGDB_CLOG_FORMAT); } int main(int argc, char *argv[]) { parse_long_options(&argc, &argv); // Create the home directory and the log directory if (init_home_dir() == -1) { exit(-1); } /* Debugging helper - wait for debugger to attach to us before continuing */ if (wait_for_debugger_to_attach) { if (cgdb_supports_debugger_attach_detection()) { printf("Waiting for debugger to attach...\n"); while (cgdb_is_debugger_attached() == 0) { sleep(1); } } else { int c; printf("Press any key to continue execution...\n"); read(0, &c, 1); } } cgdb_start_logging(); /* Initialize default option values */ cgdbrc_init(); tgdb = tgdb_initialize(callbacks); if (!tgdb) { fprintf(stderr, "%s:%d Unable to initialize tgdb\n", __FILE__, __LINE__); exit(-1); } /* From here on, the logger is initialized */ if (init_readline() == -1) { clog_error(CLOG_CGDB, "Unable to init readline"); cgdb_cleanup_and_exit(-1); } if (tty_cbreak(STDIN_FILENO, &term_attributes) == -1) { clog_error(CLOG_CGDB, "tty_cbreak error"); cgdb_cleanup_and_exit(-1); } if (init_kui() == -1) { clog_error(CLOG_CGDB, "init_kui error"); cgdb_cleanup_and_exit(-1); } /* Initialize curses */ if (!swin_start()) { clog_error(CLOG_CGDB, "Unable to start curses"); } /* Initialize the highlighting groups */ hl_groups_instance = hl_groups_initialize(); if (!hl_groups_instance) { clog_error(CLOG_CGDB, "Unable to setup highlighting groups"); cgdb_cleanup_and_exit(-1); } /* Parse the cgdbrc file. Note that we are doing this before if_init() is called so windows and highlight groups haven't been created yet. We need to do this here because some options can disable color, ansi escape parsing, or set Logo color. */ parse_cgdbrc_file(); /* Initialize the display */ if (if_init() == -1) { clog_error(CLOG_CGDB, "if_init() failed."); cgdb_cleanup_and_exit(-1); } if_layout(); // Starting gdb after the height/width of the gdb window has been decided if (start_gdb(argc, argv) == -1) { cgdb_cleanup_and_exit(-1); } /* Initialize the pipe that is used for resize */ if (init_resize_pipe() == -1) { clog_error(CLOG_CGDB, "init_resize_pipe error"); cgdb_cleanup_and_exit(-1); } /* Initialize the pipe that is used for signals */ if (init_signal_pipe() == -1) { clog_error(CLOG_CGDB, "init_signal_pipe error"); cgdb_cleanup_and_exit(-1); } /* Enter main loop */ main_loop(); /* Shut down curses and exit */ cgdb_cleanup_and_exit(0); } cgdb-0.8.0/cgdb/command_lexer.lpp0000664000175000017500000000333213046227664013605 00000000000000%option noyywrap %option nounput %option noinput 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; } ((<({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 */ } } { (\r\n|\n|\r) { return EOL; } [\t\v\f] { /* ignore white space */ } [^ \t\v\f\r\n]+ { return IDENTIFIER; } } %% cgdb-0.8.0/cgdb/highlight_groups.h0000664000175000017500000002007214135136636013770 00000000000000#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_INCSEARCH, HLG_SEARCH, HLG_STATUS_BAR, HLG_EXECUTING_LINE_ARROW, HLG_SELECTED_LINE_ARROW, HLG_EXECUTING_LINE_HIGHLIGHT, HLG_SELECTED_LINE_HIGHLIGHT, HLG_EXECUTING_LINE_BLOCK, HLG_SELECTED_LINE_BLOCK, HLG_ENABLED_BREAKPOINT, HLG_DISABLED_BREAKPOINT, HLG_SELECTED_LINE_NUMBER, HLG_EXECUTING_LINE_NUMBER, HLG_SCROLL_MODE_STATUS, HLG_LOGO, HLG_MARK, HLG_LAST, /* Straight colors - not configurable */ HLG_BLACK, HLG_RED, HLG_GREEN, HLG_YELLOW, HLG_BLUE, HLG_MAGENTA, HLG_CYAN, HLG_WHITE, HLG_BOLD_BLACK, HLG_BOLD_RED, HLG_BOLD_GREEN, HLG_BOLD_YELLOW, HLG_BOLD_BLUE, HLG_BOLD_MAGENTA, HLG_BOLD_CYAN, HLG_BOLD_WHITE, }; /* }}}*/ /* Creating 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. */ /******************************************************************************/ /*@{*/ /** * Get the attributes that may be passed to swin_wattron to tell the curses library * how to print this particular group. * * Note, this function can not fail. * * \param hl_groups * An instance of hl_groups to operate on. * * \param kind * The particular group to get the attributes for. * * \return * The attributes associated with the highlight group and the kind. * * If hl_groups is invalid than A_NORMAL will be returned or A_BOLD when * kind is HLG_EXECUTING_LINE_HIGHLIGHT. */ int hl_groups_get_attr(hl_groups_ptr hl_groups, enum hl_group_kind kind); /** * 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); /** * Determine if ansi color mode is currently enabled. * * @return * True if ansi color is enabled, false otherwise. */ bool hl_ansi_color_support(hl_groups *h); /** * Parse an ansi SGR (Select Graphic Rendition) escape sequence and return the * attributes you can use with ncurses. * * \param hl_groups * An instance of hl_groups to operate on. * * \param buf * String with escape sequence to parse * * \param attr * Ncurses attribute calculated from escape sequence * * \return * Number of characters in escape sequence */ int hl_ansi_get_color_attrs(hl_groups_ptr hl_groups, const char *buf, int *attr); enum hl_group_kind hl_get_color_group(const char *color); /** * An attribute at a particular column in a line. */ struct hl_line_attr { /** * Create an attribute using a raw ncurses attribute. * * @param col * The column the attribute starts at within a line. * * @param attr * The raw ncurses attribute to enable at this column. */ hl_line_attr(int col, int attr); /** * Create an attribute using a highlighting group kind. * * @param col * The column the attribute starts at within a line. * * @param kind * The highlighting group kind to enable at this column. */ hl_line_attr(int col, enum hl_group_kind kind); /** * Get back the column this attribute starts at. * * @return * The column this attribute starts at. */ int col(void) const; /** * Get the raw ncurses attribute. * * @return * A raw ncurses attribute. */ int as_attr(void) const; private: /// The column this attribute starts at int m_col; /// True if this is a highlighting group, False if a raw ncurse attr bool m_is_group; /** * The highlighting attribute. * * If m_is_group is true, this can be cast to an hl_group_kind. * Otherwise, it is the raw ncurses attribute. */ int m_attr; }; /** * Given a set of attributes and the column they start at, print the line. * * @param win * The window to write to. * * @param line * The line to write. * * @param line_len * The length of the line to write. * * @param attrs * The attributes to write. * * @param x * The x position to write to, -1 for current position. * * @param y * The y position to write to, -1 for current position. * * @param col * The column to write to. * * @param width */ void hl_printline(SWINDOW *win, const char *line, int line_len, const hl_line_attr *attrs, int x, int y, int col, int width); /** * Print a line with highlighting. * * This differs from hl_printline by only printing the text with attributes. * This is useful if you want to first print the line with syntax * highlighting and then do another pass with regex highlighting (or some * other attributes to highlight on top of the syntax). * * @param win * The window to write to. * * @param line * The line to write. * * @param line_len * The length of the line to write. * * @param attrs * The attributes to write. * * @param x * The x position to write to, -1 for current position. * * @param y * The y position to write to, -1 for current position. * * @param col * The column to write to. * * @param width */ void hl_printline_highlight(SWINDOW *win, const char *line, int line_len, const hl_line_attr *attrs, int x, int y, int col, int width); /** * Given a fg and bg index, get the corresponding color pair attribute. * * @param fg_index * The foreground index color * * @param bg_index * The background index color * * @param attr * The attribute associated with the color pair */ void hl_get_color_attr_from_index(int fg_index, int bg_index, int &attr); /*@}*/ /* }}}*/ #endif /* __HIGHLIGHT_GROUPS_H__ */ cgdb-0.8.0/cgdb/interface.h0000664000175000017500000001420614171031270012350 00000000000000/* 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 on error */ 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, ...) ATTRIBUTE_PRINTF( 1, 2 ); /** * Print a debugger command run by CGDB when showdebugcommands is enabled. * * @param command * The command that CGDB is about to issue to GDB. */ void if_sdc_print(const char *command); /* if_show_file: Displays the requested file in the source display window. * ------------- * * path: Full path to the file to display * sel_line: Current line of the file being selected (0 to leave unchanged) * exe_line: Current line of the file being executed (0 to leave unchanged) */ void if_show_file(char *path, int sel_line, int exe_line); /* if_get_sview: Return a pointer to the source viewer object. * ------------- */ struct sviewer *if_get_sview(); /** * Display a message on the source window status bar. * * @param dorefresh * Pass WIN_REFRESH to call wrefresh, otherwise wnoutrefresh is called. * * @param header * The header to display before the message. * If "", only the message will be displayed. * Should never be NULL, use "" instead. * * @param msg * A message to display to the user. If the message is longer than the * size of the status bar, the left most part of the string will be truncated. * Should never be NULL, use "" instead. * * Examples * * Header is "/" and message is "for_the_love_of_country". * If the width is 50, the status bar will be /for_the_love_of_country * If the width is 10, the status bar will be />_country * * Header is "" and message is "for_the_love_of_country". * If the width is 50, the status bar will be for_the_love_of_country * If the width is 10, the status bar will be >f_country */ void if_display_message(enum win_refresh dorefresh, const char *header, const char *msg); /* 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 * 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, 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); /** * Display a new logo in the source window. * * @param reset * If 0, will not reset the logo, otherwise will. */ void if_display_logo(int reset); /* if_search_next: finds the next match in a given direction. * ------------ */ void if_search_next(void); /* if_draw: * ----------- */ void if_draw(void); /** * Set the window split orientation. (vertical or horizontal) * * @param newOrientation * The orientation to switch to. */ void if_set_winsplitorientation(WIN_SPLIT_ORIENTATION_TYPE newOrientation); /* 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 language 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); /* if_change_winminwidth: * * This sets the minimal width of a window. Windows will never become smaller. * * Returns -1 if value is not acceptable. Otherwise, 0. */ int if_change_winminwidth(int value); /** * 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); /* if_layout: Update the layout of the screen based on current terminal size. * ---------- * * Return Value: Zero on success, -1 on failure. */ int if_layout(); // Get the gdb window height // // @return // The height of the gdb window int get_gdb_height(void); // Get the gdb window width // // @return // The width of the gdb window int get_gdb_width(void); #endif cgdb-0.8.0/cgdb/vterminal.cpp0000664000175000017500000003715414171031321012750 00000000000000#include "vterminal.h" // To use fill_utf8 #include "utf8.h" #include "vterm.h" #include "sys_util.h" #include "scroller.h" #include "sys_win.h" #include "highlight_groups.h" // The scrollback buffer data structure typedef struct { // The number of cells in the list below size_t cols; // A list of cells VTermScreenCell cells[]; } ScrollbackLine; struct VTerminal { VTerminal(VTerminalOptions options); ~VTerminal(); // Write data to vterm // // @param data // The data to write to vterm // // @param len // The number of characters in data to write void write(const char *data, size_t len); // Move the cursor to the new location // // @param newp // The new location of the cursor // // @param oldp // The old location of the cursor // // @param visible // The cursor is not visible when zero, otherwise visible void movecursor(VTermPos newp, VTermPos oldp, int visible); // Set some terminal properties // // @param prop // The property to set // // @param val // The value to set the property to // // @return // 1 on success, otherwise 0 int settermprop(VTermProp prop, VTermValue *val); // Ring the bell void bell(); // Push a line onto the scrollback buffer // // @param cols // The number of columns in the row to push to the scrollback buffer // // @param cells // The cells in each row to push to the scrollback buffer // // @return // On success will return 1, otherwise 0 int sb_pushline(int cols, const VTermScreenCell *cells); // Pop a line off the scrollback buffer // // @return // On success will return 1, otherwise 0 int sb_popline(int cols, VTermScreenCell *cells); // Convert VTermScreen cell arrays into utf8 strings // Currently it stores the string in textbuf, however, I suggest it may // be better to return a std::string // Also: Error handling? void fetch_row(int row, int start_col, int end_col, int &attr, int &width); // Fetch a single cell bool fetch_cell(int row, int col, VTermScreenCell *cell); // Adjust the scrollback buffer position // // See vterminal_scroll_delta for comments void scroll_delta(int delta); // Get the current scrollback delta // // See vterminal_scroll_get_delta for comments void scroll_get_delta(int &delta); // Set the current scrollback delta // // See vterminal_scroll_set_delta for comments void scroll_set_delta(int delta); // Push the terminal screen contents to the scrollback buffer // // See vterminal_push_screen_to_scrollback for comments void push_screen_to_scrollback(); // options passed to this terminal instance VTerminalOptions options; // libvterm terminal and screen instance VTerm *vt; VTermScreen *vts; // buffer used to: // - convert VTermScreen cell arrays into utf8 strings // - MAYBE: receive data from libvterm as a result of key presses. char textbuf[0x1fff]; // The number of lines scrolled back, initialized to zero int scroll_offset; // Scrollback buffer storage ScrollbackLine **sb_buffer; // Number of rows pushed to sb_buffer. // Does not include rows in vterm currently. size_t sb_current; // The scrollback buffer size (sb_buffer) size_t sb_size; // True if the cursor is visible, otherwise false bool cursor_visible; // The position of the cursor VTermPos cursorpos; }; static int vterminal_damage(VTermRect rect, void *data); static int vterminal_moverect(VTermRect dest, VTermRect src, void *data); static int vterminal_movecursor(VTermPos newp, VTermPos oldp, int visible, void *data); static int vterminal_settermprop(VTermProp prop, VTermValue *val, void *data); static int vterminal_bell(void *data); static int vterminal_resize(int rows, int cols, void *data); static int vterminal_sb_pushline(int cols, const VTermScreenCell *cells, void *data); static int vterminal_sb_popline(int cols, VTermScreenCell *cells, void *data); static VTermScreenCallbacks vterm_screen_callbacks = { .damage = vterminal_damage, .moverect = vterminal_moverect, .movecursor = vterminal_movecursor, .settermprop = vterminal_settermprop, .bell = vterminal_bell, .resize = vterminal_resize, .sb_pushline = vterminal_sb_pushline, .sb_popline = vterminal_sb_popline, }; VTerminal::VTerminal(VTerminalOptions options) : vt(nullptr) { this->options = options; cursorpos.row = 0; cursorpos.col = 0; cursor_visible = true; // neovim has a buffer assignment here, can i use our scroller or // do i need a new buffer concept? // Create vterm vt = vterm_new(this->options.height, this->options.width); vterm_set_utf8(vt, 1); // Setup state VTermState *state = vterm_obtain_state(vt); #if 0 // TODO: Determine if the colors are set by vterm automatically for (int index = 0; index < 16; ++index) { VTermColor color; vterm_color_rgb(&color, (uint8_t)((color_val >> 16) & 0xFF), (uint8_t)((color_val >> 8) & 0xFF), (uint8_t)((color_val >> 0) & 0xFF)); vterm_state_set_palette_color(state, index, } #endif // Setup screen vts = vterm_obtain_screen(vt); vterm_screen_set_callbacks(vts, &vterm_screen_callbacks, this); vterm_screen_set_damage_merge(vts, VTERM_DAMAGE_SCROLL); vterm_screen_reset(vts, 1); // Configure the scrollback buffer. scroll_offset = 0; sb_current = 0; sb_size = this->options.scrollback_buffer_size; sb_buffer = (ScrollbackLine**)malloc(sizeof(ScrollbackLine *) * sb_size); } VTerminal::~VTerminal() { for (size_t i = 0; i < sb_current; i++) { free(sb_buffer[i]); } free(sb_buffer); vterm_free(vt); } void VTerminal::write(const char *data, size_t len) { vterm_input_write(vt, data, len); vterm_screen_flush_damage(vts); } void VTerminal::movecursor(VTermPos newp, VTermPos oldp, int visible) { cursorpos.row = newp.row; cursorpos.col = newp.col; } int VTerminal::settermprop(VTermProp prop, VTermValue *val) { switch (prop) { case VTERM_PROP_CURSORVISIBLE: cursor_visible = val->boolean; break; default: return 0; } return 1; } void VTerminal::bell() { if (this->options.ring_bell) { this->options.ring_bell(this->options.data); } } int VTerminal::sb_pushline(int cols, const VTermScreenCell *cells) { if (!sb_size) { return 0; } // copy vterm cells into sb_buffer size_t c = (size_t)cols; ScrollbackLine *sbrow = NULL; if (sb_current == sb_size) { if (sb_buffer[sb_current - 1]->cols == c) { // Recycle old row if it's the right size sbrow = sb_buffer[sb_current - 1]; } else { free(sb_buffer[sb_current - 1]); } // Make room at the start by shifting to the right. memmove(sb_buffer + 1, sb_buffer, sizeof(sb_buffer[0]) * (sb_current - 1)); } else if (sb_current > 0) { // Make room at the start by shifting to the right. memmove(sb_buffer + 1, sb_buffer, sizeof(sb_buffer[0]) * sb_current); } if (!sbrow) { sbrow = (ScrollbackLine *)malloc( sizeof(ScrollbackLine) + c * sizeof(sbrow->cells[0])); sbrow->cols = c; } // New row is added at the start of the storage buffer. sb_buffer[0] = sbrow; if (sb_current < sb_size) { sb_current++; } memcpy(sbrow->cells, cells, sizeof(cells[0]) * c); return 1; } int VTerminal::sb_popline(int cols, VTermScreenCell *cells) { if (!sb_current) { return 0; } ScrollbackLine *sbrow = sb_buffer[0]; sb_current--; // Forget the "popped" row by shifting the rest onto it. memmove(sb_buffer, sb_buffer + 1, sizeof(sb_buffer[0]) * (sb_current)); size_t cols_to_copy = (size_t)cols; if (cols_to_copy > sbrow->cols) { cols_to_copy = sbrow->cols; } // copy to vterm state memcpy(cells, sbrow->cells, sizeof(cells[0]) * cols_to_copy); for (size_t col = cols_to_copy; col < (size_t)cols; col++) { cells[col].chars[0] = 0; cells[col].width = 1; } free(sbrow); return 1; } int ansi_get_closest_color_value(int r, int g, int b); static int get_ncurses_color_index(VTermColor &color, bool &bold) { int index = -1; bold = false; if (VTERM_COLOR_IS_DEFAULT_FG(&color)) { index = -1; } else if (VTERM_COLOR_IS_DEFAULT_BG(&color)) { index = -1; } else if (VTERM_COLOR_IS_INDEXED(&color)) { if (color.indexed.idx >= 0 && color.indexed.idx < 16) { index = color.indexed.idx; } else if (color.indexed.idx >=232) { int num = color.indexed.idx; int gray = 255 * (MIN(num, 255) - 232) / (255 - 232); index = ansi_get_closest_color_value( gray, gray, gray ); } else if (color.indexed.idx >= 16) { int num = color.indexed.idx; int red = ((num - 16) / 36); int green = (((num - 16) - red * 36) / 6); int blue = ((num - 16) % 6); index = ansi_get_closest_color_value( red * 255 / 6, green * 255 / 6, blue * 255 / 6 ); } // Colors 8 through 15 are high intensity colors // To my knowledge, the only way to handle this with ncurses is // to bold the corresponding low intensity numbers. // https://en.wikipedia.org/wiki/ANSI_escape_code if (index >=8 && index < 16) { index = index - 8; bold = true; } } else if (VTERM_COLOR_IS_RGB(&color)) { // TODO: RGB is currently unsupported } return index; } void VTerminal::fetch_row(int row, int start_col, int end_col, int &attr, int &width) { int col = start_col; size_t line_len = 0; char *ptr = textbuf; row = row - scroll_offset; while (col < end_col) { VTermScreenCell cell; fetch_cell(row, col, &cell); // TODO: What about rgb colors? bool fg_bold = false, bg_bold = false; int fg_index = get_ncurses_color_index(cell.fg, fg_bold); int bg_index = get_ncurses_color_index(cell.bg, bg_bold); hl_get_color_attr_from_index(fg_index, bg_index, attr); // set attributes if (cell.attrs.bold || fg_bold || bg_bold) { attr |= SWIN_A_BOLD; } else if (cell.attrs.underline) { attr |= SWIN_A_UNDERLINE; } else if (cell.attrs.blink) { attr |= SWIN_A_BLINK; } else if (cell.attrs.reverse) { attr |= SWIN_A_REVERSE; } int cell_len = 0; if (cell.chars[0]) { for (int i = 0; cell.chars[i]; i++) { cell_len += fill_utf8(cell.chars[i], ptr); } } else { *ptr = ' '; cell_len = 1; } char c = *ptr; ptr += cell_len; if (c != ' ') { // only increase the line length if the last character is not whitespace line_len = (size_t)(ptr - textbuf); } col += cell.width; } // trim trailing whitespace textbuf[line_len] = 0; width = col - start_col; } bool VTerminal::fetch_cell(int row, int col, VTermScreenCell *cell) { if (row < 0) { if(-row > sb_current) { clog_error(CLOG_CGDB, "Attempt to fetch scrollback beyond" " buffer at line %d\n", -row); return false; } /* pos.row == -1 => sb_buffer[0], -2 => [1], etc... */ ScrollbackLine *sbrow = sb_buffer[-row - 1]; if ((size_t)col < sbrow->cols) { *cell = sbrow->cells[col]; } else { // fill the pointer with an empty cell *cell = (VTermScreenCell) { .chars = { 0 }, .width = 1, }; return false; } } else { vterm_screen_get_cell(vts, (VTermPos){.row = row, .col = col}, cell); } return true; } void VTerminal::scroll_delta(int delta) { // Ensure you can't scroll past scrolling boundries // 0 >= scroll_offset <= sb_current if(delta > 0) { if(scroll_offset + delta > sb_current) delta = sb_current - scroll_offset; } else if(delta < 0) { if(delta < -scroll_offset) delta = -scroll_offset; } scroll_offset += delta; } void VTerminal::scroll_get_delta(int &delta) { delta = scroll_offset; } void VTerminal::scroll_set_delta(int delta) { scroll_offset = delta; } void VTerminal::push_screen_to_scrollback() { int height, width; vterm_get_size(vt, &height, &width); // Take each row that has some content and push to scrollback buffer VTermPos pos; for (pos.row = 0; pos.row < height; ++pos.row) { VTermScreenCell cells[width]; for (pos.col = 0; pos.col < width; ++pos.col) { fetch_cell(pos.row, pos.col, &cells[pos.col]); } sb_pushline(width, cells); if (pos.row == cursorpos.row) { break; } } } VTerminal * vterminal_new(VTerminalOptions options) { return new VTerminal(options); } void vterminal_free(VTerminal *terminal) { delete terminal; } void vterminal_write(VTerminal *terminal, const char *data, size_t len) { terminal->write(data, len); } void vterminal_get_height_width(VTerminal *terminal, int &height, int &width) { vterm_get_size(terminal->vt, &height, &width); } void vterminal_fetch_row(VTerminal *terminal, int row, int start_col, int end_col, std::string &utf8text) { int attr; int width; terminal->fetch_row(row, start_col, end_col, attr, width); if (terminal->textbuf) { utf8text = terminal->textbuf; } else { utf8text = ""; } } void vterminal_fetch_row_col(VTerminal *terminal, int row, int col, std::string &utf8text, int &attr, int &width) { terminal->fetch_row(row, col, col+1, attr, width); if (terminal->textbuf) { utf8text = terminal->textbuf; } else { utf8text = ""; } } void vterminal_get_cursor_pos(VTerminal *terminal, int &row, int &col) { row = terminal->cursorpos.row; col = terminal->cursorpos.col; } void vterminal_scrollback_num_rows(VTerminal *terminal, int &num) { num = terminal->sb_current; } void vterminal_scroll_delta(VTerminal *terminal, int delta) { terminal->scroll_delta(delta); } void vterminal_scroll_get_delta(VTerminal *terminal, int &delta) { terminal->scroll_get_delta(delta); } void vterminal_scroll_set_delta(VTerminal *terminal, int delta) { terminal->scroll_set_delta(delta); } void vterminal_push_screen_to_scrollback(VTerminal *terminal) { terminal->push_screen_to_scrollback(); } // libvterm callbacks {{{ static int vterminal_damage(VTermRect rect, void *data) { return 1; } static int vterminal_moverect(VTermRect dest, VTermRect src, void *data) { return 1; } static int vterminal_movecursor(VTermPos newp, VTermPos oldp, int visible, void *data) { VTerminal *terminal = (VTerminal*)data; terminal->movecursor(newp, oldp, visible); return 1; } static int vterminal_settermprop(VTermProp prop, VTermValue *val, void *data) { VTerminal *terminal = (VTerminal*)data; return terminal->settermprop(prop, val); } static int vterminal_bell(void *data) { VTerminal *terminal = (VTerminal*)data; terminal->bell(); return 1; } static int vterminal_resize(int rows, int cols, void *data) { return 1; } static int vterminal_sb_pushline(int cols, const VTermScreenCell *cells, void *data) { VTerminal *terminal = (VTerminal*)data; return terminal->sb_pushline(cols, cells); } static int vterminal_sb_popline(int cols, VTermScreenCell *cells, void *data) { VTerminal *terminal = (VTerminal*)data; return terminal->sb_popline(cols, cells); } // }}} cgdb-0.8.0/cgdb/scroller.cpp0000664000175000017500000004733414171031321012575 00000000000000// Some help understanding how searching in the scroller works // // - Vterm deals only with what's on the screen // It represents rows 0 through vterm height-1, which is 2 below // - vterminal introduces a scrollback buffer // It represents rows -1 through -scrollback height, which is -6 below // - vterminal also introduces a scrollback delta // Allows iterating from 0:height-1 but displaying the scrolled to text // The default is 0, which is represented by d0 // Scrolling back all the way to -6 is represented by d-6 // Scrolling back partiall to -2 is represented by d-2 // - The scroller has introduced the concept of a search id (sid) // The purpose is to iterate easily over all the text (vterm+scrollback) // // Example inputs and labels // Screen Height: 3 // Scrollback (sb) size: 6 // vid: VTerm ID (screen only) // tid: Terminal ID (screen + scrollback + scrollback delta) // sid: A search ID (for iterating eaisly over all) // sb start - scrollback buffer start // sb end - scrollback buffer end // vt start - vterm buffer start // vt end - vterm buffer end // // sid vid tid d0 d-6 d-2 // sb start 0 -6 0 abc 0 // 1 -5 1 def 1 // 2 -4 2 ghi 2 // 3 -3 def // 4 -2 0 jkl // sb end 5 -1 1 def // vt start 6 0 0 0 2 mno // 7 1 1 1 def // vt end 8 2 2 2 pqr // // Your search will start at the row the scroll cursor is at. // // You can loop from 0 to scrollback size + vterm size. // // You can convert your cursor position to the sid by doing: // sid = cursor_pos + scrollback size + vterminal_scroll_get_delta // You can convert your sid to a cursor position by doing the following: // cursor_pos = sid - scrollback size - vterminal_scroll_get_delta // // If your delta is -6, and your cursor is on sid 1, and you find a // match on sid 7, you'll have to move the display by moving the delta. // You can move the display to sid by doing the following: // delta_offset = sid - scrollback size // Then, if delta_offset > 0, delta_offset = 0. /* 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 */ #include /* Local Includes */ #include "sys_util.h" #include "stretchy.h" #include "sys_win.h" #include "cgdb.h" #include "cgdbrc.h" #include "highlight_groups.h" #include "scroller.h" #include "highlight.h" #include "vterminal.h" struct scroller { // The virtual terminal VTerminal *vt; // All text sent to the scroller to date. // Vterm does not yet support reflow, so when the terminal is resized, // or when the cgdb window orientation is changed, vterm can't update // the text that well in the scroller. Currently, to work around that, // CGDB creates a new vterm on resize and feeds it all the text found // to date. When vterm supports reflow, this could go away. std::string text; // The window the scroller will be displayed on // // NULL when the height of the scroller is zero // This occurs when the terminal has a height of 1 or if the user // minimized the height of the scroller manually to zero SWINDOW *win; // True if in scroll mode, otherwise false bool in_scroll_mode; // The position of the cursor when in scroll mode int scroll_cursor_row, scroll_cursor_col; // True if in search mode, otherwise false // Can only search when in_scroll_mode is true bool in_search_mode; // The original delta, cursor row and col. Also the initial search id. int delta_init, search_row_init, search_col_init, search_sid_init; // True when searching forward, otherwise searching backwards bool forward; // True when searching case insensitve, false otherwise bool icase; // The current regex if in_search_mode is true struct hl_regex_info *hlregex; // The current row, col start and end matching position int search_row, search_col_start, search_col_end; // The last string regex to be searched for std::string last_regex; }; /* ----------------- */ /* Exposed Functions */ /* ----------------- */ static void scr_ring_bell(void *data) { struct scroller *scr = (struct scroller *)data; // TODO: Ring the bell } // Create a new VTerminal instance // // Please note that when the height or width of the scroller is zero, // than the window (scr->win) will be NULL, as noted in the fields comment. // // In this scenario, we allow the height/width of the virtual terminal // to remain as 1. The virtual terminal requires this. This provides a // benefit that the user can continue typing into the virtual terminal // even when it's not visible. // // @param scr // The scroller to operate on // // @return // The new virtual terminal instance static VTerminal *scr_new_vterminal(struct scroller *scr) { int scrollback_buffer_size = cgdbrc_get_int(CGDBRC_SCROLLBACK_BUFFER_SIZE); VTerminalOptions options; options.data = (void*)scr; // See note in function comments about std::max usage here options.width = std::max(swin_getmaxx(scr->win), 1); options.height = std::max(swin_getmaxy(scr->win), 1); options.scrollback_buffer_size = scrollback_buffer_size; options.ring_bell = scr_ring_bell; return vterminal_new(options); } struct scroller *scr_new(SWINDOW *win) { struct scroller *rv = new scroller(); rv->in_scroll_mode = false; rv->scroll_cursor_row = rv->scroll_cursor_col = 0; rv->win = win; rv->in_search_mode = false; rv->hlregex = NULL; rv->search_row = rv->search_col_start = rv->search_col_end = 0; rv->vt = scr_new_vterminal(rv); return rv; } void scr_free(struct scroller *scr) { vterminal_free(scr->vt); hl_regex_free(&scr->hlregex); scr->hlregex = NULL; swin_delwin(scr->win); scr->win = NULL; /* Release the scroller object */ delete scr; } void scr_set_scroll_mode(struct scroller *scr, bool mode) { // If the request is to enable the scroll mode and it's not already // enabled, then enable it if (mode && !scr->in_scroll_mode) { scr->in_scroll_mode = true; // Start the scroll mode cursor at the same location as the // cursor on the screen vterminal_get_cursor_pos( scr->vt, scr->scroll_cursor_row, scr->scroll_cursor_col); // If the request is to disable the scroll mode and it's currently // enabled, then disable it } else if (!mode && scr->in_scroll_mode) { scr->in_scroll_mode = false; } } bool scr_scroll_mode(struct scroller *scr) { return scr->in_scroll_mode; } void scr_up(struct scroller *scr, int nlines) { // When moving 1 line up // Move the cursor towards the top of the screen // If it hits the top, then start scrolling back // Otherwise whem moving many lines up, simply scroll if (scr->scroll_cursor_row > 0 && nlines == 1) { scr->scroll_cursor_row = scr->scroll_cursor_row - 1; } else { vterminal_scroll_delta(scr->vt, nlines); } } void scr_down(struct scroller *scr, int nlines) { int height; int width; vterminal_get_height_width(scr->vt, height, width); // When moving 1 line down // Move the cursor towards the botttom of the screen // If it hits the botttom, then start scrolling forward // Otherwise whem moving many lines down, simply scroll if (scr->scroll_cursor_row < height - 1 && nlines == 1) { scr->scroll_cursor_row = scr->scroll_cursor_row + 1; } else { vterminal_scroll_delta(scr->vt, -nlines); } } void scr_home(struct scroller *scr) { int sb_num_rows; vterminal_scrollback_num_rows(scr->vt, sb_num_rows); vterminal_scroll_delta(scr->vt, sb_num_rows); } void scr_end(struct scroller *scr) { int sb_num_rows; vterminal_scrollback_num_rows(scr->vt, sb_num_rows); vterminal_scroll_delta(scr->vt, -sb_num_rows); } void scr_left(struct scroller *scr) { if (scr->scroll_cursor_col > 0) { scr->scroll_cursor_col--; } } void scr_right(struct scroller *scr) { int height; int width; vterminal_get_height_width(scr->vt, height, width); if (scr->scroll_cursor_col < width - 1) { scr->scroll_cursor_col++; } } void scr_beginning_of_row(struct scroller *scr) { scr->scroll_cursor_col = 0; } void scr_end_of_row(struct scroller *scr) { int height; int width; vterminal_get_height_width(scr->vt, height, width); scr->scroll_cursor_col = width - 1; } void scr_push_screen_to_scrollback(struct scroller *scr) { vterminal_push_screen_to_scrollback(scr->vt); } void scr_add(struct scroller *scr, const char *buf) { // Keep a copy of all text sent to vterm // Vterm doesn't yet support resizing, so we would create a new vterm // instance and feed it the same data scr->text.append(buf); vterminal_write(scr->vt, buf, strlen(buf)); } void scr_move(struct scroller *scr, SWINDOW *win) { swin_delwin(scr->win); scr->win = win; // recreate the vterm session with the new size vterminal_free(scr->vt); scr->vt = scr_new_vterminal(scr); vterminal_write(scr->vt, scr->text.data(), scr->text.size()); } void scr_enable_search(struct scroller *scr, bool forward, bool icase) { if (scr->in_scroll_mode) { int delta; vterminal_scroll_get_delta(scr->vt, delta); int sb_num_rows; vterminal_scrollback_num_rows(scr->vt, sb_num_rows); scr->in_search_mode = true; scr->forward = forward; scr->icase = icase; scr->delta_init = delta; scr->search_sid_init = scr->scroll_cursor_row - delta + sb_num_rows; scr->search_row_init = scr->scroll_cursor_row; scr->search_col_init = scr->scroll_cursor_col; } } void scr_disable_search(struct scroller *scr, bool accept) { if (scr->in_search_mode) { scr->in_search_mode = false; if (accept) { scr->scroll_cursor_row = scr->search_row; scr->scroll_cursor_col = scr->search_col_start; hl_regex_free(&scr->hlregex); scr->hlregex = 0; } else { scr->scroll_cursor_row = scr->search_row_init; scr->scroll_cursor_col = scr->search_col_init; vterminal_scroll_set_delta(scr->vt, scr->delta_init); scr->last_regex.clear(); } scr->search_row = 0; scr->search_col_start = 0; scr->search_col_end = 0; } } bool scr_search_mode(struct scroller *scr) { return scr->in_search_mode; } static int scr_search_regex_forward(struct scroller *scr, const char *regex) { int sb_num_rows; vterminal_scrollback_num_rows(scr->vt, sb_num_rows); int height; int width; vterminal_get_height_width(scr->vt, height, width); int delta; vterminal_scroll_get_delta(scr->vt, delta); int wrapscan_enabled = cgdbrc_get_int(CGDBRC_WRAPSCAN); int count = sb_num_rows + height; int regex_matched = 0; if (!scr || !regex) { // TODO: LOG ERROR return -1; } scr->last_regex = regex; // The starting search row and column int search_row = scr->search_sid_init; int search_col = scr->search_col_init; // Increment the column by 1 to get the starting row/column if (search_col < width - 1) { search_col++; } else { search_row++; if (search_row >= count) { search_row = 0; } search_col = 0; } for (;;) { int start, end; // convert from sid to cursor position taking into account delta int vfr = search_row - sb_num_rows + delta; std::string utf8buf; vterminal_fetch_row(scr->vt, vfr, search_col, width, utf8buf); regex_matched = hl_regex_search(&scr->hlregex, utf8buf.c_str(), regex, scr->icase, &start, &end); if (regex_matched > 0) { // Need to scroll the terminal if the search is not in view if (count - delta - height <= search_row && search_row < count - delta) { } else { delta = search_row - sb_num_rows; if (delta > 0) { delta = 0; } delta = -delta; vterminal_scroll_set_delta(scr->vt, delta); } // convert from sid to cursor position taking into account delta scr->search_row = search_row - sb_num_rows + delta; scr->search_col_start = start + search_col; scr->search_col_end = end + search_col; break; } // Stop searching when made it back to original position if (wrapscan_enabled && search_row == scr->search_sid_init && search_col == 0) { break; // Or if wrapscan is disabled and searching hit the end } else if (!wrapscan_enabled && search_row == count - 1) { break; } search_row++; if (search_row >= count) { search_row = 0; } search_col = 0; } return regex_matched; } static int scr_search_regex_backwards(struct scroller *scr, const char *regex) { int sb_num_rows; vterminal_scrollback_num_rows(scr->vt, sb_num_rows); int height; int width; vterminal_get_height_width(scr->vt, height, width); int delta; vterminal_scroll_get_delta(scr->vt, delta); int wrapscan_enabled = cgdbrc_get_int(CGDBRC_WRAPSCAN); int count = sb_num_rows + height; int regex_matched = 0; if (!scr || !regex) { // TODO: LOG ERROR return -1; } scr->last_regex = regex; // The starting search row and column int search_row = scr->search_sid_init; int search_col = scr->search_col_init; // Decrement the column by 1 to get the starting row/column if (search_col > 0) { search_col--; } else { search_row--; if (search_row < 0) { search_row = count - 1; } search_col = width - 1; } for (;;) { int start = 0, end = 0; int vfr = search_row - sb_num_rows + delta; // Searching in reverse is more difficult // The idea is to search right to left, however the regex api // doesn't support that. Need to mimic this by searching left // to right to find all the matches on the line, and then // take the right most match. for (int c = 0;;) { std::string utf8buf; vterminal_fetch_row(scr->vt, vfr, c, width, utf8buf); int _start, _end, result; result = hl_regex_search(&scr->hlregex, utf8buf.c_str(), regex, scr->icase, &_start, &_end); if ((result == 1) && (c + _start <= search_col)) { regex_matched = 1; start = c + _start; end = c + _end; c = start + 1; } else { break; } } if (regex_matched > 0) { // Need to scroll the terminal if the search is not in view if (count - delta - height <= search_row && search_row < count - delta) { } else { delta = search_row - sb_num_rows; if (delta > 0) { delta = 0; } delta = -delta; vterminal_scroll_set_delta(scr->vt, delta); } scr->search_row = search_row - sb_num_rows + delta; scr->search_col_start = start; scr->search_col_end = end; break; } // Stop searching when made it back to original position if (wrapscan_enabled && search_row == scr->search_sid_init && search_col == width - 1) { break; // Or if wrapscan is disabled and searching hit the top } else if (!wrapscan_enabled && search_row == 0) { break; } search_row--; if (search_row < 0) { search_row = count - 1; } search_col = width - 1; } return regex_matched; } int scr_search_regex(struct scroller *scr, const char *regex) { int result; if (scr->forward) { result = scr_search_regex_forward(scr, regex); } else { result = scr_search_regex_backwards(scr, regex); } return result; } void scr_search_next(struct scroller *scr, bool forward, bool icase) { if (scr->last_regex.size() > 0) { scr_enable_search(scr, forward, icase); scr_search_regex(scr, scr->last_regex.c_str()); scr_disable_search(scr, true); } } void scr_refresh(struct scroller *scr, int focus, enum win_refresh dorefresh) { int height; int width; vterminal_get_height_width(scr->vt, height, width); int vterm_cursor_row, vterm_cursor_col; vterminal_get_cursor_pos(scr->vt, vterm_cursor_row, vterm_cursor_col); int sb_num_rows; vterminal_scrollback_num_rows(scr->vt, sb_num_rows); int delta; vterminal_scroll_get_delta(scr->vt, delta); int highlight_attr, search_attr; int cursor_row, cursor_col; if (scr->in_scroll_mode) { cursor_row = scr->scroll_cursor_row; cursor_col = scr->scroll_cursor_col; } else { cursor_row = vterm_cursor_row; cursor_col = vterm_cursor_col; } /* Steal line highlight attribute for our scroll mode status */ highlight_attr = hl_groups_get_attr(hl_groups_instance, HLG_SCROLL_MODE_STATUS); search_attr = hl_groups_get_attr(hl_groups_instance, HLG_INCSEARCH); for (int r = 0; r < height; ++r) { for (int c = 0; c < width; ) { std::string utf8buf; int attr = 0; int cellwidth; int in_search = scr->in_search_mode && scr->search_row == r && c >= scr->search_col_start && c < scr->search_col_end; vterminal_fetch_row_col(scr->vt, r, c, utf8buf, attr, cellwidth); swin_wmove(scr->win, r, c); swin_wattron(scr->win, attr); if (in_search) swin_wattron(scr->win, search_attr); // print the cell utf8 data or an empty char // If nothing is written at all, then the cell will not be colored if (utf8buf.size()) { swin_waddnstr(scr->win, utf8buf.data(), utf8buf.size()); } else { swin_waddnstr(scr->win, " ", 1); } if (in_search) swin_wattroff(scr->win, search_attr); swin_wattroff(scr->win, attr); swin_wclrtoeol(scr->win); c += cellwidth; } // If in scroll mode, overlay the percent the scroller is scrolled // back on the top right of the scroller display. if (scr->in_scroll_mode && r == 0) { char status[ 64 ]; size_t status_len; snprintf(status, sizeof(status), "[%d/%d]", delta, sb_num_rows); status_len = strlen(status); if ( status_len < width ) { swin_wattron(scr->win, highlight_attr); swin_mvwprintw(scr->win, r, width - status_len, "%s", status); swin_wattroff(scr->win, highlight_attr); } } } // Show the cursor when the scroller is in focus if (focus) { swin_wmove(scr->win, cursor_row, cursor_col); swin_curs_set(1); } else { /* Hide the cursor */ swin_curs_set(0); } switch(dorefresh) { case WIN_NO_REFRESH: swin_wnoutrefresh(scr->win); break; case WIN_REFRESH: swin_wrefresh(scr->win); break; } } cgdb-0.8.0/cgdb/highlight.cpp0000664000175000017500000000556114135136636012732 00000000000000/* highlight.c: * ------------ * * Syntax highlighting routines. * */ #if HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #if HAVE_REGEX_H #include #endif /* HAVE_REGEX_H */ /* Local Includes */ #include "sys_util.h" #include "stretchy.h" #include "sys_win.h" #include "cgdb.h" #include "highlight.h" #include "tokenizer.h" #include "sources.h" #include "highlight_groups.h" struct hl_regex_info { regex_t t; int icase; char *regex; }; void hl_regex_free(struct hl_regex_info **info) { if (info && *info && (*info)->regex) { regfree(&(*info)->t); free((*info)->regex); (*info)->regex = NULL; free(*info); *info = NULL; } } int hl_regex_search(struct hl_regex_info **info, const char *line, const char *regex, int icase, int *start, int *end) { int result; regmatch_t pmatch; int recompile = 0; *start = -1; *end = -1; if (!regex || !regex[0]) return -1; if (!*info) { *info = (struct hl_regex_info *)cgdb_calloc(1, sizeof(struct hl_regex_info)); recompile = 1; } else if (!(*info)->regex) recompile = 1; else if ((*info)->regex == regex) recompile = 0; else if ((icase != -1) && (icase != (*info)->icase)) recompile = 1; else if (strcmp(regex, (*info)->regex)) recompile = 1; if (recompile) { if (*info && (*info)->regex) { regfree(&(*info)->t); free((*info)->regex); (*info)->regex = NULL; } /* Compile the regular expression */ if (regcomp(&(*info)->t, regex, REG_EXTENDED | (icase ? REG_ICASE : 0)) != 0) { hl_regex_free(info); return -1; } (*info)->regex = strdup(regex); (*info)->icase = icase; } result = regexec(&(*info)->t, line, 1, &pmatch, 0); if ((result == 0) && (pmatch.rm_eo > pmatch.rm_so)) { *start = pmatch.rm_so; *end = pmatch.rm_eo; return 1; } return 0; } struct hl_line_attr *hl_regex_highlight(struct hl_regex_info **info, char *line, enum hl_group_kind group_kind) { hl_line_attr *attrs = NULL; if (*info && (*info)->regex && (*info)->regex[0]) { int pos = 0; for (;;) { int ret; int len; int start, end; ret = hl_regex_search(info, line + pos, (*info)->regex, (*info)->icase, &start, &end); if (ret <= 0) break; len = end - start; pos += start; /* Push search attribute */ sbpush(attrs, hl_line_attr(pos, group_kind)); /* And the back to regular text attribute */ sbpush(attrs, hl_line_attr(pos + len, 0)); pos += len; } } return attrs; } cgdb-0.8.0/Makefile.in0000664000175000017500000006173214171036447011426 00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/config/readline_check_version.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \ $(am__configure_deps) $(am__DIST_COMMON) 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 = cgdb_custom_config.h 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 am__DIST_COMMON = $(srcdir)/Makefile.in \ $(srcdir)/cgdb_custom_config.h.in $(srcdir)/config.h.in \ $(top_srcdir)/config/compile $(top_srcdir)/config/config.guess \ $(top_srcdir)/config/config.sub \ $(top_srcdir)/config/install-sh $(top_srcdir)/config/missing \ AUTHORS COPYING ChangeLog INSTALL NEWS config/compile \ config/config.guess config/config.sub config/depcomp \ config/install-sh config/mdate-sh config/missing \ config/texinfo.tex config/ylwrap 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@ CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ 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@ HAS_MAKEINFO = @HAS_MAKEINFO@ 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@ ac_ct_CXX = @ac_ct_CXX@ 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@ runstatedir = @runstatedir@ 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 AUTOMAKE_OPTIONS = -Wportability foreign 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) --foreign'; \ $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign 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 @test -f $@ || rm -f stamp-h1 @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1 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 cgdb_custom_config.h: $(top_builddir)/config.status $(srcdir)/cgdb_custom_config.h.in cd $(top_builddir) && $(SHELL) ./config.status $@ # 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=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ 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 @echo WARNING: "Support for distribution archives compressed with" \ "legacy program 'compress' is deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__post_remove_distdir) dist-shar: distdir @echo WARNING: "Support for shar distribution archives is" \ "deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 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)/_build/sub $(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/sub \ && ../../configure \ $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ --srcdir=../.. --prefix="$$dc_install_base" \ && $(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 .PRECIOUS: Makefile # 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.8.0/lib/0000775000175000017500000000000014171036466010177 500000000000000cgdb-0.8.0/lib/tgdb/0000775000175000017500000000000014171036466011117 500000000000000cgdb-0.8.0/lib/tgdb/gdbwire.c0000664000175000017500000071505314134377055012642 00000000000000/** * Copyright (C) 2013 Robert Rossi * * This file is an amalgamation of the source files from GDBWIRE. * * It was created using gdbwire 1.0 and git revision 6cbdacc. * * GDBWIRE 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. * * GDBWIRE 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 GDBWIRE. If not, see . */ /***** Begin file gdbwire_sys.c **********************************************/ #include #include /***** Include gdbwire_sys.h in the middle of gdbwire_sys.c ******************/ /***** Begin file gdbwire_sys.h **********************************************/ #ifndef __GDBWIRE_SYS_H__ #define __GDBWIRE_SYS_H__ /** * Supporting system functions. */ #ifdef __cplusplus extern "C" { #endif /** * Duplicate a string. * * @param str * The string to duplicate * * @return * An allocated string that must be freed. * Null if out of memory or str is NULL. */ char *gdbwire_strdup(const char *str); #ifdef __cplusplus } #endif #endif /***** End of gdbwire_sys.h **************************************************/ /***** Continuing where we left off in gdbwire_sys.c *************************/ char *gdbwire_strdup(const char *str) { char *result = NULL; if (str) { size_t length_to_allocate = strlen(str) + 1; result = malloc(length_to_allocate * sizeof(char)); if (result) { strcpy(result, str); } } return result; } /***** End of gdbwire_sys.c **************************************************/ /***** Begin file gdbwire_string.c *******************************************/ #include #include /***** Include gdbwire_string.h in the middle of gdbwire_string.c ************/ /***** Begin file gdbwire_string.h *******************************************/ #ifndef __GDBWIRE_STRING_H__ #define __GDBWIRE_STRING_H__ #ifdef __cplusplus extern "C" { #endif #include /** * A dynamic string representation. * * To create and destroy a string use gdbwire_string_create() and * gdbwire_string_destroy() respectively. * * This string is an abstraction of a low level C string. It supports being * used as a NULL terminated c string and also as an arbitrary array of * bytes. You can append to this string in either of these modes using * gdbwire_string_append_cstr() or gdbwire_string_append_data(). This string * automatically grows as you append data to it. Please note, the size of * the string will not include the NULL terminated character when using * the gdbwire_string_append_cstr() function to append data. * * To get access to the underlying bytes associated with this string * call gdbwire_string_data(). It is OK to modify the result as long as * you are careful to stay in it's valid bounds. * * The size (or length) of the string can be accessed through the * gdbwire_string_size() function. The character pointer returned from * gdbwire_string_data() is valid from the index range of 0 to * gdbwire_string_size() - 1. */ struct gdbwire_string; /** * Create a string instance. * * @return * A valid string instance or NULL on error. */ struct gdbwire_string *gdbwire_string_create(void); /** * Destroy the string instance and it's resources. * * @param string * The string to destroy. */ void gdbwire_string_destroy(struct gdbwire_string *string); /** * Clear the contents of a string. * * Sets the string back to an empty string which also changes it's * size back to zero. * * The capacity remains unchanged. * * @param string * The string to clear */ void gdbwire_string_clear(struct gdbwire_string *string); /** * Append a character to the string instance. * * @param string * The string instance to append the character to. * * @param c * The character to append to the string instance. * * @return * 0 on success or -1 on failure. */ int gdbwire_string_append_char(struct gdbwire_string *string, char c); /** * Append a c string to the string instance. * * @param string * The string instance to append the c string to. * * @param cstr * The c string to append to the string instance. * * @return * 0 on success or -1 on failure. */ int gdbwire_string_append_cstr(struct gdbwire_string *string, const char *cstr); /** * Append a sequence of bytes to the string instance. * * @param string * The string instance to append the sequence of bytes to. * * @param data * The sequence of bytes to append to the string instance. This may * contain NUL characters. * * @param size * The number of bytes in data to append to the string instance. * * @return * 0 on success or -1 on failure. */ int gdbwire_string_append_data(struct gdbwire_string *string, const char *data, size_t size); /** * Get the data associated with this string. * * The data could be formatted as a NULL terminated C string or * as an arbitrary array of bytes. Use gdbwire_string_size() to * determine the size (or length) of the result of this function. * * Modifying the return value of this function is acceptable as long as you * stay in the string's valid bounds. * * @param string * The string index to get the pointer data from. * * @return * The data that has been added to this string instance or "" after * creation or clear. The result is gdbwire_string_size() bytes long. */ char *gdbwire_string_data(struct gdbwire_string *string); /** * Determine the size (the number of bytes) this string instance represents. * * Please note, the result of this function will not include the NULL * terminated character when using the gdbwire_string_append_cstr() function * to append data. * * @param string * The string instance to get the size for. * * @return * The number of bytes contained in this string instance. To access these * bytes see gdbwire_string_data(). Will be 0 after creation or clear. */ size_t gdbwire_string_size(struct gdbwire_string *string); /** * Determine the maximum capacity (number of bytes) this string may hold. * * The max capacity of the string is automatically increased when data * is appended to this string through the gdbwire_string_append_*() * family of functions. * * @param string * The string to determine the capacity of. * * @return * The max number of bytes this string may hold. */ size_t gdbwire_string_capacity(struct gdbwire_string *string); /** * Search for the first character in chars occuring in this string. * * @param string * The string to search for the characters in chars in. * * @param chars * A null terminated string of characters. This string is not searched * for directly but instead each individually character in the string * is searched for. * * @return * The index position of the first matched character in chars. * Will return gdbwire_string_size() if not found. */ size_t gdbwire_string_find_first_of(struct gdbwire_string *string, const char *chars); /** * Erase characters from this string, reducing it's size. * * @param string * The string to erase characters from. * * @param pos * The index position of the first character to be erased. * * @param count * The number of characters to erase starting at position pos. * If count goes past the end of the string it is adjusted to erase * until the end of the string. This allows the caller to pass in * gdbwire_string_size() to erase the end of the string with out * doing index arithmetic. * * @return * On success 0 will be returned otherwise -1. The string will remain * unmodified when an error occurs. Success can only occur if the entire * requested range can be erased. */ int gdbwire_string_erase(struct gdbwire_string *string, size_t pos, size_t count); #ifdef __cplusplus } #endif #endif /***** End of gdbwire_string.h ***********************************************/ /***** Continuing where we left off in gdbwire_string.c **********************/ struct gdbwire_string { /* The bytes that make up the string. May contain NUL characters. */ char *data; /* The number of bytes occuring in data at the moment. */ size_t size; /* The max capacity of the string */ size_t capacity; }; struct gdbwire_string * gdbwire_string_create(void) { struct gdbwire_string *string; string = calloc(1, sizeof (struct gdbwire_string)); if (string) { if (gdbwire_string_append_cstr(string, "") == -1) { gdbwire_string_destroy(string); string = NULL; } } return string; } void gdbwire_string_destroy(struct gdbwire_string *string) { if (string) { if (string->data) { free(string->data); string->data = NULL; } string->size = 0; string->capacity = 0; free(string); } } void gdbwire_string_clear(struct gdbwire_string *string) { if (string) { string->size = 0; string->data[0] = '\0'; } } /** * Increase the size of the string capacity. * * @param string * The string to increase the capacity. * * @return * 0 on success or -1 on error. */ static int gdbwire_string_increase_capacity(struct gdbwire_string *string) { /** * The algorithm chosen to increase the capacity is arbitrary. * It starts at 128 bytes. It then doubles it's size in bytes like this, * 128, 256, 512, 1024, 2048, 4096 * After it reaches 4096 it then grows by 4096 bytes at a time. */ if (string->capacity == 0) { string->capacity = 128; } else if (string->capacity < 4096) { string->capacity *= 2; } else { string->capacity += 4096; } /* At this point string->capacity is set to the new size, so realloc */ string->data = (char*)realloc(string->data, string->capacity); return (string->data) ? 0 : -1; } int gdbwire_string_append_char(struct gdbwire_string *string, char c) { return gdbwire_string_append_data(string, &c, 1); } int gdbwire_string_append_cstr(struct gdbwire_string *string, const char *cstr) { int result; if (string && cstr) { size_t length = strlen(cstr) + 1; result = gdbwire_string_append_data(string, cstr, length); /* Do not include the NUL character in the size for NULL terminated * strings. This is documented in the interface. */ if (result == 0) { string->size--; } } else { result = -1; } return result; } int gdbwire_string_append_data(struct gdbwire_string *string, const char *data, size_t size) { int result = (string && data) ? 0 : -1; size_t data_index = 0; for (; string && data && data_index < size; ++data_index, ++string->size) { if (string->size >= string->capacity) { result = gdbwire_string_increase_capacity(string); if (result == -1) { break; } } string->data[string->size] = data[data_index]; } return result; } char * gdbwire_string_data(struct gdbwire_string *string) { char *result = NULL; if (string) { result = string->data; } return result; } size_t gdbwire_string_size(struct gdbwire_string *string) { return string->size; } size_t gdbwire_string_capacity(struct gdbwire_string *string) { return string->capacity; } size_t gdbwire_string_find_first_of(struct gdbwire_string *string, const char *chars) { size_t data_pos, data_size = 0; char *data_cur; const char *chars_cur; if (string && chars) { data_size = gdbwire_string_size(string); data_cur = gdbwire_string_data(string); for (data_pos = 0; data_pos < data_size; ++data_pos) { char data_c = data_cur[data_pos]; for (chars_cur = chars; *chars_cur; ++chars_cur) { if (data_c == *chars_cur) { return data_pos; } } } } return data_size; } int gdbwire_string_erase(struct gdbwire_string *string, size_t pos, size_t count) { int result = -1; if (string) { size_t count_erased = count; size_t data_size = gdbwire_string_size(string); char *data = gdbwire_string_data(string); /* The position index must be smaller than the data size to be valid */ if (pos < data_size) { size_t from_pos = pos + count; /** * Check to see if anything needs to be copied. * If not, just null terminate the position to be erased * Null terminating the string ensures the c string and the data * string approach are both safe. In the data mode, the nul * character is unneeded. */ if (from_pos >= data_size) { data[pos] = 0; count_erased = data_size - pos; /* If so, move characters from the from position to the to position */ } else { char *to_cur = &data[pos], *from_cur = &data[from_pos]; /* shift everything after the erase request to the left */ for (; from_pos < data_size; ++from_pos, ++to_cur, ++from_cur) { *to_cur = *from_cur; } } string->size -= count_erased; result = 0; } } return result; } /***** End of gdbwire_string.c ***********************************************/ /***** Begin file gdbwire_logger.c *******************************************/ #include #include #include /***** Include gdbwire_logger.h in the middle of gdbwire_logger.c ************/ /***** Begin file gdbwire_logger.h *******************************************/ #ifndef __GDBWIRE_LOGGER_H__ #define __GDBWIRE_LOGGER_H__ /***** Include gdbwire_result.h in the middle of gdbwire_logger.h ************/ /***** Begin file gdbwire_result.h *******************************************/ #ifndef GDBWIRE_RESULT_H #define GDBWIRE_RESULT_H enum gdbwire_result { /* The result of the operation was successful */ GDBWIRE_OK, /** * An assertion failed in the calling code. * * Functions are encouraged to assert expressions they expect * to be true. The macro GDBWIRE_ASSERT and GDBWIRE_ASSERT_ERRNO * are useful for asserting expressions, and upon failure, to * automatically log the assertion expression and return * this result status. */ GDBWIRE_ASSERT, /** * An internal logic error has occurred. * * In general, this should be used when a function can no * longer carry out it's contract and must abort. * * This happens, for instance, when a called function returns * an error status, or when invalid input was provided, etc. */ GDBWIRE_LOGIC, /** * The system is out of memory. * * Will occur when malloc, strdup, calloc, etc fail to allocate memory. */ GDBWIRE_NOMEM }; #endif /* GDBWIRE_RESULT_H */ /***** End of gdbwire_result.h ***********************************************/ /***** Continuing where we left off in gdbwire_logger.h **********************/ #ifdef __cplusplus extern "C" { #endif enum gdbwire_logger_level { GDBWIRE_LOGGER_DEBUG, GDBWIRE_LOGGER_INFO, GDBWIRE_LOGGER_WARN, GDBWIRE_LOGGER_ERROR }; /** * Log a statement to the logger. * * This is typically not called directly. Use the below macros instead. * The macros automatically supply the file, line and level arguments. * * @param file * The filename the logger was invoked from. * * @param line * The line number the logger was invoked from. * * @param level * The level associated with the log message. * * @param fmt * The format string for the message (printf formatting). * * @param ... * Any additional format arguments. */ void gdbwire_logger_log(const char *file, int line, enum gdbwire_logger_level level, const char *fmt, ...) #ifdef __GNUC__ __attribute__((__format__(__printf__, 4, 5))) #endif ; /* The macros intended to be used for logging */ #define gdbwire_debug(fmt, ...)(gdbwire_logger_log(__FILE__, __LINE__, \ GDBWIRE_LOGGER_DEBUG, fmt, ##__VA_ARGS__)) #define gdbwire_info(fmt, ...)(gdbwire_logger_log(__FILE__, __LINE__, \ GDBWIRE_LOGGER_INFO, fmt, ##__VA_ARGS__)) #define gdbwire_warn(fmt, ...)(gdbwire_logger_log(__FILE__, __LINE__, \ GDBWIRE_LOGGER_WARN, fmt, ##__VA_ARGS__)) #define gdbwire_error(fmt, ...)(gdbwire_logger_log(__FILE__, __LINE__, \ GDBWIRE_LOGGER_ERROR, fmt, ##__VA_ARGS__)) #ifdef __cplusplus } #endif #endif /***** End of gdbwire_logger.h ***********************************************/ /***** Continuing where we left off in gdbwire_logger.c **********************/ static const char *gdbwire_logger_level_str[GDBWIRE_LOGGER_ERROR+1] = { "DEBUG", "INFO", "WARN", "ERROR" }; void gdbwire_logger_log(const char *file, int line, enum gdbwire_logger_level level, const char *fmt, ...) { static int checked_env = 0; static int gdbwire_debug_to_stderr; char *buf; int size; va_list ap; va_start(ap, fmt); size = vsnprintf(0, 0, fmt, ap); buf = malloc(sizeof(char)*size + 1); va_start(ap, fmt); size = vsnprintf(buf, size + 1, fmt, ap); va_end(ap); if (checked_env == 0) { checked_env = 1; gdbwire_debug_to_stderr = getenv("GDBWIRE_DEBUG_TO_STDERR") != NULL; } if (gdbwire_debug_to_stderr) { fprintf(stderr, "gdbwire_logger_log: [%s] %s:%d %s\n", gdbwire_logger_level_str[level], file, line, buf); } free(buf); } /***** End of gdbwire_logger.c ***********************************************/ /***** Begin file gdbwire_mi_parser.c ****************************************/ #include #include #include /* #include "gdbwire_sys.h" */ /***** Include gdbwire_assert.h in the middle of gdbwire_mi_parser.c *********/ /***** Begin file gdbwire_assert.h *******************************************/ #ifndef GDBWIRE_ERROR_H #define GDBWIRE_ERROR_H /* #include "gdbwire_result.h" */ /* #include "gdbwire_logger.h" */ /** * Validate that the expression evaluates to true. * * If the expression does not evaluate to true, log the error and * return a GDBWIRE_ASSERT status code. * * Otherwise, if the expression does evaluate to true, do nothing. * * @param expr * The expression to evaluate. */ #define GDBWIRE_ASSERT(expr) \ do { \ if (!(expr)) { \ gdbwire_error("Assertion failure, expr[%s]", #expr); \ return GDBWIRE_ASSERT; \ } \ } while (0) /** * Validate that the expression evaluates to true. * * If the expression does not evaluate to true, log the error, * set the variable provided to GDBWIRE_ASSERT and goto the label * provided. * * Otherwise, if the expression does evaluate to true, do nothing. * * @param expr * The expression to evaluate. * * @param variable * The result variable to assign the value GDBWIRE_ASSERT to. * * @param label * The label to jump to if the expression evaluates to False. */ #define GDBWIRE_ASSERT_GOTO(expr, variable, label) \ do { \ if (!(expr)) { \ gdbwire_error("Assertion failure, expr[%s], " \ "label[%s]", #expr, #label); \ variable = GDBWIRE_ASSERT; \ goto label; \ } \ } while (0) /** * Validate that the expression evaluates to true. * * This particular assertion macro is used when a system library * call fails and that library call has an associated errno status * to describe the failure reason. * * If the expression does not evaluate to true, log the error, * along with the errno value and message and return a GDBWIRE_ASSERT * status code. * * Otherwise, if the expression does evaluate to true, do nothing. * * @param expr * The expression to evaluate. */ #define GDBWIRE_ASSERT_ERRNO(expr) \ do { \ if (!(expr)) { \ gdbwire_error("Assertion failure, expr[%s]," \ "errno[%d], strerror[%s]", \ #expr, errno, strerror(errno)); \ return GDBWIRE_ASSERT; \ } \ } while (0) #endif /* GDBWIRE_ERROR_H */ /***** End of gdbwire_assert.h ***********************************************/ /***** Continuing where we left off in gdbwire_mi_parser.c *******************/ /***** Include gdbwire_mi_grammar.h in the middle of gdbwire_mi_parser.c *****/ /***** Begin file gdbwire_mi_grammar.h ***************************************/ /* A Bison parser, made by GNU Bison 3.0.4. */ /* Bison interface for Yacc-like parsers in C Copyright (C) 1984, 1989-1990, 2000-2015 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. */ #ifndef YY_GDBWIRE_MI_SRC_GDBWIRE_MI_GRAMMAR_H_INCLUDED # define YY_GDBWIRE_MI_SRC_GDBWIRE_MI_GRAMMAR_H_INCLUDED /* Debug traces. */ #ifndef YYDEBUG # define YYDEBUG 0 #endif #if YYDEBUG extern int gdbwire_mi_debug; #endif /* "%code requires" blocks. */ /* An opaque pointer. */ #ifndef YY_TYPEDEF_YY_SCANNER_T #define YY_TYPEDEF_YY_SCANNER_T typedef void *yyscan_t; #endif struct gdbwire_mi_output; /* Token type. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE 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 /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED union YYSTYPE { struct gdbwire_mi_output *u_output; struct gdbwire_mi_oob_record *u_oob_record; struct gdbwire_mi_result_record *u_result_record; int u_result_class; int u_async_record_kind; struct gdbwire_mi_result_list *u_result_list; struct gdbwire_mi_result *u_result; char *u_token; struct gdbwire_mi_async_record *u_async_record; struct gdbwire_mi_stream_record *u_stream_record; int u_async_class; char *u_variable; char *u_cstring; struct gdbwire_mi_result *u_tuple; struct gdbwire_mi_result *u_list; int u_stream_record_kind; }; typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1 #endif #ifndef YYPUSH_MORE_DEFINED # define YYPUSH_MORE_DEFINED enum { YYPUSH_MORE = 4 }; #endif typedef struct gdbwire_mi_pstate gdbwire_mi_pstate; int gdbwire_mi_push_parse (gdbwire_mi_pstate *ps, int pushed_char, YYSTYPE const *pushed_val, yyscan_t yyscanner, struct gdbwire_mi_output **gdbwire_mi_output); gdbwire_mi_pstate * gdbwire_mi_pstate_new (void); void gdbwire_mi_pstate_delete (gdbwire_mi_pstate *ps); #endif /* !YY_GDBWIRE_MI_SRC_GDBWIRE_MI_GRAMMAR_H_INCLUDED */ /***** End of gdbwire_mi_grammar.h *******************************************/ /***** Continuing where we left off in gdbwire_mi_parser.c *******************/ /***** Include gdbwire_mi_parser.h in the middle of gdbwire_mi_parser.c ******/ /***** Begin file gdbwire_mi_parser.h ****************************************/ #ifndef GDBWIRE_MI_PARSER_H #define GDBWIRE_MI_PARSER_H #ifdef __cplusplus extern "C" { #endif /* #include "gdbwire_result.h" */ /***** Include gdbwire_mi_pt.h in the middle of gdbwire_mi_parser.h **********/ /***** Begin file gdbwire_mi_pt.h ********************************************/ #ifndef GDBWIRE_MI_PT_H #define GDBWIRE_MI_PT_H #ifdef __cplusplus extern "C" { #endif /** * The position of a token in a GDB/MI line. * * Note that a string in C is zero based and the token column * position is 1 based. For example, * char *str = "hello world"; * The "hello" token would have a start_column as 1 and an end * column as 5. * * The start_column and end_column will be the same column number for * a token of size 1. */ struct gdbwire_mi_position { /* The starting column position of the token */ int start_column; /* The ending column position of the token */ int end_column; }; /** The gdbwire_mi output kinds. */ enum gdbwire_mi_output_kind { /** * The GDB/MI output contains an out of band record. * * The out of band record is not necessarily associated with any * particular GDB/MI input command. */ GDBWIRE_MI_OUTPUT_OOB, /** * The GDB/MI output contains a gdbwire_mi result record. * * This record typically contains the result data from a request * made by the client in a previous GDB/MI input command. */ GDBWIRE_MI_OUTPUT_RESULT, /** * The GDB/MI output represents a prompt. (ie. (gdb) ) * * TODO: Document when GDB is ready to receive a command. Only if * the prompt is received and at *stopped? */ GDBWIRE_MI_OUTPUT_PROMPT, /** * A parse error occurred. */ GDBWIRE_MI_OUTPUT_PARSE_ERROR }; /** * The GDB/MI output command. * * A GDB/MI output command is the main mechanism in which GDB * corresponds with a front end. */ struct gdbwire_mi_output { enum gdbwire_mi_output_kind kind; union { /** When kind == GDBWIRE_MI_OUTPUT_OOB, never NULL. */ struct gdbwire_mi_oob_record *oob_record; /** When kind == GDBWIRE_MI_OUTPUT_RESULT, never NULL. */ struct gdbwire_mi_result_record *result_record; /** When kind == GDBWIRE_MI_OUTPUT_PARSE_ERROR, never NULL. */ struct { /** The token the error occurred on */ char *token; /** The position of the token where the error occurred. */ struct gdbwire_mi_position pos; } error; } variant; /** * The GDB/MI output line that was used to create this output instance. * * Each gdbwire_mi output structure is created from exactly one line of * MI output from GDB. This field represents the line that created * this particular output structure. * * This field is always available and never NULL, even for a parse error. */ char *line; /** The next GDB/MI output command or NULL if none */ struct gdbwire_mi_output *next; }; /** * A GDB/MI token. * * A string made up of one or more digits. * The regular expression [0-9]+ will match this types contents. */ typedef char *gdbwire_mi_token_t; /** * A GDB/MI output command may contain one of the following result indications. */ enum gdbwire_mi_result_class { /** * The synchronous operation was successful (^done). */ GDBWIRE_MI_DONE, /** * Equivalent to GDBWIRE_MI_DONE (^running). * * Historically, was output by GDB instead of ^done if the command * resumed the target. * * Do not rely on or use this result class in the front end to determine * the state of the target. Use the async *running output record to * determine which threads have resumed running. * * TODO: Ensure that early versions of GDB can depend on the async * *running or if front ends DO have to rely on ^running. */ GDBWIRE_MI_RUNNING, /** * GDB has connected to a remote target (^connected). * * This is in response to the -target-select command. * * A comment in the GDB source code says, * There's no particularly good reason why target-connect results * in not ^done. Should kill ^connected for MI3. * * With this in mind, it makes sense to assume that GDBWIRE_MI_CONNECTED * and GDBWIRE_MI_DONE are equivalent. */ GDBWIRE_MI_CONNECTED, /** * An error has occurred (^error). * * This can occur if the user provides an improper command to GDB. * In this case, the user will be provided the standard error output but * the front end will also be provided this information independently. */ GDBWIRE_MI_ERROR, /** * GDB has terminated (^exit). * * When GDB knows it is about to exit, it provides this notification * in the GDB/MI output command. However, on all other circumstances, * the front end should be prepared to have GDB exit and not provide * this information. */ GDBWIRE_MI_EXIT, /* An unsupported result class */ GDBWIRE_MI_UNSUPPORTED }; /** * The GDB/MI result record in an output command. * * The result record represents the result data in the GDB/MI output * command sent by GDB. This typically contains the content the client * was requesting when it sent a GDB/MI input command to GDB. */ struct gdbwire_mi_result_record { /** * The token associated with the corresponding GDB/MI input command. * * The client may provide a unique string of digits at the beginning of a * GDB/MI input command. For example, * 0000-foo * When GDB finally gets around to responding to the GDB/MI input command, * it takes the token provided in the input command and puts it into the * result record of the corresponding GDB/MI output command. For * example, the output commmand associated with the above input command is, * 0000^error,msg="Undefined MI command: foo",code="undefined-command" * and the result record would have the below token field set to "0000". * * This is intended to allow the front end to correlate the GDB/MI input * command it sent with the GDB/MI output command GDB responded with. * * This represents the token value the front end provided to the * corresponding GDB/MI input command or NULL if no token was provided. */ gdbwire_mi_token_t token; /** The result records result class. */ enum gdbwire_mi_result_class result_class; /** * An optional list of results for this result record. * * Will be NULL if there is no results for this result record. * * This is typically where the result data is that the client * is looking for. */ struct gdbwire_mi_result *result; }; /** The out of band record kinds. */ enum gdbwire_mi_oob_record_kind { /** * An asyncronous out of band record. * * An asyncronous record occurs when GDB would like to update the * client with information that it has not asked for. * * For instance, if the inferior has stopped, or a new thread has * started. */ GDBWIRE_MI_ASYNC, /** * A stream out of band record. * * This is the result of normal output from the console, target or GDB. */ GDBWIRE_MI_STREAM }; /* This is an out of band record. */ struct gdbwire_mi_oob_record { /** The kind of out of band record. */ enum gdbwire_mi_oob_record_kind kind; union { /** When kind == GDBWIRE_MI_ASYNC. */ struct gdbwire_mi_async_record *async_record; /** When kind == GDBWIRE_MI_STREAM. */ struct gdbwire_mi_stream_record *stream_record; } variant; }; /** The asynchronous out of band record kinds */ enum gdbwire_mi_async_record_kind { /** * The asynchronous status record kind. * * Contains on-going status information about the progress of a slow * operation. It can be discarded. * * This output is prepended by the + character. */ GDBWIRE_MI_STATUS, /** * The asynchronous exec record kind. * * Contains asynchronous state change regarding the target: * (stopped, started, disappeared). * * This output is prepended by the * character. */ GDBWIRE_MI_EXEC, /** * The asyncronous notify record kind. * * Contains supplementary information that the client should handle * (e.g., a new breakpoint information). * * This output is prepended by the = character. */ GDBWIRE_MI_NOTIFY }; /** The stream out of band record kinds */ enum gdbwire_mi_stream_record_kind { /** * The console output. * * Output that should be displayed as is in the console. * It is the textual response to a CLI command. * * This output is prepended by the ~ character. */ GDBWIRE_MI_CONSOLE, /** * The target output. * * Output produced by the target program. * * This output is prepended by the @ character. */ GDBWIRE_MI_TARGET, /** * The GDB log output. * * Output text coming from GDB's internals. For instance messages * that should be displayed as part of an error log. * * This output is prepended by the & character. */ GDBWIRE_MI_LOG }; /** * The GDB/MI asyncronous class. * * */ enum gdbwire_mi_async_class { /** * Loading the executable onto the remote target. * * This was undocumented in the GDB manual as far as GDB 7.7. * * This occurs if the async record is GDBWIRE_MI_STATUS as +download. */ GDBWIRE_MI_ASYNC_DOWNLOAD, /** * The target has stopped. * * This occurs if the async record is GDBWIRE_MI_EXEC as *stopped. */ GDBWIRE_MI_ASYNC_STOPPED, /** * The target is now running. * * This occurs if the async record is GDBWIRE_MI_EXEC as *running. */ GDBWIRE_MI_ASYNC_RUNNING, /** * Reports that a thread group was added. * * When a thread group is added, it generally might not be associated * with a running process. * * This occurs if the async record is GDBWIRE_MI_NOTIFY * as =thread-group-added. */ GDBWIRE_MI_ASYNC_THREAD_GROUP_ADDED, /** * Reports that a thread group was removed. * * When a thread group is removed, its id becomes invalid and cannot be * used in any way. * * This occurs if the async record is GDBWIRE_MI_NOTIFY * as =thread-group-removed. */ GDBWIRE_MI_ASYNC_THREAD_GROUP_REMOVED, /** * Reports that a thread group was started. * * A thread group became associated with a running program. * * This occurs if the async record is GDBWIRE_MI_NOTIFY * as =thread-group-started. */ GDBWIRE_MI_ASYNC_THREAD_GROUP_STARTED, /** * Reports that a thread group was exited. * * A thread group is no longer associated with a running program. * * This occurs if the async record is GDBWIRE_MI_NOTIFY * as =thread-group-exited. */ GDBWIRE_MI_ASYNC_THREAD_GROUP_EXITED, /** * Reports that a thread was created. * * This occurs if the async record is GDBWIRE_MI_NOTIFY * as =thread-created. */ GDBWIRE_MI_ASYNC_THREAD_CREATED, /** * Reports that a thread was exited. * * This occurs if the async record is GDBWIRE_MI_NOTIFY as =thread-exited. */ GDBWIRE_MI_ASYNC_THREAD_EXITED, /** * Reports that a thread was selected. * * This occurs if the async record is GDBWIRE_MI_NOTIFY as =thread-selected. */ GDBWIRE_MI_ASYNC_THREAD_SELECTED, /** * Reports that a new library was loaded. * * This occurs if the async record is GDBWIRE_MI_NOTIFY as =library-loaded. */ GDBWIRE_MI_ASYNC_LIBRARY_LOADED, /** * Reports that a new library was unloaded. * * This occurs if the async record is GDBWIRE_MI_NOTIFY * as =library-unloaded. */ GDBWIRE_MI_ASYNC_LIBRARY_UNLOADED, /** * Reports that a trace frame was changed. * * This occurs if the async record is GDBWIRE_MI_NOTIFY * as =traceframe-changed. */ GDBWIRE_MI_ASYNC_TRACEFRAME_CHANGED, /** * Reports that a trace state variable was created. * * This occurs if the async record is GDBWIRE_MI_NOTIFY as =tsv-created. */ GDBWIRE_MI_ASYNC_TSV_CREATED, /** * Reports that a trace state variable was modified. * * This occurs if the async record is GDBWIRE_MI_NOTIFY as =tsv-modified. */ GDBWIRE_MI_ASYNC_TSV_MODIFIED, /** * Reports that a trace state variable was deleted. * * This occurs if the async record is GDBWIRE_MI_NOTIFY as =tsv-deleted. */ GDBWIRE_MI_ASYNC_TSV_DELETED, /** * Reports that a breakpoint was created. * * Only user-visible breakpoints are reported to the MI user. * * If a breakpoint is emitted in the result record of a * command, then it will not also be emitted in an async record. * * This occurs if the async record is GDBWIRE_MI_NOTIFY * as =breakpoint-created. */ GDBWIRE_MI_ASYNC_BREAKPOINT_CREATED, /** * Reports that a breakpoint was modified. * * Only user-visible breakpoints are reported to the MI user. * * If a breakpoint is emitted in the result record of a * command, then it will not also be emitted in an async record. * * This occurs if the async record is GDBWIRE_MI_NOTIFY * as =breakpoint-modified. */ GDBWIRE_MI_ASYNC_BREAKPOINT_MODIFIED, /** * Reports that a breakpoint was deleted. * * Only user-visible breakpoints are reported to the MI user. * * If a breakpoint is emitted in the result record of a * command, then it will not also be emitted in an async record. * * This occurs if the async record is GDBWIRE_MI_NOTIFY * as =breakpoint-deleted. */ GDBWIRE_MI_ASYNC_BREAKPOINT_DELETED, /** * Reports that execution log recording was started on an inferior. * * This occurs if the async record is GDBWIRE_MI_NOTIF * as =record-started. */ GDBWIRE_MI_ASYNC_RECORD_STARTED, /** * Reports that execution log recording was stopped on an inferior. * * This occurs if the async record is GDBWIRE_MI_NOTIFY * as =record-stopped. */ GDBWIRE_MI_ASYNC_RECORD_STOPPED, /** * Reports that a parameter of the command set param is changed to value. * * For example, when the user runs a command like 'set print pretty on', * this async command will be invoked with the parameter reported as * 'print pretty' and the value as 'on'. * * This occurs if the async record is GDBWIRE_MI_NOTIFY * as =cmd-param-changed. */ GDBWIRE_MI_ASYNC_CMD_PARAM_CHANGED, /** * Reports that bytes from addr to data + len were written in an inferior. * * This occurs if the async record is GDBWIRE_MI_NOTIFY * as =memory-changed. */ GDBWIRE_MI_ASYNC_MEMORY_CHANGED, /* An unsupported async class */ GDBWIRE_MI_ASYNC_UNSUPPORTED }; /** * The GDB/MI asyncronous record in an output command. * * An asyncronous record occurs when GDB would like to update the * client with information that it has not asked for. */ struct gdbwire_mi_async_record { /** * The result record token. * * Please note that the GDB/MI manual says that asyncronous records * do not currently populate this token on output but reserve the right * to do so. For that reason, token here should always be NULL. * * From the GDB documentation: * Note that for all async output, while the token is allowed by the * grammar and may be output by future versions of gdb for select async * output messages, it is generally omitted. Frontends should treat all * async output as reporting general changes in the state of the target * and there should be no need to associate async output to any prior * command. * * After further investigation, I determined that newer GDB's will no * longer ever output this information. Older GDB's will. The commit * that made this change in GDB is 721c02de on April 24th, 2008. * The next GDB that was released was on October 6th, 2009, version 7.0. * * Before the above mentioned commit async *stopped commands would * sometimes output the token associated with the last token provided in * a GDB/MI input command. After that change, the token is never * associated with an async output command, even though the * documentation says it might be. * * Finally, even before that change when the token was output in the * async *stopped command, the developers of GDB felt that it was not * useful and should be avoided by front ends. * * With this information, I've determined that front ends should never * use this value to determine logic. However, the value is parsed in * order to accurately handle and represent the cases where this value * occurs. * * This represents the token value the front end provided to the * corresponding GDB/MI input command or NULL if no token was provided. */ gdbwire_mi_token_t token; /** The kind of asynchronous record. */ enum gdbwire_mi_async_record_kind kind; /** The asynchronous output class */ enum gdbwire_mi_async_class async_class; /** * An optional list of results for this async output. * * Will be NULL if there is no results. */ struct gdbwire_mi_result *result; }; /** The GDB/MI result kind */ enum gdbwire_mi_result_kind { /** The result is a cstring */ GDBWIRE_MI_CSTRING, /** The result is a tuple */ GDBWIRE_MI_TUPLE, /** The result is a list */ GDBWIRE_MI_LIST }; /** * A GDB/MI result list. * * This is one of the important GDB/MI data structures. GDB communicates many * of it's values to the front end through this key/value data structure. * * It is basically a list of key/value pairs, where the key is a * variable name and the value expands to a string, a tuple of results or * a list of results. * * This can be thought of as a custom json object. */ struct gdbwire_mi_result { /** The kind of result this represents. */ enum gdbwire_mi_result_kind kind; /** The key being described by the result. */ char *variable; union { /** When kind is GDBWIRE_MI_CSTRING */ char *cstring; /** * When kind is GDBWIRE_MI_TUPLE or GDBWIRE_MI_LIST. * * If kind is GDBWIRE_MI_TUPLE, each result in the tuple should have a * valid key according to the GDB/MI specification. That is, for * each result, result->variable should not be NULL. * Note: GDBWIRE currently relaxes the above rule. It allows tuple's * with out a key in each member. For instance, {key="value"} * is what the GDB/MI specification advocates for, but some * variations of GDB emit {"value"} and so GDBWIRE allows it. * * If kind is GDBWIRE_MI_LIST, the GDB/MI specification allows * results in this list to not have keys. That is, for each result, * result->variable may be NULL. * * Will be NULL if the tuple or list is empty. */ struct gdbwire_mi_result *result; } variant; /** The next result or NULL if none */ struct gdbwire_mi_result *next; }; /** * An out of band GDB/MI stream record. * * A stream record is intended to provide the front end with information * from the console, the target or from GDB itself. */ struct gdbwire_mi_stream_record { /** The kind of stream record. */ enum gdbwire_mi_stream_record_kind kind; /** The buffer provided in this stream record. */ char *cstring; }; void gdbwire_mi_output_free(struct gdbwire_mi_output *param); struct gdbwire_mi_output *append_gdbwire_mi_output( struct gdbwire_mi_output *list, struct gdbwire_mi_output *item); struct gdbwire_mi_result *append_gdbwire_mi_result( struct gdbwire_mi_result *list, struct gdbwire_mi_result *item); #ifdef __cplusplus } #endif #endif /***** End of gdbwire_mi_pt.h ************************************************/ /***** Continuing where we left off in gdbwire_mi_parser.h *******************/ /* The opaque GDB/MI parser context */ struct gdbwire_mi_parser; /** * The primary mechanism to alert users of GDB/MI notifications. * * The flow is like this: * - create a parser context (gdbwire_mi_parser_create) * - push onto the parser arbitrary amounts of data (gdbwire_mi_parser_push) * - receive callbacks from inside gdbwire_mi_parser_push when * it discovers callbacks the user will find interesting * - destroy the parser (gdbwire_mi_parser_destroy) */ struct gdbwire_mi_parser_callbacks { /** * An arbitrary pointer to associate with the callbacks. * * If the calling api is C++ it is useful to make this an instance * of an object you want to bind to the callback functions below. */ void *context; /** * A GDB/MI output command is available. * * @param context * The context pointer above. * * @param output * The gdbwire_mi output command. This output command is now owned by the * function being invoked and should be destroyed when necessary. */ void (*gdbwire_mi_output_callback)(void *context, struct gdbwire_mi_output *output); }; /** * Create a GDB/MI parser context. * * @param callbacks * The callback functions to invoke upon discovery of parse data. * * @return * A new GDB/MI parser instance or NULL on error. */ struct gdbwire_mi_parser *gdbwire_mi_parser_create( struct gdbwire_mi_parser_callbacks callbacks); /** * Destroy a gdbwire_mi_parser context. * * This function will do nothing if parser is NULL. * * @param parser * The instance the parser to destroy */ void gdbwire_mi_parser_destroy(struct gdbwire_mi_parser *parser); /** * Push a null terminated string onto the parser. * * During this function, if a gdbwire_mi output command is discovered by * the parser (or any other useful GDB/MI notification), it will invoke * the appropriate callbacks assigned during parser creation. * * @param parser * The gdbwire_mi parser context to operate on. * * @param data * The parse data to push onto the parser. * * @return * GDBWIRE_OK on success or appropriate error result on failure. */ enum gdbwire_result gdbwire_mi_parser_push(struct gdbwire_mi_parser *parser, const char *data); /** * Push some parse data onto the parser. * * See gdbwire_mi_parser_push for details on function behavior. * * @param parser * The gdbwire_mi parser context to operate on. * * @param data * The parse data to push onto the parser. * * @param size * The size of the data to push onto the parser. * * @return * GDBWIRE_OK on success or appropriate error result on failure. */ enum gdbwire_result gdbwire_mi_parser_push_data( struct gdbwire_mi_parser *parser, const char *data, size_t size); #ifdef __cplusplus } #endif #endif /***** End of gdbwire_mi_parser.h ********************************************/ /***** Continuing where we left off in gdbwire_mi_parser.c *******************/ /* #include "gdbwire_string.h" */ /* flex prototypes used in this unit */ #ifndef YY_TYPEDEF_YY_SCANNER_T #define YY_TYPEDEF_YY_SCANNER_T typedef void *yyscan_t; #endif #ifndef YY_TYPEDEF_YY_BUFFER_STATE #define YY_TYPEDEF_YY_BUFFER_STATE typedef struct yy_buffer_state *YY_BUFFER_STATE; #endif /* Lexer set/destroy buffer to parse */ extern YY_BUFFER_STATE gdbwire_mi__scan_string( const char *yy_str, yyscan_t yyscanner); extern void gdbwire_mi__delete_buffer(YY_BUFFER_STATE state, yyscan_t yyscanner); /* Lexer get token function */ extern int gdbwire_mi_lex(yyscan_t yyscanner); extern char *gdbwire_mi_get_text(yyscan_t yyscanner); extern void gdbwire_mi_set_column(int column_no, yyscan_t yyscanner); /* Lexer state create/destroy functions */ extern int gdbwire_mi_lex_init(yyscan_t *scanner); extern int gdbwire_mi_lex_destroy(yyscan_t scanner); struct gdbwire_mi_parser { /* The buffer pushed into the parser from the user */ struct gdbwire_string *buffer; /* The GDB/MI lexer state */ yyscan_t mils; /* The GDB/MI push parser state */ gdbwire_mi_pstate *mipst; /* The client parser callbacks */ struct gdbwire_mi_parser_callbacks callbacks; }; struct gdbwire_mi_parser * gdbwire_mi_parser_create(struct gdbwire_mi_parser_callbacks callbacks) { struct gdbwire_mi_parser *parser; parser = (struct gdbwire_mi_parser *)calloc(1, sizeof(struct gdbwire_mi_parser)); if (!parser) { return NULL; } /* Create a new buffer for the user to push parse data into */ parser->buffer = gdbwire_string_create(); if (!parser->buffer) { free(parser); return NULL; } /* Create a new lexer state instance */ if (gdbwire_mi_lex_init(&parser->mils) != 0) { gdbwire_string_destroy(parser->buffer); free(parser); return NULL; } /* Create a new push parser state instance */ parser->mipst = gdbwire_mi_pstate_new(); if (!parser->mipst) { gdbwire_mi_lex_destroy(parser->mils); gdbwire_string_destroy(parser->buffer); free(parser); return NULL; } /* Ensure that the callbacks are non null */ if (!callbacks.gdbwire_mi_output_callback) { gdbwire_mi_pstate_delete(parser->mipst); gdbwire_mi_lex_destroy(parser->mils); gdbwire_string_destroy(parser->buffer); free(parser); return NULL; } parser->callbacks = callbacks; return parser; } void gdbwire_mi_parser_destroy(struct gdbwire_mi_parser *parser) { if (parser) { /* Free the parse buffer */ if (parser->buffer) { gdbwire_string_destroy(parser->buffer); parser->buffer = NULL; } /* Free the lexer instance */ if (parser->mils) { gdbwire_mi_lex_destroy(parser->mils); parser->mils = 0; } /* Free the push parser instance */ if (parser->mipst) { gdbwire_mi_pstate_delete(parser->mipst); parser->mipst = NULL; } free(parser); parser = NULL; } } static struct gdbwire_mi_parser_callbacks gdbwire_mi_parser_get_callbacks(struct gdbwire_mi_parser *parser) { return parser->callbacks; } /** * Parse a single line of output in GDB/MI format. * * The normal usage of this function is to call it over and over again with * more data lines and wait for it to return an mi output command. * * @param parser * The parser context to operate on. * * @param line * A line of output in GDB/MI format to be parsed. * * \return * GDBWIRE_OK on success or appropriate error result on failure. */ static enum gdbwire_result gdbwire_mi_parser_parse_line(struct gdbwire_mi_parser *parser, const char *line) { struct gdbwire_mi_parser_callbacks callbacks = gdbwire_mi_parser_get_callbacks(parser); struct gdbwire_mi_output *output = 0; YY_BUFFER_STATE state = 0; int pattern, mi_status; GDBWIRE_ASSERT(parser && line); /* Create a new input buffer for flex. */ state = gdbwire_mi__scan_string(line, parser->mils); GDBWIRE_ASSERT(state); gdbwire_mi_set_column(1, parser->mils); /* Iterate over all the tokens found in the scanner buffer */ do { pattern = gdbwire_mi_lex(parser->mils); if (pattern == 0) break; mi_status = gdbwire_mi_push_parse(parser->mipst, pattern, NULL, parser->mils, &output); } while (mi_status == YYPUSH_MORE); /* Free the scanners buffer */ gdbwire_mi__delete_buffer(state, parser->mils); /** * The push parser will return, * - 0 if parsing was successful (return is due to end-of-input). * - 1 if parsing failed because of invalid input, i.e., input * that contains a syntax error or that causes YYABORT to be invoked. * - 2 if parsing failed due to memory exhaustion. * - YYPUSH_MORE if more input is required to finish parsing the grammar. * Anything besides this would be unexpected. * * The grammar is designed to accept an infinate list of GDB/MI * output commands. For this reason, YYPUSH_MORE is the expected * return value of all the calls to gdbwire_mi_push_parse. However, * in reality, gdbwire only translates a line at a time from GDB. * When the line is finished, gdbwire_mi_lex returns 0, and the parsing * is done. */ /* Check mi_status, will be 1 on parse error, and YYPUSH_MORE on success */ GDBWIRE_ASSERT(mi_status == 1 || mi_status == YYPUSH_MORE); /* Each GDB/MI line should produce an output command */ GDBWIRE_ASSERT(output); output->line = gdbwire_strdup(line); callbacks.gdbwire_mi_output_callback(callbacks.context, output); return GDBWIRE_OK; } /** * Get the next line available in the buffer. * * @param buffer * The entire buffer the user has pushed onto the gdbwire_mi parser * through gdbwire_mi_parser_push. If a line is found, the returned line * will be removed from this buffer. * * @param line * Will return as an allocated line if a line is available or NULL * otherwise. If this function does not return GDBWIRE_OK then ignore * the output of this parameter. It is the callers responsibility to * free the memory. * * @return * GDBWIRE_OK on success or appropriate error result on failure. */ static enum gdbwire_result gdbwire_mi_parser_get_next_line(struct gdbwire_string *buffer, struct gdbwire_string **line) { enum gdbwire_result result = GDBWIRE_OK; GDBWIRE_ASSERT(buffer && line); char *data = gdbwire_string_data(buffer); size_t size = gdbwire_string_size(buffer); size_t pos = gdbwire_string_find_first_of(buffer, "\r\n"); /** * Search to see if a newline has been reached in gdb/mi. * If a line of data has been recieved, process it. */ if (pos != size) { int status; /** * We have the position of the newline character from * gdbwire_string_find_first_of. However, the length must be * calculated to make a copy of the line. * * This is either pos + 1 (for \r or \n) or pos + 1 + 1 for (\r\n). * Check for\r\n for the special case. */ size_t line_length = (data[pos] == '\r' && (pos + 1 < size) && data[pos + 1] == '\n') ? pos + 2 : pos + 1; /** * - allocate the buffer * - append the new line * - append a null terminating character * - if successful, delete the new line found from buffer * - any failures cleanup and return an error */ *line = gdbwire_string_create(); GDBWIRE_ASSERT(*line); status = gdbwire_string_append_data(*line, data, line_length); GDBWIRE_ASSERT_GOTO(status == 0, result, cleanup); status = gdbwire_string_append_data(*line, "\0", 1); GDBWIRE_ASSERT_GOTO(status == 0, result, cleanup); status = gdbwire_string_erase(buffer, 0, line_length); GDBWIRE_ASSERT_GOTO(status == 0, result, cleanup); } return result; cleanup: gdbwire_string_destroy(*line); *line = 0; return result; } enum gdbwire_result gdbwire_mi_parser_push(struct gdbwire_mi_parser *parser, const char *data) { return gdbwire_mi_parser_push_data(parser, data, strlen(data)); } enum gdbwire_result gdbwire_mi_parser_push_data(struct gdbwire_mi_parser *parser, const char *data, size_t size) { struct gdbwire_string *line = 0; enum gdbwire_result result = GDBWIRE_OK; int has_newline = 0; size_t index; GDBWIRE_ASSERT(parser && data); /** * No need to parse an MI command until a newline occurs. * * A gdb/mi command may be a very long line. For this reason, it is * better to check the data passed into this function once for a newline * rather than checking all the data every time this function is called. * This optimizes the case where this function is called one character * at a time. */ for (index = size; index > 0; --index) { if (data[index-1] == '\n' || data[index-1] == '\r') { has_newline = 1; break; } } GDBWIRE_ASSERT(gdbwire_string_append_data(parser->buffer, data, size) == 0); if (has_newline) { for (;;) { result = gdbwire_mi_parser_get_next_line(parser->buffer, &line); GDBWIRE_ASSERT_GOTO(result == GDBWIRE_OK, result, cleanup); if (line) { result = gdbwire_mi_parser_parse_line(parser, gdbwire_string_data(line)); gdbwire_string_destroy(line); line = 0; GDBWIRE_ASSERT_GOTO(result == GDBWIRE_OK, result, cleanup); } else { break; } } } cleanup: return result; } /***** End of gdbwire_mi_parser.c ********************************************/ /***** Begin file gdbwire_mi_pt_alloc.c **************************************/ #include /* #include "gdbwire_mi_pt.h" */ /***** Include gdbwire_mi_pt_alloc.h in the middle of gdbwire_mi_pt_alloc.c **/ /***** Begin file gdbwire_mi_pt_alloc.h **************************************/ #ifndef GDBWIRE_MI_PT_ALLOC_H #define GDBWIRE_MI_PT_ALLOC_H #ifdef __cplusplus extern "C" { #endif /** * Responsible for allocating and deallocating gdbwire_mi_pt objects. */ /* struct gdbwire_mi_output */ struct gdbwire_mi_output *gdbwire_mi_output_alloc(void); void gdbwire_mi_output_free(struct gdbwire_mi_output *param); /* struct gdbwire_mi_result_record */ struct gdbwire_mi_result_record *gdbwire_mi_result_record_alloc(void); void gdbwire_mi_result_record_free(struct gdbwire_mi_result_record *param); /* struct gdbwire_mi_result */ struct gdbwire_mi_result *gdbwire_mi_result_alloc(void); void gdbwire_mi_result_free(struct gdbwire_mi_result *param); /* struct gdbwire_mi_oob_record */ struct gdbwire_mi_oob_record *gdbwire_mi_oob_record_alloc(void); void gdbwire_mi_oob_record_free(struct gdbwire_mi_oob_record *param); /* struct gdbwire_mi_async_record */ struct gdbwire_mi_async_record *gdbwire_mi_async_record_alloc(void); void gdbwire_mi_async_record_free(struct gdbwire_mi_async_record *param); /* struct gdbwire_mi_stream_record */ struct gdbwire_mi_stream_record *gdbwire_mi_stream_record_alloc(void); void gdbwire_mi_stream_record_free(struct gdbwire_mi_stream_record *param); #ifdef __cplusplus } #endif #endif /* GDBWIRE_MI_PT_ALLOC_H */ /***** End of gdbwire_mi_pt_alloc.h ******************************************/ /***** Continuing where we left off in gdbwire_mi_pt_alloc.c *****************/ /* struct gdbwire_mi_output */ struct gdbwire_mi_output * gdbwire_mi_output_alloc(void) { return calloc(1, sizeof (struct gdbwire_mi_output)); } void gdbwire_mi_output_free(struct gdbwire_mi_output *param) { if (param) { switch (param->kind) { case GDBWIRE_MI_OUTPUT_OOB: gdbwire_mi_oob_record_free(param->variant.oob_record); param->variant.oob_record = NULL; break; case GDBWIRE_MI_OUTPUT_RESULT: gdbwire_mi_result_record_free(param->variant.result_record); param->variant.result_record = NULL; break; case GDBWIRE_MI_OUTPUT_PROMPT: break; case GDBWIRE_MI_OUTPUT_PARSE_ERROR: free(param->variant.error.token); param->variant.error.token = NULL; break; } free(param->line); param->line = 0; gdbwire_mi_output_free(param->next); param->next = NULL; free(param); param = NULL; } } /* struct gdbwire_mi_result_record */ struct gdbwire_mi_result_record * gdbwire_mi_result_record_alloc(void) { return calloc(1, sizeof (struct gdbwire_mi_result_record)); } void gdbwire_mi_result_record_free(struct gdbwire_mi_result_record *param) { if (param) { free(param->token); gdbwire_mi_result_free(param->result); param->result = NULL; free(param); param = NULL; } } /* struct gdbwire_mi_result */ struct gdbwire_mi_result * gdbwire_mi_result_alloc(void) { return calloc(1, sizeof (struct gdbwire_mi_result)); } void gdbwire_mi_result_free(struct gdbwire_mi_result *param) { if (param) { if (param->variable) { free(param->variable); param->variable = NULL; } switch (param->kind) { case GDBWIRE_MI_CSTRING: if (param->variant.cstring) { free(param->variant.cstring); param->variant.cstring = NULL; } break; case GDBWIRE_MI_TUPLE: case GDBWIRE_MI_LIST: gdbwire_mi_result_free(param->variant.result); param->variant.result = NULL; break; } gdbwire_mi_result_free(param->next); param->next = NULL; free(param); param = NULL; } } /* struct gdbwire_mi_oob_record */ struct gdbwire_mi_oob_record * gdbwire_mi_oob_record_alloc(void) { return calloc(1, sizeof (struct gdbwire_mi_oob_record)); } void gdbwire_mi_oob_record_free(struct gdbwire_mi_oob_record *param) { if (param) { switch(param->kind) { case GDBWIRE_MI_ASYNC: gdbwire_mi_async_record_free(param->variant.async_record); param->variant.async_record = NULL; break; case GDBWIRE_MI_STREAM: gdbwire_mi_stream_record_free(param->variant.stream_record); param->variant.stream_record = NULL; break; } free(param); param = NULL; } } /* struct gdbwire_mi_async_record */ struct gdbwire_mi_async_record * gdbwire_mi_async_record_alloc(void) { return calloc(1, sizeof (struct gdbwire_mi_async_record)); } void gdbwire_mi_async_record_free(struct gdbwire_mi_async_record *param) { if (param) { free(param->token); gdbwire_mi_result_free(param->result); param->result = NULL; free(param); param = NULL; } } /* struct gdbwire_mi_stream_record */ struct gdbwire_mi_stream_record * gdbwire_mi_stream_record_alloc(void) { return calloc(1, sizeof (struct gdbwire_mi_stream_record)); } void gdbwire_mi_stream_record_free(struct gdbwire_mi_stream_record *param) { if (param) { if (param->cstring) { free(param->cstring); param->cstring = NULL; } free(param); param = NULL; } } /***** End of gdbwire_mi_pt_alloc.c ******************************************/ /***** Begin file gdbwire_mi_pt.c ********************************************/ #include #include /* #include "gdbwire_mi_pt.h" */ struct gdbwire_mi_output * append_gdbwire_mi_output(struct gdbwire_mi_output *list, struct gdbwire_mi_output *item) { if (!item) return NULL; if (!list) list = item; else { struct gdbwire_mi_output *cur = list; while (cur->next) cur = cur->next; cur->next = item; } return list; } struct gdbwire_mi_result * append_gdbwire_mi_result(struct gdbwire_mi_result *list, struct gdbwire_mi_result *item) { if (!item) return NULL; if (!list) list = item; else { struct gdbwire_mi_result *cur = list; while (cur->next) cur = cur->next; cur->next = item; } return list; } /***** End of gdbwire_mi_pt.c ************************************************/ /***** Begin file gdbwire_mi_command.c ***************************************/ #include #include #include /* #include "gdbwire_sys.h" */ /* #include "gdbwire_assert.h" */ /***** Include gdbwire_mi_command.h in the middle of gdbwire_mi_command.c ****/ /***** Begin file gdbwire_mi_command.h ***************************************/ #ifndef GDBWIRE_MI_COMMAND_H #define GDBWIRE_MI_COMMAND_H #ifdef __cplusplus extern "C" { #endif /* #include "gdbwire_result.h" */ /* #include "gdbwire_mi_pt.h" */ /** * An enumeration representing the supported GDB/MI commands. */ enum gdbwire_mi_command_kind { /* -break-info */ GDBWIRE_MI_BREAK_INFO, /* -stack-info-frame */ GDBWIRE_MI_STACK_INFO_FRAME, /* -file-list-exec-source-file */ GDBWIRE_MI_FILE_LIST_EXEC_SOURCE_FILE, /* -file-list-exec-source-files */ GDBWIRE_MI_FILE_LIST_EXEC_SOURCE_FILES }; /** * An enumeration representing if debug symbols are fully loaded for a source. */ enum gdbwire_mi_debug_fully_read_kind { /** It is unknown if the debug symbols are fully loaded */ GDBWIRE_MI_DEBUG_FULLY_READ_UNKNOWN, /** The debug symbols are fully loaded */ GDBWIRE_MI_DEBUG_FULLY_READ_TRUE, /** The debug symbols are not fully loaded */ GDBWIRE_MI_DEBUG_FULLY_READ_FALSE }; /** A linked list of source files. */ struct gdbwire_mi_source_file { /** A relative path to a file, never NULL */ char *file; /**An absolute path to a file, NULL if unavailable */ char *fullname; /** If the source file has it's debug fully read, or not, or unknown */ enum gdbwire_mi_debug_fully_read_kind debug_fully_read; /** The next file name or NULL if no more. */ struct gdbwire_mi_source_file *next; }; /** The disposition of a breakpoint. What to do after hitting it. */ enum gdbwire_mi_breakpoint_disp_kind { GDBWIRE_MI_BP_DISP_DELETE, /** Delete on next hit */ GDBWIRE_MI_BP_DISP_DELETE_NEXT_STOP, /** Delete on next stop, hit or not */ GDBWIRE_MI_BP_DISP_DISABLE, /** Disable on next hit */ GDBWIRE_MI_BP_DISP_KEEP, /** Leave the breakpoint in place */ GDBWIRE_MI_BP_DISP_UNKNOWN /** When GDB doesn't specify */ }; /** * A linked list of breakpoints. * * A breakpoint is a breakpoint, a tracepoint, a watchpoing or a * catchpoint. The GDB breakpoint model is quite sophisticated. * This structure can be extended when necessary. */ struct gdbwire_mi_breakpoint { /** * The breakpoint number. * * An integer, however, for a breakpoint that represents one location of * a multiple location breakpoint, this will be a dotted pair, like ‘1.2’. * * Never NULL. */ char *number; /** * Determines if this is a multiple location breakpoint. * * True for a multi-location breakpoint, false otherwise. * * It is possible that a breakpoint corresponds to several locations in * your program. For example, several functions may have the same name. * For the following source code, * int foo(int p) { return p; } * double foo(double p) { return p; } * int main() { int i = 1; double d = 2.3; return foo(i) + foo(d); } * If the user sets a breakpoint at foo by typing, * b foo * Then gdb will create 3 breakpoints. The multiple location breakpoint, * which is the parent of the two breakpoints created for each foo * function. Here is the output of gdb from the CLI perspective, * Num Type Disp Enb Address What * 1 breakpoint keep y * 1.1 y 0x4004dd in foo(int) at main.cpp:1 * 1.2 y 0x4004eb in foo(double) at main.cpp:2 * * However, if the user created a breakpoint for main by typing, * b main * Then gdb will only create a single breakpoint which would look like, * 1 breakpoint keep y 0x4004fa in main() at main.cpp:3 * * When this is true, the address field will be "" and * the field multi_breakpoints will represent the breakpoints that this * multiple location breakpoint has created. */ unsigned char multi:1; /** * True for breakpoints of a multi-location breakpoint, otherwise false. * * For the example above, 1.1 and 1.2 would have this field set true. * * When this is true, the field multi_breakpoint will represent * the multiple location breakpoint that has created this breakpoint. */ unsigned char from_multi:1; /** * The breakpoint type. * * Typically "breakpoint", "watchpoint" or "catchpoint", but can be * a variety of different values. In gdb, see breakpoint.c:bptype_string * to see all the different possibilities. * * This will be NULL for breakpoints of a multiple location breakpoint. * In this circumstance, check the multi_breakpoint field for the * multiple location breakpoint type field. */ char *type; /** * The type of the catchpoint or NULL if not a catch point. * * This field is only valid when the breakpoint is a catchpoint. * Unfortuntely, gdb says the "type" of the breakpoint in the type field * is "breakpoint" not "catchpoint". So if this field is non-NULL, it is * safe to assume that this breakpoint represents at catch point. */ char *catch_type; /** * The breakpoint disposition. * * For multiple location breakpoints, this will be * GDBWIRE_MI_BP_DISP_UNKNOWN. In this circumstance, check the * multi_breakpoint field for the multiple location breakpoint * disposition field. */ enum gdbwire_mi_breakpoint_disp_kind disposition; /** True if enabled or False if disabled. */ unsigned char enabled:1; /** * The address of the breakpoint. * * This may be * - a hexidecimal number, representing the address * - the string ‘’ for a pending breakpoint * - the string ‘’ for a breakpoint with multiple locations * * This field will be NULL if no address can be determined. * For example, a watchpoint does not have an address. */ char *address; /** * The name of the function or NULL if unknown. */ char *func_name; /** * A relative path to the file the breakpoint is in or NULL if unknown. */ char *file; /** * An absolute path to the file the breakpoint is in or NULL if unknown. */ char *fullname; /** * The line number the breakpoint is at or 0 if unkonwn. */ unsigned long line; /** * The number of times this breakpoint has been hit. * * For breakpoints of multi-location breakpoints, this will be 0. * Look at the multi-location breakpoint field instead. */ unsigned long times; /** * The location of the breakpoint as originally specified by the user. * * This may be NULL for instance, for breakpoints for multi-breakpoints. */ char *original_location; /** * True for a pending breakpoint, otherwise false. * * When this is true, the address field will be "". */ unsigned char pending:1; /** * The breakpoints for a multi-location breakpoint. * * If multi is true, this will be the breakpoints associated with the * multiple location breakpoint. Otherwise will be NULL. */ struct gdbwire_mi_breakpoint *multi_breakpoints; /** * A pointer to the multi location breakpoint that created this breakpoint. * * When the field from_multi is true, this will be a pointer to the * multi-location breakpoint that created this breakpoint. Otherwise NULL. * * For the example above in the multi field, breakpoints 1.1 and 1.2 * would have this field pointing to the breakpoint 1. */ struct gdbwire_mi_breakpoint *multi_breakpoint; /** The next breakpoint or NULL if no more. */ struct gdbwire_mi_breakpoint *next; }; struct gdbwire_mi_stack_frame { /** * The frame number. * * Where 0 is the topmost frame, i.e., the innermost function. * * Always present. */ unsigned level; /** * The address ($pc value) of the frame. * * May be NULL if GDB can not determine the frame address. */ char *address; /** * The function name for the frame. May be NULL if unknown. */ char *func; /** * The file name for the frame. May be NULL if unknown. */ char *file; /** * The fullname name for the frame. May be NULL if unknown. */ char *fullname; /** * Line number corresponding to the $pc. Maybe be 0 if unknown. */ int line; /** * The shared library where this function is defined. * * This is only given if the frame's function is not known. * May be NULL if unknown. */ char *from; }; /** * Represents a GDB/MI command. */ struct gdbwire_mi_command { /** * The kind of mi command this represents. */ enum gdbwire_mi_command_kind kind; union { /** When kind == GDBWIRE_MI_BREAK_INFO */ struct { /** The list of breakpoints, NULL if none exist. */ struct gdbwire_mi_breakpoint *breakpoints; } break_info; /** When kind == GDBWIRE_MI_STACK_INFO_FRAME */ struct { struct gdbwire_mi_stack_frame *frame; } stack_info_frame; /** When kind == GDBWIRE_MI_FILE_LIST_EXEC_SOURCE_FILE */ struct { /** * The line number the inferior is currently executing at. */ int line; /** * The filename the inferior is currently executing at. * * This is usually a relative path. */ char *file; /** * The filename the inferior is currently executing at. * * This is an absolute path. * * This command was addd in 2004, however, it was possible * at the time that only the "file" field would be put out and * the "fullname" field would be omitted. In 2012, in git commit, * f35a17b5, gdb was changed to always omit the "fullname" field. */ char *fullname; /** * Determines if the file includes preprocessor macro information. * * This command was added in 2004. However, the macro-info * field was added to the output in 2008 in git commit 17784837. * * Only check this field if macro_info_exists is true. */ char macro_info:1; /** True if macro-info field was in mi output, otherwise false */ char macro_info_exists:1; } file_list_exec_source_file; /** When kind == GDBWIRE_MI_FILE_LIST_EXEC_SOURCE_FILES */ struct { /** * A list of files that make up the inferior. * * When there are no files (if the gdb does not have an inferior * loaded) than files will be NULL. * * This command was addd in 2004, however, it was possible * at the time that only the "file" field would be put out and * the "fullname" field would be omitted. In 2012, in git commit, * f35a17b5, gdb was changed to always omit the "fullname" field. */ struct gdbwire_mi_source_file *files; } file_list_exec_source_files; } variant; }; /** * Get a gdbwire MI command from the result record. * * @param kind * The kind of command the result record is associated with. * * @param result_record * The result record to turn into a command. * * @param out_mi_command * Will return an allocated gdbwire mi command if GDBWIRE_OK is returned * from this function. You should free this memory with * gdbwire_mi_command_free when you are done with it. * * @return * The result of this function. */ enum gdbwire_result gdbwire_get_mi_command( enum gdbwire_mi_command_kind kind, struct gdbwire_mi_result_record *result_record, struct gdbwire_mi_command **out_mi_command); /** * Free the gdbwire mi command. * * @param mi_command * The mi command to free. */ void gdbwire_mi_command_free(struct gdbwire_mi_command *mi_command); #ifdef __cplusplus } #endif #endif /***** End of gdbwire_mi_command.h *******************************************/ /***** Continuing where we left off in gdbwire_mi_command.c ******************/ /** * Free a source file list. * * @param files * The source file list to free, OK to pass in NULL. */ static void gdbwire_mi_source_files_free(struct gdbwire_mi_source_file *files) { struct gdbwire_mi_source_file *tmp, *cur = files; while (cur) { free(cur->file); free(cur->fullname); tmp = cur; cur = cur->next; free(tmp); } } /** * Free a breakpoint list. * * @param breakpoints * The breakpoint list to free, OK to pass in NULL. */ static void gdbwire_mi_breakpoints_free(struct gdbwire_mi_breakpoint *breakpoints) { struct gdbwire_mi_breakpoint *tmp, *cur = breakpoints; while (cur) { free(cur->original_location); free(cur->fullname); free(cur->file); free(cur->func_name); free(cur->address); free(cur->catch_type); free(cur->type); free(cur->number); gdbwire_mi_breakpoints_free(cur->multi_breakpoints); cur->multi_breakpoint = 0; tmp = cur; cur = cur->next; free(tmp); } } /** * Free a stack frame. * * @param frame * The frame to free, OK to pass in NULL. */ static void gdbwire_mi_stack_frame_free(struct gdbwire_mi_stack_frame *frame) { free(frame->address); free(frame->func); free(frame->file); free(frame->fullname); free(frame->from); free(frame); } /** * Convert a string to an unsigned long. * * @param str * The string to convert. * * @param num * If GDBWIRE_OK is returned, this will be returned as the number. * * @return * GDBWIRE_OK on success, and num is valid, or GDBWIRE_LOGIC on failure. */ static enum gdbwire_result gdbwire_string_to_ulong(char *str, unsigned long *num) { enum gdbwire_result result = GDBWIRE_LOGIC; unsigned long int strtol_result; char *end_ptr; GDBWIRE_ASSERT(str); GDBWIRE_ASSERT(num); errno = 0; strtol_result = strtoul(str, &end_ptr, 10); if (errno == 0 && str != end_ptr && *end_ptr == '\0') { *num = strtol_result; result = GDBWIRE_OK; } return result; } /** * Handle breakpoints from the -break-info command. * * @param mi_result * The mi parse tree starting from bkpt={...} * * @param bkpt * Allocated breakpoint on way out on success. Otherwise NULL on way out. * * @return * GDBWIRE_OK on success and bkpt is an allocated breakpoint. Otherwise * the appropriate error code and bkpt will be NULL. */ static enum gdbwire_result break_info_for_breakpoint(struct gdbwire_mi_result *mi_result, struct gdbwire_mi_breakpoint **bkpt) { enum gdbwire_result result = GDBWIRE_OK; struct gdbwire_mi_breakpoint *breakpoint = 0; char *number = 0; int multi = 0; int from_multi = 0; char *catch_type = 0; int pending = 0; int enabled = 0; char *address = 0; char *type = 0; enum gdbwire_mi_breakpoint_disp_kind disp_kind = GDBWIRE_MI_BP_DISP_UNKNOWN; char *func_name = 0; char *file = 0; char *fullname = 0; unsigned long line = 0; unsigned long times = 0; char *original_location = 0; GDBWIRE_ASSERT(mi_result); GDBWIRE_ASSERT(bkpt); *bkpt = 0; while (mi_result) { if (mi_result->kind == GDBWIRE_MI_CSTRING) { if (strcmp(mi_result->variable, "number") == 0) { number = mi_result->variant.cstring; if (strstr(number, ".") != NULL) { from_multi = 1; } } else if (strcmp(mi_result->variable, "enabled") == 0) { enabled = mi_result->variant.cstring[0] == 'y'; } else if (strcmp(mi_result->variable, "addr") == 0) { multi = strcmp(mi_result->variant.cstring, "") == 0; pending = strcmp(mi_result->variant.cstring, "") == 0; address = mi_result->variant.cstring; } else if (strcmp(mi_result->variable, "catch-type") == 0) { catch_type = mi_result->variant.cstring; } else if (strcmp(mi_result->variable, "type") == 0) { type = mi_result->variant.cstring; } else if (strcmp(mi_result->variable, "disp") == 0) { if (strcmp(mi_result->variant.cstring, "del") == 0) { disp_kind = GDBWIRE_MI_BP_DISP_DELETE; } else if (strcmp(mi_result->variant.cstring, "dstp") == 0) { disp_kind = GDBWIRE_MI_BP_DISP_DELETE_NEXT_STOP; } else if (strcmp(mi_result->variant.cstring, "dis") == 0) { disp_kind = GDBWIRE_MI_BP_DISP_DISABLE; } else if (strcmp(mi_result->variant.cstring, "keep") == 0) { disp_kind = GDBWIRE_MI_BP_DISP_KEEP; } else { return GDBWIRE_LOGIC; } } else if (strcmp(mi_result->variable, "func") == 0) { func_name = mi_result->variant.cstring; } else if (strcmp(mi_result->variable, "file") == 0) { file = mi_result->variant.cstring; } else if (strcmp(mi_result->variable, "fullname") == 0) { fullname = mi_result->variant.cstring; } else if (strcmp(mi_result->variable, "line") == 0) { GDBWIRE_ASSERT(gdbwire_string_to_ulong( mi_result->variant.cstring, &line) == GDBWIRE_OK); } else if (strcmp(mi_result->variable, "times") == 0) { GDBWIRE_ASSERT(gdbwire_string_to_ulong( mi_result->variant.cstring, ×) == GDBWIRE_OK); } else if (strcmp(mi_result->variable, "original-location") == 0) { original_location = mi_result->variant.cstring; } } mi_result = mi_result->next; } /* Validate required fields before proceeding. */ GDBWIRE_ASSERT(number); /* At this point, allocate a breakpoint */ breakpoint = calloc(1, sizeof(struct gdbwire_mi_breakpoint)); if (!breakpoint) { return GDBWIRE_NOMEM; } breakpoint->multi = multi; breakpoint->from_multi = from_multi; breakpoint->number = gdbwire_strdup(number); breakpoint->type = (type)?gdbwire_strdup(type):0; breakpoint->catch_type = (catch_type)?gdbwire_strdup(catch_type):0; breakpoint->disposition = disp_kind; breakpoint->enabled = enabled; breakpoint->address = (address)?gdbwire_strdup(address):0; breakpoint->func_name = (func_name)?gdbwire_strdup(func_name):0; breakpoint->file = (file)?gdbwire_strdup(file):0; breakpoint->fullname = (fullname)?gdbwire_strdup(fullname):0; breakpoint->line = line; breakpoint->times = times; breakpoint->original_location = (original_location)?gdbwire_strdup(original_location):0; breakpoint->pending = pending; /* Handle the out of memory situation */ if (!breakpoint->number || (type && !breakpoint->type) || (catch_type && !breakpoint->catch_type) || (address && !breakpoint->address) || (func_name && !breakpoint->func_name) || (file && !breakpoint->file) || (fullname && !breakpoint->fullname) || (original_location && !breakpoint->original_location)) { gdbwire_mi_breakpoints_free(breakpoint); breakpoint = 0; result = GDBWIRE_NOMEM; } *bkpt = breakpoint; return result; } /** * Handle the -break-info command. * * @param result_record * The mi result record that makes up the command output from gdb. * * @param out * The output command, null on error. * * @return * GDBWIRE_OK on success, otherwise failure and out is NULL. */ static enum gdbwire_result break_info( struct gdbwire_mi_result_record *result_record, struct gdbwire_mi_command **out) { enum gdbwire_result result = GDBWIRE_OK; struct gdbwire_mi_result *mi_result; struct gdbwire_mi_command *mi_command = 0; struct gdbwire_mi_breakpoint *breakpoints = 0, *cur_bkpt; int found_body = 0; GDBWIRE_ASSERT(result_record); GDBWIRE_ASSERT(out); *out = 0; GDBWIRE_ASSERT(result_record->result_class == GDBWIRE_MI_DONE); GDBWIRE_ASSERT(result_record->result); mi_result = result_record->result; GDBWIRE_ASSERT(mi_result->kind == GDBWIRE_MI_TUPLE); GDBWIRE_ASSERT(strcmp(mi_result->variable, "BreakpointTable") == 0); GDBWIRE_ASSERT(mi_result->variant.result); GDBWIRE_ASSERT(!mi_result->next); mi_result = mi_result->variant.result; /* Fast forward to the body */ while (mi_result) { if (mi_result->kind == GDBWIRE_MI_LIST && strcmp(mi_result->variable, "body") == 0) { found_body = 1; break; } else { mi_result = mi_result->next; } } GDBWIRE_ASSERT(found_body); GDBWIRE_ASSERT(!mi_result->next); mi_result = mi_result->variant.result; while (mi_result) { struct gdbwire_mi_breakpoint *bkpt; GDBWIRE_ASSERT_GOTO( mi_result->kind == GDBWIRE_MI_TUPLE, result, cleanup); /** * GDB emits non-compliant MI when sending breakpoint information. * https://sourceware.org/bugzilla/show_bug.cgi?id=9659 * In particular, instead of saying * bkpt={...},bkpt={...} * it puts out, * bkpt={...},{...} * skipping the additional bkpt for subsequent breakpoints. I've seen * this output for multiple location breakpoints as the bug points to. * * For this reason, only check bkpt for the first breakpoint and * assume it is true for the remaining. */ if (mi_result->variable) { GDBWIRE_ASSERT_GOTO( strcmp(mi_result->variable, "bkpt") == 0, result, cleanup); } result = break_info_for_breakpoint(mi_result->variant.result, &bkpt); if (result != GDBWIRE_OK) { goto cleanup; } if (bkpt->from_multi) { bkpt->multi_breakpoint = cur_bkpt; /* Append breakpoint to the multiple location breakpoints */ if (cur_bkpt->multi_breakpoints) { struct gdbwire_mi_breakpoint *multi = cur_bkpt->multi_breakpoints; while (multi->next) { multi = multi->next; } multi->next = bkpt; } else { cur_bkpt->multi_breakpoints = bkpt; } } else { /* Append breakpoint to the list of breakpoints */ if (breakpoints) { cur_bkpt->next = bkpt; cur_bkpt = cur_bkpt->next; } else { breakpoints = cur_bkpt = bkpt; } } mi_result = mi_result->next; } mi_command = calloc(1, sizeof(struct gdbwire_mi_command)); if (!mi_command) { result = GDBWIRE_NOMEM; goto cleanup; } mi_command->variant.break_info.breakpoints = breakpoints; *out = mi_command; return result; cleanup: gdbwire_mi_breakpoints_free(breakpoints); return result; } /** * Handle the -stack-info-frame command. * * @param result_record * The mi result record that makes up the command output from gdb. * * @param out * The output command, null on error. * * @return * GDBWIRE_OK on success, otherwise failure and out is NULL. */ static enum gdbwire_result stack_info_frame( struct gdbwire_mi_result_record *result_record, struct gdbwire_mi_command **out) { struct gdbwire_mi_stack_frame *frame; struct gdbwire_mi_result *mi_result; struct gdbwire_mi_command *mi_command = 0; char *level = 0, *address = 0; char *func = 0, *file = 0, *fullname = 0, *line = 0, *from = 0; *out = 0; GDBWIRE_ASSERT(result_record->result_class == GDBWIRE_MI_DONE); GDBWIRE_ASSERT(result_record->result); mi_result = result_record->result; GDBWIRE_ASSERT(mi_result->kind == GDBWIRE_MI_TUPLE); GDBWIRE_ASSERT(strcmp(mi_result->variable, "frame") == 0); GDBWIRE_ASSERT(mi_result->variant.result); GDBWIRE_ASSERT(!mi_result->next); mi_result = mi_result->variant.result; while (mi_result) { if (mi_result->kind == GDBWIRE_MI_CSTRING) { if (strcmp(mi_result->variable, "level") == 0) { level = mi_result->variant.cstring; } else if (strcmp(mi_result->variable, "addr") == 0) { address = mi_result->variant.cstring; } else if (strcmp(mi_result->variable, "func") == 0) { func = mi_result->variant.cstring; } else if (strcmp(mi_result->variable, "file") == 0) { file = mi_result->variant.cstring; } else if (strcmp(mi_result->variable, "fullname") == 0) { fullname = mi_result->variant.cstring; } else if (strcmp(mi_result->variable, "line") == 0) { line = mi_result->variant.cstring; } else if (strcmp(mi_result->variable, "from") == 0) { from = mi_result->variant.cstring; } } mi_result = mi_result->next; } GDBWIRE_ASSERT(level && address); if (strcmp(address, "") == 0) { address = 0; } frame = calloc(1, sizeof(struct gdbwire_mi_stack_frame)); if (!frame) { return GDBWIRE_NOMEM; } frame->level = atoi(level); frame->address = (address)?gdbwire_strdup(address):0; frame->func = (func)?gdbwire_strdup(func):0; frame->file = (file)?gdbwire_strdup(file):0; frame->fullname = (fullname)?gdbwire_strdup(fullname):0; frame->line = (line)?atoi(line):0; frame->from = (from)?gdbwire_strdup(from):0; /* Handle the out of memory situation */ if ((address && !frame->address) || (func && !frame->func) || (file && !frame->file) || (fullname && !frame->fullname) || (from && !frame->from)) { gdbwire_mi_stack_frame_free(frame); return GDBWIRE_NOMEM; } mi_command = calloc(1, sizeof(struct gdbwire_mi_command)); if (!mi_command) { gdbwire_mi_stack_frame_free(frame); return GDBWIRE_NOMEM; } mi_command->kind = GDBWIRE_MI_STACK_INFO_FRAME; mi_command->variant.stack_info_frame.frame = frame; *out = mi_command; return GDBWIRE_OK; } /** * Handle the -file-list-exec-source-file command. * * @param result_record * The mi result record that makes up the command output from gdb. * * @param out * The output command, null on error. * * @return * GDBWIRE_OK on success, otherwise failure and out is NULL. */ static enum gdbwire_result file_list_exec_source_file( struct gdbwire_mi_result_record *result_record, struct gdbwire_mi_command **out) { struct gdbwire_mi_result *mi_result; struct gdbwire_mi_command *mi_command = 0; char *line = 0, *file = 0, *fullname = 0, *macro_info = 0; *out = 0; GDBWIRE_ASSERT(result_record->result_class == GDBWIRE_MI_DONE); GDBWIRE_ASSERT(result_record->result); mi_result = result_record->result; while (mi_result) { if (mi_result->kind == GDBWIRE_MI_CSTRING) { if (strcmp(mi_result->variable, "line") == 0) { line = mi_result->variant.cstring; } else if (strcmp(mi_result->variable, "file") == 0) { file = mi_result->variant.cstring; } else if (strcmp(mi_result->variable, "fullname") == 0) { fullname = mi_result->variant.cstring; } else if (strcmp(mi_result->variable, "macro-info") == 0) { macro_info = mi_result->variant.cstring; GDBWIRE_ASSERT(strlen(macro_info) == 1); GDBWIRE_ASSERT(macro_info[0] == '0' || macro_info[0] == '1'); } } mi_result = mi_result->next; } GDBWIRE_ASSERT(line && file); mi_command = calloc(1, sizeof(struct gdbwire_mi_command)); if (!mi_command) { return GDBWIRE_NOMEM; } mi_command->kind = GDBWIRE_MI_FILE_LIST_EXEC_SOURCE_FILE; mi_command->variant.file_list_exec_source_file.line = atoi(line); mi_command->variant.file_list_exec_source_file.file = gdbwire_strdup(file); if (!mi_command->variant.file_list_exec_source_file.file) { gdbwire_mi_command_free(mi_command); return GDBWIRE_NOMEM; } mi_command->variant.file_list_exec_source_file.fullname = (fullname)?gdbwire_strdup(fullname):0; if (fullname && !mi_command->variant.file_list_exec_source_file.fullname) { gdbwire_mi_command_free(mi_command); return GDBWIRE_NOMEM; } mi_command->variant.file_list_exec_source_file.macro_info_exists = macro_info != 0; if (macro_info) { mi_command->variant.file_list_exec_source_file.macro_info = atoi(macro_info); } *out = mi_command; return GDBWIRE_OK; } /** * Handle the -file-list-exec-source-files command. * * @param result_record * The mi result record that makes up the command output from gdb. * * @param out * The output command, null on error. * * @return * GDBWIRE_OK on success, otherwise failure and out is NULL. */ static enum gdbwire_result file_list_exec_source_files( struct gdbwire_mi_result_record *result_record, struct gdbwire_mi_command **out) { enum gdbwire_result result = GDBWIRE_OK; struct gdbwire_mi_result *mi_result; struct gdbwire_mi_source_file *files = 0, *cur_node, *new_node; GDBWIRE_ASSERT(result_record->result_class == GDBWIRE_MI_DONE); GDBWIRE_ASSERT(result_record->result); mi_result = result_record->result; GDBWIRE_ASSERT(mi_result->kind == GDBWIRE_MI_LIST); GDBWIRE_ASSERT(strcmp(mi_result->variable, "files") == 0); GDBWIRE_ASSERT(!mi_result->next); mi_result = mi_result->variant.result; while (mi_result) { struct gdbwire_mi_result *tuple; char *file = 0, *fullname = 0; enum gdbwire_mi_debug_fully_read_kind debug_fully_read = GDBWIRE_MI_DEBUG_FULLY_READ_UNKNOWN; GDBWIRE_ASSERT_GOTO(mi_result->kind == GDBWIRE_MI_TUPLE, result, err); tuple = mi_result->variant.result; while (tuple) { /* file field */ GDBWIRE_ASSERT_GOTO(tuple->kind == GDBWIRE_MI_CSTRING, result, err); if (strcmp(tuple->variable, "file") == 0) { file = tuple->variant.cstring; } else if (strcmp(tuple->variable, "fullname") == 0) { fullname = tuple->variant.cstring; } else if (strcmp(tuple->variable, "debug-fully-read") == 0) { if (strcmp(tuple->variant.cstring, "false") == 0) { debug_fully_read = GDBWIRE_MI_DEBUG_FULLY_READ_FALSE; } else if (strcmp(tuple->variant.cstring, "true") == 0) { debug_fully_read = GDBWIRE_MI_DEBUG_FULLY_READ_TRUE; } } tuple = tuple->next; } // file is required, but fullname and debug_fully_read is not GDBWIRE_ASSERT_GOTO(file, result, err); /* Create the new */ new_node = calloc(1, sizeof(struct gdbwire_mi_source_file)); GDBWIRE_ASSERT_GOTO(new_node, result, err); new_node->file = gdbwire_strdup(file); new_node->fullname = (fullname)?gdbwire_strdup(fullname):0; new_node->debug_fully_read = debug_fully_read; new_node->next = 0; /* Append the node to the list */ if (files) { cur_node->next = new_node; cur_node = cur_node->next; } else { files = cur_node = new_node; } GDBWIRE_ASSERT_GOTO(new_node->file && (new_node->fullname || !fullname), result, err); mi_result = mi_result->next; } *out = calloc(1, sizeof(struct gdbwire_mi_command)); GDBWIRE_ASSERT_GOTO(*out, result, err); (*out)->kind = GDBWIRE_MI_FILE_LIST_EXEC_SOURCE_FILES; (*out)->variant.file_list_exec_source_files.files = files; return result; err: gdbwire_mi_source_files_free(files); return result; } enum gdbwire_result gdbwire_get_mi_command(enum gdbwire_mi_command_kind kind, struct gdbwire_mi_result_record *result_record, struct gdbwire_mi_command **out) { enum gdbwire_result result = GDBWIRE_OK; GDBWIRE_ASSERT(result_record); GDBWIRE_ASSERT(out); *out = 0; switch (kind) { case GDBWIRE_MI_BREAK_INFO: result = break_info(result_record, out); break; case GDBWIRE_MI_STACK_INFO_FRAME: result = stack_info_frame(result_record, out); break; case GDBWIRE_MI_FILE_LIST_EXEC_SOURCE_FILE: result = file_list_exec_source_file(result_record, out); break; case GDBWIRE_MI_FILE_LIST_EXEC_SOURCE_FILES: result = file_list_exec_source_files(result_record, out); break; } return result; } void gdbwire_mi_command_free(struct gdbwire_mi_command *mi_command) { if (mi_command) { switch (mi_command->kind) { case GDBWIRE_MI_BREAK_INFO: gdbwire_mi_breakpoints_free( mi_command->variant.break_info.breakpoints); break; case GDBWIRE_MI_STACK_INFO_FRAME: gdbwire_mi_stack_frame_free( mi_command->variant.stack_info_frame.frame); break; case GDBWIRE_MI_FILE_LIST_EXEC_SOURCE_FILE: free(mi_command->variant.file_list_exec_source_file.file); free(mi_command->variant.file_list_exec_source_file.fullname); break; case GDBWIRE_MI_FILE_LIST_EXEC_SOURCE_FILES: gdbwire_mi_source_files_free( mi_command->variant.file_list_exec_source_files.files); break; } free(mi_command); } } /***** End of gdbwire_mi_command.c *******************************************/ /***** Begin file gdbwire_mi_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 6 #define YY_FLEX_SUBMINOR_VERSION 0 #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) /* An opaque pointer. */ #ifndef YY_TYPEDEF_YY_SCANNER_T #define YY_TYPEDEF_YY_SCANNER_T typedef void* yyscan_t; #endif /* For convenience, these vars (plus the bison vars far below) are macros in the reentrant scanner. */ #define yyin yyg->yyin_r #define yyout yyg->yyout_r #define yyextra yyg->yyextra_r #define yyleng yyg->yyleng_r #define yytext yyg->yytext_r #define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno) #define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column) #define yy_flex_debug yyg->yy_flex_debug_r /* 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 yyg->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 ((yyg->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 gdbwire_mi_restart(yyin ,yyscanner ) #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 #ifndef YY_TYPEDEF_YY_SIZE_T #define YY_TYPEDEF_YY_SIZE_T typedef size_t yy_size_t; #endif #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 #define YY_LESS_LINENO(n) #define YY_LINENO_REWIND_TO(ptr) /* 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 = yyg->yy_hold_char; \ YY_RESTORE_YY_MORE_OFFSET \ yyg->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, yyg->yytext_ptr , yyscanner ) #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 gdbwire_mi_restart()), 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 */ /* 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 ( yyg->yy_buffer_stack \ ? yyg->yy_buffer_stack[yyg->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 yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] void gdbwire_mi_restart (FILE *input_file ,yyscan_t yyscanner ); void gdbwire_mi__switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); YY_BUFFER_STATE gdbwire_mi__create_buffer (FILE *file,int size ,yyscan_t yyscanner ); void gdbwire_mi__delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); void gdbwire_mi__flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); void gdbwire_mi_push_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); void gdbwire_mi_pop_buffer_state (yyscan_t yyscanner ); static void gdbwire_mi_ensure_buffer_stack (yyscan_t yyscanner ); static void gdbwire_mi__load_buffer_state (yyscan_t yyscanner ); static void gdbwire_mi__init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner ); #define YY_FLUSH_BUFFER gdbwire_mi__flush_buffer(YY_CURRENT_BUFFER ,yyscanner) YY_BUFFER_STATE gdbwire_mi__scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); YY_BUFFER_STATE gdbwire_mi__scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); YY_BUFFER_STATE gdbwire_mi__scan_bytes (yyconst char *bytes,yy_size_t len ,yyscan_t yyscanner ); void *gdbwire_mi_alloc (yy_size_t ,yyscan_t yyscanner ); void *gdbwire_mi_realloc (void *,yy_size_t ,yyscan_t yyscanner ); void gdbwire_mi_free (void * ,yyscan_t yyscanner ); #define yy_new_buffer gdbwire_mi__create_buffer #define yy_set_interactive(is_interactive) \ { \ if ( ! YY_CURRENT_BUFFER ){ \ gdbwire_mi_ensure_buffer_stack (yyscanner); \ YY_CURRENT_BUFFER_LVALUE = \ gdbwire_mi__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } #define yy_set_bol(at_bol) \ { \ if ( ! YY_CURRENT_BUFFER ){\ gdbwire_mi_ensure_buffer_stack (yyscanner); \ YY_CURRENT_BUFFER_LVALUE = \ gdbwire_mi__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ } #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) /* Begin user sect3 */ #define gdbwire_mi_wrap(yyscanner) (/*CONSTCOND*/1) #define YY_SKIP_YYWRAP typedef unsigned char YY_CHAR; typedef int yy_state_type; #define yytext_ptr yytext_r static yy_state_type yy_get_previous_state (yyscan_t yyscanner ); static yy_state_type yy_try_NUL_trans (yy_state_type current_state ,yyscan_t yyscanner); static int yy_get_next_buffer (yyscan_t yyscanner ); #if defined(__GNUC__) && __GNUC__ >= 3 __attribute__((__noreturn__)) #endif static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner ); /* Done after the current pattern has been matched and before the * corresponding action - sets up yytext. */ #define YY_DO_BEFORE_ACTION \ yyg->yytext_ptr = yy_bp; \ yyleng = (size_t) (yy_cp - yy_bp); \ yyg->yy_hold_char = *yy_cp; \ *yy_cp = '\0'; \ yyg->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 YY_CHAR 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 YY_CHAR 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_uint16_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_uint16_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 } ; /* 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 #define YY_NO_INPUT 1 /* Avoids the use of fileno, which is POSIX and not compatible with c11 */ /* flex 2.6.0 produces a sign-compare warning */ #pragma GCC diagnostic ignored "-Wsign-compare" #include /* #include "gdbwire_mi_grammar.h" */ /* #include "gdbwire_mi_pt.h" */ /** * This macro sets the beginning and ending column position of each * token in the pure lexer. No global state is used. * * The parser can then use this position to determine the location * of any token it desires. * * Currently only the column is stored as the parser only uses * the lexer on a line at a time. Currently, the caller of the * lexer sets the column position back to 1 each time a new * line is set to be parsed in the lexer. */ #define YY_USER_ACTION \ { \ struct gdbwire_mi_position pos = { yycolumn, yycolumn+yyleng-1 }; \ yyextra = pos; \ yycolumn += yyleng; \ } #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 #define YY_EXTRA_TYPE struct gdbwire_mi_position /* Holds the entire state of the reentrant scanner. */ struct yyguts_t { /* User-defined. Not touched by flex. */ YY_EXTRA_TYPE yyextra_r; /* The rest are the same as the globals declared in the non-reentrant scanner. */ FILE *yyin_r, *yyout_r; size_t yy_buffer_stack_top; /**< index of top of stack. */ size_t yy_buffer_stack_max; /**< capacity of stack. */ YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */ char yy_hold_char; int yy_n_chars; yy_size_t yyleng_r; char *yy_c_buf_p; int yy_init; int yy_start; int yy_did_buffer_switch_on_eof; int yy_start_stack_ptr; int yy_start_stack_depth; int *yy_start_stack; yy_state_type yy_last_accepting_state; char* yy_last_accepting_cpos; int yylineno_r; int yy_flex_debug_r; char *yytext_r; int yy_more_flag; int yy_more_len; }; /* end struct yyguts_t */ static int yy_init_globals (yyscan_t yyscanner ); int gdbwire_mi_lex_init (yyscan_t* scanner); int gdbwire_mi_lex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner); /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ int gdbwire_mi_lex_destroy (yyscan_t yyscanner ); int gdbwire_mi_get_debug (yyscan_t yyscanner ); void gdbwire_mi_set_debug (int debug_flag ,yyscan_t yyscanner ); YY_EXTRA_TYPE gdbwire_mi_get_extra (yyscan_t yyscanner ); void gdbwire_mi_set_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner ); FILE *gdbwire_mi_get_in (yyscan_t yyscanner ); void gdbwire_mi_set_in (FILE * _in_str ,yyscan_t yyscanner ); FILE *gdbwire_mi_get_out (yyscan_t yyscanner ); void gdbwire_mi_set_out (FILE * _out_str ,yyscan_t yyscanner ); yy_size_t gdbwire_mi_get_leng (yyscan_t yyscanner ); char *gdbwire_mi_get_text (yyscan_t yyscanner ); int gdbwire_mi_get_lineno (yyscan_t yyscanner ); void gdbwire_mi_set_lineno (int _line_number ,yyscan_t yyscanner ); int gdbwire_mi_get_column (yyscan_t yyscanner ); void gdbwire_mi_set_column (int _column_no ,yyscan_t yyscanner ); /* Macros after this point can all be overridden by user definitions in * section 1. */ #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus extern "C" int gdbwire_mi_wrap (yyscan_t yyscanner ); #else extern int gdbwire_mi_wrap (yyscan_t yyscanner ); #endif #endif #ifndef YY_NO_UNPUT #endif #ifndef yytext_ptr static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner); #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner); #endif #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (yyscan_t yyscanner ); #else static int input (yyscan_t yyscanner ); #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( yytext, yyleng, 1, yyout )) {} } 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( 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 , yyscanner) #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 gdbwire_mi_lex (yyscan_t yyscanner); #define YY_DECL int gdbwire_mi_lex (yyscan_t yyscanner) #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 /*LINTED*/break; #endif #define YY_RULE_SETUP \ YY_USER_ACTION /** The main scanner function which does all the work. */ YY_DECL { yy_state_type yy_current_state; char *yy_cp, *yy_bp; int yy_act; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; if ( !yyg->yy_init ) { yyg->yy_init = 1; #ifdef YY_USER_INIT YY_USER_INIT; #endif if ( ! yyg->yy_start ) yyg->yy_start = 1; /* first start state */ if ( ! yyin ) yyin = stdin; if ( ! yyout ) yyout = stdout; if ( ! YY_CURRENT_BUFFER ) { gdbwire_mi_ensure_buffer_stack (yyscanner); YY_CURRENT_BUFFER_LVALUE = gdbwire_mi__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); } gdbwire_mi__load_buffer_state(yyscanner ); } { while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ { yy_cp = yyg->yy_c_buf_p; /* Support of yytext. */ *yy_cp = yyg->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 = yyg->yy_start; yy_match: do { YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; if ( yy_accept[yy_current_state] ) { yyg->yy_last_accepting_state = yy_current_state; yyg->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_current_state != 32 ); yy_cp = yyg->yy_last_accepting_cpos; yy_current_state = yyg->yy_last_accepting_state; yy_find_action: 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 = yyg->yy_hold_char; yy_cp = yyg->yy_last_accepting_cpos; yy_current_state = yyg->yy_last_accepting_state; goto yy_find_action; case 1: YY_RULE_SETUP { return CARROT; } YY_BREAK case 2: YY_RULE_SETUP { return COMMA; } YY_BREAK case 3: YY_RULE_SETUP { return ADD_OP; } YY_BREAK case 4: YY_RULE_SETUP { return MULT_OP; } YY_BREAK case 5: YY_RULE_SETUP { return EQUAL_SIGN; } YY_BREAK case 6: YY_RULE_SETUP { return TILDA; } YY_BREAK case 7: YY_RULE_SETUP { return AT_SYMBOL; } YY_BREAK case 8: YY_RULE_SETUP { return AMPERSAND; } YY_BREAK case 9: YY_RULE_SETUP { return OPEN_BRACKET; } YY_BREAK case 10: YY_RULE_SETUP { return CLOSED_BRACKET; } YY_BREAK case 11: YY_RULE_SETUP { return OPEN_BRACE; } YY_BREAK case 12: YY_RULE_SETUP { return CLOSED_BRACE; } YY_BREAK case 13: YY_RULE_SETUP { return OPEN_PAREN; } YY_BREAK case 14: YY_RULE_SETUP { return CLOSED_PAREN; } YY_BREAK case 15: /* rule 15 can match eol */ YY_RULE_SETUP { return NEWLINE; } YY_BREAK case 16: /* rule 16 can match eol */ YY_RULE_SETUP { return NEWLINE; } YY_BREAK case 17: YY_RULE_SETUP { return NEWLINE; } YY_BREAK case 18: YY_RULE_SETUP { return INTEGER_LITERAL; } YY_BREAK case 19: YY_RULE_SETUP {} YY_BREAK case 20: YY_RULE_SETUP { return STRING_LITERAL; } YY_BREAK case 21: YY_RULE_SETUP { return STRING_LITERAL; } YY_BREAK case 22: /* rule 22 can match eol */ YY_RULE_SETUP { return CSTRING; } YY_BREAK case 23: YY_RULE_SETUP ECHO; YY_BREAK 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 - yyg->yytext_ptr) - 1; /* Undo the effects of YY_DO_BEFORE_ACTION. */ *yy_cp = yyg->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 * gdbwire_mi_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. */ yyg->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 ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) { /* This was really a NUL. */ yy_state_type yy_next_state; yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state( yyscanner ); /* 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 , yyscanner); yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; if ( yy_next_state ) { /* Consume the NUL. */ yy_cp = ++yyg->yy_c_buf_p; yy_current_state = yy_next_state; goto yy_match; } else { yy_cp = yyg->yy_last_accepting_cpos; yy_current_state = yyg->yy_last_accepting_state; goto yy_find_action; } } else switch ( yy_get_next_buffer( yyscanner ) ) { case EOB_ACT_END_OF_FILE: { yyg->yy_did_buffer_switch_on_eof = 0; if ( gdbwire_mi_wrap(yyscanner ) ) { /* 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. */ yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ; yy_act = YY_STATE_EOF(YY_START); goto do_action; } else { if ( ! yyg->yy_did_buffer_switch_on_eof ) YY_NEW_FILE; } break; } case EOB_ACT_CONTINUE_SCAN: yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state( yyscanner ); yy_cp = yyg->yy_c_buf_p; yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; goto yy_match; case EOB_ACT_LAST_MATCH: yyg->yy_c_buf_p = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars]; yy_current_state = yy_get_previous_state( yyscanner ); yy_cp = yyg->yy_c_buf_p; yy_bp = yyg->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 user's declarations */ } /* end of gdbwire_mi_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 (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; char *source = yyg->yytext_ptr; yy_size_t number_to_move, i; int ret_val; if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->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 ( yyg->yy_c_buf_p - yyg->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 = (yy_size_t) (yyg->yy_c_buf_p - yyg->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 = yyg->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_LVALUE; int yy_c_buf_p_offset = (int) (yyg->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. */ gdbwire_mi_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner ); } 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" ); yyg->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]), yyg->yy_n_chars, num_to_read ); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; } if ( yyg->yy_n_chars == 0 ) { if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; gdbwire_mi_restart(yyin ,yyscanner); } 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 ((int) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ int new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) gdbwire_mi_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner ); if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); } yyg->yy_n_chars += number_to_move; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; yyg->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 (yyscan_t yyscanner) { yy_state_type yy_current_state; char *yy_cp; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yy_current_state = yyg->yy_start; for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp ) { YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { yyg->yy_last_accepting_state = yy_current_state; yyg->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 , yyscan_t yyscanner) { int yy_is_jam; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */ char *yy_cp = yyg->yy_c_buf_p; YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { yyg->yy_last_accepting_state = yy_current_state; yyg->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); (void)yyg; return yy_is_jam ? 0 : yy_current_state; } #ifndef YY_NO_UNPUT #endif #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (yyscan_t yyscanner) #else static int input (yyscan_t yyscanner) #endif { int c; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; *yyg->yy_c_buf_p = yyg->yy_hold_char; if ( *yyg->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 ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) /* This was really a NUL. */ *yyg->yy_c_buf_p = '\0'; else { /* need more input */ yy_size_t offset = yyg->yy_c_buf_p - yyg->yytext_ptr; ++yyg->yy_c_buf_p; switch ( yy_get_next_buffer( yyscanner ) ) { 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. */ gdbwire_mi_restart(yyin ,yyscanner); /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { if ( gdbwire_mi_wrap(yyscanner ) ) return EOF; if ( ! yyg->yy_did_buffer_switch_on_eof ) YY_NEW_FILE; #ifdef __cplusplus return yyinput(yyscanner); #else return input(yyscanner); #endif } case EOB_ACT_CONTINUE_SCAN: yyg->yy_c_buf_p = yyg->yytext_ptr + offset; break; } } } c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */ *yyg->yy_c_buf_p = '\0'; /* preserve yytext */ yyg->yy_hold_char = *++yyg->yy_c_buf_p; return c; } #endif /* ifndef YY_NO_INPUT */ /** Immediately switch to a different input stream. * @param input_file A readable stream. * @param yyscanner The scanner object. * @note This function does not reset the start condition to @c INITIAL . */ void gdbwire_mi_restart (FILE * input_file , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; if ( ! YY_CURRENT_BUFFER ){ gdbwire_mi_ensure_buffer_stack (yyscanner); YY_CURRENT_BUFFER_LVALUE = gdbwire_mi__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); } gdbwire_mi__init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner); gdbwire_mi__load_buffer_state(yyscanner ); } /** Switch to a different input buffer. * @param new_buffer The new input buffer. * @param yyscanner The scanner object. */ void gdbwire_mi__switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* TODO. We should be able to replace this entire function body * with * gdbwire_mi_pop_buffer_state(); * gdbwire_mi_push_buffer_state(new_buffer); */ gdbwire_mi_ensure_buffer_stack (yyscanner); if ( YY_CURRENT_BUFFER == new_buffer ) return; if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ *yyg->yy_c_buf_p = yyg->yy_hold_char; YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; } YY_CURRENT_BUFFER_LVALUE = new_buffer; gdbwire_mi__load_buffer_state(yyscanner ); /* We don't actually know whether we did this switch during * EOF (gdbwire_mi_wrap()) processing, but the only time this flag * is looked at is after gdbwire_mi_wrap() is called, so it's safe * to go ahead and always set it. */ yyg->yy_did_buffer_switch_on_eof = 1; } static void gdbwire_mi__load_buffer_state (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; yyg->yy_hold_char = *yyg->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. * @param yyscanner The scanner object. * @return the allocated buffer state. */ YY_BUFFER_STATE gdbwire_mi__create_buffer (FILE * file, int size , yyscan_t yyscanner) { YY_BUFFER_STATE b; b = (YY_BUFFER_STATE) gdbwire_mi_alloc(sizeof( struct yy_buffer_state ) ,yyscanner ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in gdbwire_mi__create_buffer()" ); b->yy_buf_size = (yy_size_t)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 *) gdbwire_mi_alloc(b->yy_buf_size + 2 ,yyscanner ); if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in gdbwire_mi__create_buffer()" ); b->yy_is_our_buffer = 1; gdbwire_mi__init_buffer(b,file ,yyscanner); return b; } /** Destroy the buffer. * @param b a buffer created with gdbwire_mi__create_buffer() * @param yyscanner The scanner object. */ void gdbwire_mi__delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 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 ) gdbwire_mi_free((void *) b->yy_ch_buf ,yyscanner ); gdbwire_mi_free((void *) b ,yyscanner ); } /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, * such as during a gdbwire_mi_restart() or at EOF. */ static void gdbwire_mi__init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner) { int oerrno = errno; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; gdbwire_mi__flush_buffer(b ,yyscanner); b->yy_input_file = file; b->yy_fill_buffer = 1; /* If b is the current buffer, then gdbwire_mi__init_buffer was _probably_ * called from gdbwire_mi_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 = 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. * @param yyscanner The scanner object. */ void gdbwire_mi__flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 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 ) gdbwire_mi__load_buffer_state(yyscanner ); } /** 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. * @param yyscanner The scanner object. */ void gdbwire_mi_push_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; if (new_buffer == NULL) return; gdbwire_mi_ensure_buffer_stack(yyscanner); /* This block is copied from gdbwire_mi__switch_to_buffer. */ if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ *yyg->yy_c_buf_p = yyg->yy_hold_char; YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; } /* Only push if top exists. Otherwise, replace top. */ if (YY_CURRENT_BUFFER) yyg->yy_buffer_stack_top++; YY_CURRENT_BUFFER_LVALUE = new_buffer; /* copied from gdbwire_mi__switch_to_buffer. */ gdbwire_mi__load_buffer_state(yyscanner ); yyg->yy_did_buffer_switch_on_eof = 1; } /** Removes and deletes the top of the stack, if present. * The next element becomes the new top. * @param yyscanner The scanner object. */ void gdbwire_mi_pop_buffer_state (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; if (!YY_CURRENT_BUFFER) return; gdbwire_mi__delete_buffer(YY_CURRENT_BUFFER ,yyscanner); YY_CURRENT_BUFFER_LVALUE = NULL; if (yyg->yy_buffer_stack_top > 0) --yyg->yy_buffer_stack_top; if (YY_CURRENT_BUFFER) { gdbwire_mi__load_buffer_state(yyscanner ); yyg->yy_did_buffer_switch_on_eof = 1; } } /* Allocates the stack if it does not exist. * Guarantees space for at least one push. */ static void gdbwire_mi_ensure_buffer_stack (yyscan_t yyscanner) { yy_size_t num_to_alloc; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; if (!yyg->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; /* After all that talk, this was set to 1 anyways... */ yyg->yy_buffer_stack = (struct yy_buffer_state**)gdbwire_mi_alloc (num_to_alloc * sizeof(struct yy_buffer_state*) , yyscanner); if ( ! yyg->yy_buffer_stack ) YY_FATAL_ERROR( "out of dynamic memory in gdbwire_mi_ensure_buffer_stack()" ); memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*)); yyg->yy_buffer_stack_max = num_to_alloc; yyg->yy_buffer_stack_top = 0; return; } if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){ /* Increase the buffer to prepare for a possible push. */ yy_size_t grow_size = 8 /* arbitrary grow size */; num_to_alloc = yyg->yy_buffer_stack_max + grow_size; yyg->yy_buffer_stack = (struct yy_buffer_state**)gdbwire_mi_realloc (yyg->yy_buffer_stack, num_to_alloc * sizeof(struct yy_buffer_state*) , yyscanner); if ( ! yyg->yy_buffer_stack ) YY_FATAL_ERROR( "out of dynamic memory in gdbwire_mi_ensure_buffer_stack()" ); /* zero only the new slots.*/ memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*)); yyg->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 * @param yyscanner The scanner object. * @return the newly allocated buffer state object. */ YY_BUFFER_STATE gdbwire_mi__scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner) { 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) gdbwire_mi_alloc(sizeof( struct yy_buffer_state ) ,yyscanner ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in gdbwire_mi__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; gdbwire_mi__switch_to_buffer(b ,yyscanner ); return b; } /** Setup the input buffer state to scan a string. The next call to gdbwire_mi_lex() will * scan from a @e copy of @a str. * @param yystr a NUL-terminated string to scan * @param yyscanner The scanner object. * @return the newly allocated buffer state object. * @note If you want to scan bytes that may contain NUL values, then use * gdbwire_mi__scan_bytes() instead. */ YY_BUFFER_STATE gdbwire_mi__scan_string (yyconst char * yystr , yyscan_t yyscanner) { return gdbwire_mi__scan_bytes(yystr,strlen(yystr) ,yyscanner); } /** Setup the input buffer state to scan the given bytes. The next call to gdbwire_mi_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. * @param yyscanner The scanner object. * @return the newly allocated buffer state object. */ YY_BUFFER_STATE gdbwire_mi__scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len , yyscan_t yyscanner) { YY_BUFFER_STATE b; char *buf; yy_size_t n; yy_size_t i; /* Get memory for full buffer, including space for trailing EOB's. */ n = _yybytes_len + 2; buf = (char *) gdbwire_mi_alloc(n ,yyscanner ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in gdbwire_mi__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 = gdbwire_mi__scan_buffer(buf,n ,yyscanner); if ( ! b ) YY_FATAL_ERROR( "bad buffer in gdbwire_mi__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 , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; (void)yyg; (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] = yyg->yy_hold_char; \ yyg->yy_c_buf_p = yytext + yyless_macro_arg; \ yyg->yy_hold_char = *yyg->yy_c_buf_p; \ *yyg->yy_c_buf_p = '\0'; \ yyleng = yyless_macro_arg; \ } \ while ( 0 ) /* Accessor methods (get/set functions) to struct members. */ /** Get the user-defined data for this scanner. * @param yyscanner The scanner object. */ YY_EXTRA_TYPE gdbwire_mi_get_extra (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yyextra; } /** Get the current line number. * @param yyscanner The scanner object. */ int gdbwire_mi_get_lineno (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; if (! YY_CURRENT_BUFFER) return 0; return yylineno; } /** Get the current column number. * @param yyscanner The scanner object. */ int gdbwire_mi_get_column (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; if (! YY_CURRENT_BUFFER) return 0; return yycolumn; } /** Get the input stream. * @param yyscanner The scanner object. */ FILE *gdbwire_mi_get_in (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yyin; } /** Get the output stream. * @param yyscanner The scanner object. */ FILE *gdbwire_mi_get_out (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yyout; } /** Get the length of the current token. * @param yyscanner The scanner object. */ yy_size_t gdbwire_mi_get_leng (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yyleng; } /** Get the current token. * @param yyscanner The scanner object. */ char *gdbwire_mi_get_text (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yytext; } /** Set the user-defined data. This data is never touched by the scanner. * @param user_defined The data to be associated with this scanner. * @param yyscanner The scanner object. */ void gdbwire_mi_set_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yyextra = user_defined ; } /** Set the current line number. * @param _line_number line number * @param yyscanner The scanner object. */ void gdbwire_mi_set_lineno (int _line_number , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* lineno is only valid if an input buffer exists. */ if (! YY_CURRENT_BUFFER ) YY_FATAL_ERROR( "gdbwire_mi_set_lineno called with no buffer" ); yylineno = _line_number; } /** Set the current column. * @param _column_no column number * @param yyscanner The scanner object. */ void gdbwire_mi_set_column (int _column_no , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* column is only valid if an input buffer exists. */ if (! YY_CURRENT_BUFFER ) YY_FATAL_ERROR( "gdbwire_mi_set_column called with no buffer" ); yycolumn = _column_no; } /** Set the input stream. This does not discard the current * input buffer. * @param _in_str A readable stream. * @param yyscanner The scanner object. * @see gdbwire_mi__switch_to_buffer */ void gdbwire_mi_set_in (FILE * _in_str , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yyin = _in_str ; } void gdbwire_mi_set_out (FILE * _out_str , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yyout = _out_str ; } int gdbwire_mi_get_debug (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yy_flex_debug; } void gdbwire_mi_set_debug (int _bdebug , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yy_flex_debug = _bdebug ; } /* Accessor methods for yylval and yylloc */ /* User-visible API */ /* gdbwire_mi_lex_init is special because it creates the scanner itself, so it is * the ONLY reentrant function that doesn't take the scanner as the last argument. * That's why we explicitly handle the declaration, instead of using our macros. */ int gdbwire_mi_lex_init(yyscan_t* ptr_yy_globals) { if (ptr_yy_globals == NULL){ errno = EINVAL; return 1; } *ptr_yy_globals = (yyscan_t) gdbwire_mi_alloc ( sizeof( struct yyguts_t ), NULL ); if (*ptr_yy_globals == NULL){ errno = ENOMEM; return 1; } /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */ memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); return yy_init_globals ( *ptr_yy_globals ); } /* gdbwire_mi_lex_init_extra has the same functionality as gdbwire_mi_lex_init, but follows the * convention of taking the scanner as the last argument. Note however, that * this is a *pointer* to a scanner, as it will be allocated by this call (and * is the reason, too, why this function also must handle its own declaration). * The user defined value in the first argument will be available to gdbwire_mi_alloc in * the yyextra field. */ int gdbwire_mi_lex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals ) { struct yyguts_t dummy_yyguts; gdbwire_mi_set_extra (yy_user_defined, &dummy_yyguts); if (ptr_yy_globals == NULL){ errno = EINVAL; return 1; } *ptr_yy_globals = (yyscan_t) gdbwire_mi_alloc ( sizeof( struct yyguts_t ), &dummy_yyguts ); if (*ptr_yy_globals == NULL){ errno = ENOMEM; return 1; } /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */ memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); gdbwire_mi_set_extra (yy_user_defined, *ptr_yy_globals); return yy_init_globals ( *ptr_yy_globals ); } static int yy_init_globals (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* Initialization is the same as for the non-reentrant scanner. * This function is called from gdbwire_mi_lex_destroy(), so don't allocate here. */ yyg->yy_buffer_stack = 0; yyg->yy_buffer_stack_top = 0; yyg->yy_buffer_stack_max = 0; yyg->yy_c_buf_p = (char *) 0; yyg->yy_init = 0; yyg->yy_start = 0; yyg->yy_start_stack_ptr = 0; yyg->yy_start_stack_depth = 0; yyg->yy_start_stack = NULL; /* 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 * gdbwire_mi_lex_init() */ return 0; } /* gdbwire_mi_lex_destroy is for both reentrant and non-reentrant scanners. */ int gdbwire_mi_lex_destroy (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* Pop the buffer stack, destroying each element. */ while(YY_CURRENT_BUFFER){ gdbwire_mi__delete_buffer(YY_CURRENT_BUFFER ,yyscanner ); YY_CURRENT_BUFFER_LVALUE = NULL; gdbwire_mi_pop_buffer_state(yyscanner); } /* Destroy the stack itself. */ gdbwire_mi_free(yyg->yy_buffer_stack ,yyscanner); yyg->yy_buffer_stack = NULL; /* Destroy the start condition stack. */ gdbwire_mi_free(yyg->yy_start_stack ,yyscanner ); yyg->yy_start_stack = NULL; /* Reset the globals. This is important in a non-reentrant scanner so the next time * gdbwire_mi_lex() is called, initialization will occur. */ yy_init_globals( yyscanner); /* Destroy the main struct (reentrant only). */ gdbwire_mi_free ( yyscanner , yyscanner ); yyscanner = NULL; return 0; } /* * Internal utility routines. */ #ifndef yytext_ptr static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; (void)yyg; 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 , yyscan_t yyscanner) { int n; for ( n = 0; s[n]; ++n ) ; return n; } #endif void *gdbwire_mi_alloc (yy_size_t size , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; (void)yyg; return (void *) malloc( size ); } void *gdbwire_mi_realloc (void * ptr, yy_size_t size , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; (void)yyg; /* 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 gdbwire_mi_free (void * ptr , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; (void)yyg; free( (char *) ptr ); /* see gdbwire_mi_realloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" /***** End of gdbwire_mi_lexer.c *********************************************/ /***** Begin file gdbwire_mi_grammar.c ***************************************/ /* A Bison parser, made by GNU Bison 3.0.4. */ /* Bison implementation for Yacc-like parsers in C Copyright (C) 1984, 1989-1990, 2000-2015 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 "3.0.4" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" /* Pure parsers. */ #define YYPURE 1 /* Push parsers. */ #define YYPUSH 1 /* Pull parsers. */ #define YYPULL 0 /* Substitute the variable and function names. */ #define yypush_parse gdbwire_mi_push_parse #define yypstate_new gdbwire_mi_pstate_new #define yypstate_delete gdbwire_mi_pstate_delete #define yypstate gdbwire_mi_pstate #define yylex gdbwire_mi_lex #define yyerror gdbwire_mi_error #define yydebug gdbwire_mi_debug #define yynerrs gdbwire_mi_nerrs /* Copy the first part of user declarations. */ #include #include #include /* #include "gdbwire_sys.h" */ /* #include "gdbwire_mi_grammar.h" */ /* #include "gdbwire_mi_pt.h" */ /* #include "gdbwire_mi_pt_alloc.h" */ char *gdbwire_mi_get_text(yyscan_t yyscanner); struct gdbwire_mi_position gdbwire_mi_get_extra(yyscan_t yyscanner); /** * Used only in the parser to build a gdbwire_mi_result list. * * The grammar wants to build a list of gdbwire_mi_result pointers. * However, the gdbwire_mi_result is a traditional linked list and * standard append functionality (using next to get to end of list) is slow. * * This structure allows us to keep around the last result in the list * for fast insertion. */ struct gdbwire_mi_result_list { /** The gdbwire_mi_result list that is being built */ struct gdbwire_mi_result *head; /** The pointer to the last result in the list for fast insertion. */ struct gdbwire_mi_result **tail; }; /** * Allocate a gdbwire_mi_result_list data structure. * * @return * The gdbwire_mi_result_list. Use free() to release the memory. */ struct gdbwire_mi_result_list *gdbwire_mi_result_list_alloc(void) { struct gdbwire_mi_result_list *result; result = calloc(1, sizeof(struct gdbwire_mi_result_list)); result->tail = &result->head; return result; } /** * Append an item to this list. * * @param list * The list to append to. * * @param result * The result to append to the end of the list. */ void gdbwire_mi_result_list_push_back(struct gdbwire_mi_result_list *list, struct gdbwire_mi_result *result) { *list->tail = result; list->tail = &result->next; } void gdbwire_mi_error(yyscan_t yyscanner, struct gdbwire_mi_output **gdbwire_mi_output, const char *s) { char *text = gdbwire_mi_get_text(yyscanner); struct gdbwire_mi_position pos = gdbwire_mi_get_extra(yyscanner); *gdbwire_mi_output = gdbwire_mi_output_alloc(); (*gdbwire_mi_output)->kind = GDBWIRE_MI_OUTPUT_PARSE_ERROR; (*gdbwire_mi_output)->variant.error.token = gdbwire_strdup(text); (*gdbwire_mi_output)->variant.error.pos = pos; } /** * GDB/MI escapes characters in the c-string rule. * * The c-string starts and ends with a ". * Each " in the c-string is escaped with a \. So GDB turns " into \". * Each \ in the string is then escaped with a \. So GDB turns \ into \\. * * Remove the GDB/MI escape characters to provide back to the user the * original characters that GDB was intending to transmit. So * \" -> " * \\ -> \ * \n -> new line * \r -> carriage return * \t -> tab * * See gdbwire_mi_grammar.txt (GDB/MI Clarifications) for more information. * * @param str * The escaped GDB/MI c-string data. * * @return * An allocated strng representing str with the escaping undone. */ static char *gdbwire_mi_unescape_cstring(char *str) { char *result; size_t r, s, length; /*assert(str);*/ result = gdbwire_strdup(str); length = strlen(str); /* a CSTRING should start and end with a quote */ /*assert(result);*/ /*assert(length >= 2);*/ for (r = 0, s = 1; s < length - 1; ++s) { if (str[s] == '\\') { switch (str[s+1]) { case 'n': result[r++] = '\n'; ++s; break; case 'b': result[r++] = '\b'; ++s; break; case 't': result[r++] = '\t'; ++s; break; case 'f': result[r++] = '\f'; ++s; break; case 'r': result[r++] = '\r'; ++s; break; case 'e': result[r++] = '\033'; ++s; break; case 'a': result[r++] = '\007'; ++s; break; case '"': result[r++] = '\"'; ++s; break; case '\\': result[r++] = '\\'; ++s; break; default: result[r++] = str[s]; break; } } else { result[r++] = str[s]; } } result[r] = 0; return result; } # ifndef YY_NULLPTR # if defined __cplusplus && 201103L <= __cplusplus # define YY_NULLPTR nullptr # else # define YY_NULLPTR 0 # endif # endif /* Enabling verbose error messages. */ #ifdef YYERROR_VERBOSE # undef YYERROR_VERBOSE # define YYERROR_VERBOSE 1 #else # define YYERROR_VERBOSE 0 #endif /* In a future release of Bison, this section will be replaced by #include "y.tab.h". */ #ifndef YY_GDBWIRE_MI_SRC_GDBWIRE_MI_GRAMMAR_H_INCLUDED # define YY_GDBWIRE_MI_SRC_GDBWIRE_MI_GRAMMAR_H_INCLUDED /* Debug traces. */ #ifndef YYDEBUG # define YYDEBUG 0 #endif #if YYDEBUG extern int gdbwire_mi_debug; #endif /* "%code requires" blocks. */ /* An opaque pointer. */ #ifndef YY_TYPEDEF_YY_SCANNER_T #define YY_TYPEDEF_YY_SCANNER_T typedef void *yyscan_t; #endif struct gdbwire_mi_output; /* Token type. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE 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 /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED union YYSTYPE { struct gdbwire_mi_output *u_output; struct gdbwire_mi_oob_record *u_oob_record; struct gdbwire_mi_result_record *u_result_record; int u_result_class; int u_async_record_kind; struct gdbwire_mi_result_list *u_result_list; struct gdbwire_mi_result *u_result; char *u_token; struct gdbwire_mi_async_record *u_async_record; struct gdbwire_mi_stream_record *u_stream_record; int u_async_class; char *u_variable; char *u_cstring; struct gdbwire_mi_result *u_tuple; struct gdbwire_mi_result *u_list; int u_stream_record_kind; }; typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1 #endif #ifndef YYPUSH_MORE_DEFINED # define YYPUSH_MORE_DEFINED enum { YYPUSH_MORE = 4 }; #endif typedef struct gdbwire_mi_pstate gdbwire_mi_pstate; int gdbwire_mi_push_parse (gdbwire_mi_pstate *ps, int pushed_char, YYSTYPE const *pushed_val, yyscan_t yyscanner, struct gdbwire_mi_output **gdbwire_mi_output); gdbwire_mi_pstate * gdbwire_mi_pstate_new (void); void gdbwire_mi_pstate_delete (gdbwire_mi_pstate *ps); #endif /* !YY_GDBWIRE_MI_SRC_GDBWIRE_MI_GRAMMAR_H_INCLUDED */ /* Copy the second part of user declarations. */ #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; #else typedef signed char 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 # 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 defined YYENABLE_NLS && 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 #ifndef YY_ATTRIBUTE # if (defined __GNUC__ \ && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C # define YY_ATTRIBUTE(Spec) __attribute__(Spec) # else # define YY_ATTRIBUTE(Spec) /* empty */ # endif #endif #ifndef YY_ATTRIBUTE_PURE # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) #endif #ifndef YY_ATTRIBUTE_UNUSED # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) #endif #if !defined _Noreturn \ && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) # if defined _MSC_VER && 1200 <= _MSC_VER # define _Noreturn __declspec (noreturn) # else # define _Noreturn YY_ATTRIBUTE ((__noreturn__)) # 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 #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ /* Suppress an incorrect diagnostic about yylval being uninitialized. */ # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ _Pragma ("GCC diagnostic push") \ _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") # define YY_IGNORE_MAYBE_UNINITIALIZED_END \ _Pragma ("GCC diagnostic pop") #else # define YY_INITIAL_VALUE(Value) Value #endif #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN # define YY_IGNORE_MAYBE_UNINITIALIZED_END #endif #ifndef YY_INITIAL_VALUE # define YY_INITIAL_VALUE(Value) /* Nothing. */ #endif #if ! defined yyoverflow || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ # ifdef YYSTACK_ALLOC /* Pacify GCC's 'empty if-body' warning. */ # define YYSTACK_FREE(Ptr) do { /* empty */; } while (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 EXIT_SUCCESS \ && ! ((defined YYMALLOC || defined malloc) \ && (defined YYFREE || defined free))) # include /* INFRINGES ON USER NAME SPACE */ # ifndef EXIT_SUCCESS # define EXIT_SUCCESS 0 # endif # endif # ifndef YYMALLOC # define YYMALLOC malloc # if ! defined malloc && ! defined EXIT_SUCCESS void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free # if ! defined free && ! defined EXIT_SUCCESS 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) # define YYCOPY_NEEDED 1 /* 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 (0) #endif #if defined YYCOPY_NEEDED && YYCOPY_NEEDED /* Copy COUNT objects from SRC to DST. The source and destination do not overlap. */ # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ # define YYCOPY(Dst, Src, Count) \ __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) # else # define YYCOPY(Dst, Src, Count) \ do \ { \ YYSIZE_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (Dst)[yyi] = (Src)[yyi]; \ } \ while (0) # endif # endif #endif /* !YYCOPY_NEEDED */ /* YYFINAL -- State number of the termination state. */ #define YYFINAL 2 /* YYLAST -- Last index in YYTABLE. */ #define YYLAST 42 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 21 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 22 /* YYNRULES -- Number of rules. */ #define YYNRULES 40 /* YYNSTATES -- Number of states. */ #define YYNSTATES 56 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned by yylex, with out-of-bounds checking. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 275 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM as returned by yylex, without out-of-bounds checking. */ 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 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { 0, 264, 264, 267, 270, 274, 278, 284, 290, 290, 302, 309, 317, 323, 329, 337, 346, 350, 354, 358, 375, 428, 432, 436, 441, 446, 453, 460, 467, 472, 477, 481, 486, 490, 495, 501, 505, 509, 513, 517, 521 }; #endif #if YYDEBUG || YYERROR_VERBOSE || 0 /* 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", "output_variant", "$@1", "result_record", "oob_record", "async_record", "async_record_class", "result_class", "async_class", "opt_variable", "result_list", "result", "variable", "cstring", "tuple", "list", "stream_record", "stream_record_class", "opt_token", "token", YY_NULLPTR }; #endif # ifdef YYPRINT /* YYTOKNUM[NUM] -- (External) token number corresponding to the (internal) symbol number NUM (which must be that of a token). */ 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 #define YYPACT_NINF -19 #define yypact_value_is_default(Yystate) \ (!!((Yystate) == (-19))) #define YYTABLE_NINF -39 #define yytable_value_is_error(Yytable_value) \ 0 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ static const yytype_int8 yypact[] = { -19, 0, -19, 15, 11, -19, -19, -19, -19, -19, 16, -19, -19, -19, -19, -3, 14, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, 12, 18, 27, -19, 17, -19, 19, -19, 11, 11, 1, 20, -19, 28, 20, 9, -11, -19, -19, -19, 11, -19, -19, -2, -19, 13, -19, -19, -19 }; /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. Performed when YYTABLE does not specify something else to do. Zero means the default is an error. */ static const yytype_uint8 yydefact[] = { 2, 0, 1, 0, 0, 35, 36, 37, 40, 3, 0, 7, 6, 12, 13, 0, 0, 39, 5, 28, 8, 4, 29, 34, 17, 16, 18, 0, 0, 0, 19, 10, 20, 14, 9, 21, 21, 0, 11, 23, 0, 15, 21, 21, 25, 26, 27, 21, 22, 30, 0, 32, 0, 24, 31, 33 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -18, -7, 37, 5, -19, -19, -19, -19, -19, -19 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int8 yydefgoto[] = { -1, 1, 9, 10, 29, 11, 12, 13, 28, 31, 33, 37, 38, 39, 40, 23, 45, 46, 14, 15, 16, 17 }; /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule whose number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_int8 yytable[] = { 2, 3, 54, 51, 42, 4, 19, -38, -38, -38, 5, 6, 7, 49, 43, 22, 8, 47, 41, 22, -38, 24, 25, 26, 50, 52, 19, 55, 19, 30, 18, 21, 47, 34, 27, 32, 35, 48, 36, 47, 53, 20, 44 }; static const yytype_uint8 yycheck[] = { 0, 1, 4, 14, 3, 5, 17, 7, 8, 9, 10, 11, 12, 4, 13, 18, 16, 19, 36, 18, 20, 7, 8, 9, 42, 43, 17, 14, 17, 17, 15, 15, 19, 6, 20, 17, 19, 9, 19, 19, 47, 4, 37 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { 0, 22, 0, 1, 5, 10, 11, 12, 16, 23, 24, 26, 27, 28, 39, 40, 41, 42, 15, 17, 35, 15, 18, 36, 7, 8, 9, 20, 29, 25, 17, 30, 17, 31, 6, 19, 19, 32, 33, 34, 35, 33, 3, 13, 36, 37, 38, 19, 9, 4, 33, 14, 33, 34, 4, 14 }; /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { 0, 21, 22, 22, 23, 23, 24, 24, 25, 24, 26, 26, 27, 27, 28, 28, 29, 29, 29, 30, 31, 32, 32, 33, 33, 34, 34, 34, 35, 36, 37, 37, 38, 38, 39, 40, 40, 40, 41, 41, 42 }; /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ static const yytype_uint8 yyr2[] = { 0, 2, 0, 2, 2, 2, 1, 1, 0, 4, 3, 5, 1, 1, 3, 5, 1, 1, 1, 1, 1, 0, 2, 1, 3, 2, 2, 2, 1, 1, 2, 3, 2, 3, 2, 1, 1, 1, 0, 1, 1 }; #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 #define YYRECOVERING() (!!yyerrstatus) #define YYBACKUP(Token, Value) \ do \ if (yychar == YYEMPTY) \ { \ yychar = (Token); \ yylval = (Value); \ YYPOPSTACK (yylen); \ yystate = *yyssp; \ goto yybackup; \ } \ else \ { \ yyerror (yyscanner, gdbwire_mi_output, YY_("syntax error: cannot back up")); \ YYERROR; \ } \ while (0) /* Error token number */ #define YYTERROR 1 #define YYERRCODE 256 /* 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 (0) /* This macro is provided for backward compatibility. */ #ifndef YY_LOCATION_PRINT # define YY_LOCATION_PRINT(File, Loc) ((void) 0) #endif # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ do { \ if (yydebug) \ { \ YYFPRINTF (stderr, "%s ", Title); \ yy_symbol_print (stderr, \ Type, Value, yyscanner, gdbwire_mi_output); \ YYFPRINTF (stderr, "\n"); \ } \ } while (0) /*----------------------------------------. | Print this symbol's value on YYOUTPUT. | `----------------------------------------*/ static void yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, yyscan_t yyscanner, struct gdbwire_mi_output **gdbwire_mi_output) { FILE *yyo = yyoutput; YYUSE (yyo); YYUSE (yyscanner); YYUSE (gdbwire_mi_output); if (!yyvaluep) return; # ifdef YYPRINT if (yytype < YYNTOKENS) YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); # endif YYUSE (yytype); } /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ static void yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, yyscan_t yyscanner, struct gdbwire_mi_output **gdbwire_mi_output) { YYFPRINTF (yyoutput, "%s %s (", yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); yy_symbol_value_print (yyoutput, yytype, yyvaluep, yyscanner, gdbwire_mi_output); YYFPRINTF (yyoutput, ")"); } /*------------------------------------------------------------------. | yy_stack_print -- Print the state stack from its BOTTOM up to its | | TOP (included). | `------------------------------------------------------------------*/ static void yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) { 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 (0) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ static void yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, yyscan_t yyscanner, struct gdbwire_mi_output **gdbwire_mi_output) { unsigned long int yylno = yyrline[yyrule]; int yynrhs = yyr2[yyrule]; int yyi; 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, yystos[yyssp[yyi + 1 - yynrhs]], &(yyvsp[(yyi + 1) - (yynrhs)]) , yyscanner, gdbwire_mi_output); YYFPRINTF (stderr, "\n"); } } # define YY_REDUCE_PRINT(Rule) \ do { \ if (yydebug) \ yy_reduce_print (yyssp, yyvsp, Rule, yyscanner, gdbwire_mi_output); \ } while (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. */ static YYSIZE_T yystrlen (const char *yystr) { 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. */ static char * yystpcpy (char *yydest, const char *yysrc) { 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 *YYMSG, which is of size *YYMSG_ALLOC, an error message about the unexpected token YYTOKEN for the state stack whose top is YYSSP. Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is not large enough to hold the message. In that case, also set *YYMSG_ALLOC to the required number of bytes. Return 2 if the required number of bytes is too large to store. */ static int yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, yytype_int16 *yyssp, int yytoken) { YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); YYSIZE_T yysize = yysize0; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; /* Internationalized format string. */ const char *yyformat = YY_NULLPTR; /* Arguments of yyformat. */ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; /* Number of reported tokens (one for the "unexpected", one per "expected"). */ int yycount = 0; /* There are many possibilities here to consider: - If this state is a consistent state with a default action, then the only way this function was invoked is if the default action is an error action. In that case, don't check for expected tokens because there are none. - The only way there can be no lookahead present (in yychar) is if this state is a consistent state with a default action. Thus, detecting the absence of a lookahead is sufficient to determine that there is no unexpected or expected token to report. In that case, just report a simple "syntax error". - Don't assume there isn't a lookahead just because this state is a consistent state with a default action. There might have been a previous inconsistent state, consistent state with a non-default action, or user semantic action that manipulated yychar. - Of course, the expected token list depends on states to have correct lookahead information, and it depends on the parser not to perform extra reductions after fetching a lookahead from the scanner and before detecting a syntax error. Thus, state merging (from LALR or IELR) and default reductions corrupt the expected token list. However, the list is correct for canonical LR with one exception: it will still contain any token that will not be accepted due to an error action in a later state. */ if (yytoken != YYEMPTY) { int yyn = yypact[*yyssp]; yyarg[yycount++] = yytname[yytoken]; if (!yypact_value_is_default (yyn)) { /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. In other words, skip the first -YYN actions for this state because they are default actions. */ 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 yyx; for (yyx = yyxbegin; yyx < yyxend; ++yyx) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR && !yytable_value_is_error (yytable[yyx + yyn])) { if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) { yycount = 1; yysize = yysize0; break; } yyarg[yycount++] = yytname[yyx]; { YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) return 2; yysize = yysize1; } } } } switch (yycount) { # define YYCASE_(N, S) \ case N: \ yyformat = S; \ break YYCASE_(0, YY_("syntax error")); YYCASE_(1, YY_("syntax error, unexpected %s")); YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); # undef YYCASE_ } { YYSIZE_T yysize1 = yysize + yystrlen (yyformat); if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) return 2; yysize = yysize1; } if (*yymsg_alloc < yysize) { *yymsg_alloc = 2 * yysize; if (! (yysize <= *yymsg_alloc && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; return 1; } /* 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 = *yymsg; int yyi = 0; while ((*yyp = *yyformat) != '\0') if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) { yyp += yytnamerr (yyp, yyarg[yyi++]); yyformat += 2; } else { yyp++; yyformat++; } } return 0; } #endif /* YYERROR_VERBOSE */ /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ static void yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, yyscan_t yyscanner, struct gdbwire_mi_output **gdbwire_mi_output) { YYUSE (yyvaluep); YYUSE (yyscanner); YYUSE (gdbwire_mi_output); if (!yymsg) yymsg = "Deleting"; YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN switch (yytype) { case 24: /* output_variant */ { gdbwire_mi_output_free(((*yyvaluep).u_output)); } break; case 32: /* opt_variable */ { free(((*yyvaluep).u_variable)); } break; case 33: /* result_list */ { gdbwire_mi_result_free(((*yyvaluep).u_result_list)->head); free(((*yyvaluep).u_result_list)); } break; case 34: /* result */ { gdbwire_mi_result_free(((*yyvaluep).u_result)); } break; case 35: /* variable */ { free(((*yyvaluep).u_variable)); } break; case 41: /* opt_token */ { free(((*yyvaluep).u_token)); } break; default: break; } YY_IGNORE_MAYBE_UNINITIALIZED_END } 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 through 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. */ yypstate * yypstate_new (void) { yypstate *yyps; yyps = (yypstate *) malloc (sizeof *yyps); if (!yyps) return YY_NULLPTR; yyps->yynew = 1; return yyps; } void yypstate_delete (yypstate *yyps) { #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 gdbwire_mi_nerrs yyps->gdbwire_mi_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 /*---------------. | yypush_parse. | `---------------*/ int yypush_parse (yypstate *yyps, int yypushed_char, YYSTYPE const *yypushed_val, yyscan_t yyscanner, struct gdbwire_mi_output **gdbwire_mi_output) { /* The lookahead symbol. */ int yychar; /* The semantic value of the lookahead symbol. */ /* Default value used for initialization, for pacifying older GCCs or non-GCC compilers. */ YY_INITIAL_VALUE (static YYSTYPE yyval_default;) YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); int yyn; int yyresult; /* Lookahead token as an internal (translated) token number. */ int yytoken = 0; /* 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; } yyssp = yyss = yyssa; yyvsp = yyvs = yyvsa; yystacksize = YYINITDEPTH; YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ 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 (yypact_value_is_default (yyn)) 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 (yytable_value_is_error (yyn)) 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; YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; YY_IGNORE_MAYBE_UNINITIALIZED_END 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: { } break; case 3: { } break; case 4: { *gdbwire_mi_output = (yyvsp[-1].u_output); } break; case 5: { yyerrok; } break; case 6: { (yyval.u_output) = gdbwire_mi_output_alloc(); (yyval.u_output)->kind = GDBWIRE_MI_OUTPUT_OOB; (yyval.u_output)->variant.oob_record = (yyvsp[0].u_oob_record); } break; case 7: { (yyval.u_output) = gdbwire_mi_output_alloc(); (yyval.u_output)->kind = GDBWIRE_MI_OUTPUT_RESULT; (yyval.u_output)->variant.result_record = (yyvsp[0].u_result_record); } break; case 8: { if (strcmp("gdb", (yyvsp[0].u_variable)) != 0) { /* Destructor will be called to free $2 on error */ yyerror(yyscanner, gdbwire_mi_output, ""); YYERROR; } } break; case 9: { (yyval.u_output) = gdbwire_mi_output_alloc(); (yyval.u_output)->kind = GDBWIRE_MI_OUTPUT_PROMPT; free((yyvsp[-2].u_variable)); } break; case 10: { (yyval.u_result_record) = gdbwire_mi_result_record_alloc(); (yyval.u_result_record)->token = (yyvsp[-2].u_token); (yyval.u_result_record)->result_class = (yyvsp[0].u_result_class); (yyval.u_result_record)->result = NULL; } break; case 11: { (yyval.u_result_record) = gdbwire_mi_result_record_alloc(); (yyval.u_result_record)->token = (yyvsp[-4].u_token); (yyval.u_result_record)->result_class = (yyvsp[-2].u_result_class); (yyval.u_result_record)->result = (yyvsp[0].u_result_list)->head; free((yyvsp[0].u_result_list)); } break; case 12: { (yyval.u_oob_record) = gdbwire_mi_oob_record_alloc(); (yyval.u_oob_record)->kind = GDBWIRE_MI_ASYNC; (yyval.u_oob_record)->variant.async_record = (yyvsp[0].u_async_record); } break; case 13: { (yyval.u_oob_record) = gdbwire_mi_oob_record_alloc(); (yyval.u_oob_record)->kind = GDBWIRE_MI_STREAM; (yyval.u_oob_record)->variant.stream_record = (yyvsp[0].u_stream_record); } break; case 14: { (yyval.u_async_record) = gdbwire_mi_async_record_alloc(); (yyval.u_async_record)->token = (yyvsp[-2].u_token); (yyval.u_async_record)->kind = (yyvsp[-1].u_async_record_kind); (yyval.u_async_record)->async_class = (yyvsp[0].u_async_class); (yyval.u_async_record)->result = NULL; } break; case 15: { (yyval.u_async_record) = gdbwire_mi_async_record_alloc(); (yyval.u_async_record)->token = (yyvsp[-4].u_token); (yyval.u_async_record)->kind = (yyvsp[-3].u_async_record_kind); (yyval.u_async_record)->async_class = (yyvsp[-2].u_async_class); (yyval.u_async_record)->result = (yyvsp[0].u_result_list)->head; free((yyvsp[0].u_result_list)); } break; case 16: { (yyval.u_async_record_kind) = GDBWIRE_MI_EXEC; } break; case 17: { (yyval.u_async_record_kind) = GDBWIRE_MI_STATUS; } break; case 18: { (yyval.u_async_record_kind) = GDBWIRE_MI_NOTIFY; } break; case 19: { char *text = gdbwire_mi_get_text(yyscanner); if (strcmp("done", text) == 0) { (yyval.u_result_class) = GDBWIRE_MI_DONE; } else if (strcmp("running", text) == 0) { (yyval.u_result_class) = GDBWIRE_MI_RUNNING; } else if (strcmp("connected", text) == 0) { (yyval.u_result_class) = GDBWIRE_MI_CONNECTED; } else if (strcmp("error", text) == 0) { (yyval.u_result_class) = GDBWIRE_MI_ERROR; } else if (strcmp("exit", text) == 0) { (yyval.u_result_class) = GDBWIRE_MI_EXIT; } else { (yyval.u_result_class) = GDBWIRE_MI_UNSUPPORTED; } } break; case 20: { char *text = gdbwire_mi_get_text(yyscanner); if (strcmp("download", text) == 0) { (yyval.u_async_class) = GDBWIRE_MI_ASYNC_DOWNLOAD; } else if (strcmp("stopped", text) == 0) { (yyval.u_async_class) = GDBWIRE_MI_ASYNC_STOPPED; } else if (strcmp("running", text) == 0) { (yyval.u_async_class) = GDBWIRE_MI_ASYNC_RUNNING; } else if (strcmp("thread-group-added", text) == 0) { (yyval.u_async_class) = GDBWIRE_MI_ASYNC_THREAD_GROUP_ADDED; } else if (strcmp("thread-group-removed", text) == 0) { (yyval.u_async_class) = GDBWIRE_MI_ASYNC_THREAD_GROUP_REMOVED; } else if (strcmp("thread-group-started", text) == 0) { (yyval.u_async_class) = GDBWIRE_MI_ASYNC_THREAD_GROUP_STARTED; } else if (strcmp("thread-group-exited", text) == 0) { (yyval.u_async_class) = GDBWIRE_MI_ASYNC_THREAD_GROUP_EXITED; } else if (strcmp("thread-created", text) == 0) { (yyval.u_async_class) = GDBWIRE_MI_ASYNC_THREAD_CREATED; } else if (strcmp("thread-exited", text) == 0) { (yyval.u_async_class) = GDBWIRE_MI_ASYNC_THREAD_EXITED; } else if (strcmp("thread-selected", text) == 0) { (yyval.u_async_class) = GDBWIRE_MI_ASYNC_THREAD_SELECTED; } else if (strcmp("library-loaded", text) == 0) { (yyval.u_async_class) = GDBWIRE_MI_ASYNC_LIBRARY_LOADED; } else if (strcmp("library-unloaded", text) == 0) { (yyval.u_async_class) = GDBWIRE_MI_ASYNC_LIBRARY_UNLOADED; } else if (strcmp("traceframe-changed", text) == 0) { (yyval.u_async_class) = GDBWIRE_MI_ASYNC_TRACEFRAME_CHANGED; } else if (strcmp("tsv-created", text) == 0) { (yyval.u_async_class) = GDBWIRE_MI_ASYNC_TSV_CREATED; } else if (strcmp("tsv-modified", text) == 0) { (yyval.u_async_class) = GDBWIRE_MI_ASYNC_TSV_MODIFIED; } else if (strcmp("tsv-deleted", text) == 0) { (yyval.u_async_class) = GDBWIRE_MI_ASYNC_TSV_DELETED; } else if (strcmp("breakpoint-created", text) == 0) { (yyval.u_async_class) = GDBWIRE_MI_ASYNC_BREAKPOINT_CREATED; } else if (strcmp("breakpoint-modified", text) == 0) { (yyval.u_async_class) = GDBWIRE_MI_ASYNC_BREAKPOINT_MODIFIED; } else if (strcmp("breakpoint-deleted", text) == 0) { (yyval.u_async_class) = GDBWIRE_MI_ASYNC_BREAKPOINT_DELETED; } else if (strcmp("record-started", text) == 0) { (yyval.u_async_class) = GDBWIRE_MI_ASYNC_RECORD_STARTED; } else if (strcmp("record-stopped", text) == 0) { (yyval.u_async_class) = GDBWIRE_MI_ASYNC_RECORD_STOPPED; } else if (strcmp("cmd-param-changed", text) == 0) { (yyval.u_async_class) = GDBWIRE_MI_ASYNC_CMD_PARAM_CHANGED; } else if (strcmp("memory-changed", text) == 0) { (yyval.u_async_class) = GDBWIRE_MI_ASYNC_MEMORY_CHANGED; } else { (yyval.u_async_class) = GDBWIRE_MI_ASYNC_UNSUPPORTED; } } break; case 21: { (yyval.u_variable) = 0; } break; case 22: { (yyval.u_variable) = (yyvsp[-1].u_variable); } break; case 23: { (yyval.u_result_list) = gdbwire_mi_result_list_alloc(); gdbwire_mi_result_list_push_back((yyval.u_result_list), (yyvsp[0].u_result)); } break; case 24: { gdbwire_mi_result_list_push_back((yyvsp[-2].u_result_list), (yyvsp[0].u_result)); (yyval.u_result_list) = (yyvsp[-2].u_result_list); } break; case 25: { (yyval.u_result) = gdbwire_mi_result_alloc(); (yyval.u_result)->variable = (yyvsp[-1].u_variable); (yyval.u_result)->kind = GDBWIRE_MI_CSTRING; (yyval.u_result)->variant.cstring = (yyvsp[0].u_cstring); } break; case 26: { (yyval.u_result) = gdbwire_mi_result_alloc(); (yyval.u_result)->variable = (yyvsp[-1].u_variable); (yyval.u_result)->kind = GDBWIRE_MI_TUPLE; (yyval.u_result)->variant.result = (yyvsp[0].u_tuple); } break; case 27: { (yyval.u_result) = gdbwire_mi_result_alloc(); (yyval.u_result)->variable = (yyvsp[-1].u_variable); (yyval.u_result)->kind = GDBWIRE_MI_LIST; (yyval.u_result)->variant.result = (yyvsp[0].u_list); } break; case 28: { char *text = gdbwire_mi_get_text(yyscanner); (yyval.u_variable) = gdbwire_strdup(text); } break; case 29: { char *text = gdbwire_mi_get_text(yyscanner); (yyval.u_cstring) = gdbwire_mi_unescape_cstring(text); } break; case 30: { (yyval.u_tuple) = NULL; } break; case 31: { (yyval.u_tuple) = (yyvsp[-1].u_result_list)->head; free((yyvsp[-1].u_result_list)); } break; case 32: { (yyval.u_list) = NULL; } break; case 33: { (yyval.u_list) = (yyvsp[-1].u_result_list)->head; free((yyvsp[-1].u_result_list)); } break; case 34: { (yyval.u_stream_record) = gdbwire_mi_stream_record_alloc(); (yyval.u_stream_record)->kind = (yyvsp[-1].u_stream_record_kind); (yyval.u_stream_record)->cstring = (yyvsp[0].u_cstring); } break; case 35: { (yyval.u_stream_record_kind) = GDBWIRE_MI_CONSOLE; } break; case 36: { (yyval.u_stream_record_kind) = GDBWIRE_MI_TARGET; } break; case 37: { (yyval.u_stream_record_kind) = GDBWIRE_MI_LOG; } break; case 38: { (yyval.u_token) = NULL; } break; case 39: { (yyval.u_token) = (yyvsp[0].u_token); } break; case 40: { char *text = gdbwire_mi_get_text(yyscanner); (yyval.u_token) = gdbwire_strdup(text); } break; default: break; } /* User semantic actions sometimes alter yychar, and that requires that yytoken be updated with the new translation. We take the approach of translating immediately before every use of yytoken. One alternative is translating here after every semantic action, but that translation would be missed if the semantic action invokes YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an incorrect destructor might then be invoked immediately. In the case of YYERROR or YYBACKUP, subsequent parser actions might lead to an incorrect destructor call or verbose syntax error message before the lookahead is translated. */ 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: /* Make sure we have latest lookahead translation. See comments at user semantic actions for why this is necessary. */ yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { ++yynerrs; #if ! YYERROR_VERBOSE yyerror (yyscanner, gdbwire_mi_output, YY_("syntax error")); #else # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ yyssp, yytoken) { char const *yymsgp = YY_("syntax error"); int yysyntax_error_status; yysyntax_error_status = YYSYNTAX_ERROR; if (yysyntax_error_status == 0) yymsgp = yymsg; else if (yysyntax_error_status == 1) { if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); if (!yymsg) { yymsg = yymsgbuf; yymsg_alloc = sizeof yymsgbuf; yysyntax_error_status = 2; } else { yysyntax_error_status = YYSYNTAX_ERROR; yymsgp = yymsg; } } yyerror (yyscanner, gdbwire_mi_output, yymsgp); if (yysyntax_error_status == 2) goto yyexhaustedlab; } # undef YYSYNTAX_ERROR #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, yyscanner, gdbwire_mi_output); 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 whose 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 (!yypact_value_is_default (yyn)) { 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, yyscanner, gdbwire_mi_output); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; YY_IGNORE_MAYBE_UNINITIALIZED_END /* 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 (yyscanner, gdbwire_mi_output, YY_("memory exhausted")); yyresult = 2; /* Fall through. */ #endif yyreturn: if (yychar != YYEMPTY) { /* Make sure we have latest lookahead translation. See comments at user semantic actions for why this is necessary. */ yytoken = YYTRANSLATE (yychar); yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval, yyscanner, gdbwire_mi_output); } /* Do not reclaim the symbols of the rule whose action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); YY_STACK_PRINT (yyss, yyssp); while (yyssp != yyss) { yydestruct ("Cleanup: popping", yystos[*yyssp], yyvsp, yyscanner, gdbwire_mi_output); 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 return yyresult; } /***** End of gdbwire_mi_grammar.c *******************************************/ /***** Begin file gdbwire.c **************************************************/ /** * Copyright (C) 2013 Robert Rossi * * This file is part of GDBWIRE. * * GDBWIRE 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. * * GDBWIRE 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 GDBWIRE. If not, see . */ #include #include /* #include "gdbwire_assert.h" */ /***** Include gdbwire.h in the middle of gdbwire.c **************************/ /***** Begin file gdbwire.h **************************************************/ /** * Copyright (C) 2013 Robert Rossi * * This file is part of GDBWIRE. * * GDBWIRE 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. * * GDBWIRE 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 GDBWIRE. If not, see . */ #ifndef GDBWIRE_H #define GDBWIRE_H #ifdef __cplusplus extern "C" { #endif #include /* #include "gdbwire_result.h" */ /* #include "gdbwire_mi_pt.h" */ /* #include "gdbwire_mi_command.h" */ /* The opaque gdbwire context */ struct gdbwire; /** * The primary mechanism for gdbwire to send events to the caller. * * The flow is like this: * - create a gdbwire instance * - loop: * - call gdbwire functions to send commands to gdb * - receive callback events with results when they become available * - destroy the instance */ struct gdbwire_callbacks { /** * An arbitrary pointer to associate with the events. * * This pointer will be passed back to the caller in each event. */ void *context; /** * A console, target or log output event has occured. * * @param context * The context pointer above. * * @param stream_record * The stream record to display to the user. */ void (*gdbwire_stream_record_fn)(void *context, struct gdbwire_mi_stream_record *stream_record); /** * An asynchronous output event. * * @param context * The context pointer above. * * @param async_record * The asychronous record output by GDB. */ void (*gdbwire_async_record_fn)(void *context, struct gdbwire_mi_async_record *async_record); /** * A result output event. * * @param context * The context pointer above. * * @param result_record * The result record output by GDB. */ void (*gdbwire_result_record_fn)(void *context, struct gdbwire_mi_result_record *result_record); /** * A prompt output event. * * @param context * The context pointer above. * * @param prompt * The prompt output to display to the user. */ void (*gdbwire_prompt_fn)(void *context, const char *prompt); /** * A gdbwire parse error occurred. * * If you receive this callback, that means the gdbwire parser * failed to parse some gdb/mi coming out of gdb. * Please send the parameters received in this callback to the * gdbwire develpment team. * * @param context * The context pointer above. * * @param mi * The mi string that gdbwire could not parse. * * @param token * The token the error occurred on. * * @param position * The position of the token the error occurred on. */ void (*gdbwire_parse_error_fn)(void *context, const char *mi, const char *token, struct gdbwire_mi_position position); }; /** * Create a gdbwire context. * * Each gdbwire structure is capable of talking to a single gdb instance. * * @param callbacks * The callback functions for when events should be sent. Be sure to * initialize all of the callback functions. If a callback event is * initialized to NULL, it will not be called. * * @return * A new gdbwire instance or NULL on error. */ struct gdbwire *gdbwire_create(struct gdbwire_callbacks callbacks); /** * Destroy a gdbwire context. * * This function will do nothing if the instance is NULL. * * @param gdbwire * The instance of gdbwire to destroy */ void gdbwire_destroy(struct gdbwire *wire); /** * Push some GDB output characters to gdbwire for processing. * * Currently, the calling application is responsible for reading the * output of GDB and sending it to gdbwire. This may change in the future. * Call this function with output from GDB when it is available. * * During this function, callback events may be invoked to alert the * caller of useful gdbwire_mi events. * * @param wire * The gdbwire context to operate on. * * @param data * The data to push to gdbwire for interpretation. * * @param size * The size of the data to push to gdbwire. * * @return * GDBWIRE_OK on success or appropriate error result on failure. */ enum gdbwire_result gdbwire_push_data(struct gdbwire *wire, const char *data, size_t size); /** * Handle an interpreter-exec command. * * Typically, a front end would start gdb with the MI interface and create * a corresponding gdbwire instance. The front end would feed the gdbwire * instance all of the MI output. In this scenario, gdbwire triggers * callbacks when interesting events occur. * * Some GDB front ends use the annotate interface with gdb, and will * transition to using MI through the use of the interpreter-exec command. * In this scenario, the front end will send GDB a single interpreter-exec * command and will want to interpret the output of only that command. * For this use case, a gdbwire instance is not necessary for the front end, * nor any of the callbacks associated with that instance. * * This function provides a way for a front end to interpret the output * of a single interpreter-exec command with out the need for creating * a gdbwire instance or any gdbwire callbacks. * * @param interpreter_exec_output * The MI output from GDB for the interpreter exec command. * * @param kind * The interpreter-exec command kind. * * @param out_mi_command * Will return an allocated gdbwire mi command if GDBWIRE_OK is returned * from this function. You should free this memory with * gdbwire_mi_command_free when you are done with it. * * @return * The result of this function. */ enum gdbwire_result gdbwire_interpreter_exec( const char *interpreter_exec_output, enum gdbwire_mi_command_kind kind, struct gdbwire_mi_command **out_mi_command); #ifdef __cplusplus } #endif #endif /***** End of gdbwire.h ******************************************************/ /***** Continuing where we left off in gdbwire.c *****************************/ /* #include "gdbwire_mi_parser.h" */ struct gdbwire { /* The gdbwire_mi parser. */ struct gdbwire_mi_parser *parser; /* The client callback functions */ struct gdbwire_callbacks callbacks; }; static void gdbwire_mi_output_callback(void *context, struct gdbwire_mi_output *output) { struct gdbwire *wire = (struct gdbwire *)context; struct gdbwire_mi_output *cur = output; while (cur) { switch (cur->kind) { case GDBWIRE_MI_OUTPUT_OOB: { struct gdbwire_mi_oob_record *oob_record = cur->variant.oob_record; switch (oob_record->kind) { case GDBWIRE_MI_ASYNC: if (wire->callbacks.gdbwire_async_record_fn) { wire->callbacks.gdbwire_async_record_fn( wire->callbacks.context, oob_record->variant.async_record); } break; case GDBWIRE_MI_STREAM: if (wire->callbacks.gdbwire_stream_record_fn) { wire->callbacks.gdbwire_stream_record_fn( wire->callbacks.context, oob_record->variant.stream_record); } break; } break; } case GDBWIRE_MI_OUTPUT_RESULT: if (wire->callbacks.gdbwire_result_record_fn) { wire->callbacks.gdbwire_result_record_fn( wire->callbacks.context, cur->variant.result_record); } break; case GDBWIRE_MI_OUTPUT_PROMPT: if (wire->callbacks.gdbwire_prompt_fn) { wire->callbacks.gdbwire_prompt_fn( wire->callbacks.context, cur->line); } break; case GDBWIRE_MI_OUTPUT_PARSE_ERROR: if (wire->callbacks.gdbwire_parse_error_fn) { wire->callbacks.gdbwire_parse_error_fn( wire->callbacks.context, cur->line, cur->variant.error.token, cur->variant.error.pos); } break; } cur = cur->next; } gdbwire_mi_output_free(output); } struct gdbwire * gdbwire_create(struct gdbwire_callbacks callbacks) { struct gdbwire *result = 0; result = malloc(sizeof(struct gdbwire)); if (result) { struct gdbwire_mi_parser_callbacks parser_callbacks = { result,gdbwire_mi_output_callback }; result->callbacks = callbacks; result->parser = gdbwire_mi_parser_create(parser_callbacks); if (!result->parser) { free(result); result = 0; } } return result; } void gdbwire_destroy(struct gdbwire *gdbwire) { if (gdbwire) { gdbwire_mi_parser_destroy(gdbwire->parser); free(gdbwire); } } enum gdbwire_result gdbwire_push_data(struct gdbwire *wire, const char *data, size_t size) { enum gdbwire_result result; GDBWIRE_ASSERT(wire); result = gdbwire_mi_parser_push_data(wire->parser, data, size); return result; } struct gdbwire_interpreter_exec_context { enum gdbwire_result result; enum gdbwire_mi_command_kind kind; struct gdbwire_mi_command *mi_command; }; static void gdbwire_interpreter_exec_stream_record(void *context, struct gdbwire_mi_stream_record *stream_record) { struct gdbwire_interpreter_exec_context *ctx = (struct gdbwire_interpreter_exec_context*)context; ctx->result = GDBWIRE_LOGIC; } static void gdbwire_interpreter_exec_async_record(void *context, struct gdbwire_mi_async_record *async_record) { struct gdbwire_interpreter_exec_context *ctx = (struct gdbwire_interpreter_exec_context*)context; ctx->result = GDBWIRE_LOGIC; } static void gdbwire_interpreter_exec_result_record(void *context, struct gdbwire_mi_result_record *result_record) { struct gdbwire_interpreter_exec_context *ctx = (struct gdbwire_interpreter_exec_context*)context; if (ctx->result == GDBWIRE_OK) { ctx->result = gdbwire_get_mi_command( ctx->kind, result_record, &ctx->mi_command); } } static void gdbwire_interpreter_exec_prompt(void *context, const char *prompt) { struct gdbwire_interpreter_exec_context *ctx = (struct gdbwire_interpreter_exec_context*)context; ctx->result = GDBWIRE_LOGIC; } static void gdbwire_interpreter_exec_parse_error(void *context, const char *mi, const char *token, struct gdbwire_mi_position position) { struct gdbwire_interpreter_exec_context *ctx = (struct gdbwire_interpreter_exec_context*)context; ctx->result = GDBWIRE_LOGIC; } enum gdbwire_result gdbwire_interpreter_exec( const char *interpreter_exec_output, enum gdbwire_mi_command_kind kind, struct gdbwire_mi_command **out_mi_command) { struct gdbwire_interpreter_exec_context context = { GDBWIRE_OK, kind, 0 }; size_t len; enum gdbwire_result result = GDBWIRE_OK; struct gdbwire_callbacks callbacks = { &context, gdbwire_interpreter_exec_stream_record, gdbwire_interpreter_exec_async_record, gdbwire_interpreter_exec_result_record, gdbwire_interpreter_exec_prompt, gdbwire_interpreter_exec_parse_error }; struct gdbwire *wire; GDBWIRE_ASSERT(interpreter_exec_output); GDBWIRE_ASSERT(out_mi_command); len = strlen(interpreter_exec_output); wire = gdbwire_create(callbacks); GDBWIRE_ASSERT(wire); result = gdbwire_push_data(wire, interpreter_exec_output, len); if (result == GDBWIRE_OK) { /* Honor function documentation, * When it returns GDBWIRE_OK - the command will exist. * Otherwise it will not. */ if (context.result == GDBWIRE_OK && !context.mi_command) { result = GDBWIRE_LOGIC; } else if (context.result != GDBWIRE_OK && context.mi_command) { result = context.result; gdbwire_mi_command_free(context.mi_command); } else { result = context.result; *out_mi_command = context.mi_command; } } gdbwire_destroy(wire); return result; } /***** End of gdbwire.c ******************************************************/ cgdb-0.8.0/lib/tgdb/tgdb.h0000664000175000017500000003741314135136636012140 00000000000000#ifndef __TGDB_H__ #define __TGDB_H__ #ifdef HAVE_STDINT_H #include #endif /*! * \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. */ #include "sys_util.h" /* Basic interface types {{{ */ // The client can give any of these commands to TGDB through // tgdb_run_debugger_command. enum tgdb_command_type { TGDB_CONTINUE = 0, TGDB_FINISH, TGDB_NEXT, TGDB_NEXTI, TGDB_START, TGDB_RUN, TGDB_KILL, TGDB_STEP, TGDB_STEPI, TGDB_UNTIL, TGDB_UP, TGDB_DOWN, }; // 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, }; // This structure represents a breakpoint struct tgdb_breakpoint { // The path to the file. // // This will usually be absolute. If the absolute path is not // available for GDB it will be a relative path char *path; // The line number where the breakpoint is set int line; // Line number corresponding to the $pc or 0 if unknown uint64_t addr; //0 if it is not enabled or 1 if it is enabled int enabled; }; // This structure currently represents a file position. // // Either path or addr will be non-NULL. Never both. // // If the source location is available, path and line number will be valid. // If the source information can not be determined, the addr will be // available. It is possible they are both available. struct tgdb_file_position { // The path to the file. // // This will usually be absolute. If the absolute path is not // available for GDB it will be a relative path. // // Will be NULL if the source information is not available char *path; // The line number in the file or 0 if unknown int line_number; // Line number corresponding to the $pc or 0 if unknown uint64_t addr; // Shared library where this function is defined or NULL if unknown char *from; // Function name or NULL if unknown char *func; }; enum tgdb_request_type { // Get a list of all the source files in the program being debugged TGDB_REQUEST_INFO_SOURCES, // Determine the current location of the debugged program. // // This is a filename and line number for source code. TGDB_REQUEST_INFO_SOURCE_FILE, // Get the list of existing breakpoints. TGDB_REQUEST_BREAKPOINTS, // Set which terminal to use for future runs of program being debugged. // // This allows tgdb to separate the output of gdb from the output // of the program being debugged. TGDB_REQUEST_TTY, // Get information about the current frame. // // Generally useful for finding the current location of the program // that is being debugged. TGDB_REQUEST_INFO_FRAME, // Query if the CLI disassemble command supports mixed source+assembly. // // Mixed source+assembly mode was added as the /s flag to the CLI // disassemble command and as mode 4 to the MI -data-disassemble // command. // // We query the MI command to determine if it supports mode 4, and // if it does, we also know that the CLI disassemble command supports // /s. // // The passing case, // (gdb) interpreter-exec mi "-data-disassemble -s 0 -e 0 -- 4" // ^done,asm_insns=[] // // The failing case, // (gdb) interpreter-exec mi "-data-disassemble -s 0 -e 0 -- 4" // ^error,msg="-data-disassemble: Mode argument must // be 0, 1, 2, or 3." // // If the command comes back as an MI error, we assume /s is not // supported. // // This functionality was added in gdb in commit 6ff0ba5f. TGDB_REQUEST_DATA_DISASSEMBLE_MODE_QUERY, // Run a debugger command through gdb. // // This is when the caller wants to run a command through gdb, // next, step, finish, but without the user typing it at the // console. For instance, a cgdb shortcut like F8. TGDB_REQUEST_DEBUGGER_COMMAND, // Request that a breakpoint be modified. // // Useful for creating, deleting and disabling breakpoints. TGDB_REQUEST_MODIFY_BREAKPOINT, // Request GDB to disassemble the function surrounding the pc of the // selected frame. TGDB_REQUEST_DISASSEMBLE_PC, // Request GDB to disassemble a function. TGDB_REQUEST_DISASSEMBLE_FUNC }; // 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 tgdb_response_type { // 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, // Disassemble $pc output TGDB_DISASSEMBLE_PC, // Disassemble function output TGDB_DISASSEMBLE_FUNC, // This happens when gdb quits. // 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. struct tgdb_response { // This is the type of response enum tgdb_response_type header; union { // header == TGDB_UPDATE_BREAKPOINTS struct { // This list has elements of 'struct tgdb_breakpoint *' // representing each breakpoint struct tgdb_breakpoint *breakpoints; } 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. char **source_files; } update_source_files; // header == TGDB_INFERIOR_EXITED struct { int exit_status; } inferior_exited; // header == TGDB_DISASSEMBLE_FUNC struct { uint64_t addr_start; uint64_t addr_end; int error; char **disasm; } disassemble_function; // header == TGDB_QUIT struct { // If the GDB being used is pre new-ui, before GDB 7.12 // then it is unsupported, and this will be set to true. // Otherwise, this will be set to false. bool new_ui_unsupported; } quit; } choice; }; /* }}} */ /* Creating and Destroying a libtgdb context. {{{*/ /******************************************************************************/ /** * @name Creating 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; struct tgdb_callbacks { /** * An arbitrary pointer to associate with the callbacks. */ void *context; /** * Output is available for the console. * * @param context * The context pointer * * @param str * The console output */ void (*console_output_callback)(void *context, const std::string &str); /** * A command response is available for consumption. * * @param context * The tgdb instance to operate on * * @param response * The response to consume. This response is only valid for use * during this callback function. It is freed by tgdb afterwards. */ void (*command_response_callback)(void *context, struct tgdb_response *response); }; /** * This initializes a tgdb library instance. * * \param callbacks * Callback functions for event driven notifications * * @return * NULL on error, a valid context on success. */ struct tgdb *tgdb_initialize(tgdb_callbacks callbacks); /** * 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); /* Close tgdb logfiles. This should happen after tgdb_shutdown() and all * other shutdown which might use logfiles. Right before exit() works great. */ void tgdb_close_logfiles(); /*@}*/ /* }}}*/ /* Input/Output commands {{{*/ /******************************************************************************/ /** * @name Input/Output commands * These functions are for communicating I/O with the tgdb context. */ /******************************************************************************/ /*@{*/ // Start the debugger // // Returns all file descriptors the client must select on. // // @param tgdb // An instance of the tgdb library to operate on. // // @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 gdb_win_rows // The number of rows in the gdb console // // @param gdb_win_cols // The number of columns in the gdb console // // @param gdb_console_fd // The gdb console file descriptor // // @param gdb_mi_fd // The gdb machine interface file descriptor int tgdb_start_gdb(struct tgdb *tgdb, const char *debugger, int argc, char **argv, int gdb_win_rows, int gdb_win_cols, int *gdb_console_fd, int *gdb_mi_fd); /** * 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 fd * The file descriptor that has input (either the console or mi). * * @return * 0 on sucess, or -1 on error */ int tgdb_process(struct tgdb *tgdb, int fd); /** * Send a character to the gdb console. * * \param tgdb * An instance of the tgdb library to operate on. * * \param c * The character to send to the gdb console * * \return * 0 on sucess, or -1 on error */ int tgdb_send_char(struct tgdb *tgdb, char c); /** * Resize the gdb console. * * If tgdb_start_gdb has not been called yet, this function will be a * no-op. * * \param tgdb * An instance of the tgdb library to operate on. * * \param rows * The number of rows in the new gdb console * * \param cols * The number of columns in the new gdb console */ int tgdb_resize_console(struct tgdb *tgdb, int rows, int cols); /*@}*/ /* }}}*/ /* Functional commands {{{*/ /******************************************************************************/ /** * @name Functional commands * These functinos are used to ask the TGDB context to perform a task. */ /******************************************************************************/ /*@{*/ /** * Gets a list of source files that make up the program being debugged. * * \param tgdb * An instance of the tgdb library to operate on. */ void tgdb_request_inferiors_source_files(struct tgdb *tgdb); /** * Get the current location of the inferior. * * \param tgdb * An instance of the tgdb library to operate on. */ void tgdb_request_current_location(struct tgdb *tgdb); /** * Request an update of the breakpoints to the front end. * * @param tgdb * An instance of the tgdb library to operate on. */ void tgdb_request_breakpoints(struct tgdb *tgdb); /** * 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. */ void 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. */ void tgdb_request_modify_breakpoint(struct tgdb *tgdb, const char *file, int line, uint64_t addr, enum tgdb_breakpoint_action b); /** * Used to get the disassemble of the current $pc. * * \param tgdb * An instance of the tgdb library to operate on. * * \param lines * The number of lines to disassemble after the pc. */ void tgdb_request_disassemble_pc(struct tgdb *tgdb, int lines); /** * Get disassembly for entire function. * * \param tgdb * An instance of the tgdb library to operate on. */ enum disassemble_func_type { DISASSEMBLE_FUNC_DISASSEMBLY, DISASSEMBLE_FUNC_SOURCE_LINES, DISASSEMBLE_FUNC_RAW_INSTRUCTIONS, }; void tgdb_request_disassemble_func(struct tgdb *tgdb, enum disassemble_func_type type); /*@}*/ /* }}}*/ /* Signal Handling Support {{{*/ /******************************************************************************/ /** * @name Signal Handling Support * These functinos are used to notify TGDB of signal received. */ /******************************************************************************/ /*@{*/ /** * 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 occurred. * * @return * 0 on success or -1 on error */ int tgdb_signal_notification(struct tgdb *tgdb, int signum); /*@}*/ /* }}}*/ #endif /* __TGDB_H__ */ cgdb-0.8.0/lib/tgdb/driver.cpp0000664000175000017500000001476214171031321013031 00000000000000#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 */ #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 "io.h" #include "terminal.h" #include "fork_util.h" #include "cgdb_clog.h" #define MAXLINE 4096 struct tgdb *tgdb; /* Readline interface */ static int gdb_quit = 0; /* Original terminal attributes */ static struct termios term_attributes; static void start_logging() { /* Open our cgdb and tgdb io logfiles */ clog_open(CLOG_CGDB_ID, "%s/cgdb_log%d.txt", "."); clog_open(CLOG_GDBIO_ID, "%s/cgdb_gdb_console_io_log%d.txt", "."); clog_open(CLOG_GDBMIIO_ID, "%s/cgdb_gdb_mi_io_log%d.txt", "."); clog_set_level(CLOG_GDBMIIO_ID, CLOG_DEBUG); clog_set_fmt(CLOG_GDBMIIO_ID, CGDB_CLOG_FORMAT); /* Puts cgdb 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 useful in determining what is going on under tgdb * since the gui is good at hiding that info from the user. * * Change level to CLOG_ERROR to write only error messages. * clog_set_level(CLOG_GDBIO, CLOG_ERROR); */ clog_set_level(CLOG_GDBIO_ID, CLOG_DEBUG); clog_set_fmt(CLOG_GDBIO_ID, CGDB_CLOG_FORMAT); /* General cgdb logging. Only logging warnings and debug messages by default. */ clog_set_level(CLOG_CGDB_ID, CLOG_DEBUG); clog_set_fmt(CLOG_CGDB_ID, CGDB_CLOG_FORMAT); } static void signal_handler(int signo) { if (signo == SIGINT || signo == SIGTERM || signo == SIGQUIT) tgdb_signal_notification(tgdb, signo); } /* 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) { clog_error(CLOG_CGDB, "sigaction failed "); return -1; } if (sigaction(SIGTERM, &action, NULL) < 0) { clog_error(CLOG_CGDB, "sigaction failed "); return -1; } if (sigaction(SIGQUIT, &action, NULL) < 0) { clog_error(CLOG_CGDB, "sigaction failed "); return -1; } return 0; } static int gdb_input(int fd) { int result = tgdb_process(tgdb, fd); if (result == -1) { clog_error(CLOG_CGDB, "file descriptor closed"); return -1; } return 0; } static int stdin_input() { char buf[MAXLINE]; size_t size; size_t i; size = read(STDIN_FILENO, buf, MAXLINE - 1); if (size == -1) { clog_error(CLOG_CGDB, "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) { tgdb_send_char(tgdb, buf[i]); } return 0; } int main_loop(int gdbfd, int mifd) { int max; fd_set rfds; int result; while (!gdb_quit) { max = (gdbfd > STDIN_FILENO) ? gdbfd : STDIN_FILENO; max = (max > mifd) ? max : mifd; /* 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(mifd, &rfds); result = select(max + 1, &rfds, NULL, NULL, NULL); /* if the signal interrupted system call keep going */ if (result == -1 && errno == EINTR) continue; else if (result == -1) /* on error ... must die -> stupid OS */ clog_error(CLOG_CGDB, "select failed"); /* stdin -> readline input */ if (FD_ISSET(STDIN_FILENO, &rfds)) { stdin_input(); } /* gdb's output -> stdout */ if (FD_ISSET(gdbfd, &rfds)) if (gdb_input(gdbfd) == -1) return -1; /* gdb's mi output -> tgdb */ if (FD_ISSET(mifd, &rfds)) { if (gdb_input(mifd) == -1) return -1; } } return 0; } void console_output(void *context, const std::string &str) { std::string::const_iterator iter = str.begin(); for (; iter != str.end(); ++iter) { if (write(STDOUT_FILENO, &*iter, 1) != 1) { clog_error(CLOG_CGDB, "could not write byte"); } } } void command_response(void *context, struct tgdb_response *response) { if (response->header == TGDB_QUIT) { fprintf(stderr, "%s:%d TGDB_QUIT\n", __FILE__, __LINE__); gdb_quit = 1; } } tgdb_callbacks callbacks = { NULL, console_output, command_response }; int main(int argc, char **argv) { int gdb_console_fd, gdb_mi_fd; #if 0 int c; read(0, &c, 1); #endif start_logging(); /* Set all clog levels to debug */ clog_set_level(CLOG_CGDB_ID, CLOG_DEBUG); clog_set_level(CLOG_GDBIO_ID, CLOG_DEBUG); clog_set_level(CLOG_GDBMIIO_ID, CLOG_DEBUG); if (tty_cbreak(STDIN_FILENO, &term_attributes) == -1) clog_error(CLOG_CGDB, "tty_cbreak error"); if ((tgdb = tgdb_initialize(callbacks)) == NULL) { clog_error(CLOG_CGDB, "tgdb_start error"); goto driver_end; } if (tgdb_start_gdb(tgdb, NULL, argc - 1, argv + 1, 0, 0, &gdb_console_fd, &gdb_mi_fd ) == -1) { clog_error(CLOG_CGDB, "tgdb_start error"); goto driver_end; } set_up_signal(); main_loop(gdb_console_fd, gdb_mi_fd); if (tgdb_shutdown(tgdb) == -1) clog_error(CLOG_CGDB, "could not shutdown"); driver_end: if (tty_set_attributes(STDIN_FILENO, &term_attributes) == -1) clog_error(CLOG_CGDB, "tty_reset error"); tgdb_close_logfiles(); return 0; } cgdb-0.8.0/lib/tgdb/Makefile.in0000664000175000017500000004463114171036447013113 00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/config/readline_check_version.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) 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) gdbwire.$(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/util/libcgdbutil.a tgdb_driver_LINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \ $(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 = CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) AM_V_CXX = $(am__v_CXX_@AM_V@) am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) am__v_CXX_0 = @echo " CXX " $@; am__v_CXX_1 = CXXLD = $(CXX) CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ -o $@ AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) am__v_CXXLD_0 = @echo " CXXLD " $@; am__v_CXXLD_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 am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/config/depcomp 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@ CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ 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@ HAS_MAKEINFO = @HAS_MAKEINFO@ 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@ ac_ct_CXX = @ac_ct_CXX@ 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@ runstatedir = @runstatedir@ 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_CXXFLAGS = \ -I$(top_srcdir)/lib/util \ -I$(top_srcdir)/lib/tgdb \ -std=c++11 noinst_LIBRARIES = libtgdb.a libtgdb_a_SOURCES = \ tgdb.cpp \ tgdb.h \ gdbwire.c \ gdbwire.h tgdb_driver_LDFLAGS = \ -L$(top_builddir)/lib/util \ -L$(top_builddir)/lib/tgdb tgdb_driver_LDADD = \ libtgdb.a \ $(top_builddir)/lib/util/libcgdbutil.a tgdb_driver_SOURCES = driver.cpp all: all-am .SUFFIXES: .SUFFIXES: .c .cpp .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) --foreign lib/tgdb/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign lib/tgdb/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_CXXLD)$(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)/gdbwire.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/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 -o $@ $< .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 -o $@ `$(CYGPATH_W) '$<'` .cpp.o: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< .cpp.obj: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(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 .PRECIOUS: Makefile # 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.8.0/lib/tgdb/Makefile.am0000664000175000017500000000067114130163771013072 00000000000000AM_CXXFLAGS = \ -I$(top_srcdir)/lib/util \ -I$(top_srcdir)/lib/tgdb \ -std=c++11 noinst_LIBRARIES = libtgdb.a libtgdb_a_SOURCES = \ tgdb.cpp \ tgdb.h \ gdbwire.c \ gdbwire.h noinst_PROGRAMS = tgdb_driver tgdb_driver_LDFLAGS = \ -L$(top_builddir)/lib/util \ -L$(top_builddir)/lib/tgdb tgdb_driver_LDADD = \ libtgdb.a \ $(top_builddir)/lib/util/libcgdbutil.a tgdb_driver_SOURCES = driver.cpp cgdb-0.8.0/lib/tgdb/tgdb.cpp0000664000175000017500000012467214160500142012460 00000000000000/* Includes {{{ */ #if HAVE_CONFIG_H #include "config.h" #endif #if HAVE_STDIO_H #include #endif /* HAVE_STDIO_H */ #if HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #if HAVE_SIGNAL_H #include /* sig_atomic_t */ #endif #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #if HAVE_SYS_WAIT_H #include #endif #define __STDC_FORMAT_MACROS #include #include #include #include "tgdb.h" #include "fork_util.h" #include "io.h" #include "terminal.h" #include "pseudo.h" /* SLAVE_SIZE constant */ #include "sys_util.h" #include "stretchy.h" #include "cgdb_clog.h" #include "gdbwire.h" /* }}} */ /* struct tgdb {{{ */ typedef struct tgdb_request *tgdb_request_ptr; typedef std::list tgdb_request_ptr_list; /** * The TGDB context data structure. */ struct tgdb { /** 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; /** * The gdb new-ui mi console file descriptor. * * Writing to this will write to the gdb/mi interpreter. * Reading from it will read the output of the gdb/mi interpreter. */ int gdb_mi_ui_fd; /** The master, slave and slavename of the new-ui pty device */ pty_pair_ptr new_ui_pty_pair; /** The pid of child process */ pid_t debugger_pid; /** The list of command requests to process */ tgdb_request_ptr_list *command_requests; /** * If set to 1, libtgdb thinks the lower level subsystem is capable of * receiving another command. It needs this so that it doesn't send 2 * commands to the lower level before it can say it can't receive 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. * * Basically whether gdb is at prompt or not. */ int is_gdb_ready_for_next_command; /** If ^c was hit by user */ sig_atomic_t control_c; tgdb_callbacks callbacks; // commands structure // The current command request type that is executing. NULL to start. enum tgdb_request_type current_request_type; // The disassemble command output. char **disasm; uint64_t address_start, address_end; // The gdbwire context to talk to GDB with. struct gdbwire *wire; // True if the disassemble command supports /s, otherwise false. int disassemble_supports_s_mode; // True if GDB supports the 'new-ui' command, otherwise false. // If gdb prints out, // Undefined command: "new-ui". Try "help". // on the console output, then it does not support the new-ui command. // Otherwise it is assumed that it does support the command. bool gdb_supports_new_ui_command; // Temporary buffer used to store the line by line console output // in order to search for the unsupported new ui string above. std::string *undefined_new_ui_command; }; // This is the type of request struct tgdb_request { enum tgdb_request_type header; union { struct { // The null terminated console command to pass to GDB const char *command; } console_command; struct { const char *slavename; } tty_command; 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 address to set breakpoint in (if file is null) uint64_t addr; // The action to take enum tgdb_breakpoint_action b; } modify_breakpoint; struct { int lines; } disassemble; struct { int source; int raw; } disassemble_func; } choice; }; /* }}} */ /* Temporary prototypes {{{ */ struct tgdb_response *tgdb_create_response(enum tgdb_response_type header); void tgdb_send_response(struct tgdb *tgdb, struct tgdb_response *response); static void tgdb_run_request(struct tgdb *tgdb, struct tgdb_request *request); static void tgdb_unqueue_and_deliver_command(struct tgdb *tgdb); void tgdb_run_or_queue_request(struct tgdb *tgdb, struct tgdb_request *request, bool priority); /* }}} */ // Command Functions {{{ static void tgdb_commands_send_breakpoints(struct tgdb *tgdb, struct tgdb_breakpoint *breakpoints) { struct tgdb_response *response = (struct tgdb_response *) tgdb_create_response(TGDB_UPDATE_BREAKPOINTS); response->choice.update_breakpoints.breakpoints = breakpoints; tgdb_send_response(tgdb, response); } static void tgdb_commands_process_breakpoint( struct tgdb_breakpoint *&breakpoints, struct gdbwire_mi_breakpoint *breakpoint) { bool file_location_avialable = (breakpoint->fullname || breakpoint->file) && breakpoint->line != 0; bool assembly_location_available = breakpoint->address && !breakpoint->pending && !breakpoint->multi; if (file_location_avialable || assembly_location_available) { struct tgdb_breakpoint tb; if (file_location_avialable) { tb.path = (breakpoint->fullname)? cgdb_strdup(breakpoint->fullname): cgdb_strdup(breakpoint->file); tb.line = breakpoint->line; } else { tb.path = 0; tb.line = 0; } if (assembly_location_available) { uint64_t address = 0; cgdb_hexstr_to_u64(breakpoint->address, &address); tb.addr = address; } else { tb.addr = 0; } tb.enabled = breakpoint->enabled; sbpush(breakpoints, tb); } } static void tgdb_commands_process_breakpoints(struct tgdb *tgdb, struct gdbwire_mi_result_record *result_record) { enum gdbwire_result result; struct gdbwire_mi_command *mi_command = 0; result = gdbwire_get_mi_command(GDBWIRE_MI_BREAK_INFO, result_record, &mi_command); if (result == GDBWIRE_OK) { struct tgdb_breakpoint *breakpoints = NULL; struct gdbwire_mi_breakpoint *breakpoint = mi_command->variant.break_info.breakpoints; while (breakpoint) { tgdb_commands_process_breakpoint(breakpoints, breakpoint); if (breakpoint->multi) { struct gdbwire_mi_breakpoint *multi_bkpt = breakpoint->multi_breakpoints; while (multi_bkpt) { tgdb_commands_process_breakpoint(breakpoints, multi_bkpt); multi_bkpt = multi_bkpt->next; } } breakpoint = breakpoint->next; } tgdb_commands_send_breakpoints(tgdb, breakpoints); gdbwire_mi_command_free(mi_command); } } static void tgdb_commands_send_source_files(struct tgdb *tgdb, char **source_files) { struct tgdb_response *response = tgdb_create_response(TGDB_UPDATE_SOURCE_FILES); response->choice.update_source_files.source_files = source_files; tgdb_send_response(tgdb, response); } /* 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 tgdb_commands_process_info_sources(struct tgdb *tgdb, struct gdbwire_mi_result_record *result_record) { enum gdbwire_result result; struct gdbwire_mi_command *mi_command = 0; result = gdbwire_get_mi_command(GDBWIRE_MI_FILE_LIST_EXEC_SOURCE_FILES, result_record, &mi_command); if (result == GDBWIRE_OK) { char **source_files = NULL; struct gdbwire_mi_source_file *files = mi_command->variant.file_list_exec_source_files.files; while (files) { char *file = (files->fullname)?files->fullname:files->file; sbpush(source_files, strdup(file)); files = files->next; } tgdb_commands_send_source_files(tgdb, source_files); gdbwire_mi_command_free(mi_command); } } static void send_disassemble_func_complete_response(struct tgdb *tgdb, struct gdbwire_mi_result_record *result_record) { tgdb_response_type type = (tgdb->current_request_type == TGDB_REQUEST_DISASSEMBLE_PC) ? TGDB_DISASSEMBLE_PC : TGDB_DISASSEMBLE_FUNC; struct tgdb_response *response = tgdb_create_response(type); response->choice.disassemble_function.error = (result_record->result_class == GDBWIRE_MI_ERROR); response->choice.disassemble_function.disasm = tgdb->disasm; response->choice.disassemble_function.addr_start = tgdb->address_start; response->choice.disassemble_function.addr_end = tgdb->address_end; tgdb->disasm = NULL; tgdb->address_start = 0; tgdb->address_end = 0; tgdb_send_response(tgdb, response); } static void tgdb_commands_send_source_file(struct tgdb *tgdb, const char *fullname, const char *file, uint64_t address, const char *from, const char *func, int line) { /* 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 = tgdb_create_response(TGDB_UPDATE_FILE_POSITION); if (fullname || file) { tfp->path = (fullname)?cgdb_strdup(fullname):cgdb_strdup(file); } else { tfp->path = 0; } tfp->addr = address; tfp->from = (from)?cgdb_strdup(from):0; tfp->func = (func)?cgdb_strdup(func):0; tfp->line_number = line; response->choice.update_file_position.file_position = tfp; tgdb_send_response(tgdb, response); } static void tgdb_commands_process_info_source(struct tgdb *tgdb, struct gdbwire_mi_result_record *result_record) { enum gdbwire_result result; struct gdbwire_mi_command *mi_command = 0; result = gdbwire_get_mi_command(GDBWIRE_MI_FILE_LIST_EXEC_SOURCE_FILE, result_record, &mi_command); if (result == GDBWIRE_OK) { tgdb_commands_send_source_file(tgdb, mi_command->variant.file_list_exec_source_file.fullname, mi_command->variant.file_list_exec_source_file.file, 0, 0, 0, mi_command->variant.file_list_exec_source_file.line); gdbwire_mi_command_free(mi_command); } } static void tgdb_commands_process_info_frame(struct tgdb *tgdb, struct gdbwire_mi_result_record *result_record) { bool require_source = false; enum gdbwire_result result; struct gdbwire_mi_command *mi_command = 0; result = gdbwire_get_mi_command(GDBWIRE_MI_STACK_INFO_FRAME, result_record, &mi_command); if (result == GDBWIRE_OK) { struct gdbwire_mi_stack_frame *frame = mi_command->variant.stack_info_frame.frame; uint64_t address = 0; cgdb_hexstr_to_u64(frame->address, &address); if (frame->address || frame->file || frame->fullname) { tgdb_commands_send_source_file(tgdb, frame->fullname, frame->file, address, frame->from, frame->func, frame->line); } else { require_source = true; } gdbwire_mi_command_free(mi_command); } else { require_source = true; } if (require_source) { tgdb_request_ptr request; request = (tgdb_request_ptr) cgdb_malloc(sizeof (struct tgdb_request)); request->header = TGDB_REQUEST_INFO_SOURCE_FILE; tgdb_run_or_queue_request(tgdb, request, true); } } static void gdbwire_stream_record_callback(void *context, struct gdbwire_mi_stream_record *stream_record) { struct tgdb *tgdb = (struct tgdb*)context; switch (tgdb->current_request_type) { case TGDB_REQUEST_BREAKPOINTS: case TGDB_REQUEST_INFO_FRAME: /** * When using GDB with annotate=2 and also using interpreter-exec, * GDB spits out the annotations in the MI output. All of these * annotations can be ignored. */ break; case TGDB_REQUEST_DISASSEMBLE_PC: case TGDB_REQUEST_DISASSEMBLE_FUNC: if (stream_record->kind == GDBWIRE_MI_CONSOLE) { uint64_t address; int result; char *str = stream_record->cstring; size_t length = strlen(str); char *colon = 0, colon_char = 0; if (str[length-1] == '\n') { str[length-1] = 0; } /* Trim the gdb current location pointer off */ if (length > 2 && str[0] == '=' && str[1] == '>') { str[0] = ' '; str[1] = ' '; } sbpush(tgdb->disasm, cgdb_strdup(str)); colon = strchr((char*)str, ':'); if (colon) { colon_char = *colon; *colon = 0; } result = cgdb_hexstr_to_u64(str, &address); if (colon) { *colon = colon_char; } if (result == 0 && address) { tgdb->address_start = tgdb->address_start ? MIN(address, tgdb->address_start) : address; tgdb->address_end = MAX(address, tgdb->address_end); } } break; case TGDB_REQUEST_DATA_DISASSEMBLE_MODE_QUERY: case TGDB_REQUEST_INFO_SOURCES: case TGDB_REQUEST_INFO_SOURCE_FILE: case TGDB_REQUEST_TTY: case TGDB_REQUEST_DEBUGGER_COMMAND: case TGDB_REQUEST_MODIFY_BREAKPOINT: break; } } static void source_position_changed(struct tgdb *tgdb, gdbwire_mi_result *result) { std::string frame("frame"); std::string addr("addr"); std::string fullname("fullname"); std::string line("line"); while (result) { if (frame == result->variable && result->kind == GDBWIRE_MI_TUPLE) { uint64_t addr_value = 0; bool addr_value_set = false; std::string fullname_value; bool fullname_value_set = false; int line_value = 0; bool line_value_set = false; struct gdbwire_mi_result *fresult = result->variant.result; while (fresult) { if (addr == fresult->variable) { addr_value = std::stoull( fresult->variant.cstring, 0, 16); addr_value_set = true; } else if (fullname == fresult->variable) { fullname_value = fresult->variant.cstring; fullname_value_set = true; } else if (line == fresult->variable) { line_value = std::stoi(fresult->variant.cstring); line_value_set = true; } fresult = fresult->next; } if(addr_value_set || (fullname_value_set && line_value_set)) { tgdb_commands_send_source_file(tgdb, fullname_value.c_str(), NULL, addr_value, NULL, NULL, line_value); } } result = result->next; } } void tgdb_breakpoints_changed(void *context); static void gdbwire_async_record_callback(void *context, struct gdbwire_mi_async_record *async_record) { struct tgdb *tgdb = (struct tgdb*)context; switch (async_record->async_class) { case GDBWIRE_MI_ASYNC_STOPPED: case GDBWIRE_MI_ASYNC_THREAD_SELECTED: source_position_changed(tgdb, async_record->result); break; case GDBWIRE_MI_ASYNC_BREAKPOINT_CREATED: case GDBWIRE_MI_ASYNC_BREAKPOINT_MODIFIED: case GDBWIRE_MI_ASYNC_BREAKPOINT_DELETED: tgdb_breakpoints_changed(tgdb); break; default: break; } } static void gdbwire_result_record_callback(void *context, struct gdbwire_mi_result_record *result_record) { struct tgdb *tgdb = (struct tgdb*)context; switch (tgdb->current_request_type) { case TGDB_REQUEST_BREAKPOINTS: tgdb_commands_process_breakpoints(tgdb, result_record); break; case TGDB_REQUEST_INFO_SOURCES: tgdb_commands_process_info_sources(tgdb, result_record); break; case TGDB_REQUEST_DISASSEMBLE_PC: case TGDB_REQUEST_DISASSEMBLE_FUNC: send_disassemble_func_complete_response(tgdb, result_record); break; case TGDB_REQUEST_DATA_DISASSEMBLE_MODE_QUERY: /** * If the mode was to high, than the result record would be * an error, meaning the mode is not supported. Otherwise, * the mode is supported. */ if (result_record->result_class == GDBWIRE_MI_DONE) { tgdb->disassemble_supports_s_mode = 1; clog_info(CLOG_CGDB, "disassemble supports s mode"); } break; case TGDB_REQUEST_INFO_SOURCE_FILE: tgdb_commands_process_info_source(tgdb, result_record); break; case TGDB_REQUEST_INFO_FRAME: tgdb_commands_process_info_frame(tgdb, result_record); break; case TGDB_REQUEST_TTY: case TGDB_REQUEST_DEBUGGER_COMMAND: case TGDB_REQUEST_MODIFY_BREAKPOINT: break; } } void tgdb_console_at_prompt(void *context); static void gdbwire_prompt_callback(void *context, const char *prompt) { struct tgdb *tgdb = (struct tgdb*)context; tgdb_console_at_prompt(tgdb); } static void gdbwire_parse_error_callback(void *context, const char *mi, const char *token, struct gdbwire_mi_position position) { clog_error(CLOG_CGDB, "gdbwire parse error\n" " mi text=[%s]\n" " token=[%s]\n" " start col=[%d]\n" " end col=[%d]\n", mi, token, position.start_column, position.end_column); } static struct gdbwire_callbacks wire_callbacks = { 0, gdbwire_stream_record_callback, gdbwire_async_record_callback, gdbwire_result_record_callback, gdbwire_prompt_callback, gdbwire_parse_error_callback }; int free_char_star(void *item) { char *s = (char *) item; free(s); s = NULL; return 0; } void tgdb_commands_process(struct tgdb *tgdb, const std::string &str) { gdbwire_push_data(tgdb->wire, str.data(), str.size()); } void tgdb_commands_set_current_request_type(struct tgdb *tgdb, enum tgdb_request_type type) { tgdb->current_request_type = type; } int tgdb_commands_disassemble_supports_s_mode(struct tgdb *tgdb) { return tgdb->disassemble_supports_s_mode; } // }}} static struct tgdb *initialize_tgdb_context(tgdb_callbacks callbacks) { struct tgdb *tgdb = (struct tgdb *) cgdb_malloc(sizeof (struct tgdb)); tgdb->control_c = 0; tgdb->debugger_stdout = -1; tgdb->debugger_stdin = -1; tgdb->gdb_mi_ui_fd = -1; tgdb->new_ui_pty_pair = NULL; tgdb->command_requests = new tgdb_request_ptr_list(); tgdb->is_gdb_ready_for_next_command = 0; tgdb->callbacks = callbacks; tgdb->disasm = NULL; tgdb->address_start = 0; tgdb->address_end = 0; wire_callbacks.context = (void*)tgdb; tgdb->wire = gdbwire_create(wire_callbacks); tgdb->disassemble_supports_s_mode = 0; tgdb->gdb_supports_new_ui_command = true; tgdb->undefined_new_ui_command = new std::string(); return tgdb; } /******************************************************************************* * This is the basic initialization ******************************************************************************/ static void tgdb_issue_request(struct tgdb *tgdb, enum tgdb_request_type type, bool priority) { tgdb_request_ptr request_ptr; request_ptr = (tgdb_request_ptr)cgdb_malloc(sizeof (struct tgdb_request)); request_ptr->header = type; tgdb_run_or_queue_request(tgdb, request_ptr, priority); } void tgdb_breakpoints_changed(void *context) { struct tgdb *tgdb = (struct tgdb*)context; tgdb_issue_request(tgdb, TGDB_REQUEST_BREAKPOINTS, true); } static void tgdb_source_location_changed(void *context) { struct tgdb *tgdb = (struct tgdb*)context; tgdb_request_current_location(tgdb); } static void tgdb_command_error(void *context, const std::string &msg) { struct tgdb *tgdb = (struct tgdb*)context; /* Send cgdb the error message */ tgdb->callbacks.console_output_callback(tgdb->callbacks.context, msg); } void tgdb_console_at_prompt(void *context) { struct tgdb *tgdb = (struct tgdb*)context; tgdb->is_gdb_ready_for_next_command = 1; if (tgdb->command_requests->size() > 0) { tgdb_unqueue_and_deliver_command(tgdb); } } /** * Free the tgdb request pointer data. * * @param request_ptr * The request pointer to destroy. */ static void tgdb_request_destroy(tgdb_request_ptr request_ptr) { if (!request_ptr) return; switch (request_ptr->header) { case TGDB_REQUEST_INFO_SOURCES: 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_DISASSEMBLE_PC: case TGDB_REQUEST_DISASSEMBLE_FUNC: break; default: break; } free(request_ptr); request_ptr = NULL; } /* Creating and Destroying a libtgdb context. {{{*/ struct tgdb *tgdb_initialize(tgdb_callbacks callbacks) { /* Initialize the libtgdb context */ struct tgdb *tgdb = initialize_tgdb_context(callbacks); // create the new ui pty pair // initialize the size to the gdb window size tgdb->new_ui_pty_pair = pty_pair_create(); if (!tgdb->new_ui_pty_pair) { clog_error(CLOG_CGDB, "pty_pair_create failed"); return NULL; } tgdb->gdb_mi_ui_fd = pty_pair_get_masterfd(tgdb->new_ui_pty_pair); tty_set_echo(tgdb->gdb_mi_ui_fd, 0); /* Need to get source information before breakpoint information otherwise * the TGDB_UPDATE_BREAKPOINTS event will be ignored in process_commands() * because there are no source files to add the breakpoints to. */ tgdb_request_current_location(tgdb); /* 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. */ tgdb_issue_request(tgdb, TGDB_REQUEST_BREAKPOINTS, true); /** * Query if disassemble supports the /s flag */ tgdb_issue_request(tgdb, TGDB_REQUEST_DATA_DISASSEMBLE_MODE_QUERY, true); return tgdb; } int tgdb_start_gdb(struct tgdb *tgdb, const char *debugger, int argc, char **argv, int gdb_win_rows, int gdb_win_cols, int *gdb_console_fd, int *gdb_mi_fd) { tgdb->debugger_pid = invoke_debugger(debugger, argc, argv, gdb_win_rows, gdb_win_cols, &tgdb->debugger_stdin, &tgdb->debugger_stdout, pty_pair_get_slavename(tgdb->new_ui_pty_pair)); /* Couldn't invoke process */ if (tgdb->debugger_pid == -1) return -1; *gdb_console_fd = tgdb->debugger_stdout; *gdb_mi_fd = tgdb->gdb_mi_ui_fd; return 0; } int tgdb_shutdown(struct tgdb *tgdb) { delete tgdb->undefined_new_ui_command; tgdb_request_ptr_list::iterator iter = tgdb->command_requests->begin(); for (; iter != tgdb->command_requests->end(); ++iter) { tgdb_request_destroy(*iter); } delete tgdb->command_requests; tgdb->command_requests = 0; if (tgdb->debugger_stdin != -1) { cgdb_close(tgdb->debugger_stdin); tgdb->debugger_stdin = -1; } gdbwire_destroy(tgdb->wire); return 0; } void tgdb_close_logfiles() { clog_info(CLOG_CGDB, "Closing logfile."); clog_free(CLOG_CGDB_ID); clog_info(CLOG_GDBIO, "Closing logfile."); clog_free(CLOG_GDBIO_ID); clog_info(CLOG_GDBMIIO, "Closing logfile."); clog_free(CLOG_GDBMIIO_ID); } /* }}}*/ static const char *tgdb_get_client_command(struct tgdb *tgdb, enum tgdb_command_type c) { switch (c) { case TGDB_CONTINUE: return "continue"; case TGDB_FINISH: return "finish"; case TGDB_NEXT: return "next"; case TGDB_NEXTI: return "nexti"; case TGDB_START: return "start"; case TGDB_RUN: return "run"; case TGDB_KILL: return "kill"; case TGDB_STEP: return "step"; case TGDB_STEPI: return "stepi"; case TGDB_UNTIL: return "until"; case TGDB_UP: return "up"; case TGDB_DOWN: return "down"; } return NULL; } static char *tgdb_client_modify_breakpoint_call(struct tgdb *tgdb, const char *file, int line, uint64_t addr, enum tgdb_breakpoint_action b) { const char *action; switch (b) { default: case TGDB_BREAKPOINT_ADD: action = "break"; break; case TGDB_BREAKPOINT_DELETE: action ="clear"; break; case TGDB_TBREAKPOINT_ADD: action = "tbreak"; break; } if (file) return sys_aprintf("%s \"%s\":%d", action, file, line); return sys_aprintf("%s *0x%" PRIx64, action, addr); } /******************************************************************************* * This is the main_loop stuff for tgdb-base ******************************************************************************/ /** * Run a command request if gdb is idle, otherwise queue it. * * @param tgdb * The TGDB context to use. * * @param request * The command request * * @param priority * True if this is a priority request, false otherwise. */ void tgdb_run_or_queue_request(struct tgdb *tgdb, struct tgdb_request *request, bool priority) { int can_issue; // Debugger commands currently get executed in the gdb console // rather than the gdb mi channel. The gdb console is no longer // queued by CGDB, rather CGDB passes everything along to it that the // user types. So always issue debugger commands for now. if (request->header == TGDB_REQUEST_DEBUGGER_COMMAND) { can_issue = 1; } else { can_issue = tgdb->is_gdb_ready_for_next_command; } if (can_issue) { tgdb_run_request(tgdb, request); } else { if (priority) { tgdb->command_requests->push_front(request); } else { tgdb->command_requests->push_back(request); } } } int tgdb_get_gdb_command(struct tgdb *tgdb, tgdb_request_ptr request, std::string &command); /** * Send a command to gdb. * * @param tgdb * An instance of tgdb * * @param request * The command request to issue the command for */ static void tgdb_run_request(struct tgdb *tgdb, struct tgdb_request *request) { std::string command; tgdb->is_gdb_ready_for_next_command = 0; tgdb_get_gdb_command(tgdb, request, command); /* Add a newline to the end of the command if it doesn't exist */ if (*command.rbegin() != '\n') { command.push_back('\n'); } /* Send what we're doing to log file */ std::string str = sys_quote_nonprintables(command.c_str(), -1); clog_debug(CLOG_GDBMIIO, "%s", str.c_str()); /* A command for the debugger */ tgdb_commands_set_current_request_type(tgdb, request->header); if (request->header == TGDB_REQUEST_DEBUGGER_COMMAND) { // since debugger commands are sent to the debugger's stdin // and not to the new-ui mi window, then we don't have to wait // for gdb to respond with an mi prompt. CGDB can send as many // commands as it likes, just as if the user typed it at the console tgdb->is_gdb_ready_for_next_command = 1; io_writen(tgdb->debugger_stdin, command.c_str(), command.size()); } else { io_writen(tgdb->gdb_mi_ui_fd, command.c_str(), command.size()); } tgdb_request_destroy(request); } /** * 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 void tgdb_unqueue_and_deliver_command(struct tgdb *tgdb) { if (tgdb->command_requests->size() > 0) { struct tgdb_request *request = tgdb->command_requests->front(); tgdb->command_requests->pop_front(); tgdb_run_request(tgdb, request); // TODO: free request? } } int tgdb_send_char(struct tgdb *tgdb, char c) { if (io_write_byte(tgdb->debugger_stdin, c) == -1) { clog_error(CLOG_CGDB, "io_write_byte failed"); return -1; } return 0; } /** * 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, bool new_ui_unsupported) { struct tgdb_response *response; response = tgdb_create_response(TGDB_QUIT); response->choice.quit.new_ui_unsupported = new_ui_unsupported; tgdb_send_response(tgdb, response); return 0; } /** * Called to process the sigchld signal, and clean up zombies! * * @param tgdb * The tgdb instance * * @return * 0 on success or -1 on error */ static int tgdb_handle_sigchld(struct tgdb *tgdb) { int result = 0; int status; int waitpid_result; do { waitpid_result = waitpid(tgdb->debugger_pid, &status, WNOHANG); if (waitpid_result == -1) { result = -1; clog_error(CLOG_CGDB, "waitpid error %d %s", errno, strerror(errno)); } } while (waitpid_result == 0); return result; } /** * If the user typed control_c at the prompt, clear the queues. * * @param tgdb * The tgdb instance to work on */ static void tgdb_handle_control_c(struct tgdb *tgdb) { if (tgdb->control_c) { tgdb_request_ptr_list::iterator iter = tgdb->command_requests->begin(); for (; iter != tgdb->command_requests->end(); ++iter) { tgdb_request_destroy(*iter); } tgdb->command_requests->clear(); tgdb->control_c = 0; } } // Search for the string // Undefined command: "new-ui" // to determine if this gdb supports the new-ui command or not. // If the string is found, set tgdb->gdb_supports_new_ui_command to false static void tgdb_search_for_unsupported_new_ui_message( struct tgdb *tgdb, const std::string &console_output) { static const char *new_ui_text = "Undefined command: \"new-ui\"."; (*tgdb->undefined_new_ui_command) += console_output; std::istringstream ss(*tgdb->undefined_new_ui_command); std::string line; while (getline(ss, line)) { if (line.find(new_ui_text) == 0) { tgdb->gdb_supports_new_ui_command = false; break; } } // Remove everything up to the last newline character so that // only newly added new lines are searched size_t pos = tgdb->undefined_new_ui_command->find_last_of("\n"); if (pos != std::string::npos) { *tgdb->undefined_new_ui_command = tgdb->undefined_new_ui_command->substr(pos); } } int tgdb_process(struct tgdb * tgdb, int fd) { const int n = 4096; static char buf[n]; ssize_t size; int result = 0; // If ^c has been typed at the prompt, clear the queues tgdb_handle_control_c(tgdb); size = io_read(fd, buf, n); if (size < 0) { // Error reading from GDB clog_error(CLOG_CGDB, "Error reading from gdb's stdout, closing down"); result = -1; tgdb_add_quit_command(tgdb, false); } else if (size == 0) { // Read EOF from GDB clog_info(CLOG_GDBIO, "read EOF from GDB, closing down"); tgdb_add_quit_command(tgdb, false); } else { if (fd == tgdb->debugger_stdout) { // Read some GDB console output, process it std::string str = sys_quote_nonprintables(buf, size); clog_debug(CLOG_GDBIO, "%s", str.c_str()); std::string msg(buf, size); // Determine if this gdb supports the new-ui command. // If it does not, send the quit command to alert the user // that they need a newer gdb. tgdb_search_for_unsupported_new_ui_message(tgdb, msg); if (!tgdb->gdb_supports_new_ui_command) { tgdb_add_quit_command(tgdb, true); } tgdb->callbacks.console_output_callback( tgdb->callbacks.context, msg); } else if (fd == tgdb->gdb_mi_ui_fd){ // Read some GDB console output, process it std::string msg(buf, size); clog_debug(CLOG_GDBMIIO, "%s", msg.c_str()); tgdb_commands_process(tgdb, msg); } else { } } return result; } /* Getting Data out of TGDB {{{*/ struct tgdb_response *tgdb_create_response(enum tgdb_response_type header) { struct tgdb_response *response; response = (struct tgdb_response *)cgdb_calloc(1, sizeof(struct tgdb_response)); response->header = header; return response; } static int tgdb_delete_response(struct tgdb_response *com) { if (!com) return -1; switch (com->header) { case TGDB_UPDATE_BREAKPOINTS: { int i; struct tgdb_breakpoint *breakpoints = com->choice.update_breakpoints.breakpoints; for (i = 0; i < sbcount(breakpoints); i++) { struct tgdb_breakpoint *tb = &breakpoints[i]; free(tb->path); } sbfree(breakpoints); com->choice.update_breakpoints.breakpoints = NULL; break; } case TGDB_UPDATE_FILE_POSITION: { struct tgdb_file_position *tfp = com->choice.update_file_position.file_position; free(tfp->path); free(tfp->from); free(tfp->func); free(tfp); com->choice.update_file_position.file_position = NULL; break; } case TGDB_UPDATE_SOURCE_FILES: { int i; char **source_files = com->choice.update_source_files.source_files; for (i = 0; i < sbcount(source_files); i++) { free(source_files[i]); } sbfree(source_files); com->choice.update_source_files.source_files = NULL; break; } case TGDB_DISASSEMBLE_PC: case TGDB_DISASSEMBLE_FUNC: { int i; char **disasm = com->choice.disassemble_function.disasm; for (i = 0; i < sbcount(disasm); i++) { free(disasm[i]); } sbfree(disasm); break; } case TGDB_QUIT: break; } free(com); com = NULL; return 0; } void tgdb_send_response(struct tgdb *tgdb, struct tgdb_response *response) { tgdb->callbacks.command_response_callback( tgdb->callbacks.context, response); tgdb_delete_response(response); } int tgdb_resize_console(struct tgdb *tgdb, int rows, int cols) { struct winsize size; int result; if (tgdb->debugger_stdin == -1) { return 0; } size.ws_row = rows; size.ws_col = cols; size.ws_xpixel = 0; size.ws_ypixel = 0; result = ioctl(tgdb->debugger_stdin, TIOCSWINSZ, &size); if (result == -1) { clog_error(CLOG_CGDB, "ioctl failed"); } return 0; } /* }}}*/ /* Functional commands {{{ */ /* Request {{{*/ void tgdb_request_inferiors_source_files(struct tgdb * tgdb) { tgdb_request_ptr request_ptr; request_ptr = (tgdb_request_ptr)cgdb_malloc(sizeof (struct tgdb_request)); request_ptr->header = TGDB_REQUEST_INFO_SOURCES; tgdb_run_or_queue_request(tgdb, request_ptr, false); } void tgdb_request_current_location(struct tgdb * tgdb) { tgdb_request_ptr request_ptr; request_ptr = (tgdb_request_ptr)cgdb_malloc(sizeof (struct tgdb_request)); request_ptr->header = TGDB_REQUEST_INFO_FRAME; tgdb_run_or_queue_request(tgdb, request_ptr, true); } void tgdb_request_breakpoints(struct tgdb * tgdb) { tgdb_request_ptr request_ptr; request_ptr = (tgdb_request_ptr)cgdb_malloc(sizeof (struct tgdb_request)); request_ptr->header = TGDB_REQUEST_BREAKPOINTS; tgdb_run_or_queue_request(tgdb, request_ptr, false); } void tgdb_request_run_debugger_command(struct tgdb * tgdb, enum tgdb_command_type c) { tgdb_request_ptr request_ptr; request_ptr = (tgdb_request_ptr)cgdb_malloc(sizeof (struct tgdb_request)); request_ptr->header = TGDB_REQUEST_DEBUGGER_COMMAND; request_ptr->choice.debugger_command.c = c; tgdb_run_or_queue_request(tgdb, request_ptr, false); } void tgdb_request_modify_breakpoint(struct tgdb *tgdb, const char *file, int line, uint64_t addr, enum tgdb_breakpoint_action b) { tgdb_request_ptr request_ptr; request_ptr = (tgdb_request_ptr)cgdb_malloc(sizeof (struct tgdb_request)); request_ptr->header = TGDB_REQUEST_MODIFY_BREAKPOINT; request_ptr->choice.modify_breakpoint.file = file ? cgdb_strdup(file) : NULL; request_ptr->choice.modify_breakpoint.line = line; request_ptr->choice.modify_breakpoint.addr = addr; request_ptr->choice.modify_breakpoint.b = b; tgdb_run_or_queue_request(tgdb, request_ptr, false); } void tgdb_request_disassemble_pc(struct tgdb *tgdb, int lines) { tgdb_request_ptr request_ptr; request_ptr = (tgdb_request_ptr)cgdb_malloc(sizeof (struct tgdb_request)); request_ptr->header = TGDB_REQUEST_DISASSEMBLE_PC; request_ptr->choice.disassemble.lines = lines; tgdb_run_or_queue_request(tgdb, request_ptr, false); } void tgdb_request_disassemble_func(struct tgdb *tgdb, enum disassemble_func_type type) { tgdb_request_ptr request_ptr; request_ptr = (tgdb_request_ptr)cgdb_malloc(sizeof (struct tgdb_request)); request_ptr->header = TGDB_REQUEST_DISASSEMBLE_FUNC; request_ptr->choice.disassemble_func.raw = (type == DISASSEMBLE_FUNC_RAW_INSTRUCTIONS); request_ptr->choice.disassemble_func.source = (type == DISASSEMBLE_FUNC_SOURCE_LINES); tgdb_run_or_queue_request(tgdb, request_ptr, false); } /* }}}*/ /* Process {{{*/ int tgdb_get_gdb_command(struct tgdb *tgdb, tgdb_request_ptr request, std::string &command) { char *str; if (!tgdb || !request) { return -1; } switch (request->header) { case TGDB_REQUEST_INFO_SOURCES: command = "-file-list-exec-source-files\n"; break; case TGDB_REQUEST_INFO_SOURCE_FILE: command = "-file-list-exec-source-file\n"; break; case TGDB_REQUEST_BREAKPOINTS: command = "-break-info\n"; break; case TGDB_REQUEST_TTY: str = sys_aprintf("-inferior-tty-set %s\n", request->choice.tty_command.slavename); command = str; free(str); str = NULL; break; case TGDB_REQUEST_INFO_FRAME: command = "-stack-info-frame\n"; break; case TGDB_REQUEST_DATA_DISASSEMBLE_MODE_QUERY: command = "-data-disassemble -s 0 -e 0 -- 4\n"; break; case TGDB_REQUEST_DEBUGGER_COMMAND: command = tgdb_get_client_command(tgdb, request->choice.debugger_command.c); break; case TGDB_REQUEST_MODIFY_BREAKPOINT: str = tgdb_client_modify_breakpoint_call(tgdb, request->choice.modify_breakpoint.file, request->choice.modify_breakpoint.line, request->choice.modify_breakpoint.addr, request->choice.modify_breakpoint.b); command = str; free(str); str = NULL; break; case TGDB_REQUEST_DISASSEMBLE_PC: str = sys_aprintf("x/%di $pc\n", request->choice.disassemble.lines); command = str; free(str); str = NULL; break; case TGDB_REQUEST_DISASSEMBLE_FUNC: { /* GDB 7.11 adds /s command to disassemble https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=6ff0ba5f7b8a2b10642bbb233a32043595c55670 The "source centric" /m option to the disassemble command is often unhelpful, e.g., in the presence of optimized code. This patch adds a /s modifier that is better. For one, /m only prints instructions from the originating source file, leaving out instructions from e.g., inlined functions from other files. disassemble /m: source lines included /s: source lines included, output in pc order (7.10 and higher) /r: raw instructions included in hex single argument: function surrounding is dumped two arguments: start,end or start,+length disassemble 'driver.cpp'::main interp mi "disassemble /s 'driver.cpp'::main,+10" interp mi "disassemble /r 'driver.cpp'::main,+10" */ const char *data = NULL; if (request->choice.disassemble_func.raw) { data = "/r"; } else if (request->choice.disassemble_func.source && tgdb_commands_disassemble_supports_s_mode(tgdb)) { data = "/s"; } str = sys_aprintf("disassemble%s%s\n", data ? " " : "", data ? data : ""); command = str; free(str); str = NULL; break; } } 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) { // GDB has died, clean up the zombie and send the quit command tgdb_handle_sigchld(tgdb); tgdb_add_quit_command(tgdb, false); } return 0; } /* }}}*/ cgdb-0.8.0/lib/tgdb/gdbwire.h0000664000175000017500000027622114134377055012646 00000000000000/** * Copyright (C) 2013 Robert Rossi * * This file is an amalgamation of the source files from GDBWIRE. * * It was created using gdbwire 1.0 and git revision 6cbdacc. * * GDBWIRE 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. * * GDBWIRE 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 GDBWIRE. If not, see . */ /***** Begin file gdbwire_sys.h **********************************************/ #ifndef __GDBWIRE_SYS_H__ #define __GDBWIRE_SYS_H__ /** * Supporting system functions. */ #ifdef __cplusplus extern "C" { #endif /** * Duplicate a string. * * @param str * The string to duplicate * * @return * An allocated string that must be freed. * Null if out of memory or str is NULL. */ char *gdbwire_strdup(const char *str); #ifdef __cplusplus } #endif #endif /***** End of gdbwire_sys.h **************************************************/ /***** Begin file gdbwire_string.h *******************************************/ #ifndef __GDBWIRE_STRING_H__ #define __GDBWIRE_STRING_H__ #ifdef __cplusplus extern "C" { #endif #include /** * A dynamic string representation. * * To create and destroy a string use gdbwire_string_create() and * gdbwire_string_destroy() respectively. * * This string is an abstraction of a low level C string. It supports being * used as a NULL terminated c string and also as an arbitrary array of * bytes. You can append to this string in either of these modes using * gdbwire_string_append_cstr() or gdbwire_string_append_data(). This string * automatically grows as you append data to it. Please note, the size of * the string will not include the NULL terminated character when using * the gdbwire_string_append_cstr() function to append data. * * To get access to the underlying bytes associated with this string * call gdbwire_string_data(). It is OK to modify the result as long as * you are careful to stay in it's valid bounds. * * The size (or length) of the string can be accessed through the * gdbwire_string_size() function. The character pointer returned from * gdbwire_string_data() is valid from the index range of 0 to * gdbwire_string_size() - 1. */ struct gdbwire_string; /** * Create a string instance. * * @return * A valid string instance or NULL on error. */ struct gdbwire_string *gdbwire_string_create(void); /** * Destroy the string instance and it's resources. * * @param string * The string to destroy. */ void gdbwire_string_destroy(struct gdbwire_string *string); /** * Clear the contents of a string. * * Sets the string back to an empty string which also changes it's * size back to zero. * * The capacity remains unchanged. * * @param string * The string to clear */ void gdbwire_string_clear(struct gdbwire_string *string); /** * Append a character to the string instance. * * @param string * The string instance to append the character to. * * @param c * The character to append to the string instance. * * @return * 0 on success or -1 on failure. */ int gdbwire_string_append_char(struct gdbwire_string *string, char c); /** * Append a c string to the string instance. * * @param string * The string instance to append the c string to. * * @param cstr * The c string to append to the string instance. * * @return * 0 on success or -1 on failure. */ int gdbwire_string_append_cstr(struct gdbwire_string *string, const char *cstr); /** * Append a sequence of bytes to the string instance. * * @param string * The string instance to append the sequence of bytes to. * * @param data * The sequence of bytes to append to the string instance. This may * contain NUL characters. * * @param size * The number of bytes in data to append to the string instance. * * @return * 0 on success or -1 on failure. */ int gdbwire_string_append_data(struct gdbwire_string *string, const char *data, size_t size); /** * Get the data associated with this string. * * The data could be formatted as a NULL terminated C string or * as an arbitrary array of bytes. Use gdbwire_string_size() to * determine the size (or length) of the result of this function. * * Modifying the return value of this function is acceptable as long as you * stay in the string's valid bounds. * * @param string * The string index to get the pointer data from. * * @return * The data that has been added to this string instance or "" after * creation or clear. The result is gdbwire_string_size() bytes long. */ char *gdbwire_string_data(struct gdbwire_string *string); /** * Determine the size (the number of bytes) this string instance represents. * * Please note, the result of this function will not include the NULL * terminated character when using the gdbwire_string_append_cstr() function * to append data. * * @param string * The string instance to get the size for. * * @return * The number of bytes contained in this string instance. To access these * bytes see gdbwire_string_data(). Will be 0 after creation or clear. */ size_t gdbwire_string_size(struct gdbwire_string *string); /** * Determine the maximum capacity (number of bytes) this string may hold. * * The max capacity of the string is automatically increased when data * is appended to this string through the gdbwire_string_append_*() * family of functions. * * @param string * The string to determine the capacity of. * * @return * The max number of bytes this string may hold. */ size_t gdbwire_string_capacity(struct gdbwire_string *string); /** * Search for the first character in chars occuring in this string. * * @param string * The string to search for the characters in chars in. * * @param chars * A null terminated string of characters. This string is not searched * for directly but instead each individually character in the string * is searched for. * * @return * The index position of the first matched character in chars. * Will return gdbwire_string_size() if not found. */ size_t gdbwire_string_find_first_of(struct gdbwire_string *string, const char *chars); /** * Erase characters from this string, reducing it's size. * * @param string * The string to erase characters from. * * @param pos * The index position of the first character to be erased. * * @param count * The number of characters to erase starting at position pos. * If count goes past the end of the string it is adjusted to erase * until the end of the string. This allows the caller to pass in * gdbwire_string_size() to erase the end of the string with out * doing index arithmetic. * * @return * On success 0 will be returned otherwise -1. The string will remain * unmodified when an error occurs. Success can only occur if the entire * requested range can be erased. */ int gdbwire_string_erase(struct gdbwire_string *string, size_t pos, size_t count); #ifdef __cplusplus } #endif #endif /***** End of gdbwire_string.h ***********************************************/ /***** Begin file gdbwire_assert.h *******************************************/ #ifndef GDBWIRE_ERROR_H #define GDBWIRE_ERROR_H /***** Include gdbwire_result.h in the middle of gdbwire_assert.h ************/ /***** Begin file gdbwire_result.h *******************************************/ #ifndef GDBWIRE_RESULT_H #define GDBWIRE_RESULT_H enum gdbwire_result { /* The result of the operation was successful */ GDBWIRE_OK, /** * An assertion failed in the calling code. * * Functions are encouraged to assert expressions they expect * to be true. The macro GDBWIRE_ASSERT and GDBWIRE_ASSERT_ERRNO * are useful for asserting expressions, and upon failure, to * automatically log the assertion expression and return * this result status. */ GDBWIRE_ASSERT, /** * An internal logic error has occurred. * * In general, this should be used when a function can no * longer carry out it's contract and must abort. * * This happens, for instance, when a called function returns * an error status, or when invalid input was provided, etc. */ GDBWIRE_LOGIC, /** * The system is out of memory. * * Will occur when malloc, strdup, calloc, etc fail to allocate memory. */ GDBWIRE_NOMEM }; #endif /* GDBWIRE_RESULT_H */ /***** End of gdbwire_result.h ***********************************************/ /***** Continuing where we left off in gdbwire_assert.h **********************/ /***** Include gdbwire_logger.h in the middle of gdbwire_assert.h ************/ /***** Begin file gdbwire_logger.h *******************************************/ #ifndef __GDBWIRE_LOGGER_H__ #define __GDBWIRE_LOGGER_H__ /* #include "gdbwire_result.h" */ #ifdef __cplusplus extern "C" { #endif enum gdbwire_logger_level { GDBWIRE_LOGGER_DEBUG, GDBWIRE_LOGGER_INFO, GDBWIRE_LOGGER_WARN, GDBWIRE_LOGGER_ERROR }; /** * Log a statement to the logger. * * This is typically not called directly. Use the below macros instead. * The macros automatically supply the file, line and level arguments. * * @param file * The filename the logger was invoked from. * * @param line * The line number the logger was invoked from. * * @param level * The level associated with the log message. * * @param fmt * The format string for the message (printf formatting). * * @param ... * Any additional format arguments. */ void gdbwire_logger_log(const char *file, int line, enum gdbwire_logger_level level, const char *fmt, ...) #ifdef __GNUC__ __attribute__((__format__(__printf__, 4, 5))) #endif ; /* The macros intended to be used for logging */ #define gdbwire_debug(fmt, ...)(gdbwire_logger_log(__FILE__, __LINE__, \ GDBWIRE_LOGGER_DEBUG, fmt, ##__VA_ARGS__)) #define gdbwire_info(fmt, ...)(gdbwire_logger_log(__FILE__, __LINE__, \ GDBWIRE_LOGGER_INFO, fmt, ##__VA_ARGS__)) #define gdbwire_warn(fmt, ...)(gdbwire_logger_log(__FILE__, __LINE__, \ GDBWIRE_LOGGER_WARN, fmt, ##__VA_ARGS__)) #define gdbwire_error(fmt, ...)(gdbwire_logger_log(__FILE__, __LINE__, \ GDBWIRE_LOGGER_ERROR, fmt, ##__VA_ARGS__)) #ifdef __cplusplus } #endif #endif /***** End of gdbwire_logger.h ***********************************************/ /***** Continuing where we left off in gdbwire_assert.h **********************/ /** * Validate that the expression evaluates to true. * * If the expression does not evaluate to true, log the error and * return a GDBWIRE_ASSERT status code. * * Otherwise, if the expression does evaluate to true, do nothing. * * @param expr * The expression to evaluate. */ #define GDBWIRE_ASSERT(expr) \ do { \ if (!(expr)) { \ gdbwire_error("Assertion failure, expr[%s]", #expr); \ return GDBWIRE_ASSERT; \ } \ } while (0) /** * Validate that the expression evaluates to true. * * If the expression does not evaluate to true, log the error, * set the variable provided to GDBWIRE_ASSERT and goto the label * provided. * * Otherwise, if the expression does evaluate to true, do nothing. * * @param expr * The expression to evaluate. * * @param variable * The result variable to assign the value GDBWIRE_ASSERT to. * * @param label * The label to jump to if the expression evaluates to False. */ #define GDBWIRE_ASSERT_GOTO(expr, variable, label) \ do { \ if (!(expr)) { \ gdbwire_error("Assertion failure, expr[%s], " \ "label[%s]", #expr, #label); \ variable = GDBWIRE_ASSERT; \ goto label; \ } \ } while (0) /** * Validate that the expression evaluates to true. * * This particular assertion macro is used when a system library * call fails and that library call has an associated errno status * to describe the failure reason. * * If the expression does not evaluate to true, log the error, * along with the errno value and message and return a GDBWIRE_ASSERT * status code. * * Otherwise, if the expression does evaluate to true, do nothing. * * @param expr * The expression to evaluate. */ #define GDBWIRE_ASSERT_ERRNO(expr) \ do { \ if (!(expr)) { \ gdbwire_error("Assertion failure, expr[%s]," \ "errno[%d], strerror[%s]", \ #expr, errno, strerror(errno)); \ return GDBWIRE_ASSERT; \ } \ } while (0) #endif /* GDBWIRE_ERROR_H */ /***** End of gdbwire_assert.h ***********************************************/ /***** Begin file gdbwire_result.h *******************************************/ #ifndef GDBWIRE_RESULT_H #define GDBWIRE_RESULT_H enum gdbwire_result { /* The result of the operation was successful */ GDBWIRE_OK, /** * An assertion failed in the calling code. * * Functions are encouraged to assert expressions they expect * to be true. The macro GDBWIRE_ASSERT and GDBWIRE_ASSERT_ERRNO * are useful for asserting expressions, and upon failure, to * automatically log the assertion expression and return * this result status. */ GDBWIRE_ASSERT, /** * An internal logic error has occurred. * * In general, this should be used when a function can no * longer carry out it's contract and must abort. * * This happens, for instance, when a called function returns * an error status, or when invalid input was provided, etc. */ GDBWIRE_LOGIC, /** * The system is out of memory. * * Will occur when malloc, strdup, calloc, etc fail to allocate memory. */ GDBWIRE_NOMEM }; #endif /* GDBWIRE_RESULT_H */ /***** End of gdbwire_result.h ***********************************************/ /***** Begin file gdbwire_logger.h *******************************************/ #ifndef __GDBWIRE_LOGGER_H__ #define __GDBWIRE_LOGGER_H__ /* #include "gdbwire_result.h" */ #ifdef __cplusplus extern "C" { #endif enum gdbwire_logger_level { GDBWIRE_LOGGER_DEBUG, GDBWIRE_LOGGER_INFO, GDBWIRE_LOGGER_WARN, GDBWIRE_LOGGER_ERROR }; /** * Log a statement to the logger. * * This is typically not called directly. Use the below macros instead. * The macros automatically supply the file, line and level arguments. * * @param file * The filename the logger was invoked from. * * @param line * The line number the logger was invoked from. * * @param level * The level associated with the log message. * * @param fmt * The format string for the message (printf formatting). * * @param ... * Any additional format arguments. */ void gdbwire_logger_log(const char *file, int line, enum gdbwire_logger_level level, const char *fmt, ...) #ifdef __GNUC__ __attribute__((__format__(__printf__, 4, 5))) #endif ; /* The macros intended to be used for logging */ #define gdbwire_debug(fmt, ...)(gdbwire_logger_log(__FILE__, __LINE__, \ GDBWIRE_LOGGER_DEBUG, fmt, ##__VA_ARGS__)) #define gdbwire_info(fmt, ...)(gdbwire_logger_log(__FILE__, __LINE__, \ GDBWIRE_LOGGER_INFO, fmt, ##__VA_ARGS__)) #define gdbwire_warn(fmt, ...)(gdbwire_logger_log(__FILE__, __LINE__, \ GDBWIRE_LOGGER_WARN, fmt, ##__VA_ARGS__)) #define gdbwire_error(fmt, ...)(gdbwire_logger_log(__FILE__, __LINE__, \ GDBWIRE_LOGGER_ERROR, fmt, ##__VA_ARGS__)) #ifdef __cplusplus } #endif #endif /***** End of gdbwire_logger.h ***********************************************/ /***** Begin file gdbwire_mi_pt.h ********************************************/ #ifndef GDBWIRE_MI_PT_H #define GDBWIRE_MI_PT_H #ifdef __cplusplus extern "C" { #endif /** * The position of a token in a GDB/MI line. * * Note that a string in C is zero based and the token column * position is 1 based. For example, * char *str = "hello world"; * The "hello" token would have a start_column as 1 and an end * column as 5. * * The start_column and end_column will be the same column number for * a token of size 1. */ struct gdbwire_mi_position { /* The starting column position of the token */ int start_column; /* The ending column position of the token */ int end_column; }; /** The gdbwire_mi output kinds. */ enum gdbwire_mi_output_kind { /** * The GDB/MI output contains an out of band record. * * The out of band record is not necessarily associated with any * particular GDB/MI input command. */ GDBWIRE_MI_OUTPUT_OOB, /** * The GDB/MI output contains a gdbwire_mi result record. * * This record typically contains the result data from a request * made by the client in a previous GDB/MI input command. */ GDBWIRE_MI_OUTPUT_RESULT, /** * The GDB/MI output represents a prompt. (ie. (gdb) ) * * TODO: Document when GDB is ready to receive a command. Only if * the prompt is received and at *stopped? */ GDBWIRE_MI_OUTPUT_PROMPT, /** * A parse error occurred. */ GDBWIRE_MI_OUTPUT_PARSE_ERROR }; /** * The GDB/MI output command. * * A GDB/MI output command is the main mechanism in which GDB * corresponds with a front end. */ struct gdbwire_mi_output { enum gdbwire_mi_output_kind kind; union { /** When kind == GDBWIRE_MI_OUTPUT_OOB, never NULL. */ struct gdbwire_mi_oob_record *oob_record; /** When kind == GDBWIRE_MI_OUTPUT_RESULT, never NULL. */ struct gdbwire_mi_result_record *result_record; /** When kind == GDBWIRE_MI_OUTPUT_PARSE_ERROR, never NULL. */ struct { /** The token the error occurred on */ char *token; /** The position of the token where the error occurred. */ struct gdbwire_mi_position pos; } error; } variant; /** * The GDB/MI output line that was used to create this output instance. * * Each gdbwire_mi output structure is created from exactly one line of * MI output from GDB. This field represents the line that created * this particular output structure. * * This field is always available and never NULL, even for a parse error. */ char *line; /** The next GDB/MI output command or NULL if none */ struct gdbwire_mi_output *next; }; /** * A GDB/MI token. * * A string made up of one or more digits. * The regular expression [0-9]+ will match this types contents. */ typedef char *gdbwire_mi_token_t; /** * A GDB/MI output command may contain one of the following result indications. */ enum gdbwire_mi_result_class { /** * The synchronous operation was successful (^done). */ GDBWIRE_MI_DONE, /** * Equivalent to GDBWIRE_MI_DONE (^running). * * Historically, was output by GDB instead of ^done if the command * resumed the target. * * Do not rely on or use this result class in the front end to determine * the state of the target. Use the async *running output record to * determine which threads have resumed running. * * TODO: Ensure that early versions of GDB can depend on the async * *running or if front ends DO have to rely on ^running. */ GDBWIRE_MI_RUNNING, /** * GDB has connected to a remote target (^connected). * * This is in response to the -target-select command. * * A comment in the GDB source code says, * There's no particularly good reason why target-connect results * in not ^done. Should kill ^connected for MI3. * * With this in mind, it makes sense to assume that GDBWIRE_MI_CONNECTED * and GDBWIRE_MI_DONE are equivalent. */ GDBWIRE_MI_CONNECTED, /** * An error has occurred (^error). * * This can occur if the user provides an improper command to GDB. * In this case, the user will be provided the standard error output but * the front end will also be provided this information independently. */ GDBWIRE_MI_ERROR, /** * GDB has terminated (^exit). * * When GDB knows it is about to exit, it provides this notification * in the GDB/MI output command. However, on all other circumstances, * the front end should be prepared to have GDB exit and not provide * this information. */ GDBWIRE_MI_EXIT, /* An unsupported result class */ GDBWIRE_MI_UNSUPPORTED }; /** * The GDB/MI result record in an output command. * * The result record represents the result data in the GDB/MI output * command sent by GDB. This typically contains the content the client * was requesting when it sent a GDB/MI input command to GDB. */ struct gdbwire_mi_result_record { /** * The token associated with the corresponding GDB/MI input command. * * The client may provide a unique string of digits at the beginning of a * GDB/MI input command. For example, * 0000-foo * When GDB finally gets around to responding to the GDB/MI input command, * it takes the token provided in the input command and puts it into the * result record of the corresponding GDB/MI output command. For * example, the output commmand associated with the above input command is, * 0000^error,msg="Undefined MI command: foo",code="undefined-command" * and the result record would have the below token field set to "0000". * * This is intended to allow the front end to correlate the GDB/MI input * command it sent with the GDB/MI output command GDB responded with. * * This represents the token value the front end provided to the * corresponding GDB/MI input command or NULL if no token was provided. */ gdbwire_mi_token_t token; /** The result records result class. */ enum gdbwire_mi_result_class result_class; /** * An optional list of results for this result record. * * Will be NULL if there is no results for this result record. * * This is typically where the result data is that the client * is looking for. */ struct gdbwire_mi_result *result; }; /** The out of band record kinds. */ enum gdbwire_mi_oob_record_kind { /** * An asyncronous out of band record. * * An asyncronous record occurs when GDB would like to update the * client with information that it has not asked for. * * For instance, if the inferior has stopped, or a new thread has * started. */ GDBWIRE_MI_ASYNC, /** * A stream out of band record. * * This is the result of normal output from the console, target or GDB. */ GDBWIRE_MI_STREAM }; /* This is an out of band record. */ struct gdbwire_mi_oob_record { /** The kind of out of band record. */ enum gdbwire_mi_oob_record_kind kind; union { /** When kind == GDBWIRE_MI_ASYNC. */ struct gdbwire_mi_async_record *async_record; /** When kind == GDBWIRE_MI_STREAM. */ struct gdbwire_mi_stream_record *stream_record; } variant; }; /** The asynchronous out of band record kinds */ enum gdbwire_mi_async_record_kind { /** * The asynchronous status record kind. * * Contains on-going status information about the progress of a slow * operation. It can be discarded. * * This output is prepended by the + character. */ GDBWIRE_MI_STATUS, /** * The asynchronous exec record kind. * * Contains asynchronous state change regarding the target: * (stopped, started, disappeared). * * This output is prepended by the * character. */ GDBWIRE_MI_EXEC, /** * The asyncronous notify record kind. * * Contains supplementary information that the client should handle * (e.g., a new breakpoint information). * * This output is prepended by the = character. */ GDBWIRE_MI_NOTIFY }; /** The stream out of band record kinds */ enum gdbwire_mi_stream_record_kind { /** * The console output. * * Output that should be displayed as is in the console. * It is the textual response to a CLI command. * * This output is prepended by the ~ character. */ GDBWIRE_MI_CONSOLE, /** * The target output. * * Output produced by the target program. * * This output is prepended by the @ character. */ GDBWIRE_MI_TARGET, /** * The GDB log output. * * Output text coming from GDB's internals. For instance messages * that should be displayed as part of an error log. * * This output is prepended by the & character. */ GDBWIRE_MI_LOG }; /** * The GDB/MI asyncronous class. * * */ enum gdbwire_mi_async_class { /** * Loading the executable onto the remote target. * * This was undocumented in the GDB manual as far as GDB 7.7. * * This occurs if the async record is GDBWIRE_MI_STATUS as +download. */ GDBWIRE_MI_ASYNC_DOWNLOAD, /** * The target has stopped. * * This occurs if the async record is GDBWIRE_MI_EXEC as *stopped. */ GDBWIRE_MI_ASYNC_STOPPED, /** * The target is now running. * * This occurs if the async record is GDBWIRE_MI_EXEC as *running. */ GDBWIRE_MI_ASYNC_RUNNING, /** * Reports that a thread group was added. * * When a thread group is added, it generally might not be associated * with a running process. * * This occurs if the async record is GDBWIRE_MI_NOTIFY * as =thread-group-added. */ GDBWIRE_MI_ASYNC_THREAD_GROUP_ADDED, /** * Reports that a thread group was removed. * * When a thread group is removed, its id becomes invalid and cannot be * used in any way. * * This occurs if the async record is GDBWIRE_MI_NOTIFY * as =thread-group-removed. */ GDBWIRE_MI_ASYNC_THREAD_GROUP_REMOVED, /** * Reports that a thread group was started. * * A thread group became associated with a running program. * * This occurs if the async record is GDBWIRE_MI_NOTIFY * as =thread-group-started. */ GDBWIRE_MI_ASYNC_THREAD_GROUP_STARTED, /** * Reports that a thread group was exited. * * A thread group is no longer associated with a running program. * * This occurs if the async record is GDBWIRE_MI_NOTIFY * as =thread-group-exited. */ GDBWIRE_MI_ASYNC_THREAD_GROUP_EXITED, /** * Reports that a thread was created. * * This occurs if the async record is GDBWIRE_MI_NOTIFY * as =thread-created. */ GDBWIRE_MI_ASYNC_THREAD_CREATED, /** * Reports that a thread was exited. * * This occurs if the async record is GDBWIRE_MI_NOTIFY as =thread-exited. */ GDBWIRE_MI_ASYNC_THREAD_EXITED, /** * Reports that a thread was selected. * * This occurs if the async record is GDBWIRE_MI_NOTIFY as =thread-selected. */ GDBWIRE_MI_ASYNC_THREAD_SELECTED, /** * Reports that a new library was loaded. * * This occurs if the async record is GDBWIRE_MI_NOTIFY as =library-loaded. */ GDBWIRE_MI_ASYNC_LIBRARY_LOADED, /** * Reports that a new library was unloaded. * * This occurs if the async record is GDBWIRE_MI_NOTIFY * as =library-unloaded. */ GDBWIRE_MI_ASYNC_LIBRARY_UNLOADED, /** * Reports that a trace frame was changed. * * This occurs if the async record is GDBWIRE_MI_NOTIFY * as =traceframe-changed. */ GDBWIRE_MI_ASYNC_TRACEFRAME_CHANGED, /** * Reports that a trace state variable was created. * * This occurs if the async record is GDBWIRE_MI_NOTIFY as =tsv-created. */ GDBWIRE_MI_ASYNC_TSV_CREATED, /** * Reports that a trace state variable was modified. * * This occurs if the async record is GDBWIRE_MI_NOTIFY as =tsv-modified. */ GDBWIRE_MI_ASYNC_TSV_MODIFIED, /** * Reports that a trace state variable was deleted. * * This occurs if the async record is GDBWIRE_MI_NOTIFY as =tsv-deleted. */ GDBWIRE_MI_ASYNC_TSV_DELETED, /** * Reports that a breakpoint was created. * * Only user-visible breakpoints are reported to the MI user. * * If a breakpoint is emitted in the result record of a * command, then it will not also be emitted in an async record. * * This occurs if the async record is GDBWIRE_MI_NOTIFY * as =breakpoint-created. */ GDBWIRE_MI_ASYNC_BREAKPOINT_CREATED, /** * Reports that a breakpoint was modified. * * Only user-visible breakpoints are reported to the MI user. * * If a breakpoint is emitted in the result record of a * command, then it will not also be emitted in an async record. * * This occurs if the async record is GDBWIRE_MI_NOTIFY * as =breakpoint-modified. */ GDBWIRE_MI_ASYNC_BREAKPOINT_MODIFIED, /** * Reports that a breakpoint was deleted. * * Only user-visible breakpoints are reported to the MI user. * * If a breakpoint is emitted in the result record of a * command, then it will not also be emitted in an async record. * * This occurs if the async record is GDBWIRE_MI_NOTIFY * as =breakpoint-deleted. */ GDBWIRE_MI_ASYNC_BREAKPOINT_DELETED, /** * Reports that execution log recording was started on an inferior. * * This occurs if the async record is GDBWIRE_MI_NOTIF * as =record-started. */ GDBWIRE_MI_ASYNC_RECORD_STARTED, /** * Reports that execution log recording was stopped on an inferior. * * This occurs if the async record is GDBWIRE_MI_NOTIFY * as =record-stopped. */ GDBWIRE_MI_ASYNC_RECORD_STOPPED, /** * Reports that a parameter of the command set param is changed to value. * * For example, when the user runs a command like 'set print pretty on', * this async command will be invoked with the parameter reported as * 'print pretty' and the value as 'on'. * * This occurs if the async record is GDBWIRE_MI_NOTIFY * as =cmd-param-changed. */ GDBWIRE_MI_ASYNC_CMD_PARAM_CHANGED, /** * Reports that bytes from addr to data + len were written in an inferior. * * This occurs if the async record is GDBWIRE_MI_NOTIFY * as =memory-changed. */ GDBWIRE_MI_ASYNC_MEMORY_CHANGED, /* An unsupported async class */ GDBWIRE_MI_ASYNC_UNSUPPORTED }; /** * The GDB/MI asyncronous record in an output command. * * An asyncronous record occurs when GDB would like to update the * client with information that it has not asked for. */ struct gdbwire_mi_async_record { /** * The result record token. * * Please note that the GDB/MI manual says that asyncronous records * do not currently populate this token on output but reserve the right * to do so. For that reason, token here should always be NULL. * * From the GDB documentation: * Note that for all async output, while the token is allowed by the * grammar and may be output by future versions of gdb for select async * output messages, it is generally omitted. Frontends should treat all * async output as reporting general changes in the state of the target * and there should be no need to associate async output to any prior * command. * * After further investigation, I determined that newer GDB's will no * longer ever output this information. Older GDB's will. The commit * that made this change in GDB is 721c02de on April 24th, 2008. * The next GDB that was released was on October 6th, 2009, version 7.0. * * Before the above mentioned commit async *stopped commands would * sometimes output the token associated with the last token provided in * a GDB/MI input command. After that change, the token is never * associated with an async output command, even though the * documentation says it might be. * * Finally, even before that change when the token was output in the * async *stopped command, the developers of GDB felt that it was not * useful and should be avoided by front ends. * * With this information, I've determined that front ends should never * use this value to determine logic. However, the value is parsed in * order to accurately handle and represent the cases where this value * occurs. * * This represents the token value the front end provided to the * corresponding GDB/MI input command or NULL if no token was provided. */ gdbwire_mi_token_t token; /** The kind of asynchronous record. */ enum gdbwire_mi_async_record_kind kind; /** The asynchronous output class */ enum gdbwire_mi_async_class async_class; /** * An optional list of results for this async output. * * Will be NULL if there is no results. */ struct gdbwire_mi_result *result; }; /** The GDB/MI result kind */ enum gdbwire_mi_result_kind { /** The result is a cstring */ GDBWIRE_MI_CSTRING, /** The result is a tuple */ GDBWIRE_MI_TUPLE, /** The result is a list */ GDBWIRE_MI_LIST }; /** * A GDB/MI result list. * * This is one of the important GDB/MI data structures. GDB communicates many * of it's values to the front end through this key/value data structure. * * It is basically a list of key/value pairs, where the key is a * variable name and the value expands to a string, a tuple of results or * a list of results. * * This can be thought of as a custom json object. */ struct gdbwire_mi_result { /** The kind of result this represents. */ enum gdbwire_mi_result_kind kind; /** The key being described by the result. */ char *variable; union { /** When kind is GDBWIRE_MI_CSTRING */ char *cstring; /** * When kind is GDBWIRE_MI_TUPLE or GDBWIRE_MI_LIST. * * If kind is GDBWIRE_MI_TUPLE, each result in the tuple should have a * valid key according to the GDB/MI specification. That is, for * each result, result->variable should not be NULL. * Note: GDBWIRE currently relaxes the above rule. It allows tuple's * with out a key in each member. For instance, {key="value"} * is what the GDB/MI specification advocates for, but some * variations of GDB emit {"value"} and so GDBWIRE allows it. * * If kind is GDBWIRE_MI_LIST, the GDB/MI specification allows * results in this list to not have keys. That is, for each result, * result->variable may be NULL. * * Will be NULL if the tuple or list is empty. */ struct gdbwire_mi_result *result; } variant; /** The next result or NULL if none */ struct gdbwire_mi_result *next; }; /** * An out of band GDB/MI stream record. * * A stream record is intended to provide the front end with information * from the console, the target or from GDB itself. */ struct gdbwire_mi_stream_record { /** The kind of stream record. */ enum gdbwire_mi_stream_record_kind kind; /** The buffer provided in this stream record. */ char *cstring; }; void gdbwire_mi_output_free(struct gdbwire_mi_output *param); struct gdbwire_mi_output *append_gdbwire_mi_output( struct gdbwire_mi_output *list, struct gdbwire_mi_output *item); struct gdbwire_mi_result *append_gdbwire_mi_result( struct gdbwire_mi_result *list, struct gdbwire_mi_result *item); #ifdef __cplusplus } #endif #endif /***** End of gdbwire_mi_pt.h ************************************************/ /***** Begin file gdbwire_mi_pt_alloc.h **************************************/ #ifndef GDBWIRE_MI_PT_ALLOC_H #define GDBWIRE_MI_PT_ALLOC_H #ifdef __cplusplus extern "C" { #endif /** * Responsible for allocating and deallocating gdbwire_mi_pt objects. */ /* struct gdbwire_mi_output */ struct gdbwire_mi_output *gdbwire_mi_output_alloc(void); void gdbwire_mi_output_free(struct gdbwire_mi_output *param); /* struct gdbwire_mi_result_record */ struct gdbwire_mi_result_record *gdbwire_mi_result_record_alloc(void); void gdbwire_mi_result_record_free(struct gdbwire_mi_result_record *param); /* struct gdbwire_mi_result */ struct gdbwire_mi_result *gdbwire_mi_result_alloc(void); void gdbwire_mi_result_free(struct gdbwire_mi_result *param); /* struct gdbwire_mi_oob_record */ struct gdbwire_mi_oob_record *gdbwire_mi_oob_record_alloc(void); void gdbwire_mi_oob_record_free(struct gdbwire_mi_oob_record *param); /* struct gdbwire_mi_async_record */ struct gdbwire_mi_async_record *gdbwire_mi_async_record_alloc(void); void gdbwire_mi_async_record_free(struct gdbwire_mi_async_record *param); /* struct gdbwire_mi_stream_record */ struct gdbwire_mi_stream_record *gdbwire_mi_stream_record_alloc(void); void gdbwire_mi_stream_record_free(struct gdbwire_mi_stream_record *param); #ifdef __cplusplus } #endif #endif /* GDBWIRE_MI_PT_ALLOC_H */ /***** End of gdbwire_mi_pt_alloc.h ******************************************/ /***** Begin file gdbwire_mi_parser.h ****************************************/ #ifndef GDBWIRE_MI_PARSER_H #define GDBWIRE_MI_PARSER_H #ifdef __cplusplus extern "C" { #endif /* #include "gdbwire_result.h" */ /***** Include gdbwire_mi_pt.h in the middle of gdbwire_mi_parser.h **********/ /***** Begin file gdbwire_mi_pt.h ********************************************/ #ifndef GDBWIRE_MI_PT_H #define GDBWIRE_MI_PT_H #ifdef __cplusplus extern "C" { #endif /** * The position of a token in a GDB/MI line. * * Note that a string in C is zero based and the token column * position is 1 based. For example, * char *str = "hello world"; * The "hello" token would have a start_column as 1 and an end * column as 5. * * The start_column and end_column will be the same column number for * a token of size 1. */ struct gdbwire_mi_position { /* The starting column position of the token */ int start_column; /* The ending column position of the token */ int end_column; }; /** The gdbwire_mi output kinds. */ enum gdbwire_mi_output_kind { /** * The GDB/MI output contains an out of band record. * * The out of band record is not necessarily associated with any * particular GDB/MI input command. */ GDBWIRE_MI_OUTPUT_OOB, /** * The GDB/MI output contains a gdbwire_mi result record. * * This record typically contains the result data from a request * made by the client in a previous GDB/MI input command. */ GDBWIRE_MI_OUTPUT_RESULT, /** * The GDB/MI output represents a prompt. (ie. (gdb) ) * * TODO: Document when GDB is ready to receive a command. Only if * the prompt is received and at *stopped? */ GDBWIRE_MI_OUTPUT_PROMPT, /** * A parse error occurred. */ GDBWIRE_MI_OUTPUT_PARSE_ERROR }; /** * The GDB/MI output command. * * A GDB/MI output command is the main mechanism in which GDB * corresponds with a front end. */ struct gdbwire_mi_output { enum gdbwire_mi_output_kind kind; union { /** When kind == GDBWIRE_MI_OUTPUT_OOB, never NULL. */ struct gdbwire_mi_oob_record *oob_record; /** When kind == GDBWIRE_MI_OUTPUT_RESULT, never NULL. */ struct gdbwire_mi_result_record *result_record; /** When kind == GDBWIRE_MI_OUTPUT_PARSE_ERROR, never NULL. */ struct { /** The token the error occurred on */ char *token; /** The position of the token where the error occurred. */ struct gdbwire_mi_position pos; } error; } variant; /** * The GDB/MI output line that was used to create this output instance. * * Each gdbwire_mi output structure is created from exactly one line of * MI output from GDB. This field represents the line that created * this particular output structure. * * This field is always available and never NULL, even for a parse error. */ char *line; /** The next GDB/MI output command or NULL if none */ struct gdbwire_mi_output *next; }; /** * A GDB/MI token. * * A string made up of one or more digits. * The regular expression [0-9]+ will match this types contents. */ typedef char *gdbwire_mi_token_t; /** * A GDB/MI output command may contain one of the following result indications. */ enum gdbwire_mi_result_class { /** * The synchronous operation was successful (^done). */ GDBWIRE_MI_DONE, /** * Equivalent to GDBWIRE_MI_DONE (^running). * * Historically, was output by GDB instead of ^done if the command * resumed the target. * * Do not rely on or use this result class in the front end to determine * the state of the target. Use the async *running output record to * determine which threads have resumed running. * * TODO: Ensure that early versions of GDB can depend on the async * *running or if front ends DO have to rely on ^running. */ GDBWIRE_MI_RUNNING, /** * GDB has connected to a remote target (^connected). * * This is in response to the -target-select command. * * A comment in the GDB source code says, * There's no particularly good reason why target-connect results * in not ^done. Should kill ^connected for MI3. * * With this in mind, it makes sense to assume that GDBWIRE_MI_CONNECTED * and GDBWIRE_MI_DONE are equivalent. */ GDBWIRE_MI_CONNECTED, /** * An error has occurred (^error). * * This can occur if the user provides an improper command to GDB. * In this case, the user will be provided the standard error output but * the front end will also be provided this information independently. */ GDBWIRE_MI_ERROR, /** * GDB has terminated (^exit). * * When GDB knows it is about to exit, it provides this notification * in the GDB/MI output command. However, on all other circumstances, * the front end should be prepared to have GDB exit and not provide * this information. */ GDBWIRE_MI_EXIT, /* An unsupported result class */ GDBWIRE_MI_UNSUPPORTED }; /** * The GDB/MI result record in an output command. * * The result record represents the result data in the GDB/MI output * command sent by GDB. This typically contains the content the client * was requesting when it sent a GDB/MI input command to GDB. */ struct gdbwire_mi_result_record { /** * The token associated with the corresponding GDB/MI input command. * * The client may provide a unique string of digits at the beginning of a * GDB/MI input command. For example, * 0000-foo * When GDB finally gets around to responding to the GDB/MI input command, * it takes the token provided in the input command and puts it into the * result record of the corresponding GDB/MI output command. For * example, the output commmand associated with the above input command is, * 0000^error,msg="Undefined MI command: foo",code="undefined-command" * and the result record would have the below token field set to "0000". * * This is intended to allow the front end to correlate the GDB/MI input * command it sent with the GDB/MI output command GDB responded with. * * This represents the token value the front end provided to the * corresponding GDB/MI input command or NULL if no token was provided. */ gdbwire_mi_token_t token; /** The result records result class. */ enum gdbwire_mi_result_class result_class; /** * An optional list of results for this result record. * * Will be NULL if there is no results for this result record. * * This is typically where the result data is that the client * is looking for. */ struct gdbwire_mi_result *result; }; /** The out of band record kinds. */ enum gdbwire_mi_oob_record_kind { /** * An asyncronous out of band record. * * An asyncronous record occurs when GDB would like to update the * client with information that it has not asked for. * * For instance, if the inferior has stopped, or a new thread has * started. */ GDBWIRE_MI_ASYNC, /** * A stream out of band record. * * This is the result of normal output from the console, target or GDB. */ GDBWIRE_MI_STREAM }; /* This is an out of band record. */ struct gdbwire_mi_oob_record { /** The kind of out of band record. */ enum gdbwire_mi_oob_record_kind kind; union { /** When kind == GDBWIRE_MI_ASYNC. */ struct gdbwire_mi_async_record *async_record; /** When kind == GDBWIRE_MI_STREAM. */ struct gdbwire_mi_stream_record *stream_record; } variant; }; /** The asynchronous out of band record kinds */ enum gdbwire_mi_async_record_kind { /** * The asynchronous status record kind. * * Contains on-going status information about the progress of a slow * operation. It can be discarded. * * This output is prepended by the + character. */ GDBWIRE_MI_STATUS, /** * The asynchronous exec record kind. * * Contains asynchronous state change regarding the target: * (stopped, started, disappeared). * * This output is prepended by the * character. */ GDBWIRE_MI_EXEC, /** * The asyncronous notify record kind. * * Contains supplementary information that the client should handle * (e.g., a new breakpoint information). * * This output is prepended by the = character. */ GDBWIRE_MI_NOTIFY }; /** The stream out of band record kinds */ enum gdbwire_mi_stream_record_kind { /** * The console output. * * Output that should be displayed as is in the console. * It is the textual response to a CLI command. * * This output is prepended by the ~ character. */ GDBWIRE_MI_CONSOLE, /** * The target output. * * Output produced by the target program. * * This output is prepended by the @ character. */ GDBWIRE_MI_TARGET, /** * The GDB log output. * * Output text coming from GDB's internals. For instance messages * that should be displayed as part of an error log. * * This output is prepended by the & character. */ GDBWIRE_MI_LOG }; /** * The GDB/MI asyncronous class. * * */ enum gdbwire_mi_async_class { /** * Loading the executable onto the remote target. * * This was undocumented in the GDB manual as far as GDB 7.7. * * This occurs if the async record is GDBWIRE_MI_STATUS as +download. */ GDBWIRE_MI_ASYNC_DOWNLOAD, /** * The target has stopped. * * This occurs if the async record is GDBWIRE_MI_EXEC as *stopped. */ GDBWIRE_MI_ASYNC_STOPPED, /** * The target is now running. * * This occurs if the async record is GDBWIRE_MI_EXEC as *running. */ GDBWIRE_MI_ASYNC_RUNNING, /** * Reports that a thread group was added. * * When a thread group is added, it generally might not be associated * with a running process. * * This occurs if the async record is GDBWIRE_MI_NOTIFY * as =thread-group-added. */ GDBWIRE_MI_ASYNC_THREAD_GROUP_ADDED, /** * Reports that a thread group was removed. * * When a thread group is removed, its id becomes invalid and cannot be * used in any way. * * This occurs if the async record is GDBWIRE_MI_NOTIFY * as =thread-group-removed. */ GDBWIRE_MI_ASYNC_THREAD_GROUP_REMOVED, /** * Reports that a thread group was started. * * A thread group became associated with a running program. * * This occurs if the async record is GDBWIRE_MI_NOTIFY * as =thread-group-started. */ GDBWIRE_MI_ASYNC_THREAD_GROUP_STARTED, /** * Reports that a thread group was exited. * * A thread group is no longer associated with a running program. * * This occurs if the async record is GDBWIRE_MI_NOTIFY * as =thread-group-exited. */ GDBWIRE_MI_ASYNC_THREAD_GROUP_EXITED, /** * Reports that a thread was created. * * This occurs if the async record is GDBWIRE_MI_NOTIFY * as =thread-created. */ GDBWIRE_MI_ASYNC_THREAD_CREATED, /** * Reports that a thread was exited. * * This occurs if the async record is GDBWIRE_MI_NOTIFY as =thread-exited. */ GDBWIRE_MI_ASYNC_THREAD_EXITED, /** * Reports that a thread was selected. * * This occurs if the async record is GDBWIRE_MI_NOTIFY as =thread-selected. */ GDBWIRE_MI_ASYNC_THREAD_SELECTED, /** * Reports that a new library was loaded. * * This occurs if the async record is GDBWIRE_MI_NOTIFY as =library-loaded. */ GDBWIRE_MI_ASYNC_LIBRARY_LOADED, /** * Reports that a new library was unloaded. * * This occurs if the async record is GDBWIRE_MI_NOTIFY * as =library-unloaded. */ GDBWIRE_MI_ASYNC_LIBRARY_UNLOADED, /** * Reports that a trace frame was changed. * * This occurs if the async record is GDBWIRE_MI_NOTIFY * as =traceframe-changed. */ GDBWIRE_MI_ASYNC_TRACEFRAME_CHANGED, /** * Reports that a trace state variable was created. * * This occurs if the async record is GDBWIRE_MI_NOTIFY as =tsv-created. */ GDBWIRE_MI_ASYNC_TSV_CREATED, /** * Reports that a trace state variable was modified. * * This occurs if the async record is GDBWIRE_MI_NOTIFY as =tsv-modified. */ GDBWIRE_MI_ASYNC_TSV_MODIFIED, /** * Reports that a trace state variable was deleted. * * This occurs if the async record is GDBWIRE_MI_NOTIFY as =tsv-deleted. */ GDBWIRE_MI_ASYNC_TSV_DELETED, /** * Reports that a breakpoint was created. * * Only user-visible breakpoints are reported to the MI user. * * If a breakpoint is emitted in the result record of a * command, then it will not also be emitted in an async record. * * This occurs if the async record is GDBWIRE_MI_NOTIFY * as =breakpoint-created. */ GDBWIRE_MI_ASYNC_BREAKPOINT_CREATED, /** * Reports that a breakpoint was modified. * * Only user-visible breakpoints are reported to the MI user. * * If a breakpoint is emitted in the result record of a * command, then it will not also be emitted in an async record. * * This occurs if the async record is GDBWIRE_MI_NOTIFY * as =breakpoint-modified. */ GDBWIRE_MI_ASYNC_BREAKPOINT_MODIFIED, /** * Reports that a breakpoint was deleted. * * Only user-visible breakpoints are reported to the MI user. * * If a breakpoint is emitted in the result record of a * command, then it will not also be emitted in an async record. * * This occurs if the async record is GDBWIRE_MI_NOTIFY * as =breakpoint-deleted. */ GDBWIRE_MI_ASYNC_BREAKPOINT_DELETED, /** * Reports that execution log recording was started on an inferior. * * This occurs if the async record is GDBWIRE_MI_NOTIF * as =record-started. */ GDBWIRE_MI_ASYNC_RECORD_STARTED, /** * Reports that execution log recording was stopped on an inferior. * * This occurs if the async record is GDBWIRE_MI_NOTIFY * as =record-stopped. */ GDBWIRE_MI_ASYNC_RECORD_STOPPED, /** * Reports that a parameter of the command set param is changed to value. * * For example, when the user runs a command like 'set print pretty on', * this async command will be invoked with the parameter reported as * 'print pretty' and the value as 'on'. * * This occurs if the async record is GDBWIRE_MI_NOTIFY * as =cmd-param-changed. */ GDBWIRE_MI_ASYNC_CMD_PARAM_CHANGED, /** * Reports that bytes from addr to data + len were written in an inferior. * * This occurs if the async record is GDBWIRE_MI_NOTIFY * as =memory-changed. */ GDBWIRE_MI_ASYNC_MEMORY_CHANGED, /* An unsupported async class */ GDBWIRE_MI_ASYNC_UNSUPPORTED }; /** * The GDB/MI asyncronous record in an output command. * * An asyncronous record occurs when GDB would like to update the * client with information that it has not asked for. */ struct gdbwire_mi_async_record { /** * The result record token. * * Please note that the GDB/MI manual says that asyncronous records * do not currently populate this token on output but reserve the right * to do so. For that reason, token here should always be NULL. * * From the GDB documentation: * Note that for all async output, while the token is allowed by the * grammar and may be output by future versions of gdb for select async * output messages, it is generally omitted. Frontends should treat all * async output as reporting general changes in the state of the target * and there should be no need to associate async output to any prior * command. * * After further investigation, I determined that newer GDB's will no * longer ever output this information. Older GDB's will. The commit * that made this change in GDB is 721c02de on April 24th, 2008. * The next GDB that was released was on October 6th, 2009, version 7.0. * * Before the above mentioned commit async *stopped commands would * sometimes output the token associated with the last token provided in * a GDB/MI input command. After that change, the token is never * associated with an async output command, even though the * documentation says it might be. * * Finally, even before that change when the token was output in the * async *stopped command, the developers of GDB felt that it was not * useful and should be avoided by front ends. * * With this information, I've determined that front ends should never * use this value to determine logic. However, the value is parsed in * order to accurately handle and represent the cases where this value * occurs. * * This represents the token value the front end provided to the * corresponding GDB/MI input command or NULL if no token was provided. */ gdbwire_mi_token_t token; /** The kind of asynchronous record. */ enum gdbwire_mi_async_record_kind kind; /** The asynchronous output class */ enum gdbwire_mi_async_class async_class; /** * An optional list of results for this async output. * * Will be NULL if there is no results. */ struct gdbwire_mi_result *result; }; /** The GDB/MI result kind */ enum gdbwire_mi_result_kind { /** The result is a cstring */ GDBWIRE_MI_CSTRING, /** The result is a tuple */ GDBWIRE_MI_TUPLE, /** The result is a list */ GDBWIRE_MI_LIST }; /** * A GDB/MI result list. * * This is one of the important GDB/MI data structures. GDB communicates many * of it's values to the front end through this key/value data structure. * * It is basically a list of key/value pairs, where the key is a * variable name and the value expands to a string, a tuple of results or * a list of results. * * This can be thought of as a custom json object. */ struct gdbwire_mi_result { /** The kind of result this represents. */ enum gdbwire_mi_result_kind kind; /** The key being described by the result. */ char *variable; union { /** When kind is GDBWIRE_MI_CSTRING */ char *cstring; /** * When kind is GDBWIRE_MI_TUPLE or GDBWIRE_MI_LIST. * * If kind is GDBWIRE_MI_TUPLE, each result in the tuple should have a * valid key according to the GDB/MI specification. That is, for * each result, result->variable should not be NULL. * Note: GDBWIRE currently relaxes the above rule. It allows tuple's * with out a key in each member. For instance, {key="value"} * is what the GDB/MI specification advocates for, but some * variations of GDB emit {"value"} and so GDBWIRE allows it. * * If kind is GDBWIRE_MI_LIST, the GDB/MI specification allows * results in this list to not have keys. That is, for each result, * result->variable may be NULL. * * Will be NULL if the tuple or list is empty. */ struct gdbwire_mi_result *result; } variant; /** The next result or NULL if none */ struct gdbwire_mi_result *next; }; /** * An out of band GDB/MI stream record. * * A stream record is intended to provide the front end with information * from the console, the target or from GDB itself. */ struct gdbwire_mi_stream_record { /** The kind of stream record. */ enum gdbwire_mi_stream_record_kind kind; /** The buffer provided in this stream record. */ char *cstring; }; void gdbwire_mi_output_free(struct gdbwire_mi_output *param); struct gdbwire_mi_output *append_gdbwire_mi_output( struct gdbwire_mi_output *list, struct gdbwire_mi_output *item); struct gdbwire_mi_result *append_gdbwire_mi_result( struct gdbwire_mi_result *list, struct gdbwire_mi_result *item); #ifdef __cplusplus } #endif #endif /***** End of gdbwire_mi_pt.h ************************************************/ /***** Continuing where we left off in gdbwire_mi_parser.h *******************/ /* The opaque GDB/MI parser context */ struct gdbwire_mi_parser; /** * The primary mechanism to alert users of GDB/MI notifications. * * The flow is like this: * - create a parser context (gdbwire_mi_parser_create) * - push onto the parser arbitrary amounts of data (gdbwire_mi_parser_push) * - receive callbacks from inside gdbwire_mi_parser_push when * it discovers callbacks the user will find interesting * - destroy the parser (gdbwire_mi_parser_destroy) */ struct gdbwire_mi_parser_callbacks { /** * An arbitrary pointer to associate with the callbacks. * * If the calling api is C++ it is useful to make this an instance * of an object you want to bind to the callback functions below. */ void *context; /** * A GDB/MI output command is available. * * @param context * The context pointer above. * * @param output * The gdbwire_mi output command. This output command is now owned by the * function being invoked and should be destroyed when necessary. */ void (*gdbwire_mi_output_callback)(void *context, struct gdbwire_mi_output *output); }; /** * Create a GDB/MI parser context. * * @param callbacks * The callback functions to invoke upon discovery of parse data. * * @return * A new GDB/MI parser instance or NULL on error. */ struct gdbwire_mi_parser *gdbwire_mi_parser_create( struct gdbwire_mi_parser_callbacks callbacks); /** * Destroy a gdbwire_mi_parser context. * * This function will do nothing if parser is NULL. * * @param parser * The instance the parser to destroy */ void gdbwire_mi_parser_destroy(struct gdbwire_mi_parser *parser); /** * Push a null terminated string onto the parser. * * During this function, if a gdbwire_mi output command is discovered by * the parser (or any other useful GDB/MI notification), it will invoke * the appropriate callbacks assigned during parser creation. * * @param parser * The gdbwire_mi parser context to operate on. * * @param data * The parse data to push onto the parser. * * @return * GDBWIRE_OK on success or appropriate error result on failure. */ enum gdbwire_result gdbwire_mi_parser_push(struct gdbwire_mi_parser *parser, const char *data); /** * Push some parse data onto the parser. * * See gdbwire_mi_parser_push for details on function behavior. * * @param parser * The gdbwire_mi parser context to operate on. * * @param data * The parse data to push onto the parser. * * @param size * The size of the data to push onto the parser. * * @return * GDBWIRE_OK on success or appropriate error result on failure. */ enum gdbwire_result gdbwire_mi_parser_push_data( struct gdbwire_mi_parser *parser, const char *data, size_t size); #ifdef __cplusplus } #endif #endif /***** End of gdbwire_mi_parser.h ********************************************/ /***** Begin file gdbwire_mi_command.h ***************************************/ #ifndef GDBWIRE_MI_COMMAND_H #define GDBWIRE_MI_COMMAND_H #ifdef __cplusplus extern "C" { #endif /* #include "gdbwire_result.h" */ /* #include "gdbwire_mi_pt.h" */ /** * An enumeration representing the supported GDB/MI commands. */ enum gdbwire_mi_command_kind { /* -break-info */ GDBWIRE_MI_BREAK_INFO, /* -stack-info-frame */ GDBWIRE_MI_STACK_INFO_FRAME, /* -file-list-exec-source-file */ GDBWIRE_MI_FILE_LIST_EXEC_SOURCE_FILE, /* -file-list-exec-source-files */ GDBWIRE_MI_FILE_LIST_EXEC_SOURCE_FILES }; /** * An enumeration representing if debug symbols are fully loaded for a source. */ enum gdbwire_mi_debug_fully_read_kind { /** It is unknown if the debug symbols are fully loaded */ GDBWIRE_MI_DEBUG_FULLY_READ_UNKNOWN, /** The debug symbols are fully loaded */ GDBWIRE_MI_DEBUG_FULLY_READ_TRUE, /** The debug symbols are not fully loaded */ GDBWIRE_MI_DEBUG_FULLY_READ_FALSE }; /** A linked list of source files. */ struct gdbwire_mi_source_file { /** A relative path to a file, never NULL */ char *file; /**An absolute path to a file, NULL if unavailable */ char *fullname; /** If the source file has it's debug fully read, or not, or unknown */ enum gdbwire_mi_debug_fully_read_kind debug_fully_read; /** The next file name or NULL if no more. */ struct gdbwire_mi_source_file *next; }; /** The disposition of a breakpoint. What to do after hitting it. */ enum gdbwire_mi_breakpoint_disp_kind { GDBWIRE_MI_BP_DISP_DELETE, /** Delete on next hit */ GDBWIRE_MI_BP_DISP_DELETE_NEXT_STOP, /** Delete on next stop, hit or not */ GDBWIRE_MI_BP_DISP_DISABLE, /** Disable on next hit */ GDBWIRE_MI_BP_DISP_KEEP, /** Leave the breakpoint in place */ GDBWIRE_MI_BP_DISP_UNKNOWN /** When GDB doesn't specify */ }; /** * A linked list of breakpoints. * * A breakpoint is a breakpoint, a tracepoint, a watchpoing or a * catchpoint. The GDB breakpoint model is quite sophisticated. * This structure can be extended when necessary. */ struct gdbwire_mi_breakpoint { /** * The breakpoint number. * * An integer, however, for a breakpoint that represents one location of * a multiple location breakpoint, this will be a dotted pair, like ‘1.2’. * * Never NULL. */ char *number; /** * Determines if this is a multiple location breakpoint. * * True for a multi-location breakpoint, false otherwise. * * It is possible that a breakpoint corresponds to several locations in * your program. For example, several functions may have the same name. * For the following source code, * int foo(int p) { return p; } * double foo(double p) { return p; } * int main() { int i = 1; double d = 2.3; return foo(i) + foo(d); } * If the user sets a breakpoint at foo by typing, * b foo * Then gdb will create 3 breakpoints. The multiple location breakpoint, * which is the parent of the two breakpoints created for each foo * function. Here is the output of gdb from the CLI perspective, * Num Type Disp Enb Address What * 1 breakpoint keep y * 1.1 y 0x4004dd in foo(int) at main.cpp:1 * 1.2 y 0x4004eb in foo(double) at main.cpp:2 * * However, if the user created a breakpoint for main by typing, * b main * Then gdb will only create a single breakpoint which would look like, * 1 breakpoint keep y 0x4004fa in main() at main.cpp:3 * * When this is true, the address field will be "" and * the field multi_breakpoints will represent the breakpoints that this * multiple location breakpoint has created. */ unsigned char multi:1; /** * True for breakpoints of a multi-location breakpoint, otherwise false. * * For the example above, 1.1 and 1.2 would have this field set true. * * When this is true, the field multi_breakpoint will represent * the multiple location breakpoint that has created this breakpoint. */ unsigned char from_multi:1; /** * The breakpoint type. * * Typically "breakpoint", "watchpoint" or "catchpoint", but can be * a variety of different values. In gdb, see breakpoint.c:bptype_string * to see all the different possibilities. * * This will be NULL for breakpoints of a multiple location breakpoint. * In this circumstance, check the multi_breakpoint field for the * multiple location breakpoint type field. */ char *type; /** * The type of the catchpoint or NULL if not a catch point. * * This field is only valid when the breakpoint is a catchpoint. * Unfortuntely, gdb says the "type" of the breakpoint in the type field * is "breakpoint" not "catchpoint". So if this field is non-NULL, it is * safe to assume that this breakpoint represents at catch point. */ char *catch_type; /** * The breakpoint disposition. * * For multiple location breakpoints, this will be * GDBWIRE_MI_BP_DISP_UNKNOWN. In this circumstance, check the * multi_breakpoint field for the multiple location breakpoint * disposition field. */ enum gdbwire_mi_breakpoint_disp_kind disposition; /** True if enabled or False if disabled. */ unsigned char enabled:1; /** * The address of the breakpoint. * * This may be * - a hexidecimal number, representing the address * - the string ‘’ for a pending breakpoint * - the string ‘’ for a breakpoint with multiple locations * * This field will be NULL if no address can be determined. * For example, a watchpoint does not have an address. */ char *address; /** * The name of the function or NULL if unknown. */ char *func_name; /** * A relative path to the file the breakpoint is in or NULL if unknown. */ char *file; /** * An absolute path to the file the breakpoint is in or NULL if unknown. */ char *fullname; /** * The line number the breakpoint is at or 0 if unkonwn. */ unsigned long line; /** * The number of times this breakpoint has been hit. * * For breakpoints of multi-location breakpoints, this will be 0. * Look at the multi-location breakpoint field instead. */ unsigned long times; /** * The location of the breakpoint as originally specified by the user. * * This may be NULL for instance, for breakpoints for multi-breakpoints. */ char *original_location; /** * True for a pending breakpoint, otherwise false. * * When this is true, the address field will be "". */ unsigned char pending:1; /** * The breakpoints for a multi-location breakpoint. * * If multi is true, this will be the breakpoints associated with the * multiple location breakpoint. Otherwise will be NULL. */ struct gdbwire_mi_breakpoint *multi_breakpoints; /** * A pointer to the multi location breakpoint that created this breakpoint. * * When the field from_multi is true, this will be a pointer to the * multi-location breakpoint that created this breakpoint. Otherwise NULL. * * For the example above in the multi field, breakpoints 1.1 and 1.2 * would have this field pointing to the breakpoint 1. */ struct gdbwire_mi_breakpoint *multi_breakpoint; /** The next breakpoint or NULL if no more. */ struct gdbwire_mi_breakpoint *next; }; struct gdbwire_mi_stack_frame { /** * The frame number. * * Where 0 is the topmost frame, i.e., the innermost function. * * Always present. */ unsigned level; /** * The address ($pc value) of the frame. * * May be NULL if GDB can not determine the frame address. */ char *address; /** * The function name for the frame. May be NULL if unknown. */ char *func; /** * The file name for the frame. May be NULL if unknown. */ char *file; /** * The fullname name for the frame. May be NULL if unknown. */ char *fullname; /** * Line number corresponding to the $pc. Maybe be 0 if unknown. */ int line; /** * The shared library where this function is defined. * * This is only given if the frame's function is not known. * May be NULL if unknown. */ char *from; }; /** * Represents a GDB/MI command. */ struct gdbwire_mi_command { /** * The kind of mi command this represents. */ enum gdbwire_mi_command_kind kind; union { /** When kind == GDBWIRE_MI_BREAK_INFO */ struct { /** The list of breakpoints, NULL if none exist. */ struct gdbwire_mi_breakpoint *breakpoints; } break_info; /** When kind == GDBWIRE_MI_STACK_INFO_FRAME */ struct { struct gdbwire_mi_stack_frame *frame; } stack_info_frame; /** When kind == GDBWIRE_MI_FILE_LIST_EXEC_SOURCE_FILE */ struct { /** * The line number the inferior is currently executing at. */ int line; /** * The filename the inferior is currently executing at. * * This is usually a relative path. */ char *file; /** * The filename the inferior is currently executing at. * * This is an absolute path. * * This command was addd in 2004, however, it was possible * at the time that only the "file" field would be put out and * the "fullname" field would be omitted. In 2012, in git commit, * f35a17b5, gdb was changed to always omit the "fullname" field. */ char *fullname; /** * Determines if the file includes preprocessor macro information. * * This command was added in 2004. However, the macro-info * field was added to the output in 2008 in git commit 17784837. * * Only check this field if macro_info_exists is true. */ char macro_info:1; /** True if macro-info field was in mi output, otherwise false */ char macro_info_exists:1; } file_list_exec_source_file; /** When kind == GDBWIRE_MI_FILE_LIST_EXEC_SOURCE_FILES */ struct { /** * A list of files that make up the inferior. * * When there are no files (if the gdb does not have an inferior * loaded) than files will be NULL. * * This command was addd in 2004, however, it was possible * at the time that only the "file" field would be put out and * the "fullname" field would be omitted. In 2012, in git commit, * f35a17b5, gdb was changed to always omit the "fullname" field. */ struct gdbwire_mi_source_file *files; } file_list_exec_source_files; } variant; }; /** * Get a gdbwire MI command from the result record. * * @param kind * The kind of command the result record is associated with. * * @param result_record * The result record to turn into a command. * * @param out_mi_command * Will return an allocated gdbwire mi command if GDBWIRE_OK is returned * from this function. You should free this memory with * gdbwire_mi_command_free when you are done with it. * * @return * The result of this function. */ enum gdbwire_result gdbwire_get_mi_command( enum gdbwire_mi_command_kind kind, struct gdbwire_mi_result_record *result_record, struct gdbwire_mi_command **out_mi_command); /** * Free the gdbwire mi command. * * @param mi_command * The mi command to free. */ void gdbwire_mi_command_free(struct gdbwire_mi_command *mi_command); #ifdef __cplusplus } #endif #endif /***** End of gdbwire_mi_command.h *******************************************/ /***** Begin file gdbwire_mi_grammar.h ***************************************/ /* A Bison parser, made by GNU Bison 3.0.4. */ /* Bison interface for Yacc-like parsers in C Copyright (C) 1984, 1989-1990, 2000-2015 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. */ #ifndef YY_GDBWIRE_MI_SRC_GDBWIRE_MI_GRAMMAR_H_INCLUDED # define YY_GDBWIRE_MI_SRC_GDBWIRE_MI_GRAMMAR_H_INCLUDED /* Debug traces. */ #ifndef YYDEBUG # define YYDEBUG 0 #endif #if YYDEBUG extern int gdbwire_mi_debug; #endif /* "%code requires" blocks. */ /* An opaque pointer. */ #ifndef YY_TYPEDEF_YY_SCANNER_T #define YY_TYPEDEF_YY_SCANNER_T typedef void *yyscan_t; #endif struct gdbwire_mi_output; /* Token type. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE 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 /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED union YYSTYPE { struct gdbwire_mi_output *u_output; struct gdbwire_mi_oob_record *u_oob_record; struct gdbwire_mi_result_record *u_result_record; int u_result_class; int u_async_record_kind; struct gdbwire_mi_result_list *u_result_list; struct gdbwire_mi_result *u_result; char *u_token; struct gdbwire_mi_async_record *u_async_record; struct gdbwire_mi_stream_record *u_stream_record; int u_async_class; char *u_variable; char *u_cstring; struct gdbwire_mi_result *u_tuple; struct gdbwire_mi_result *u_list; int u_stream_record_kind; }; typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1 #endif #ifndef YYPUSH_MORE_DEFINED # define YYPUSH_MORE_DEFINED enum { YYPUSH_MORE = 4 }; #endif typedef struct gdbwire_mi_pstate gdbwire_mi_pstate; int gdbwire_mi_push_parse (gdbwire_mi_pstate *ps, int pushed_char, YYSTYPE const *pushed_val, yyscan_t yyscanner, struct gdbwire_mi_output **gdbwire_mi_output); gdbwire_mi_pstate * gdbwire_mi_pstate_new (void); void gdbwire_mi_pstate_delete (gdbwire_mi_pstate *ps); #endif /* !YY_GDBWIRE_MI_SRC_GDBWIRE_MI_GRAMMAR_H_INCLUDED */ /***** End of gdbwire_mi_grammar.h *******************************************/ /***** Begin file gdbwire.h **************************************************/ /** * Copyright (C) 2013 Robert Rossi * * This file is part of GDBWIRE. * * GDBWIRE 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. * * GDBWIRE 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 GDBWIRE. If not, see . */ #ifndef GDBWIRE_H #define GDBWIRE_H #ifdef __cplusplus extern "C" { #endif #include /* #include "gdbwire_result.h" */ /* #include "gdbwire_mi_pt.h" */ /***** Include gdbwire_mi_command.h in the middle of gdbwire.h ***************/ /***** Begin file gdbwire_mi_command.h ***************************************/ #ifndef GDBWIRE_MI_COMMAND_H #define GDBWIRE_MI_COMMAND_H #ifdef __cplusplus extern "C" { #endif /* #include "gdbwire_result.h" */ /* #include "gdbwire_mi_pt.h" */ /** * An enumeration representing the supported GDB/MI commands. */ enum gdbwire_mi_command_kind { /* -break-info */ GDBWIRE_MI_BREAK_INFO, /* -stack-info-frame */ GDBWIRE_MI_STACK_INFO_FRAME, /* -file-list-exec-source-file */ GDBWIRE_MI_FILE_LIST_EXEC_SOURCE_FILE, /* -file-list-exec-source-files */ GDBWIRE_MI_FILE_LIST_EXEC_SOURCE_FILES }; /** * An enumeration representing if debug symbols are fully loaded for a source. */ enum gdbwire_mi_debug_fully_read_kind { /** It is unknown if the debug symbols are fully loaded */ GDBWIRE_MI_DEBUG_FULLY_READ_UNKNOWN, /** The debug symbols are fully loaded */ GDBWIRE_MI_DEBUG_FULLY_READ_TRUE, /** The debug symbols are not fully loaded */ GDBWIRE_MI_DEBUG_FULLY_READ_FALSE }; /** A linked list of source files. */ struct gdbwire_mi_source_file { /** A relative path to a file, never NULL */ char *file; /**An absolute path to a file, NULL if unavailable */ char *fullname; /** If the source file has it's debug fully read, or not, or unknown */ enum gdbwire_mi_debug_fully_read_kind debug_fully_read; /** The next file name or NULL if no more. */ struct gdbwire_mi_source_file *next; }; /** The disposition of a breakpoint. What to do after hitting it. */ enum gdbwire_mi_breakpoint_disp_kind { GDBWIRE_MI_BP_DISP_DELETE, /** Delete on next hit */ GDBWIRE_MI_BP_DISP_DELETE_NEXT_STOP, /** Delete on next stop, hit or not */ GDBWIRE_MI_BP_DISP_DISABLE, /** Disable on next hit */ GDBWIRE_MI_BP_DISP_KEEP, /** Leave the breakpoint in place */ GDBWIRE_MI_BP_DISP_UNKNOWN /** When GDB doesn't specify */ }; /** * A linked list of breakpoints. * * A breakpoint is a breakpoint, a tracepoint, a watchpoing or a * catchpoint. The GDB breakpoint model is quite sophisticated. * This structure can be extended when necessary. */ struct gdbwire_mi_breakpoint { /** * The breakpoint number. * * An integer, however, for a breakpoint that represents one location of * a multiple location breakpoint, this will be a dotted pair, like ‘1.2’. * * Never NULL. */ char *number; /** * Determines if this is a multiple location breakpoint. * * True for a multi-location breakpoint, false otherwise. * * It is possible that a breakpoint corresponds to several locations in * your program. For example, several functions may have the same name. * For the following source code, * int foo(int p) { return p; } * double foo(double p) { return p; } * int main() { int i = 1; double d = 2.3; return foo(i) + foo(d); } * If the user sets a breakpoint at foo by typing, * b foo * Then gdb will create 3 breakpoints. The multiple location breakpoint, * which is the parent of the two breakpoints created for each foo * function. Here is the output of gdb from the CLI perspective, * Num Type Disp Enb Address What * 1 breakpoint keep y * 1.1 y 0x4004dd in foo(int) at main.cpp:1 * 1.2 y 0x4004eb in foo(double) at main.cpp:2 * * However, if the user created a breakpoint for main by typing, * b main * Then gdb will only create a single breakpoint which would look like, * 1 breakpoint keep y 0x4004fa in main() at main.cpp:3 * * When this is true, the address field will be "" and * the field multi_breakpoints will represent the breakpoints that this * multiple location breakpoint has created. */ unsigned char multi:1; /** * True for breakpoints of a multi-location breakpoint, otherwise false. * * For the example above, 1.1 and 1.2 would have this field set true. * * When this is true, the field multi_breakpoint will represent * the multiple location breakpoint that has created this breakpoint. */ unsigned char from_multi:1; /** * The breakpoint type. * * Typically "breakpoint", "watchpoint" or "catchpoint", but can be * a variety of different values. In gdb, see breakpoint.c:bptype_string * to see all the different possibilities. * * This will be NULL for breakpoints of a multiple location breakpoint. * In this circumstance, check the multi_breakpoint field for the * multiple location breakpoint type field. */ char *type; /** * The type of the catchpoint or NULL if not a catch point. * * This field is only valid when the breakpoint is a catchpoint. * Unfortuntely, gdb says the "type" of the breakpoint in the type field * is "breakpoint" not "catchpoint". So if this field is non-NULL, it is * safe to assume that this breakpoint represents at catch point. */ char *catch_type; /** * The breakpoint disposition. * * For multiple location breakpoints, this will be * GDBWIRE_MI_BP_DISP_UNKNOWN. In this circumstance, check the * multi_breakpoint field for the multiple location breakpoint * disposition field. */ enum gdbwire_mi_breakpoint_disp_kind disposition; /** True if enabled or False if disabled. */ unsigned char enabled:1; /** * The address of the breakpoint. * * This may be * - a hexidecimal number, representing the address * - the string ‘’ for a pending breakpoint * - the string ‘’ for a breakpoint with multiple locations * * This field will be NULL if no address can be determined. * For example, a watchpoint does not have an address. */ char *address; /** * The name of the function or NULL if unknown. */ char *func_name; /** * A relative path to the file the breakpoint is in or NULL if unknown. */ char *file; /** * An absolute path to the file the breakpoint is in or NULL if unknown. */ char *fullname; /** * The line number the breakpoint is at or 0 if unkonwn. */ unsigned long line; /** * The number of times this breakpoint has been hit. * * For breakpoints of multi-location breakpoints, this will be 0. * Look at the multi-location breakpoint field instead. */ unsigned long times; /** * The location of the breakpoint as originally specified by the user. * * This may be NULL for instance, for breakpoints for multi-breakpoints. */ char *original_location; /** * True for a pending breakpoint, otherwise false. * * When this is true, the address field will be "". */ unsigned char pending:1; /** * The breakpoints for a multi-location breakpoint. * * If multi is true, this will be the breakpoints associated with the * multiple location breakpoint. Otherwise will be NULL. */ struct gdbwire_mi_breakpoint *multi_breakpoints; /** * A pointer to the multi location breakpoint that created this breakpoint. * * When the field from_multi is true, this will be a pointer to the * multi-location breakpoint that created this breakpoint. Otherwise NULL. * * For the example above in the multi field, breakpoints 1.1 and 1.2 * would have this field pointing to the breakpoint 1. */ struct gdbwire_mi_breakpoint *multi_breakpoint; /** The next breakpoint or NULL if no more. */ struct gdbwire_mi_breakpoint *next; }; struct gdbwire_mi_stack_frame { /** * The frame number. * * Where 0 is the topmost frame, i.e., the innermost function. * * Always present. */ unsigned level; /** * The address ($pc value) of the frame. * * May be NULL if GDB can not determine the frame address. */ char *address; /** * The function name for the frame. May be NULL if unknown. */ char *func; /** * The file name for the frame. May be NULL if unknown. */ char *file; /** * The fullname name for the frame. May be NULL if unknown. */ char *fullname; /** * Line number corresponding to the $pc. Maybe be 0 if unknown. */ int line; /** * The shared library where this function is defined. * * This is only given if the frame's function is not known. * May be NULL if unknown. */ char *from; }; /** * Represents a GDB/MI command. */ struct gdbwire_mi_command { /** * The kind of mi command this represents. */ enum gdbwire_mi_command_kind kind; union { /** When kind == GDBWIRE_MI_BREAK_INFO */ struct { /** The list of breakpoints, NULL if none exist. */ struct gdbwire_mi_breakpoint *breakpoints; } break_info; /** When kind == GDBWIRE_MI_STACK_INFO_FRAME */ struct { struct gdbwire_mi_stack_frame *frame; } stack_info_frame; /** When kind == GDBWIRE_MI_FILE_LIST_EXEC_SOURCE_FILE */ struct { /** * The line number the inferior is currently executing at. */ int line; /** * The filename the inferior is currently executing at. * * This is usually a relative path. */ char *file; /** * The filename the inferior is currently executing at. * * This is an absolute path. * * This command was addd in 2004, however, it was possible * at the time that only the "file" field would be put out and * the "fullname" field would be omitted. In 2012, in git commit, * f35a17b5, gdb was changed to always omit the "fullname" field. */ char *fullname; /** * Determines if the file includes preprocessor macro information. * * This command was added in 2004. However, the macro-info * field was added to the output in 2008 in git commit 17784837. * * Only check this field if macro_info_exists is true. */ char macro_info:1; /** True if macro-info field was in mi output, otherwise false */ char macro_info_exists:1; } file_list_exec_source_file; /** When kind == GDBWIRE_MI_FILE_LIST_EXEC_SOURCE_FILES */ struct { /** * A list of files that make up the inferior. * * When there are no files (if the gdb does not have an inferior * loaded) than files will be NULL. * * This command was addd in 2004, however, it was possible * at the time that only the "file" field would be put out and * the "fullname" field would be omitted. In 2012, in git commit, * f35a17b5, gdb was changed to always omit the "fullname" field. */ struct gdbwire_mi_source_file *files; } file_list_exec_source_files; } variant; }; /** * Get a gdbwire MI command from the result record. * * @param kind * The kind of command the result record is associated with. * * @param result_record * The result record to turn into a command. * * @param out_mi_command * Will return an allocated gdbwire mi command if GDBWIRE_OK is returned * from this function. You should free this memory with * gdbwire_mi_command_free when you are done with it. * * @return * The result of this function. */ enum gdbwire_result gdbwire_get_mi_command( enum gdbwire_mi_command_kind kind, struct gdbwire_mi_result_record *result_record, struct gdbwire_mi_command **out_mi_command); /** * Free the gdbwire mi command. * * @param mi_command * The mi command to free. */ void gdbwire_mi_command_free(struct gdbwire_mi_command *mi_command); #ifdef __cplusplus } #endif #endif /***** End of gdbwire_mi_command.h *******************************************/ /***** Continuing where we left off in gdbwire.h *****************************/ /* The opaque gdbwire context */ struct gdbwire; /** * The primary mechanism for gdbwire to send events to the caller. * * The flow is like this: * - create a gdbwire instance * - loop: * - call gdbwire functions to send commands to gdb * - receive callback events with results when they become available * - destroy the instance */ struct gdbwire_callbacks { /** * An arbitrary pointer to associate with the events. * * This pointer will be passed back to the caller in each event. */ void *context; /** * A console, target or log output event has occured. * * @param context * The context pointer above. * * @param stream_record * The stream record to display to the user. */ void (*gdbwire_stream_record_fn)(void *context, struct gdbwire_mi_stream_record *stream_record); /** * An asynchronous output event. * * @param context * The context pointer above. * * @param async_record * The asychronous record output by GDB. */ void (*gdbwire_async_record_fn)(void *context, struct gdbwire_mi_async_record *async_record); /** * A result output event. * * @param context * The context pointer above. * * @param result_record * The result record output by GDB. */ void (*gdbwire_result_record_fn)(void *context, struct gdbwire_mi_result_record *result_record); /** * A prompt output event. * * @param context * The context pointer above. * * @param prompt * The prompt output to display to the user. */ void (*gdbwire_prompt_fn)(void *context, const char *prompt); /** * A gdbwire parse error occurred. * * If you receive this callback, that means the gdbwire parser * failed to parse some gdb/mi coming out of gdb. * Please send the parameters received in this callback to the * gdbwire develpment team. * * @param context * The context pointer above. * * @param mi * The mi string that gdbwire could not parse. * * @param token * The token the error occurred on. * * @param position * The position of the token the error occurred on. */ void (*gdbwire_parse_error_fn)(void *context, const char *mi, const char *token, struct gdbwire_mi_position position); }; /** * Create a gdbwire context. * * Each gdbwire structure is capable of talking to a single gdb instance. * * @param callbacks * The callback functions for when events should be sent. Be sure to * initialize all of the callback functions. If a callback event is * initialized to NULL, it will not be called. * * @return * A new gdbwire instance or NULL on error. */ struct gdbwire *gdbwire_create(struct gdbwire_callbacks callbacks); /** * Destroy a gdbwire context. * * This function will do nothing if the instance is NULL. * * @param gdbwire * The instance of gdbwire to destroy */ void gdbwire_destroy(struct gdbwire *wire); /** * Push some GDB output characters to gdbwire for processing. * * Currently, the calling application is responsible for reading the * output of GDB and sending it to gdbwire. This may change in the future. * Call this function with output from GDB when it is available. * * During this function, callback events may be invoked to alert the * caller of useful gdbwire_mi events. * * @param wire * The gdbwire context to operate on. * * @param data * The data to push to gdbwire for interpretation. * * @param size * The size of the data to push to gdbwire. * * @return * GDBWIRE_OK on success or appropriate error result on failure. */ enum gdbwire_result gdbwire_push_data(struct gdbwire *wire, const char *data, size_t size); /** * Handle an interpreter-exec command. * * Typically, a front end would start gdb with the MI interface and create * a corresponding gdbwire instance. The front end would feed the gdbwire * instance all of the MI output. In this scenario, gdbwire triggers * callbacks when interesting events occur. * * Some GDB front ends use the annotate interface with gdb, and will * transition to using MI through the use of the interpreter-exec command. * In this scenario, the front end will send GDB a single interpreter-exec * command and will want to interpret the output of only that command. * For this use case, a gdbwire instance is not necessary for the front end, * nor any of the callbacks associated with that instance. * * This function provides a way for a front end to interpret the output * of a single interpreter-exec command with out the need for creating * a gdbwire instance or any gdbwire callbacks. * * @param interpreter_exec_output * The MI output from GDB for the interpreter exec command. * * @param kind * The interpreter-exec command kind. * * @param out_mi_command * Will return an allocated gdbwire mi command if GDBWIRE_OK is returned * from this function. You should free this memory with * gdbwire_mi_command_free when you are done with it. * * @return * The result of this function. */ enum gdbwire_result gdbwire_interpreter_exec( const char *interpreter_exec_output, enum gdbwire_mi_command_kind kind, struct gdbwire_mi_command **out_mi_command); #ifdef __cplusplus } #endif #endif /***** End of gdbwire.h ******************************************************/ cgdb-0.8.0/lib/util/0000775000175000017500000000000014171036466011154 500000000000000cgdb-0.8.0/lib/util/sys_win.cpp0000664000175000017500000001326313521326311013265 00000000000000#if HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #if HAVE_CURSES_H #include #elif HAVE_NCURSES_CURSES_H #include #endif #include "cgdb_clog.h" #include "sys_util.h" #include "sys_win.h" const int SWIN_A_NORMAL = A_NORMAL; const int SWIN_A_STANDOUT = A_STANDOUT; const int SWIN_A_UNDERLINE = A_UNDERLINE; const int SWIN_A_REVERSE = A_REVERSE; const int SWIN_A_BLINK = A_BLINK; const int SWIN_A_DIM = A_DIM; const int SWIN_A_BOLD = A_BOLD; const int SWIN_KEY_BACKSPACE = KEY_BACKSPACE; SWIN_CHTYPE SWIN_SYM_VLINE; SWIN_CHTYPE SWIN_SYM_HLINE; SWIN_CHTYPE SWIN_SYM_LTEE; static bool initscr_intialized = false; /** * Set the ESCDELAY environment variable. * * This environment variable is necessary for ncurses to not delay * user input when the ESCAPE key is pressed. CGDB does it's own handling * of escape. * * @return * True on success or False on failure */ static bool swin_set_escdelay(void) { static char escdelay[] = "ESCDELAY=0"; bool success = putenv(escdelay) == 0; if (!success) clog_error(CLOG_CGDB, "putenv(\"%s\") failed", escdelay); return success; } bool swin_start() { bool success = swin_set_escdelay(); if (success) { success = swin_initscr() != NULL; if (success) { if (swin_has_colors()) { swin_start_color(); swin_use_default_colors(); } swin_refresh(); } } return success; } /* Determines the terminal type and initializes all data structures. */ SWINDOW *swin_initscr() { SWINDOW *win = (SWINDOW *)initscr(); #ifdef HAVE_CYGWIN SWIN_SYM_VLINE = ':'; #else SWIN_SYM_VLINE = ACS_VLINE; #endif SWIN_SYM_HLINE = ACS_HLINE; SWIN_SYM_LTEE = ACS_LTEE; initscr_intialized = true; return win; } int swin_endwin() { int result = 0; if (initscr_intialized) result = endwin(); return result; } int swin_lines() { return LINES; } int swin_cols() { return COLS; } int swin_colors() { return COLORS; } int swin_color_pairs() { return COLOR_PAIRS; } int swin_has_colors() { return has_colors(); } int swin_start_color() { int result = start_color(); if (result == ERR) { clog_error(CLOG_CGDB, "start_color failed"); } return result; } int swin_use_default_colors() { int result = use_default_colors(); if (result == ERR) { clog_error(CLOG_CGDB, "use_default_colors failed"); } return result; } bool swin_supports_default_color_pairs_extension() { int result = init_pair(65, -1, COLOR_BLACK); return result != ERR; } int swin_resizeterm(int lines, int columns) { return resizeterm(lines, columns); } int swin_scrl(int n) { return scrl(n); } int swin_keypad(SWINDOW *win, int bf) { return keypad((WINDOW *)win, bf); } char *swin_tigetstr(const char *capname) { return tigetstr((char*)capname); } int swin_move(int y, int x) { return move(y, x); } int swin_wmove(SWINDOW *win, int y, int x) { return wmove((WINDOW *)win, y, x); } int swin_wattron(SWINDOW *win, int attrs) { return wattron((WINDOW *)win, attrs); } int swin_wattroff(SWINDOW *win, int attrs) { return wattroff((WINDOW *)win, attrs); } SWINDOW *swin_newwin(int nlines, int ncols, int begin_y, int begin_x) { return (SWINDOW *)newwin(nlines, ncols, begin_y, begin_x); } int swin_delwin(SWINDOW *win) { return delwin((WINDOW *)win); } int swin_curs_set(int visibility) { return curs_set(visibility); } int swin_getcurx(const SWINDOW *win) { return getcurx((WINDOW *)win); } int swin_getcury(const SWINDOW *win) { return getcury((WINDOW *)win); } int swin_getbegx(const SWINDOW *win) { return getbegx((WINDOW *)win); } int swin_getbegy(const SWINDOW *win) { return getbegy((WINDOW *)win); } int swin_getmaxx(const SWINDOW *win) { return getmaxx((WINDOW *)win); } int swin_getmaxy(const SWINDOW *win) { return getmaxy((WINDOW *)win); } int swin_werase(SWINDOW *win) { return werase((WINDOW *)win); } int swin_wvline(SWINDOW *win, SWIN_CHTYPE ch, int n) { return wvline((WINDOW *)win, ch, n); } int swin_waddch(SWINDOW *win, const SWIN_CHTYPE ch) { return waddch((WINDOW *)win, ch); } int swin_wprintw(SWINDOW *win, const char *fmt, ...) { int ret; va_list ap; va_start(ap, fmt); ret = vw_printw((WINDOW *)win, fmt, ap); va_end(ap); return ret; } int swin_waddnstr(SWINDOW *win, const char *str, int n) { return waddnstr((WINDOW *)win, str, n); } int swin_wclrtoeol(SWINDOW *win) { return wclrtoeol((WINDOW *)win); } int swin_mvwprintw(SWINDOW *win, int y, int x, const char *fmt, ...) { int ret; ret = wmove((WINDOW *)win, y, x); if (ret != ERR) { va_list ap; va_start(ap, fmt); ret = vw_printw((WINDOW *)win, fmt, ap); va_end(ap); } return ret; } int swin_refresh() { return refresh(); } int swin_wnoutrefresh(SWINDOW *win) { return wnoutrefresh((WINDOW *)win); } int swin_wrefresh(SWINDOW *win) { return wrefresh((WINDOW *)win); } int swin_doupdate() { return doupdate(); } int swin_init_pair(int pair, int f, int b) { int result = init_pair(pair, f, b); if (result == ERR) { clog_error(CLOG_CGDB, "init_pair failed pair=%d f=%d b=%d", pair, f, b); } return result; } int swin_pair_content(int pair, int *fin, int *bin) { int ret; short f, b; ret = pair_content(pair, &f, &b); if (ret == ERR) { clog_error(CLOG_CGDB, "pair_content failed pair=%d", pair); } *fin = f; *bin = b; return ret; } int swin_color_pair(int pair) { return COLOR_PAIR(pair); } int swin_raw(void) { return raw(); } cgdb-0.8.0/lib/util/pseudo.h0000664000175000017500000000421312363611465012543 00000000000000/* * 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.8.0/lib/util/terminal.cpp0000664000175000017500000000352414112303404013377 00000000000000#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.8.0/lib/util/fs_util.cpp0000664000175000017500000000665313642106634013254 00000000000000#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 "sys_util.h" #include "fs_util.h" int fs_util_is_valid(const char *dir) { char actual_dir[FSUTIL_PATH_MAX]; if (dir == NULL) { clog_error(CLOG_CGDB, "$HOME is not set"); return 0; } /* Get the directory to check */ strncpy(actual_dir, dir, strlen(dir) + 1); /* Check if directory dir is readable and writeable */ if (access(actual_dir, R_OK | W_OK) == -1) { if (errno == ENOENT) { clog_error(CLOG_CGDB, "directory '%s' is not set", dir); return 0; } clog_error(CLOG_CGDB, "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; if (dir == NULL) { clog_error(CLOG_CGDB, "dir is NULL"); return 0; } /* Get the directory to check */ strncpy(actual_dir, dir, strlen(dir) + 1); /* 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 { clog_error(CLOG_CGDB, "file %s 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) { clog_error(CLOG_CGDB, "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]; snprintf(dir, sizeof(dir), "%s/%s", base, dirname); return fs_util_create_dir(dir); } void fs_util_get_path(const char *base, const char *name, char *path) { snprintf(path, FSUTIL_PATH_MAX, "%s/%s", base, name); } int fs_util_file_exists_in_path(char * filePath) { struct stat buff; char * tok, *local_pathStr; char testPath[1024]; int result = -1; char *pathStr = getenv("PATH"); local_pathStr = (char *)malloc(strlen(pathStr) + 1); strcpy(local_pathStr, pathStr); if (stat(filePath, &buff) >= 0) { free(local_pathStr); return 0; } /* Check all directories in path*/ tok = strtok(local_pathStr, ":"); while (tok != NULL) { snprintf(testPath, sizeof(testPath), "%s/%s", tok, filePath); if (stat(testPath, &buff) >= 0) { result = 0; break; } tok = strtok(NULL, ":"); } free(local_pathStr); return result; } int fs_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; } cgdb-0.8.0/lib/util/stretchy.h0000664000175000017500000000264514135136636013121 00000000000000#ifndef __STRETCHY_H__ #define __STRETCHY_H__ #if HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ // ---- stretchy buffers (From Sean's stb.h) // https://github.com/nothings/stb/blob/master/stretchy_buffer.h #define sbfree( a ) ( ( a ) ? free( stb__sbraw( a ) ), NULL : NULL ) #define sbpush( a, v ) ( stb__sbmaybegrow( a, 1 ), ( a )[ stb__sbn( a )++ ] = ( v ) ) #define sbpop( a ) ( ( a )[ --stb__sbn( a ) ] ) #define sbcount( a ) ( ( a ) ? stb__sbn( a ) : 0 ) #define sbadd( a, n ) ( stb__sbmaybegrow( a, n ), stb__sbn( a ) += ( n ), &( a )[ stb__sbn( a ) - ( n ) ] ) #define sblast( a ) ( ( a )[ stb__sbn( a ) - 1 ] ) #define sbforeach( v, arr ) for ( ( v ) = ( arr ); ( v ) < ( arr ) + sbcount( arr ); ++( v ) ) #define sbsetcount( a, n ) ( stb__sbmaybegrow( a, n ), stb__sbn( a ) = n ) #define sbpopfront(a) (sbpush(a,*(a)), stb__shl(a), (a)[--stb__sbn(a)]) #define stb__sbraw( a ) ( ( int * )( a )-2 ) #define stb__sbm( a ) stb__sbraw( a )[ 0 ] #define stb__sbn( a ) stb__sbraw( a )[ 1 ] int stb__sbgrowf( void **arr, int increment, int itemsize ); void stb__shlf(void **arr, int itemsize); #define stb__sbneedgrow( a, n ) ( ( a ) == 0 || stb__sbn( a ) + n >= stb__sbm( a ) ) #define stb__sbmaybegrow( a, n ) ( stb__sbneedgrow( a, ( n ) ) ? stb__sbgrow( a, n ) : 0 ) #define stb__sbgrow( a, n ) stb__sbgrowf( ( void ** )&( a ), ( n ), sizeof( *( a ) ) ) #define stb__shl(a) stb__shlf((void **)&(a), sizeof(*(a))) #endif cgdb-0.8.0/lib/util/io.cpp0000664000175000017500000001217214130163771012205 00000000000000#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 "sys_util.h" #include "cgdb_clog.h" #include "io.h" static void process_error(void) { if (errno == EINTR) clog_error(CLOG_CGDB, "ERRNO = EINTR"); else if (errno == EAGAIN) clog_error(CLOG_CGDB, "ERRNO = EAGAIN"); else if (errno == EIO) clog_error(CLOG_CGDB, "ERRNO = EIO"); else if (errno == EISDIR) clog_error(CLOG_CGDB, "ERRNO = EISDIR"); else if (errno == EBADF) clog_error(CLOG_CGDB, "ERRNO = EBADF"); else if (errno == EINVAL) clog_error(CLOG_CGDB, "ERRNO = EINVAL"); else if (errno == EFAULT) clog_error(CLOG_CGDB, "ERRNO = EFAULT"); } 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) { clog_error(CLOG_CGDB, "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) { clog_error(CLOG_CGDB, "I/O error"); process_error(); return -1; } if (write(dest, &c, 1) != 1) { clog_error(CLOG_CGDB, "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) { clog_error(CLOG_CGDB, "error reading from fd"); return -1; } else { return 0; /* Happens on EOF for some reason */ } } else if (amountRead == 0) { /* EOF */ return 0; } 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) { clog_error(CLOG_CGDB, "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) { clog_error(CLOG_CGDB, "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; clog_error(CLOG_CGDB, "Errno(%d)\n", errno); } else if (ret == 0) { c = 0; ret = -1; clog_error(CLOG_CGDB, "Read returned nothing\n"); } /* Set to original state */ fcntl(fd, F_SETFL, flag); if (ret == -1) return -1; *key = c; return 1; } cgdb-0.8.0/lib/util/driver.cpp0000664000175000017500000000747213046227642013103 00000000000000#if HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #if HAVE_STDIO_H #include #endif /* HAVE_STDIO_H */ /* http://stackoverflow.com/questions/27159322/rgb-values-of-the-colors-in-the-ansi-extended-colors-index-17-255 The color range of a 256 color terminal consists of 4 parts, often 5, in which case you actually get 258 colors: - Color numbers 0 to 7 are the default terminal colors, the actual RGB value of which is not standardized and can often be configured. - Color numbers 8 to 15 are the "bright" colors. Most of the time these are a lighter shade of the the color with index - 8. They are also not standardized and can often be configured. Depending on terminal and shell, they are often used instead of or in conjunction with bold font faces. - Color numbers 16 to 231 are RGB colors. These 216 colors are defined by 6 values on each of the three RGB axes. That is instead of values 0 - 255, each color only ranges from 0 - 5. The color number is then calculated like this: number = 16 + 36 * r + 6 * g + b with r, g and b in the range 0 - 5. - The color numbers 232 to 255 are grayscale with 24 shades of gray from dark to light. - The default colors for foreground and background. In many terminals they can be configured independently from the 256 indexed colors, giving an additional two configurable colors . You get them when not setting any other color or disabling other colors (i.e. print '\e[m'). */ /* In 256-color mode, the color-codes are the following: 0x00-0x07: standard colors (as in ESC [ 30–37 m) 0x08-0x0F: high intensity colors (as in ESC [ 90–97 m) 0x10-0xE7: 6 × 6 × 6 = 216 colors: 16 + 36 × r + 6 × g + b (0 ? r, g, b ? 5) 0xE8-0xFF: grayscale from black to white in 24 steps Set the foreground color to index N: \033[38;5;${N}m Set the background color to index M: \033[48;5;${M}m */ int main( int argc, char **argv ) { int fg, bg, bold; // This line has a tab // Two tabs here printf( "\n\033[1;33m --- Terminal Color Chart ---\033[0m\n\n" ); printf( " 40m 41m 42m 43m 44m 45m 46m 47m\n" ); for ( fg = 29; fg <= 37; fg++ ) { for ( bold = 0; bold <= 1; bold++ ) { if ( fg == 29 ) printf( " %sm ", bold ? "1" : " " ); else printf( " %s%2dm ", bold ? "1;" : " ", fg ); printf( "\033[%d;%dm mLs \033[0m ", bold, fg ); for ( bg = 40; bg <= 47; bg++ ) { printf( "\033[%d;%d;%dm mLs \033[0m ", bold, bg, fg ); } printf( "\n" ); } } printf( "\n" ); int index, red, green, blue; printf( "Standard colors:\n" ); for ( index = 0; index < 16; index++ ) { printf( "\033[48;5;%dm %2d ", index, index ); if ( index == 7 ) printf( "\033[0m\n" ); } printf( "\033[0m\n" ); printf( "\n6x6x6 Color cube:\n" ); for ( int pass = 0; pass < 2; pass++ ) { for ( green = 0; green < 6; green++ ) { for ( red = pass * 3; red < pass * 3 + 3; red++ ) { for ( blue = 0; blue < 6; blue++ ) { index = 16 + ( red * 36 ) + ( green * 6 ) + blue; printf( "\033[48;5;%dm %2x ", index, index ); } printf( "\033[0m " ); } printf( "\n" ); } printf( "\n" ); } printf( "\nGrayscale:\n" ); for ( index = 232; index < 256; index++ ) { printf( "\033[48;5;%dm %2x ", index, index ); if ( index == 243 ) printf( "\033[0m\n" ); } printf( "\033[0m\n\n" ); return 0; } cgdb-0.8.0/lib/util/Makefile.in0000664000175000017500000004455714171036450013151 00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = cgdbutil_driver$(EXEEXT) subdir = lib/util ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/config/readline_check_version.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) 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 = libcgdbutil_a_AR = $(AR) $(ARFLAGS) libcgdbutil_a_LIBADD = am_libcgdbutil_a_OBJECTS = cgdb_clog.$(OBJEXT) fork_util.$(OBJEXT) \ fs_util.$(OBJEXT) io.$(OBJEXT) pseudo.$(OBJEXT) \ stretchy.$(OBJEXT) sys_util.$(OBJEXT) sys_win.$(OBJEXT) \ terminal.$(OBJEXT) libcgdbutil_a_OBJECTS = $(am_libcgdbutil_a_OBJECTS) PROGRAMS = $(noinst_PROGRAMS) am_cgdbutil_driver_OBJECTS = driver.$(OBJEXT) cgdbutil_driver_OBJECTS = $(am_cgdbutil_driver_OBJECTS) cgdbutil_driver_DEPENDENCIES = libcgdbutil.a cgdbutil_driver_LINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \ $(cgdbutil_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 CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) AM_V_CXX = $(am__v_CXX_@AM_V@) am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) am__v_CXX_0 = @echo " CXX " $@; am__v_CXX_1 = CXXLD = $(CXX) CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ -o $@ AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) am__v_CXXLD_0 = @echo " CXXLD " $@; am__v_CXXLD_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 = $(libcgdbutil_a_SOURCES) $(cgdbutil_driver_SOURCES) DIST_SOURCES = $(libcgdbutil_a_SOURCES) $(cgdbutil_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 am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/config/depcomp 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@ CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ 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@ HAS_MAKEINFO = @HAS_MAKEINFO@ 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@ ac_ct_CXX = @ac_ct_CXX@ 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@ runstatedir = @runstatedir@ 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 = libcgdbutil.a libcgdbutil_a_SOURCES = \ clog.h \ cgdb_clog.cpp \ cgdb_clog.h \ fork_util.cpp \ fork_util.h \ fs_util.cpp \ fs_util.h \ io.cpp \ io.h \ pseudo.cpp \ pseudo.h \ stretchy.h \ stretchy.cpp \ sys_util.cpp \ sys_util.h \ sys_win.cpp \ sys_win.h \ terminal.cpp \ terminal.h cgdbutil_driver_LDFLAGS = \ -L$(top_builddir)/lib/util cgdbutil_driver_LDADD = \ libcgdbutil.a cgdbutil_driver_SOURCES = driver.cpp all: all-am .SUFFIXES: .SUFFIXES: .cpp .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) --foreign lib/util/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign lib/util/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) libcgdbutil.a: $(libcgdbutil_a_OBJECTS) $(libcgdbutil_a_DEPENDENCIES) $(EXTRA_libcgdbutil_a_DEPENDENCIES) $(AM_V_at)-rm -f libcgdbutil.a $(AM_V_AR)$(libcgdbutil_a_AR) libcgdbutil.a $(libcgdbutil_a_OBJECTS) $(libcgdbutil_a_LIBADD) $(AM_V_at)$(RANLIB) libcgdbutil.a clean-noinstPROGRAMS: -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) cgdbutil_driver$(EXEEXT): $(cgdbutil_driver_OBJECTS) $(cgdbutil_driver_DEPENDENCIES) $(EXTRA_cgdbutil_driver_DEPENDENCIES) @rm -f cgdbutil_driver$(EXEEXT) $(AM_V_CXXLD)$(cgdbutil_driver_LINK) $(cgdbutil_driver_OBJECTS) $(cgdbutil_driver_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cgdb_clog.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/driver.Po@am__quote@ @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)/pseudo.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stretchy.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sys_util.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sys_win.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/terminal.Po@am__quote@ .cpp.o: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< .cpp.obj: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(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 .PRECIOUS: Makefile # 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.8.0/lib/util/fork_util.cpp0000664000175000017500000001363514171031321013567 00000000000000#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 "sys_util.h" #include "fork_util.h" #include "fs_util.h" #include "pseudo.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) { clog_error(CLOG_CGDB, "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) { clog_error(CLOG_CGDB, "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) { clog_error(CLOG_CGDB, "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) { clog_error(CLOG_CGDB, "pty_release failed"); error = -1; } if (fd != -1 && close(fd) == -1) { clog_error(CLOG_CGDB, "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 gdb_win_rows, int gdb_win_cols, int *in, int *out, const char *new_ui_tty) { pid_t pid; const char *const GDB = "gdb"; const char *const NW = "--nw"; const char *const EX = "-ex"; char **local_argv; int i, j = 0, extra = 5; int malloc_size = argc + extra; char slavename[64]; int masterfd; struct winsize size, *winsize; size.ws_row = gdb_win_rows; size.ws_col = gdb_win_cols; size.ws_xpixel = 0; size.ws_ypixel = 0; if (gdb_win_rows == 0 && gdb_win_cols == 0) { winsize = 0; } else { winsize = &size; } /* 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); local_argv[j++] = cgdb_strdup(EX); local_argv[j++] = cgdb_strdup(std::string("new-ui mi "). append(new_ui_tty).c_str()); /* 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; if (fs_util_file_exists_in_path(local_argv[0]) == -1) { clog_error(CLOG_CGDB, "Debugger \"%s\" not found", local_argv[0]); pty_free_memory(slavename, masterfd, argc, local_argv); return -1; } /* Log the gdb invocation line */ clog_info(CLOG_GDBIO, "Invoking program:"); for (i = 0; i < j; i++) { clog_info(CLOG_GDBIO, " argv[%d]=%s ", i, local_argv[i]); } /* Fork into two processes with a shared pty pipe */ pid = pty_fork(&masterfd, slavename, SLAVE_SIZE, NULL, winsize); if (pid == -1) { /* error, free memory and return */ pty_free_memory(slavename, masterfd, argc, local_argv); clog_error(CLOG_CGDB, "fork failed"); return -1; } else if (pid == 0) { /* child */ 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.8.0/lib/util/cgdb_clog.h0000664000175000017500000000157314130163771013151 00000000000000#ifndef __CGDB_CLOG_H__ #define __CGDB_CLOG_H__ #include #include const int CLOG_CGDB_ID = 1; #define CLOG_CGDB CLOG(CLOG_CGDB_ID) const int CLOG_GDBIO_ID = 2; #define CLOG_GDBIO CLOG(CLOG_GDBIO_ID) const int CLOG_GDBMIIO_ID = 3; #define CLOG_GDBMIIO CLOG(CLOG_GDBMIIO_ID) #include "config.h" #include "fs_util.h" #include "clog.h" #define CGDB_CLOG_FORMAT "%d %t %f:%n(%F) %l:%m\n\n" /** * Attempt to open the tgdb log file. * * @param id * The clog id * * @param fmt * The filename format * * @param config_dir * The directory to open the file in * * @return * 0 on success, -1 on failure */ int clog_open(int id, const char *fmt, const char *config_dir); /** * Determine if an error log message was sent to the logger. * * @return * True if an error log message was written to a log file, False otherwise. */ bool clog_did_error_occur(); #endif cgdb-0.8.0/lib/util/Makefile.am0000664000175000017500000000105214135136636013126 00000000000000noinst_LIBRARIES = libcgdbutil.a libcgdbutil_a_SOURCES = \ clog.h \ cgdb_clog.cpp \ cgdb_clog.h \ fork_util.cpp \ fork_util.h \ fs_util.cpp \ fs_util.h \ io.cpp \ io.h \ pseudo.cpp \ pseudo.h \ stretchy.h \ stretchy.cpp \ sys_util.cpp \ sys_util.h \ sys_win.cpp \ sys_win.h \ terminal.cpp \ terminal.h noinst_PROGRAMS = cgdbutil_driver cgdbutil_driver_LDFLAGS = \ -L$(top_builddir)/lib/util cgdbutil_driver_LDADD = \ libcgdbutil.a cgdbutil_driver_SOURCES = driver.cpp cgdb-0.8.0/lib/util/terminal.h0000664000175000017500000000437112755663236013074 00000000000000#ifndef __TERMINAL_H__ #define __TERMINAL_H__ #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); #endif cgdb-0.8.0/lib/util/io.h0000664000175000017500000000471313046227664011663 00000000000000#ifndef __IO_H__ #define __IO_H__ #include "config.h" /* 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 receives: * 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_display_char: Displays the char c in fd. * This is useful 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 character. * * 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 indefinitely. * * \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.8.0/lib/util/sys_util.h0000664000175000017500000000371113257311731013115 00000000000000#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 */ #ifdef HAVE_STDINT_H #include #endif #include #include "cgdb_clog.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); /** * Convert a string to an integer. * * @param str * The string to convert. * * @param num * The integer result on success. * On failure, the value passed in will remain unchanged. * * @return * 0 on success or -1 on error. */ int cgdb_string_to_int(const char *str, int *num); /** * Convert a string to an integer. * * @param str * The hex string to convert. * * @param num * The integer result on success. * On failure, the value passed in will remain unchanged. * * @return * 0 on success or -1 on error. */ int cgdb_hexstr_to_u64(const char *str, uint64_t *num); /** * Check to see if cgdb supports debugger attachment detection. * * @return * 1 if it does support detecting debugger attachment, otherwise 0. */ int cgdb_supports_debugger_attach_detection(); /* Check if debugger is attached to cgdb. * Return 0 for no, 1 for yes, -1 for error. */ int cgdb_is_debugger_attached(); /** * Get file size from file pointer. * * \param file * file pointer * * \return * file size on success, or -1 on error. */ long get_file_size(FILE *file); /* Unsigned integer version of log10 */ int log10_uint(unsigned int val); char *sys_aprintf(const char *fmt, ...) ATTRIBUTE_PRINTF(1, 2); #define MAX(a, b) (((a) > (b)) ? (a) : (b)) #define MIN(a, b) (((a) < (b)) ? (a) : (b)) std::string sys_quote_nonprintables(const char *str, int len); #endif cgdb-0.8.0/lib/util/sys_win.h0000664000175000017500000001625514134376364012754 00000000000000#ifndef __SYS_WIN_H__ #define __SYS_WIN_H__ typedef struct SWINDOW SWINDOW; typedef unsigned long SWIN_CHTYPE; /* From the ncurses doupdate() man page: * * The wnoutrefresh and doupdate routines allow multiple updates with more * efficiency than wrefresh alone. In addition to all the window structures, * curses keeps two data structures representing the terminal screen: a * physical screen, describing what is actually on the screen, and a virtual * screen, describing what the programmer wants to have on the screen. * * The routine wrefresh works by first calling wnoutrefresh, which copies the * named window to the virtual screen, and then calling doupdate, which * compares the virtual screen to the physical screen and does the actual * update. If the programmer wishes to output several windows at once, a * series of calls to wrefresh results in alternating calls to wnoutrefresh * and doupdate, causing several bursts of output to the screen. By first * calling wnoutrefresh for each window, it is then possible to call doupdate * once, resulting in only one burst of output, with fewer total characters * transmitted and less CPU time used. * * So we use the win_refresh option to tell the routine whether to use * wrefresh() or wnoutrefresh(). This eliminates quite a bit of flashing as * well. */ enum win_refresh { /* Tells CGDB to use wnoutrefresh */ WIN_NO_REFRESH, /* Tells CGDB to use wrefresh */ WIN_REFRESH }; #define COLOR_BLACK 0 #define COLOR_RED 1 #define COLOR_GREEN 2 #define COLOR_YELLOW 3 #define COLOR_BLUE 4 #define COLOR_MAGENTA 5 #define COLOR_CYAN 6 #define COLOR_WHITE 7 /* attributes */ extern const int SWIN_A_NORMAL; extern const int SWIN_A_STANDOUT; extern const int SWIN_A_UNDERLINE; extern const int SWIN_A_REVERSE; extern const int SWIN_A_BLINK; extern const int SWIN_A_DIM; extern const int SWIN_A_BOLD; extern const int SWIN_KEY_BACKSPACE; /* backspace key */ extern SWIN_CHTYPE SWIN_SYM_VLINE; /* vertical line */ extern SWIN_CHTYPE SWIN_SYM_HLINE; /* horizontal line */ extern SWIN_CHTYPE SWIN_SYM_LTEE; /* tee pointing right */ /** * Initialize the system window. * * @return * True if successful, otherwise False. On failure, logging will occur. */ bool swin_start(); /* Determines the terminal type and initializes all data structures. */ SWINDOW *swin_initscr(); /* The program must call endwin for each terminal being used before exiting. */ int swin_endwin(); int swin_lines(); /* height of screen */ int swin_cols(); /* width of screen */ int swin_colors(); /* number of colors supported */ int swin_color_pairs(); /* number of color pairs supported */ int swin_has_colors(); int swin_start_color(); int swin_use_default_colors(); /** * Determine if ncurses supports the default color pairs extensions. * * Newer versions of ncurses support COLOR_PAIRS (ie. 64) pairs, but also * support ladditional color pairs (ie. 16) for using the default background. * According to the init_pair documentation, * The value of the first argument must be between 1 and COLOR_PAIRS-1, * except that if default colors are used (see use_default_colors) the * upper limit is adjusted to allow for extra pairs which use a default * color in foreground and/or background. * * @return * True if init_pair supports the ncurses extension, False otherwise. */ bool swin_supports_default_color_pairs_extension(); /* Resizes the standard and current windows to the specified dimensions, and adjusts other bookkeeping data used by the ncurses library that record the window dimensions such as the LINES and COLS variables. */ int swin_resizeterm(int lines, int columns); SWINDOW *swin_newwin(int nlines, int ncols, int begin_y, int begin_x); int swin_delwin(SWINDOW *win); /* Scroll window up n lines */ int swin_scrl(int n); /* The keypad option enables the keypad of the user's terminal. If enabled the user can press a function key (such as an arrow key) and wgetch returns a single value representing the function key, as in KEY_LEFT. If disabled curses does not treat function keys specially and the program has to interpret the escape sequences itself. */ int swin_keypad(SWINDOW *win, int bf); /* Get terminfo value capname capability */ char *swin_tigetstr(const char *capname); /* Move cursor */ int swin_move(int y, int x); int swin_wmove(SWINDOW *win, int y, int x); /* Set cursor state */ int swin_curs_set(int visibility); /* Turns on/off named attributes */ int swin_wattron(SWINDOW *win, int attrs); int swin_wattroff(SWINDOW *win, int attrs); int swin_getcurx(const SWINDOW *win); int swin_getcury(const SWINDOW *win); int swin_getbegx(const SWINDOW *win); int swin_getbegy(const SWINDOW *win); int swin_getmaxx(const SWINDOW *win); int swin_getmaxy(const SWINDOW *win); /* Copy blanks to every position in the window */ int swin_werase(SWINDOW *win); /* Draw a vertical (top to bottom) line using ch starting at the current cursor position in the window. The current cursor position is not changed. The line is at most n characters long, or as many as fit into the window. */ int swin_wvline(SWINDOW *win, SWIN_CHTYPE ch, int n); /* Draw ch and advance cursor */ int swin_waddch(SWINDOW *win, const SWIN_CHTYPE ch); /* Erase the current line to the right of the cursor, inclusive, to the end of the current line. */ int swin_wclrtoeol(SWINDOW *win); int swin_waddnstr(SWINDOW *win, const char *str, int n); int swin_wprintw(SWINDOW *win, const char *fmt, ...) ATTRIBUTE_PRINTF(2, 3); int swin_mvwprintw(SWINDOW *win, int y, int x, const char *fmt, ...) ATTRIBUTE_PRINTF(4, 5); /* From the ncurses doupdate() man page: * * The routine wrefresh works by first calling wnoutrefresh, which copies the * named window to the virtual screen, and then calling doupdate, which * compares the virtual screen to the physical screen and does the actual * update. If the programmer wishes to output several windows at once, a * series of calls to wrefresh results in alternating calls to wnoutrefresh * and doupdate, causing several bursts of output to the screen. By first * calling wnoutrefresh for each window, it is then possible to call doupdate * once, resulting in only one burst of output, with fewer total characters * transmitted and less CPU time used. */ int swin_refresh(); int swin_wrefresh(SWINDOW *win); int swin_wnoutrefresh(SWINDOW *win); int swin_doupdate(); /* * Curses supports color attributes on terminals with that capability. To use * these routines start_color must be called, usually right after initscr. * Colors are always used in pairs (referred to as color-pairs). A color-pair * consists of a foreground color (for characters) and a background color * (for the blank field on which the characters are displayed). A programmer * initializes a color-pair with the routine init_pair. After it has been * initialized, COLOR_PAIR(n), a macro defined in , can be used as * a new video attribute. */ int swin_init_pair(int pair, int f, int b); int swin_pair_content(int pair, int *f, int *b); int swin_color_pair(int pair); /* COLOR_PAIR(n) */ /** * Put the keyboard into raw mode. * * This is currently only used by the kui_driver. * * @return * 0 on succes or -1 on error */ int swin_raw(void); #endif cgdb-0.8.0/lib/util/fork_util.h0000664000175000017500000000424714130163771013245 00000000000000#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. * new_ui_tty: The path to the new ui tty device * * Return: -1 on error, pid of child on success */ int invoke_debugger(const char *path, int argc, char *argv[], int gdb_win_rows, int gdb_win_cols, int *in, int *out, const char *new_ui_tty); #endif cgdb-0.8.0/lib/util/fs_util.h0000664000175000017500000000505613642100057012706 00000000000000#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 minimum. Unfortunately, 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 4096 /* 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); /* fs_util_file_exists_in path: * ---------------------------- * * Checks if the file exists in any known location (absolute path * and paths stored in $PATH. */ int fs_util_file_exists_in_path(char * filePath); /* fs_verify_file_exists path: * ---------------------------- * * Checks if the file exists. * * @param path * The path to determine if it exists or not. * * @return * 1 if the file exists, otherwise 0. */ int fs_verify_file_exists(const char *path); #endif cgdb-0.8.0/lib/util/clog.h0000664000175000017500000004154414171031321012162 00000000000000/* clog: Extremely simple logger for C. * * Features: * - Implemented purely as a single header file. * - Create multiple loggers. * - Four log levels (debug, info, warn, error). * - Custom formats. * - Fast. * * Dependencies: * - Should conform to C89, C++98 (but requires vsnprintf, unfortunately). * - POSIX environment. * * USAGE: * * Include this header in any file that wishes to write to logger(s). In * exactly one file (per executable), define CLOG_MAIN first (e.g. in your * main .c file). * * #define CLOG_MAIN * #include "clog.h" * * This will define the actual objects that all the other units will use. * * Loggers are identified by integers (0 - 15). It's expected that you'll * create meaningful constants and then refer to the loggers as such. * * Example: * * const int MY_LOGGER = 0; * * int main() { * int r; * r = clog_init_path(MY_LOGGER, "my_log.txt"); * if (r != 0) { * fprintf(stderr, "Logger initialization failed.\n"); * return 1; * } * clog_info(CLOG(MY_LOGGER), "Hello, world!"); * clog_free(MY_LOGGER); * return 0; * } * * The CLOG macro used in the call to clog_info is a helper that passes the * __FILE__ and __LINE__ parameters for you, so you don't have to type them * every time. (It could be prettier with variadic macros, but that requires * C99 or C++11 to be standards compliant.) * * Errors encountered by clog will be printed to stderr. You can suppress * these by defining a macro called CLOG_SILENT before including clog.h. * * License: Do whatever you want. It would be nice if you contribute * improvements as pull requests here: * * https://github.com/mmueller/clog * * Copyright 2013 Mike Mueller . * * As is; no warranty is provided; use at your own risk. */ #ifndef __CLOG_H__ #define __CLOG_H__ #include #include #include #include #include #include #include #include #include #include /* Number of loggers that can be defined. */ #define CLOG_MAX_LOGGERS 16 /* Format strings cannot be longer than this. */ #define CLOG_FORMAT_LENGTH 256 /* Formatted times and dates should be less than this length. If they are not, * they will not appear in the log. */ #define CLOG_DATETIME_LENGTH 256 /* Default format strings. */ #define CLOG_DEFAULT_FORMAT "%d %t %f(%n): %l: %m\n" #define CLOG_DEFAULT_DATE_FORMAT "%Y-%m-%d" #define CLOG_DEFAULT_TIME_FORMAT "%H:%M:%S" /* GCC defines __va_copy, but does not define va_copy unless in c99 mode or -ansi is not specified, since it was not part of C90. */ #if !defined(va_copy) && defined(__va_copy) #define va_copy(d,s) __va_copy(d,s) #endif #ifdef __cplusplus extern "C" { #endif enum clog_level { CLOG_DEBUG, CLOG_INFO, CLOG_WARN, CLOG_ERROR }; struct clog; /** * Create a new logger writing to the given file path. The file will always * be opened in append mode. * * @param id * A constant integer between 0 and 15 that uniquely identifies this logger. * * @param path * Path to the file where log messages will be written. * * @return * Zero on success, non-zero on failure. */ int clog_init_path(int id, const char *const path); /** * Create a new logger writing to a file descriptor. * * @param id * A constant integer between 0 and 15 that uniquely identifies this logger. * * @param fd * The file descriptor where log messages will be written. * * @return * Zero on success, non-zero on failure. */ int clog_init_fd(int id, int fd); /** * Destroy (clean up) a logger. You should do this at the end of execution, * or when you are done using the logger. * * @param id * The id of the logger to destroy. */ void clog_free(int id); #define CLOG(id) __FILE__, __LINE__, id /** * Log functions (one per level). Call these to write messages to the log * file. The first three arguments can be replaced with a call to the CLOG * macro defined above, e.g.: * * clog_debug(CLOG(MY_LOGGER_ID), "This is a log message."); * * @param sfile * The name of the source file making this log call (e.g. __FILE__). * * @param sline * The line number of the call in the source code (e.g. __LINE__). * * @param id * The id of the logger to write to. * * @param fmt * The format string for the message (printf formatting). * * @param ... * Any additional format arguments. */ void clog_debug(const char *sfile, int sline, int id, const char *fmt, ...) ATTRIBUTE_PRINTF(4, 5); void clog_info(const char *sfile, int sline, int id, const char *fmt, ...) ATTRIBUTE_PRINTF(4, 5); void clog_warn(const char *sfile, int sline, int id, const char *fmt, ...) ATTRIBUTE_PRINTF(4, 5); void clog_error(const char *sfile, int sline, int id, const char *fmt, ...) ATTRIBUTE_PRINTF(4, 5); /** * Set the minimum level of messages that should be written to the log. * Messages below this level will not be written. By default, loggers are * created with level == CLOG_DEBUG. * * @param id * The identifier of the logger. * * @param level * The new minimum log level. * * @return * Zero on success, non-zero on failure. */ int clog_set_level(int id, enum clog_level level); /** * Set the format string used for times. See strftime(3) for how this string * should be defined. The default format string is CLOG_DEFAULT_TIME_FORMAT. * * @param fmt * The new format string, which must be less than CLOG_FORMAT_LENGTH bytes. * * @return * Zero on success, non-zero on failure. */ int clog_set_time_fmt(int id, const char *fmt); /** * Set the format string used for dates. See strftime(3) for how this string * should be defined. The default format string is CLOG_DEFAULT_DATE_FORMAT. * * @param fmt * The new format string, which must be less than CLOG_FORMAT_LENGTH bytes. * * @return * Zero on success, non-zero on failure. */ int clog_set_date_fmt(int id, const char *fmt); /** * Set the format string for log messages. Here are the substitutions you may * use: * * %f: Source file name generating the log call. * %n: Source line number where the log call was made. * %m: The message text sent to the logger (after printf formatting). * %d: The current date, formatted using the logger's date format. * %t: The current time, formatted using the logger's time format. * %l: The log level (one of "DEBUG", "INFO", "WARN", or "ERROR"). * %%: A literal percent sign. * * The default format string is CLOG_DEFAULT_FORMAT. * * @param fmt * The new format string, which must be less than CLOG_FORMAT_LENGTH bytes. * You probably will want to end this with a newline (\n). * * @return * Zero on success, non-zero on failure. */ int clog_set_fmt(int id, const char *fmt); /* * No need to read below this point. */ /* * Portability stuff. */ /* This is not portable, but should work on old Visual C++ compilers. Visual * Studio 2013 defines va_copy, but older versions do not. */ #ifdef _MSC_VER #if _MSC_VER < 1800 #define va_copy(a,b) ((a) = (b)) #endif #endif /** * The C logger structure. */ struct clog { /* The current level of this logger. Messages below it will be dropped. */ enum clog_level level; /* The file being written. */ int fd; /* The format specifier. */ char fmt[CLOG_FORMAT_LENGTH]; /* Date format */ char date_fmt[CLOG_FORMAT_LENGTH]; /* Time format */ char time_fmt[CLOG_FORMAT_LENGTH]; /* Tracks whether the fd needs to be closed eventually. */ int opened; }; void _clog_err(const char *fmt, ...) ATTRIBUTE_PRINTF(1, 2); #ifdef CLOG_MAIN struct clog *_clog_loggers[CLOG_MAX_LOGGERS] = { 0 }; #else extern struct clog *_clog_loggers[CLOG_MAX_LOGGERS]; #endif #ifdef CLOG_MAIN const char *const CLOG_LEVEL_NAMES[] = { "DEBUG", "INFO", "WARN", "ERROR", }; int clog_init_path(int id, const char *const path) { int fd = open(path, O_CREAT | O_WRONLY | O_TRUNC, 0666); if (fd == -1) { _clog_err("Unable to open %s: %s\n", path, strerror(errno)); return 1; } if (clog_init_fd(id, fd)) { close(fd); return 1; } _clog_loggers[id]->opened = 1; return 0; } int clog_init_fd(int id, int fd) { struct clog *logger; if (_clog_loggers[id] != NULL) { _clog_err("Logger %d already initialized.\n", id); return 1; } logger = (struct clog *) malloc(sizeof(struct clog)); if (logger == NULL) { _clog_err("Failed to allocate logger: %s\n", strerror(errno)); return 1; } logger->level = CLOG_DEBUG; logger->fd = fd; logger->opened = 0; strcpy(logger->fmt, CLOG_DEFAULT_FORMAT); strcpy(logger->date_fmt, CLOG_DEFAULT_DATE_FORMAT); strcpy(logger->time_fmt, CLOG_DEFAULT_TIME_FORMAT); _clog_loggers[id] = logger; return 0; } void clog_free(int id) { if (_clog_loggers[id]) { if (_clog_loggers[id]->opened) { close(_clog_loggers[id]->fd); } free(_clog_loggers[id]); _clog_loggers[ id ] = 0; } } int clog_set_level(int id, enum clog_level level) { if (_clog_loggers[id] == NULL) { return 1; } if ((unsigned) level > CLOG_ERROR) { return 1; } _clog_loggers[id]->level = level; return 0; } int clog_set_time_fmt(int id, const char *fmt) { struct clog *logger = _clog_loggers[id]; if (logger == NULL) { _clog_err("clog_set_time_fmt: No such logger: %d\n", id); return 1; } if (strlen(fmt) >= CLOG_FORMAT_LENGTH) { _clog_err("clog_set_time_fmt: Format specifier too long.\n"); return 1; } strcpy(logger->time_fmt, fmt); return 0; } int clog_set_date_fmt(int id, const char *fmt) { struct clog *logger = _clog_loggers[id]; if (logger == NULL) { _clog_err("clog_set_date_fmt: No such logger: %d\n", id); return 1; } if (strlen(fmt) >= CLOG_FORMAT_LENGTH) { _clog_err("clog_set_date_fmt: Format specifier too long.\n"); return 1; } strcpy(logger->date_fmt, fmt); return 0; } int clog_set_fmt(int id, const char *fmt) { struct clog *logger = _clog_loggers[id]; if (logger == NULL) { _clog_err("clog_set_fmt: No such logger: %d\n", id); return 1; } if (strlen(fmt) >= CLOG_FORMAT_LENGTH) { _clog_err("clog_set_fmt: Format specifier too long.\n"); return 1; } strcpy(logger->fmt, fmt); return 0; } /* Internal functions */ size_t _clog_append_str(char **dst, char *orig_buf, const char *src, size_t cur_size) { size_t new_size = cur_size; while (strlen(*dst) + strlen(src) >= new_size) { new_size *= 2; } if (new_size != cur_size) { if (*dst == orig_buf) { *dst = (char *) malloc(new_size); strcpy(*dst, orig_buf); } else { *dst = (char *) realloc(*dst, new_size); } } strcat(*dst, src); return new_size; } size_t _clog_append_int(char **dst, char *orig_buf, long int d, size_t cur_size) { char buf[40]; /* Enough for 128-bit decimal */ if (snprintf(buf, 40, "%ld", d) >= 40) { return cur_size; } return _clog_append_str(dst, orig_buf, buf, cur_size); } size_t _clog_append_time(char **dst, char *orig_buf, struct tm *lt, const char *fmt, size_t cur_size) { char buf[CLOG_DATETIME_LENGTH]; size_t result = strftime(buf, CLOG_DATETIME_LENGTH, fmt, lt); if (result > 0) { return _clog_append_str(dst, orig_buf, buf, cur_size); } return cur_size; } const char * _clog_basename(const char *path) { const char *slash = strrchr(path, '/'); if (slash) { path = slash + 1; } #ifdef _WIN32 slash = strrchr(path, '\\'); if (slash) { path = slash + 1; } #endif return path; } char * _clog_format(const struct clog *logger, char buf[], size_t buf_size, const char *sfile, int sline, const char *level, const char *message) { size_t cur_size = buf_size; char *result = buf; enum { NORMAL, SUBST } state = NORMAL; size_t fmtlen = strlen(logger->fmt); size_t i; time_t t = time(NULL); struct tm *lt = localtime(&t); sfile = _clog_basename(sfile); result[0] = 0; for (i = 0; i < fmtlen; ++i) { if (state == NORMAL) { if (logger->fmt[i] == '%') { state = SUBST; } else { char str[2] = { 0 }; str[0] = logger->fmt[i]; cur_size = _clog_append_str(&result, buf, str, cur_size); } } else { switch (logger->fmt[i]) { case '%': cur_size = _clog_append_str(&result, buf, "%", cur_size); break; case 't': cur_size = _clog_append_time(&result, buf, lt, logger->time_fmt, cur_size); break; case 'd': cur_size = _clog_append_time(&result, buf, lt, logger->date_fmt, cur_size); break; case 'l': cur_size = _clog_append_str(&result, buf, level, cur_size); break; case 'n': cur_size = _clog_append_int(&result, buf, sline, cur_size); break; case 'f': cur_size = _clog_append_str(&result, buf, sfile, cur_size); break; case 'm': cur_size = _clog_append_str(&result, buf, message, cur_size); break; } state = NORMAL; } } return result; } void _clog_log(const char *sfile, int sline, enum clog_level level, int id, const char *fmt, va_list ap) ATTRIBUTE_PRINTF(5, 0); void _clog_log(const char *sfile, int sline, enum clog_level level, int id, const char *fmt, va_list ap) { /* For speed: Use a stack buffer until message exceeds 4096, then switch * to dynamically allocated. This should greatly reduce the number of * memory allocations (and subsequent fragmentation). */ char buf[4096]; size_t buf_size = 4096; char *dynbuf = buf; char *message; va_list ap_copy; int result; struct clog *logger = _clog_loggers[id]; if (!logger) { _clog_err("No such logger: %d\n", id); return; } if (level < logger->level) { return; } /* Format the message text with the argument list. */ va_copy(ap_copy, ap); result = vsnprintf(dynbuf, buf_size, fmt, ap); if ((size_t) result >= buf_size) { buf_size = result + 1; dynbuf = (char *) malloc(buf_size); result = vsnprintf(dynbuf, buf_size, fmt, ap_copy); if ((size_t) result >= buf_size) { /* Formatting failed -- too large */ _clog_err("Formatting failed (1).\n"); va_end(ap_copy); free(dynbuf); return; } } va_end(ap_copy); /* Format according to log format and write to log */ { char message_buf[4096]; message = _clog_format(logger, message_buf, 4096, sfile, sline, CLOG_LEVEL_NAMES[level], dynbuf); if (!message) { _clog_err("Formatting failed (2).\n"); if (dynbuf != buf) { free(dynbuf); } return; } result = write(logger->fd, message, strlen(message)); if (result == -1) { _clog_err("Unable to write to log file: %s\n", strerror(errno)); } if (message != message_buf) { free(message); } if (dynbuf != buf) { free(dynbuf); } } } void clog_debug(const char *sfile, int sline, int id, const char *fmt, ...) { va_list ap; va_start(ap, fmt); _clog_log(sfile, sline, CLOG_DEBUG, id, fmt, ap); va_end(ap); } void clog_info(const char *sfile, int sline, int id, const char *fmt, ...) { va_list ap; va_start(ap, fmt); _clog_log(sfile, sline, CLOG_INFO, id, fmt, ap); va_end(ap); } void clog_warn(const char *sfile, int sline, int id, const char *fmt, ...) { va_list ap; va_start(ap, fmt); _clog_log(sfile, sline, CLOG_WARN, id, fmt, ap); va_end(ap); } int cgdb_had_error = 0; void clog_error(const char *sfile, int sline, int id, const char *fmt, ...) { va_list ap; va_start(ap, fmt); _clog_log(sfile, sline, CLOG_ERROR, id, fmt, ap); va_end(ap); // The next 2 lines are CGDB mods extern bool clog_cgdb_error_occurred; clog_cgdb_error_occurred = true; } void _clog_err(const char *fmt, ...) { #ifdef CLOG_SILENT (void) fmt; #else va_list ap; va_start(ap, fmt); vfprintf(stderr, fmt, ap); va_end(ap); #endif } #endif /* CLOG_MAIN */ #ifdef __cplusplus } /* extern "C" */ #endif #endif /* __CLOG_H__ */ cgdb-0.8.0/lib/util/sys_util.cpp0000664000175000017500000001124113257311731013445 00000000000000#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_STRING_H #include #endif /* HAVE_STRING_H */ #if HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #if HAVE_CTYPE_H #include #endif #if HAVE_ERRNO_H #include #endif /* HAVE_ERRNO_H */ #define CLOG_MAIN #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; } int cgdb_string_to_int(const char *str, int *num) { int result = -1; if (str && num) { long int strtol_result; char *end_ptr; errno = 0; strtol_result = strtol(str, &end_ptr, 10); if (errno == 0 && str != end_ptr && *end_ptr == '\0') { int convert_to_int_result = (int)strtol_result; if (convert_to_int_result == strtol_result) { *num = convert_to_int_result; result = 0; } } } return result; } int cgdb_hexstr_to_u64(const char *str, uint64_t *num) { int result = -1; if (str && num) { uint64_t strtoull_result; char *end_ptr; errno = 0; strtoull_result = strtoull(str, &end_ptr, 16); if (errno == 0 && str != end_ptr && (*end_ptr == '\0' || *end_ptr == ' ')) { *num = strtoull_result; result = 0; } } return result; } int cgdb_supports_debugger_attach_detection() { #ifdef HAVE_PROC_SELF_STATUS_FILE return 1; #else return 0; #endif } int cgdb_is_debugger_attached() { int result; if (cgdb_supports_debugger_attach_detection()) { int debugger_attached = 0; static const char TracerPid[] = "TracerPid:"; FILE *fp = fopen("/proc/self/status", "r"); if ( fp ) { ssize_t chars_read; size_t line_len = 0; char *line = NULL; while ((chars_read = getline(&line, &line_len, fp)) != -1) { char *tracer_pid = strstr(line, TracerPid); if (tracer_pid) { debugger_attached = !!atoi(tracer_pid + sizeof(TracerPid) - 1); break; } } free(line); fclose(fp); } result = debugger_attached; } else { /* TODO: Implement for other platforms. */ result = -1; } return result; } long get_file_size(FILE *file) { if (fseek(file, 0, SEEK_END) != -1) { long size; size = ftell(file); fseek(file, 0, SEEK_SET); return size; } return -1; } int log10_uint(unsigned int val) { if (val >= 1000000000u) return 9; if (val >= 100000000u) return 8; if (val >= 10000000u) return 7; if (val >= 1000000u) return 6; if (val >= 100000u) return 5; if (val >= 10000u) return 4; if (val >= 1000u) return 3; if (val >= 100u) return 2; if (val >= 10u) return 1; return 0; } char *sys_aprintf(const char *fmt, ...) { int n; va_list ap; va_start(ap, fmt); n = vsnprintf(NULL, 0, fmt, ap) + 1; va_end(ap); if (n > 0 ) { char *str = (char *)cgdb_malloc(n); va_start(ap, fmt); vsnprintf(str, n, fmt, ap); va_end(ap); return str; } return NULL; } std::string sys_quote_nonprintables(const char *str, int len) { int i; std::string ret; if (len == -1) len = strlen(str); for (i = 0; i < len; ++i) { const char *ch = NULL; if (str[i] == '\r') ch = "\\r"; else if (str[i] == '\n') ch = "\\n"; else if (str[i] == '\032') ch = "\\032"; else if (str[i] == '\033') ch = "\\033"; else if (str[i] == '\b') ch = "\\b"; else if (str[i] == '\t') ch = "\\t"; if (ch) { ret.push_back('('); ret.append(ch); ret.push_back(')'); } else ret.push_back(str[i]); } return ret; } cgdb-0.8.0/lib/util/stretchy.cpp0000664000175000017500000000136514135136636013452 00000000000000#if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #include "sys_util.h" #include "stretchy.h" /* stb__sbgrowf: internal stretchy buffer grow function. */ int stb__sbgrowf(void **arr, int increment, int itemsize) { int m = *arr ? 2 * stb__sbm( *arr ) + increment : increment + 1; void *p = cgdb_realloc( *arr ? stb__sbraw( *arr ) : 0, itemsize * m + sizeof( int ) * 2 ); if ( !*arr ) ( ( int * )p )[ 1 ] = 0; *arr = ( void * )( ( int * )p + 2 ); stb__sbm( *arr ) = m; return 0; } void stb__shlf(void **arr, int itemsize) { int n = stb__sbn(*arr); char *arrptr = (char *)(*arr); memmove(arrptr, arrptr + itemsize, itemsize * (n - 1)); stb__sbn(*arr) = n - 1; } cgdb-0.8.0/lib/util/cgdb_clog.cpp0000664000175000017500000000133214012265341013470 00000000000000#include "cgdb_clog.h" /** * Modified clog's clog_error function to set this variable. */ bool clog_cgdb_error_occurred = false; int clog_open(int id, const char *fmt, const char *config_dir) { int i; /* Try to open a log file exclusively. This allows us to run * several instances of cgdb without the logfiles getting borked. */ for (i = 1; i < 100; i++) { char filename[FSUTIL_PATH_MAX]; /* Initialize the debug file that a2_tgdb writes to */ snprintf(filename, sizeof(filename), fmt, config_dir, i); if (clog_init_path(id, filename) == 0) { return 0; } } return -1; } bool clog_did_error_occur() { return clog_cgdb_error_occurred; } cgdb-0.8.0/lib/util/pseudo.cpp0000664000175000017500000005022713521346110013071 00000000000000/* * 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 1 /* 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); /** * Intentionally not checking errors below, as the note above indicates * that non root users typically fail here. I'm unaware if this code is * even necessary to execute on certain systems. Since this came with * the pseudo library, I'm assuming it is useful in some configurations. * The solution was to ignore errors on systems that don't allow the * following calls. */ chown(slavename, (uid_t) 0, (gid_t) 0); chmod(slavename, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH); 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 process 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.8.0/lib/rline/0000775000175000017500000000000014171036466011310 500000000000000cgdb-0.8.0/lib/rline/Makefile.in0000664000175000017500000004064514171036447013305 00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/config/readline_check_version.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) 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 CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) AM_V_CXX = $(am__v_CXX_@AM_V@) am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) am__v_CXX_0 = @echo " CXX " $@; am__v_CXX_1 = CXXLD = $(CXX) CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ -o $@ AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) am__v_CXXLD_0 = @echo " CXXLD " $@; am__v_CXXLD_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 = $(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 am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/config/depcomp 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@ CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ 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@ HAS_MAKEINFO = @HAS_MAKEINFO@ 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@ ac_ct_CXX = @ac_ct_CXX@ 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@ runstatedir = @runstatedir@ 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_CXXFLAGS = \ -I$(top_srcdir)/lib/util \ -std=c++11 noinst_LIBRARIES = librline.a librline_a_SOURCES = \ rline.cpp \ rline.h all: all-am .SUFFIXES: .SUFFIXES: .cpp .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) --foreign lib/rline/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign lib/rline/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@ .cpp.o: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< .cpp.obj: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(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 .PRECIOUS: Makefile # 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.8.0/lib/rline/rline.h0000664000175000017500000001730014130163771012506 00000000000000#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 #include /* Creating and Destroying a librline context. {{{ */ /******************************************************************************/ /** * @name Creating 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(command_cb * command, completion_cb * completion, const 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 completions * The array 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, char **completions, 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 * A list of key sequences that can be used to map to * the named_function the user requested. * * \return * 0 on success or -1 on error */ int rline_get_keyseq(struct rline *rline, const char *named_function, std::list &keyseq); /*@}*/ /* }}}*/ #endif /* __RL_H__ */ cgdb-0.8.0/lib/rline/Makefile.am0000664000175000017500000000022013521324221013241 00000000000000AM_CXXFLAGS = \ -I$(top_srcdir)/lib/util \ -std=c++11 noinst_LIBRARIES = librline.a librline_a_SOURCES = \ rline.cpp \ rline.h cgdb-0.8.0/lib/rline/rline.cpp0000664000175000017500000002776614135136636013067 00000000000000#include #include #include "rline.h" #include "fork_util.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 */ /* }}}*/ /* Our array of completion strings and current index */ static int completions_index = 0; static char **completions_array = NULL; static int completions_array_size = 0; 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; /** Master/Slave PTY used to keep readline off of stdin/stdout. */ pty_pair_ptr pty_pair; /* 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(command_cb * command, completion_cb * completion, const char *TERM) { struct rline *rline = (struct rline *) malloc(sizeof (struct rline)); static char word_break_chars[] = " \t\n!@#$%^&*()+=|~`}{[]\"';:?/>.<,-"; if (!rline) return NULL; /* Initialize each member variable */ rline->input = NULL; rline->output = NULL; rline->pty_pair = pty_pair_create(); if (!rline->pty_pair) { return NULL; } int slavefd = pty_pair_get_masterfd(rline->pty_pair); 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 = word_break_chars; rl_completer_quote_characters = "'"; return rline; } static void rline_free_completions() { /* Set and index to 0. */ delete [] completions_array; completions_array = NULL; completions_index = 0; completions_array_size = 0; } int rline_shutdown(struct rline *rline) { if (!rline) return -1; /* Should this be OK? */ rline_free_completions(); if (rline->input) fclose(rline->input); if (rline->output) fclose(rline->output); pty_pair_destroy(rline->pty_pair); 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; } /** * 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 (completions_index < completions_array_size) { /** * '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 = completions_array[completions_index++]; char *word = local + rl_point - strlen(text); return strdup(word); } return NULL; } /* This is necessary because we want to make what the user has typed * against a list of possibilities. For example, if the user has typed * 'b ma', the completion possibilities should at least have 'b main'. * The default readline word break includes a ' ', which would not * result in 'b main' as the completion result. */ static char *rline_rl_cpvfunc_t(void) { static char buf[] = ""; return buf; } int rline_rl_complete(struct rline *rline, char **completions, 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 = sbcount(completions); if (size == 0) { rl_completion_word_break_hook = NULL; rl_completion_entry_function = NULL; } else { completions_index = 0; completions_array_size = size; completions_array = new char*[size]; for (int i = 0; i < size; i++) completions_array[i] = completions[i]; 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; /* 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"); /* Free the current completion array entries */ rline_free_completions(); 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) { rl_command_func_t *func; char **invoking_keyseqs = NULL; char **invoking_keyseqs_cur = NULL; char *new_keyseq = NULL; int len; 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; } keyseq.push_back(new_keyseq); free(new_keyseq); free(*invoking_keyseqs_cur); invoking_keyseqs_cur++; } free(invoking_keyseqs); return 0; } /*@}*/ /* }}}*/ cgdb-0.8.0/lib/kui/0000775000175000017500000000000014171036466010767 500000000000000cgdb-0.8.0/lib/kui/kui_cgdb_key.h0000664000175000017500000000452213257311731013475 00000000000000#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 passes some special keys directly to readline. * These keys are not vim compatible. */ CGDB_KEY_BACKWARD_WORD, CGDB_KEY_FORWARD_WORD, CGDB_KEY_BACKWARD_KILL_WORD, CGDB_KEY_FORWARD_KILL_WORD, CGDB_KEY_ERROR }; /* }}} */ #endif cgdb-0.8.0/lib/kui/kui.h0000664000175000017500000003414513257311731011652 00000000000000#ifndef __KUI_H__ #define __KUI_H__ /* includes {{{ */ #include #include #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. * * If a map already exists with this key in the map set, * it will be deleted and replaced by the new requested mapping. * * \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); /*@}*/ /* }}} */ /* 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 map set or NULL if none. */ struct kui_map_set *kui_get_map_set(struct kuictx *kctx); /** * Set or clear the map set for this kui context. * * \param kctx * The kui context to add the map set of * * \param kui_ms * The new kui map set to use or NULL to clear the set. * * @return * 0 on success, or -1 on error. */ int kui_set_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 * True if can get a key, or false if nothing available. */ bool 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 */ /******************************************************************************/ /*@{*/ /** * Clear the map set, no mappings will be used. * * @param kuim * The kui context to clear the map of * * @return * 0 on success, or -1 on error */ int kui_manager_clear_map_set(struct kui_manager *kuim); /** * Set the kui map for the kui manager's kui context. * * \param kuim * The kui context to set 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_set_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 characters 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 * 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, const std::list &keyseq); /*@}*/ /* }}} */ #endif /* __KUI_H__ */ cgdb-0.8.0/lib/kui/kui_driver.cpp0000664000175000017500000002211313046230117013542 00000000000000#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_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 "sys_win.h" #include "sys_util.h" #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 */ if (use_endwin) swin_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': swin_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 interrupted 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 ch; char line[4096]; int pos = 0; fprintf(stderr, "\r\n(kui_map)"); do { ch = fgetc(stdin); line[pos++] = ch; fprintf(stderr, "%c", ch); } while (ch != '\r' && ch != '\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 received */ 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_set_map_set(kuim, map) == -1) return -1; return 0; } /* Original terminal attributes */ int main(int argc, char **argv) { /* Initialize curses */ swin_initscr(); swin_raw(); swin_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.8.0/lib/kui/kui_term.cpp0000664000175000017500000004567713257311731013250 00000000000000#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 /* for getenv */ #endif /* HAVE_STDLIB_H */ #if HAVE_STDIO_H #include /* for stderr */ #endif /* HAVE_STDIO_H */ /* term.h prototypes */ #ifdef __cplusplus #define EXTERN_C extern "C" #else #define EXTERN_C extern #endif EXTERN_C int tgetent(char *, const char *); EXTERN_C char *tgetstr(const char *, char **); #include "sys_util.h" #include "sys_win.h" #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 */ const char *tname; /* the termcap key sequence */ const char *tname_seq; /* the terminfo capability name */ const char *tiname; /* the terminfo key sequence */ const 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; const char *key_seq; } hard_coded_bindings[] = { { CGDB_KEY_ESC, "\033"}, /* Arrow bindings */ /* A cgdb key can be represented by several different terminal * mappings. Different terminals produce different key sequences, for * say F11, and we hard code common cases for the popular terminals. * * cgdb returns the enumeration cgdb_key back up to cgdb * instead of the key sequence. The first key mapping is the one that * will be used when asking what character mapping makes up a cgdb key. * * For this reason, we put the ones that are hard coded in readline * on top. That way, we know when we pass readline the key mapping, * it will understand it. */ { 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"}, /* Passed through to readline */ { CGDB_KEY_BACKWARD_WORD, "\033b"}, { CGDB_KEY_FORWARD_WORD, "\033f"}, { CGDB_KEY_BACKWARD_KILL_WORD, "\033\b"}, { CGDB_KEY_FORWARD_KILL_WORD, "\033d"}, /* 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_BACKWARD_WORD, "", "CGDB_KEY_BACKWARD_WORD"}, { CGDB_KEY_FORWARD_WORD, "", "CGDB_KEY_FORWARD_WORD"}, { CGDB_KEY_BACKWARD_KILL_WORD, "", "CGDB_KEY_BACKWARD_KILL_WORD"}, { CGDB_KEY_FORWARD_KILL_WORD, "", "CGDB_KEY_FORWARD_KILL_WORD"}, { 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 = swin_tigetstr((char *)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; } const 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.8.0/lib/kui/kui_tree.h0000664000175000017500000001140513257311731012663 00000000000000#ifndef __KUI_TREE_H__ #define __KUI_TREE_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 * receive 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 received. * * \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.8.0/lib/kui/Makefile.in0000664000175000017500000004736714171036447012774 00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/config/readline_check_version.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) 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/util/libcgdbutil.a kui_driver_LINK = $(CXXLD) $(kui_driver_CXXFLAGS) $(CXXFLAGS) \ $(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 = CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) AM_V_CXX = $(am__v_CXX_@AM_V@) am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) am__v_CXX_0 = @echo " CXX " $@; am__v_CXX_1 = CXXLD = $(CXX) CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ -o $@ AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) am__v_CXXLD_0 = @echo " CXXLD " $@; am__v_CXXLD_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 am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/config/depcomp 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@ CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ 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@ HAS_MAKEINFO = @HAS_MAKEINFO@ 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@ ac_ct_CXX = @ac_ct_CXX@ 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@ runstatedir = @runstatedir@ 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_CXXFLAGS = \ -I$(top_srcdir)/lib/util \ -std=c++11 # create the input library noinst_LIBRARIES = libkui.a libkui_a_SOURCES = \ kui.cpp \ kui.h \ kui_cgdb_key.h \ kui_term.cpp \ kui_term.h \ kui_tree.cpp \ kui_tree.h # This is the kui driver kui_driver_LDFLAGS = \ -L$(top_builddir)/lib/util kui_driver_LDADD = libkui.a \ $(top_builddir)/lib/util/libcgdbutil.a kui_driver_SOURCES = kui_driver.cpp kui_driver_CXXFLAGS = $(AM_CXXFLAGS) all: all-am .SUFFIXES: .SUFFIXES: .cpp .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) --foreign lib/kui/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign lib/kui/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_CXXLD)$(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@ .cpp.o: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< .cpp.obj: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` kui_driver-kui_driver.o: kui_driver.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(kui_driver_CXXFLAGS) $(CXXFLAGS) -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.cpp' || echo '$(srcdir)/'`kui_driver.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/kui_driver-kui_driver.Tpo $(DEPDIR)/kui_driver-kui_driver.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kui_driver.cpp' object='kui_driver-kui_driver.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(kui_driver_CXXFLAGS) $(CXXFLAGS) -c -o kui_driver-kui_driver.o `test -f 'kui_driver.cpp' || echo '$(srcdir)/'`kui_driver.cpp kui_driver-kui_driver.obj: kui_driver.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(kui_driver_CXXFLAGS) $(CXXFLAGS) -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.cpp'; then $(CYGPATH_W) 'kui_driver.cpp'; else $(CYGPATH_W) '$(srcdir)/kui_driver.cpp'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/kui_driver-kui_driver.Tpo $(DEPDIR)/kui_driver-kui_driver.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='kui_driver.cpp' object='kui_driver-kui_driver.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(kui_driver_CXXFLAGS) $(CXXFLAGS) -c -o kui_driver-kui_driver.obj `if test -f 'kui_driver.cpp'; then $(CYGPATH_W) 'kui_driver.cpp'; else $(CYGPATH_W) '$(srcdir)/kui_driver.cpp'; 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 .PRECIOUS: Makefile # 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.8.0/lib/kui/Makefile.am0000664000175000017500000000106413521324221012727 00000000000000AM_CXXFLAGS = \ -I$(top_srcdir)/lib/util \ -std=c++11 # create the input library noinst_LIBRARIES = libkui.a libkui_a_SOURCES = \ kui.cpp \ kui.h \ kui_cgdb_key.h \ kui_term.cpp \ kui_term.h \ kui_tree.cpp \ 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/util kui_driver_LDADD = libkui.a \ $(top_builddir)/lib/util/libcgdbutil.a kui_driver_SOURCES = kui_driver.cpp kui_driver_CXXFLAGS = $(AM_CXXFLAGS) cgdb-0.8.0/lib/kui/kui.cpp0000664000175000017500000005576413257311731012217 00000000000000/** * Provides the routines for reading keys. * * The basic breakdown of the data structures are as follows, * * kui_map * - A kui_map will map a sequence of keys to another sequence of keys. * - i.e. map abc def (changes abc to def when matched) * - Contains a key sequence and a value sequence * * kui_map_set * - A kui map_set is many kui_map items. * - This data structure stores the kui maps in a std::map and a kui tree. * - The std::map is used to keep track of what kui maps exist * - The kui tree is used to keep track of what mappings are being * matched when recieving input. * * kuictx * - A kui context owns a kui map set. * - It's added benefit is that it reads a key and handles it. It determine's * if a macro was hit, or if more keys are necessary, etc. * * kui manager * - Contains several kui contexts. the normal user mappings and the * - One of the kui contexts represents the current user mappings. * This could be the map or imap mappings depending on cgdb's state. * The other kui context is the terminal mappings. * * Kui Tree and Kui Tree Node * - The kui tree node, and kui node exist to efficiently determine if * a mapping has been reached. The mappings are stored in a tree. * One character at each node. Every time a key is read as input, the * tree can be traversed one child to know if a mapping was found, or * if several mappings are still in the running. * * - kui_tree_node * - A node in a kui_tree. * - A Key/Value pair and a list of children nodes. * - The key is the charachter * - The value is the mapping result * - The children are the list of potential macros still left to match * * - kui_tree * - A list of kui tree nodes * */ /* includes {{{ */ #if HAVE_CONFIG_H #include "config.h" #endif #if HAVE_STDIO_H #include #endif #if HAVE_UNISTD_H #include #endif #if HAVE_STRING_H #include #endif #include #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; /** * All of the maps in this kui map set * * The key is what you type to trigger the mapping. The value * is the kui_map representing the mapping. */ std::map maps; }; struct kui_map_set *kui_ms_create(void) { kui_map_set *map = new kui_map_set(); 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; } for (auto it = kui_ms->maps.cbegin(); it != kui_ms->maps.cend();) { kui_map_destroy(it->second); kui_ms->maps.erase(it++); } delete kui_ms; return retval; } 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; auto iter = kui_ms->maps.find(key_data); if (iter != kui_ms->maps.end()) { kui_map_destroy(iter->second); kui_ms->maps.erase(iter); } kui_ms->maps[key_data] = map; 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) { if (!kui_ms) return -1; auto iter = kui_ms->maps.find(key); if (iter == kui_ms->maps.end()) { return -1; } /* Delete from the tree */ if (kui_tree_delete(kui_ms->ktree, iter->second->literal_key) == -1) return -1; kui_map_destroy(iter->second); kui_ms->maps.erase(iter); return 0; } /* }}} */ /* struct kuictx {{{ */ /** * A Key User Interface context. */ struct kuictx { /** * The current map set for this KUI context. */ struct kui_map_set *map_set; /** * 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; }; struct kuictx *kui_create(int stdinfd, kui_getkey_callback callback, int ms, void *state_data) { struct kuictx *kctx = new kuictx(); kctx->callback = callback; kctx->state_data = state_data; kctx->map_set = NULL; kctx->ms = ms; kctx->fd = stdinfd; return kctx; } int kui_destroy(struct kuictx *kctx) { delete kctx; return 0; } struct kui_map_set *kui_get_map_set(struct kuictx *kctx) { if (!kctx) return NULL; return kctx->map_set; } int kui_set_map_set(struct kuictx *kctx, struct kui_map_set *kui_ms) { if (!kctx) return -1; kctx->map_set = kui_ms; return 0; } /** * This basically get's a char from the internal buffer within the kui context * or it get's a character 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) { if (!key) return -1; if (kctx->buffer.size()) { *key = kctx->buffer.front(); kctx->buffer.pop_front(); } 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 kui context's map set with the new key. * * @param key * The new key to push into the kui context's map set. * * @param map_found * Return's as 1 if a map was found while pushing this key, otherwise 0. * * @return * 0 on success, -1 on error. */ static int kui_update_map_set(struct kuictx *kctx, int key, int *map_found) { 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 */ if (kui_tree_push_key(kctx->map_set->ktree, key, map_found) == -1) return -1; if (*map_found) { /* If a map was found, reset the extra char's read */ kctx->volatile_buffer.clear(); } return 0; } /** * Checks to see if the map set is matching a map. * If it is, 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) { 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 */ if (kui_tree_get_state(kctx->map_set->ktree, &map_state) == -1) return -1; if (map_state == KUI_TREE_MATCHING) *should_continue = 1; return 0; } /** * 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) { enum kui_tree_state map_state; if (!was_map_found) return -1; if (!the_map_found) return -1; *was_map_found = 0; /* If the kui context's map set has the value KUI_TREE_FOUND, * than a map was found, and it should be the value used. * * Otherwise, no map is found. */ if (kui_tree_get_state(kctx->map_set->ktree, &map_state) == -1) return -1; if (map_state == KUI_TREE_FOUND) { void *data; if (kui_tree_get_data(kctx->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) { if (!map_was_found && kctx->volatile_buffer.size()) { *key = kctx->volatile_buffer.back(); kctx->volatile_buffer.pop_back(); } for (auto it : kctx->volatile_buffer) { kctx->buffer.push_front(it); } /* Add the map value */ if (map_was_found) { /* Add the value onto the buffer */ int length = intlen(the_map_found->literal_value); for (int i = length - 1; i >= 0; --i) { kctx->buffer.push_front(the_map_found->literal_value[i]); } } 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 map_found; /* Validate parameters */ if (!kctx) return -1; if (!was_map_found) return -1; /* Initialize variables on stack */ key = -1; *was_map_found = 0; should_continue = 0; if (!kctx->map_set) { retval = kui_findchar(kctx, &key); if (retval == -1) { return -1; } else { return key; } } kctx->volatile_buffer.clear(); if (kui_tree_reset_state(kctx->map_set->ktree) == -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; kctx->volatile_buffer.push_front(key); /* Update each list, with the character read, and the position. */ if (kui_update_map_set(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; } /* This should no longer be used. Enforcing that. */ key = 0; /* 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 (kui_tree_finalize_state(kctx->map_set->ktree) == -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; } bool kui_cangetkey(struct kuictx *kctx) { return kctx && kctx->buffer.size() != 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_set_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; } int kui_manager_clear_map_set(struct kui_manager *kuim) { if (!kuim) return -1; return kui_set_map_set(kuim->normal_keys, NULL); } int kui_manager_set_map_set(struct kui_manager *kuim, struct kui_map_set *kui_ms) { if (!kuim) return -1; return kui_set_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, const std::list &keyseq) { struct kui_map_set *map_set; struct kuictx *terminalkeys; 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_set = kui_get_map_set(terminalkeys); for (const auto &data : keyseq) { kui_ms_register_map(map_set, data.c_str(), keycode_str); } return 0; } /* }}} */ cgdb-0.8.0/lib/kui/kui_term.h0000664000175000017500000000614512755663236012714 00000000000000#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 conversion 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 character sequence on success. If key is not a cgdb_key * or if this function fails, NULL will return. */ const 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.8.0/lib/kui/kui_tree.cpp0000664000175000017500000001363213257311731013222 00000000000000#include #include #include #include #include "kui_tree.h" /* struct kui_tree_node {{{ */ struct kui_tree_node; typedef std::shared_ptr KuiTreeNodeSPtr; typedef std::map KuiTreeNodeMap; /** * A node in a kui tree. */ struct kui_tree_node { kui_tree_node() : key(0), macro_value(NULL) {} /* The keyboard key this node represents. */ int key; /* If non-null, this node represents the macro value reached. * Otherwise, this node is not the end of the macro. */ void *macro_value; /** * The children macros from this nodes perspective. */ KuiTreeNodeMap children; private: kui_tree_node(const kui_tree_node &other); kui_tree_node &operator=(const kui_tree_node &other); }; /** * Inserts a map into the tree. * * @param node * The node to insert the map into * * @param klist * The key sequence that will trigger the key mapping substitution * The last item in the list will have a 0 value * * @param data * The substitution that should take place when the key mapping is reached. * * @return * 0 on success or -1 on error */ static int kui_tree_node_insert(KuiTreeNodeSPtr node, int *klist, void *data) { if (!node) { return -1; } // If at the end of the list, done if (klist[0] == 0) { node->macro_value = data; return 0; } else { KuiTreeNodeSPtr new_node; KuiTreeNodeMap::const_iterator iter = node->children.find(klist[0]); if (iter == node->children.end()) { new_node = KuiTreeNodeSPtr(new kui_tree_node()); new_node->key = klist[0]; node->children.insert(std::make_pair(klist[0], new_node)); } else { new_node = iter->second; } return kui_tree_node_insert(new_node, &klist[1], data); } } /** * Delete a map from the tree. * * @param node * The node to remove the map from * * @param klist * The key sequence to delete. * The last item in the list will have a 0 value */ static int kui_tree_node_delete(KuiTreeNodeSPtr node, int *klist) { auto iter = node->children.find(klist[0]); if (iter == node->children.end()) { return -1; } else { // Delete the requested mapping if (klist[1] == 0) { iter->second->macro_value = NULL; // The found node (iter->second) is the leaf node // for this mapping. However, other mappings may be require // this node to continue existing. For example, // imap u1 a // imap u12 b // iunmap u1 // When unmapping u1, you'll want to keep the node for 1 // because the u12 mapping still requires it. if (iter->second->children.size() == 0) { node->children.erase(iter); } } else { kui_tree_node_delete(iter->second, &klist[1]); if (iter->second->children.size() == 0 && iter->second->macro_value == NULL) { node->children.erase(iter); } } } 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 */ KuiTreeNodeSPtr root; /* The current position pointing into the tree (while looking for a map) */ KuiTreeNodeSPtr cur; /* The last node found while looking for a map. */ /* This happens because maps can be subsets of other maps. */ KuiTreeNodeSPtr 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) { delete ktree; return 0; } struct kui_tree *kui_tree_create(void) { struct kui_tree *ktree = new kui_tree();; ktree->root = KuiTreeNodeSPtr(new kui_tree_node()); 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) { kui_tree_node_delete(ktree->root, klist); 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) { *map_found = 0; if (ktree->state != KUI_TREE_MATCHING) return -1; /* Check to see if this key matches */ auto iter = ktree->cur->children.find(key); /* Not found */ if (iter == ktree->cur->children.end()) { ktree->state = KUI_TREE_NOT_FOUND; ktree->cur = NULL; } else { ktree->cur = iter->second; if (iter->second->children.size() == 0) { ktree->state = KUI_TREE_FOUND; } if (iter->second->macro_value) { ktree->found = 1; ktree->found_node = iter->second; *map_found = 1; } } return 0; } /* }}} */ cgdb-0.8.0/lib/Makefile.in0000664000175000017500000004307314171036447012172 00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/config/readline_check_version.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) 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) am__DIST_COMMON = $(srcdir)/Makefile.in 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@ CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ 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@ HAS_MAKEINFO = @HAS_MAKEINFO@ 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@ ac_ct_CXX = @ac_ct_CXX@ 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@ runstatedir = @runstatedir@ 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 tgdb kui tokenizer vterm 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) --foreign lib/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign lib/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=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ 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 .PRECIOUS: Makefile # 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.8.0/lib/Makefile.am0000664000175000017500000000005614160506307012146 00000000000000SUBDIRS = util rline tgdb kui tokenizer vterm cgdb-0.8.0/lib/tokenizer/0000775000175000017500000000000014171036466012211 500000000000000cgdb-0.8.0/lib/tokenizer/asmlexer.cpp0000664000175000017500000025657114171036460014467 00000000000000#line 2 "asmlexer.cpp" #line 4 "asmlexer.cpp" #define YY_INT_ALIGNED short int /* A lexical scanner generated by flex */ #define yy_create_buffer asm__create_buffer #define yy_delete_buffer asm__delete_buffer #define yy_flex_debug asm__flex_debug #define yy_init_buffer asm__init_buffer #define yy_flush_buffer asm__flush_buffer #define yy_load_buffer_state asm__load_buffer_state #define yy_switch_to_buffer asm__switch_to_buffer #define yyin asm_in #define yyleng asm_leng #define yylex asm_lex #define yylineno asm_lineno #define yyout asm_out #define yyrestart asm_restart #define yytext asm_text #define yywrap asm_wrap #define yyalloc asm_alloc #define yyrealloc asm_realloc #define yyfree asm_free #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 6 #define YY_FLEX_SUBMINOR_VERSION 0 #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 asm_restart(asm_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 #ifndef YY_TYPEDEF_YY_SIZE_T #define YY_TYPEDEF_YY_SIZE_T typedef size_t yy_size_t; #endif extern yy_size_t asm_leng; extern FILE *asm_in, *asm_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) #define YY_LINENO_REWIND_TO(ptr) /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ do \ { \ /* Undo effects of setting up asm_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 asm_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. */ 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 asm_restart()), so that the user can continue scanning by * just pointing asm_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 asm_text is formed. */ static char yy_hold_char; static int yy_n_chars; /* number of characters read into yy_ch_buf */ yy_size_t asm_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 asm_wrap()'s to do buffer switches * instead of setting up a fresh asm_in. A bit of a hack ... */ static int yy_did_buffer_switch_on_eof; void asm_restart (FILE *input_file ); void asm__switch_to_buffer (YY_BUFFER_STATE new_buffer ); YY_BUFFER_STATE asm__create_buffer (FILE *file,int size ); void asm__delete_buffer (YY_BUFFER_STATE b ); void asm__flush_buffer (YY_BUFFER_STATE b ); void asm_push_buffer_state (YY_BUFFER_STATE new_buffer ); void asm_pop_buffer_state (void ); static void asm_ensure_buffer_stack (void ); static void asm__load_buffer_state (void ); static void asm__init_buffer (YY_BUFFER_STATE b,FILE *file ); #define YY_FLUSH_BUFFER asm__flush_buffer(YY_CURRENT_BUFFER ) YY_BUFFER_STATE asm__scan_buffer (char *base,yy_size_t size ); YY_BUFFER_STATE asm__scan_string (yyconst char *yy_str ); YY_BUFFER_STATE asm__scan_bytes (yyconst char *bytes,yy_size_t len ); void *asm_alloc (yy_size_t ); void *asm_realloc (void *,yy_size_t ); void asm_free (void * ); #define yy_new_buffer asm__create_buffer #define yy_set_interactive(is_interactive) \ { \ if ( ! YY_CURRENT_BUFFER ){ \ asm_ensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ asm__create_buffer(asm_in,YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } #define yy_set_bol(at_bol) \ { \ if ( ! YY_CURRENT_BUFFER ){\ asm_ensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ asm__create_buffer(asm_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 */ #define asm_wrap() (/*CONSTCOND*/1) #define YY_SKIP_YYWRAP typedef unsigned char YY_CHAR; FILE *asm_in = (FILE *) 0, *asm_out = (FILE *) 0; typedef int yy_state_type; extern int asm_lineno; int asm_lineno = 1; extern char *asm_text; #ifdef yytext_ptr #undef yytext_ptr #endif #define yytext_ptr asm_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 ); #if defined(__GNUC__) && __GNUC__ >= 3 __attribute__((__noreturn__)) #endif static void yy_fatal_error (yyconst char msg[] ); /* Done after the current pattern has been matched and before the * corresponding action - sets up asm_text. */ #define YY_DO_BEFORE_ACTION \ (yytext_ptr) = yy_bp; \ asm_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 123 #define YY_END_OF_BUFFER 124 /* 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[432] = { 0, 0, 0, 82, 82, 91, 91, 124, 122, 120, 117, 119, 90, 122, 122, 122, 122, 96, 96, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 82, 84, 85, 83, 91, 92, 93, 95, 123, 118, 89, 0, 0, 112, 81, 88, 0, 96, 0, 113, 97, 98, 0, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 41, 121, 121, 121, 121, 121, 121, 121, 121, 121, 48, 121, 121, 121, 121, 121, 121, 121, 53, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 82, 86, 83, 83, 87, 91, 0, 94, 115, 0, 115, 114, 88, 112, 0, 112, 99, 102, 100, 104, 121, 121, 80, 121, 121, 121, 28, 30, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 46, 121, 121, 121, 13, 121, 121, 121, 49, 50, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 67, 121, 121, 121, 121, 121, 121, 121, 121, 121, 73, 116, 103, 101, 105, 106, 79, 121, 121, 78, 121, 121, 1, 121, 121, 2, 121, 34, 121, 3, 121, 121, 121, 121, 121, 121, 121, 121, 43, 7, 121, 121, 121, 121, 121, 121, 47, 121, 14, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 64, 121, 66, 121, 121, 121, 121, 121, 25, 121, 121, 121, 121, 107, 110, 108, 77, 75, 121, 121, 121, 32, 33, 35, 4, 36, 5, 121, 121, 121, 121, 121, 121, 121, 121, 45, 10, 121, 121, 121, 121, 121, 121, 54, 121, 121, 121, 121, 121, 121, 18, 121, 121, 121, 121, 121, 121, 65, 121, 121, 121, 22, 121, 71, 121, 121, 121, 72, 121, 111, 109, 121, 29, 31, 121, 121, 121, 40, 6, 121, 121, 44, 8, 11, 12, 121, 121, 51, 121, 121, 121, 57, 121, 121, 59, 19, 60, 20, 21, 62, 121, 121, 69, 121, 121, 121, 121, 121, 74, 76, 121, 121, 39, 121, 121, 15, 121, 121, 55, 121, 121, 121, 121, 121, 68, 121, 121, 24, 121, 27, 121, 38, 121, 9, 121, 52, 121, 17, 121, 121, 63, 70, 23, 26, 121, 121, 16, 56, 121, 121, 37, 121, 121, 121, 121, 121, 61, 42, 121, 121, 121, 121, 58, 0 } ; static yyconst YY_CHAR 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, 9, 10, 11, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 1, 1, 1, 1, 1, 1, 1, 14, 15, 14, 16, 17, 18, 19, 19, 19, 19, 19, 20, 21, 19, 22, 23, 24, 25, 19, 26, 27, 19, 28, 29, 30, 19, 1, 31, 1, 1, 32, 1, 33, 34, 35, 36, 37, 38, 39, 40, 41, 19, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 YY_CHAR yy_meta[58] = { 0, 1, 1, 2, 3, 4, 1, 1, 5, 1, 1, 1, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 1, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8 } ; static yyconst flex_uint16_t yy_base[444] = { 0, 0, 0, 55, 57, 63, 66, 301, 1415, 1415, 1415, 279, 1415, 0, 243, 60, 66, 88, 193, 63, 66, 71, 69, 74, 91, 97, 77, 104, 108, 120, 122, 125, 134, 111, 147, 149, 151, 157, 160, 99, 170, 177, 173, 179, 79, 182, 0, 1415, 210, 77, 174, 1415, 197, 1415, 182, 1415, 0, 174, 137, 217, 1415, 0, 219, 73, 166, 1415, 195, 87, 0, 0, 186, 190, 227, 231, 229, 233, 240, 247, 250, 252, 254, 256, 258, 260, 263, 265, 268, 276, 272, 278, 280, 274, 287, 294, 296, 303, 195, 305, 308, 315, 319, 323, 327, 331, 333, 335, 337, 341, 347, 349, 355, 363, 365, 367, 379, 381, 383, 391, 393, 399, 397, 404, 412, 414, 416, 0, 1415, 131, 144, 1415, 62, 75, 1415, 1415, 57, 55, 1415, 0, 419, 406, 429, 252, 1415, 176, 424, 436, 446, 448, 450, 456, 461, 465, 467, 469, 471, 473, 475, 481, 478, 483, 486, 488, 490, 493, 497, 499, 509, 507, 511, 515, 517, 525, 533, 535, 537, 539, 547, 544, 550, 557, 555, 552, 559, 564, 566, 568, 571, 574, 582, 584, 586, 588, 594, 596, 592, 598, 602, 607, 612, 614, 618, 622, 628, 632, 634, 636, 639, 644, 646, 651, 654, 656, 1415, 1415, 1415, 650, 207, 659, 670, 679, 661, 686, 688, 691, 693, 697, 699, 701, 703, 705, 707, 709, 711, 714, 716, 718, 720, 723, 728, 735, 737, 739, 743, 748, 750, 755, 762, 764, 766, 769, 771, 773, 776, 781, 778, 783, 787, 789, 791, 796, 805, 807, 809, 815, 819, 821, 824, 826, 830, 832, 836, 838, 840, 850, 852, 854, 858, 860, 863, 865, 868, 270, 1415, 343, 875, 880, 882, 884, 886, 888, 891, 896, 901, 903, 905, 907, 911, 913, 916, 918, 921, 923, 926, 928, 930, 932, 935, 945, 948, 950, 952, 954, 957, 964, 966, 968, 970, 972, 974, 977, 980, 992, 984, 997, 999, 1002, 1008, 1010, 1016, 1012, 1018, 1021, 1026, 1028, 1030, 1035, 1038, 1415, 1415, 1040, 1042, 1045, 1048, 1052, 1054, 1058, 1060, 1062, 1065, 1067, 1069, 1072, 1075, 1077, 1079, 1081, 1083, 1086, 1088, 1090, 1095, 1097, 1103, 1105, 1107, 1109, 1112, 1114, 1118, 1121, 1123, 1130, 1125, 1132, 1135, 1137, 1139, 1141, 1143, 1145, 1148, 1151, 1153, 1155, 1158, 1160, 1167, 1173, 1177, 1182, 1179, 1184, 1186, 1188, 1194, 1190, 1199, 1203, 1205, 1207, 1210, 1215, 1219, 1221, 1225, 1227, 1229, 1231, 1234, 1236, 1238, 1240, 1245, 1247, 1250, 1253, 1255, 1257, 1259, 1261, 1263, 1269, 1271, 1273, 1275, 1277, 1281, 1285, 1287, 1289, 1291, 1415, 1340, 1348, 1350, 1358, 1361, 1369, 1377, 1385, 1393, 1401, 1404, 1406 } ; static yyconst flex_int16_t yy_def[444] = { 0, 431, 1, 432, 432, 433, 433, 431, 431, 431, 431, 431, 431, 434, 435, 431, 431, 431, 17, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 437, 431, 431, 438, 439, 431, 431, 431, 439, 431, 434, 431, 440, 431, 431, 441, 431, 17, 431, 431, 431, 431, 442, 443, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 437, 431, 438, 438, 431, 439, 439, 431, 431, 431, 431, 431, 441, 431, 431, 431, 431, 431, 431, 442, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 431, 431, 431, 431, 431, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 431, 431, 431, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 431, 431, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, 0, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431 } ; static yyconst flex_uint16_t yy_nxt[1473] = { 0, 8, 9, 10, 11, 12, 13, 14, 8, 8, 15, 16, 17, 18, 19, 20, 21, 19, 19, 19, 19, 19, 19, 22, 23, 19, 19, 19, 24, 25, 19, 8, 19, 26, 27, 28, 29, 30, 31, 32, 19, 33, 19, 34, 35, 36, 37, 38, 19, 39, 40, 41, 42, 43, 44, 45, 19, 19, 47, 48, 47, 48, 212, 49, 212, 49, 51, 52, 53, 51, 52, 53, 59, 59, 60, 69, 69, 61, 69, 69, 130, 69, 69, 69, 69, 128, 69, 69, 129, 69, 69, 69, 69, 131, 54, 73, 71, 54, 62, 72, 63, 63, 74, 69, 69, 64, 65, 143, 66, 69, 69, 69, 69, 75, 122, 67, 69, 69, 76, 123, 69, 69, 77, 69, 69, 64, 65, 78, 431, 79, 143, 66, 69, 69, 69, 69, 109, 69, 69, 431, 67, 83, 431, 68, 135, 80, 69, 69, 84, 98, 81, 85, 128, 82, 86, 129, 99, 87, 93, 69, 69, 69, 69, 69, 69, 90, 88, 91, 94, 69, 69, 95, 69, 69, 96, 139, 89, 92, 140, 140, 97, 133, 69, 69, 102, 69, 69, 130, 103, 69, 69, 69, 69, 100, 69, 69, 214, 104, 69, 69, 132, 101, 69, 69, 105, 131, 106, 69, 69, 107, 110, 111, 108, 126, 114, 141, 145, 115, 118, 214, 120, 112, 142, 119, 113, 121, 116, 283, 124, 59, 59, 138, 138, 117, 64, 136, 174, 65, 141, 69, 69, 69, 69, 69, 69, 69, 69, 142, 431, 146, 283, 148, 69, 69, 64, 136, 147, 65, 149, 69, 69, 150, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 58, 69, 69, 69, 69, 213, 69, 69, 55, 151, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 152, 156, 159, 337, 160, 69, 69, 431, 155, 153, 213, 154, 69, 69, 69, 69, 157, 158, 161, 162, 163, 69, 69, 69, 69, 164, 69, 69, 337, 166, 165, 431, 168, 69, 69, 431, 167, 69, 69, 431, 169, 69, 69, 171, 170, 69, 69, 431, 172, 69, 69, 69, 69, 69, 69, 69, 69, 431, 173, 69, 69, 431, 175, 431, 176, 69, 69, 69, 69, 338, 178, 431, 177, 69, 69, 184, 431, 180, 183, 431, 179, 69, 69, 69, 69, 69, 69, 187, 185, 431, 182, 181, 338, 186, 188, 431, 189, 69, 69, 69, 69, 69, 69, 431, 194, 431, 190, 191, 192, 69, 69, 69, 69, 431, 196, 69, 69, 69, 69, 431, 195, 431, 69, 69, 140, 140, 193, 431, 198, 197, 69, 69, 69, 69, 69, 69, 199, 138, 138, 431, 203, 200, 64, 65, 202, 201, 205, 140, 140, 204, 215, 207, 206, 208, 69, 69, 431, 216, 209, 217, 431, 210, 64, 65, 69, 69, 69, 69, 69, 69, 431, 211, 431, 215, 69, 69, 431, 218, 220, 69, 69, 219, 216, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 221, 69, 69, 431, 69, 69, 69, 69, 222, 69, 69, 69, 69, 69, 69, 224, 69, 69, 431, 227, 69, 69, 69, 69, 229, 431, 223, 226, 225, 228, 69, 69, 69, 69, 69, 69, 431, 235, 69, 69, 69, 69, 431, 230, 237, 236, 232, 231, 69, 69, 431, 233, 234, 238, 431, 239, 69, 69, 69, 69, 69, 69, 69, 69, 431, 243, 240, 69, 69, 241, 69, 69, 242, 69, 69, 69, 69, 245, 69, 69, 69, 69, 69, 69, 431, 246, 244, 69, 69, 69, 69, 69, 69, 431, 69, 69, 247, 69, 69, 248, 249, 250, 252, 251, 431, 69, 69, 69, 69, 69, 69, 69, 69, 431, 254, 69, 69, 69, 69, 69, 69, 69, 69, 431, 253, 69, 69, 431, 257, 431, 69, 69, 255, 256, 258, 69, 69, 69, 69, 431, 259, 69, 69, 431, 263, 69, 69, 431, 261, 260, 262, 69, 69, 431, 264, 69, 69, 69, 69, 69, 69, 265, 69, 69, 266, 267, 270, 69, 69, 69, 69, 269, 431, 268, 69, 69, 271, 69, 69, 69, 69, 281, 69, 69, 69, 69, 273, 431, 282, 272, 277, 276, 274, 69, 69, 278, 431, 284, 431, 280, 431, 275, 69, 69, 281, 431, 285, 431, 279, 69, 69, 69, 69, 282, 69, 69, 69, 69, 431, 286, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 287, 69, 69, 69, 69, 69, 69, 69, 69, 431, 69, 69, 431, 288, 431, 69, 69, 431, 290, 431, 291, 289, 69, 69, 69, 69, 69, 69, 431, 293, 69, 69, 295, 431, 292, 69, 69, 69, 69, 431, 294, 298, 69, 69, 431, 296, 297, 299, 431, 69, 69, 69, 69, 69, 69, 300, 69, 69, 69, 69, 69, 69, 303, 69, 69, 69, 69, 301, 69, 69, 69, 69, 302, 431, 69, 69, 69, 69, 69, 69, 307, 304, 305, 69, 69, 431, 306, 431, 309, 310, 431, 312, 69, 69, 69, 69, 69, 69, 308, 313, 431, 311, 69, 69, 431, 314, 69, 69, 69, 69, 431, 69, 69, 69, 69, 431, 315, 69, 69, 69, 69, 319, 316, 69, 69, 69, 69, 69, 69, 317, 431, 322, 431, 318, 323, 321, 320, 69, 69, 69, 69, 69, 69, 431, 324, 69, 69, 69, 69, 326, 69, 69, 69, 69, 327, 69, 69, 431, 328, 431, 329, 325, 69, 69, 330, 431, 331, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 335, 69, 69, 336, 332, 339, 69, 69, 431, 333, 334, 69, 69, 69, 69, 69, 69, 69, 69, 431, 341, 69, 69, 69, 69, 431, 69, 69, 69, 69, 340, 69, 69, 69, 69, 342, 69, 69, 69, 69, 69, 69, 69, 69, 431, 69, 69, 431, 345, 431, 343, 346, 344, 431, 348, 69, 69, 347, 69, 69, 69, 69, 69, 69, 69, 69, 351, 69, 69, 350, 352, 431, 349, 431, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 353, 69, 69, 431, 69, 69, 431, 354, 69, 69, 355, 358, 431, 359, 431, 356, 69, 69, 431, 361, 357, 69, 69, 69, 69, 363, 69, 69, 431, 362, 364, 360, 69, 69, 69, 69, 69, 69, 431, 365, 69, 69, 69, 69, 368, 69, 69, 366, 431, 367, 69, 69, 69, 69, 69, 69, 431, 369, 370, 69, 69, 371, 69, 69, 69, 69, 69, 69, 377, 69, 69, 373, 69, 69, 375, 372, 69, 69, 69, 69, 431, 374, 69, 69, 69, 69, 69, 69, 431, 69, 69, 69, 69, 69, 69, 378, 69, 69, 376, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 381, 69, 69, 69, 69, 69, 69, 379, 380, 382, 69, 69, 69, 69, 431, 384, 431, 383, 69, 69, 69, 69, 69, 69, 69, 69, 386, 69, 69, 69, 69, 431, 385, 69, 69, 388, 69, 69, 69, 69, 69, 69, 387, 431, 390, 69, 69, 69, 69, 389, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 392, 69, 69, 394, 69, 69, 69, 69, 69, 69, 391, 69, 69, 69, 69, 393, 395, 398, 431, 396, 69, 69, 431, 399, 400, 431, 69, 69, 431, 397, 69, 69, 69, 69, 402, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 401, 431, 69, 69, 431, 403, 404, 69, 69, 431, 407, 69, 69, 69, 69, 69, 69, 408, 69, 69, 431, 409, 405, 69, 69, 406, 410, 69, 69, 69, 69, 431, 411, 69, 69, 69, 69, 69, 69, 69, 69, 413, 69, 69, 69, 69, 69, 69, 69, 69, 431, 412, 414, 69, 69, 69, 69, 415, 69, 69, 417, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 431, 416, 431, 419, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 431, 420, 69, 69, 431, 418, 69, 69, 69, 69, 69, 69, 69, 69, 426, 431, 421, 431, 431, 431, 422, 431, 431, 423, 431, 427, 431, 428, 431, 424, 431, 425, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 429, 431, 431, 430, 46, 46, 46, 46, 46, 46, 46, 46, 50, 50, 50, 50, 50, 50, 50, 50, 56, 56, 57, 431, 57, 57, 57, 57, 57, 57, 70, 70, 70, 125, 431, 431, 125, 431, 125, 125, 125, 127, 431, 431, 127, 127, 127, 127, 127, 130, 431, 431, 431, 130, 130, 130, 130, 134, 431, 134, 134, 134, 134, 134, 134, 137, 431, 431, 137, 137, 137, 137, 137, 144, 144, 69, 69, 69, 7, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431 } ; static yyconst flex_int16_t yy_chk[1473] = { 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 4, 4, 135, 3, 134, 4, 5, 5, 5, 6, 6, 6, 15, 15, 16, 19, 19, 16, 20, 20, 131, 22, 22, 21, 21, 49, 23, 23, 49, 26, 26, 44, 44, 130, 5, 22, 20, 6, 17, 21, 17, 17, 23, 24, 24, 17, 17, 67, 17, 25, 25, 39, 39, 24, 44, 17, 27, 27, 25, 44, 28, 28, 26, 33, 33, 17, 17, 26, 63, 26, 67, 17, 29, 29, 30, 30, 39, 31, 31, 127, 17, 28, 127, 17, 58, 27, 32, 32, 28, 33, 27, 28, 128, 27, 28, 128, 33, 29, 31, 34, 34, 35, 35, 36, 36, 30, 29, 30, 31, 37, 37, 31, 38, 38, 31, 64, 29, 30, 64, 64, 32, 57, 40, 40, 36, 42, 42, 54, 36, 41, 41, 43, 43, 34, 45, 45, 143, 36, 70, 70, 52, 35, 71, 71, 37, 50, 37, 96, 96, 38, 40, 40, 38, 48, 41, 66, 71, 41, 42, 143, 43, 40, 66, 42, 40, 43, 41, 216, 45, 59, 59, 62, 62, 41, 59, 59, 96, 62, 66, 72, 72, 74, 74, 73, 73, 75, 75, 66, 18, 72, 216, 74, 76, 76, 59, 59, 73, 62, 75, 77, 77, 76, 78, 78, 79, 79, 80, 80, 81, 81, 82, 82, 83, 83, 14, 84, 84, 85, 85, 141, 86, 86, 11, 77, 88, 88, 91, 91, 87, 87, 89, 89, 90, 90, 78, 82, 84, 281, 85, 92, 92, 7, 81, 79, 141, 80, 93, 93, 94, 94, 83, 83, 86, 86, 87, 95, 95, 97, 97, 87, 98, 98, 281, 89, 88, 0, 91, 99, 99, 0, 90, 100, 100, 0, 92, 101, 101, 93, 92, 102, 102, 0, 94, 103, 103, 104, 104, 105, 105, 106, 106, 0, 95, 107, 107, 0, 97, 0, 99, 108, 108, 109, 109, 283, 100, 0, 99, 110, 110, 106, 0, 102, 105, 0, 101, 111, 111, 112, 112, 113, 113, 108, 107, 0, 104, 103, 283, 107, 109, 0, 109, 114, 114, 115, 115, 116, 116, 0, 112, 0, 109, 110, 111, 117, 117, 118, 118, 0, 113, 120, 120, 119, 119, 0, 112, 0, 121, 121, 139, 139, 111, 0, 115, 114, 122, 122, 123, 123, 124, 124, 115, 138, 138, 0, 118, 116, 138, 138, 117, 116, 119, 140, 140, 118, 144, 121, 120, 121, 145, 145, 0, 144, 122, 145, 0, 123, 138, 138, 146, 146, 147, 147, 148, 148, 0, 124, 0, 144, 149, 149, 0, 146, 149, 150, 150, 148, 144, 151, 151, 152, 152, 153, 153, 154, 154, 155, 155, 156, 156, 150, 158, 158, 0, 157, 157, 159, 159, 151, 160, 160, 161, 161, 162, 162, 154, 163, 163, 0, 156, 164, 164, 165, 165, 158, 0, 153, 155, 154, 157, 167, 167, 166, 166, 168, 168, 0, 163, 169, 169, 170, 170, 0, 159, 165, 164, 161, 160, 171, 171, 0, 162, 162, 166, 0, 167, 172, 172, 173, 173, 174, 174, 175, 175, 0, 170, 168, 177, 177, 169, 176, 176, 169, 178, 178, 181, 181, 172, 180, 180, 179, 179, 182, 182, 0, 174, 171, 183, 183, 184, 184, 185, 185, 0, 186, 186, 175, 187, 187, 176, 178, 179, 182, 180, 0, 188, 188, 189, 189, 190, 190, 191, 191, 0, 184, 194, 194, 192, 192, 193, 193, 195, 195, 0, 183, 196, 196, 0, 187, 0, 197, 197, 185, 186, 188, 198, 198, 199, 199, 0, 189, 200, 200, 0, 193, 201, 201, 0, 191, 190, 192, 202, 202, 0, 194, 203, 203, 204, 204, 205, 205, 195, 206, 206, 196, 197, 200, 207, 207, 208, 208, 199, 0, 198, 209, 209, 202, 210, 210, 211, 211, 215, 217, 217, 220, 220, 204, 0, 215, 203, 208, 207, 205, 218, 218, 209, 0, 218, 0, 211, 0, 206, 219, 219, 215, 0, 219, 0, 210, 221, 221, 222, 222, 215, 223, 223, 224, 224, 0, 221, 225, 225, 226, 226, 227, 227, 228, 228, 229, 229, 230, 230, 231, 231, 232, 232, 222, 233, 233, 234, 234, 235, 235, 236, 236, 0, 237, 237, 0, 224, 0, 238, 238, 0, 227, 0, 229, 225, 239, 239, 240, 240, 241, 241, 0, 232, 242, 242, 234, 0, 231, 243, 243, 244, 244, 0, 233, 237, 245, 245, 0, 235, 236, 238, 0, 246, 246, 247, 247, 248, 248, 241, 249, 249, 250, 250, 251, 251, 244, 252, 252, 254, 254, 242, 253, 253, 255, 255, 243, 0, 256, 256, 257, 257, 258, 258, 250, 245, 246, 259, 259, 0, 248, 0, 252, 253, 0, 255, 260, 260, 261, 261, 262, 262, 251, 256, 0, 254, 263, 263, 0, 257, 264, 264, 265, 265, 0, 266, 266, 267, 267, 0, 258, 268, 268, 269, 269, 262, 259, 270, 270, 271, 271, 272, 272, 260, 0, 265, 0, 261, 266, 264, 263, 273, 273, 274, 274, 275, 275, 0, 267, 276, 276, 277, 277, 271, 278, 278, 279, 279, 271, 280, 280, 0, 271, 0, 272, 269, 284, 284, 273, 0, 274, 285, 285, 286, 286, 287, 287, 288, 288, 289, 289, 279, 290, 290, 280, 275, 286, 291, 291, 0, 277, 278, 292, 292, 293, 293, 294, 294, 295, 295, 0, 288, 296, 296, 297, 297, 0, 298, 298, 299, 299, 287, 300, 300, 301, 301, 294, 302, 302, 303, 303, 304, 304, 305, 305, 0, 306, 306, 0, 297, 0, 295, 298, 296, 0, 300, 307, 307, 299, 308, 308, 309, 309, 310, 310, 311, 311, 305, 312, 312, 302, 306, 0, 301, 0, 313, 313, 314, 314, 315, 315, 316, 316, 317, 317, 318, 318, 307, 319, 319, 0, 320, 320, 0, 308, 322, 322, 309, 313, 0, 314, 0, 310, 321, 321, 0, 316, 312, 323, 323, 324, 324, 319, 325, 325, 0, 317, 320, 315, 326, 326, 327, 327, 329, 329, 0, 321, 328, 328, 330, 330, 324, 331, 331, 322, 0, 323, 332, 332, 333, 333, 334, 334, 0, 326, 327, 335, 335, 328, 336, 336, 339, 339, 340, 340, 339, 341, 341, 332, 342, 342, 334, 330, 343, 343, 344, 344, 0, 333, 345, 345, 346, 346, 347, 347, 0, 348, 348, 349, 349, 350, 350, 342, 351, 351, 336, 352, 352, 353, 353, 354, 354, 355, 355, 356, 356, 347, 357, 357, 358, 358, 359, 359, 343, 344, 348, 360, 360, 361, 361, 0, 354, 0, 353, 362, 362, 363, 363, 364, 364, 365, 365, 357, 366, 366, 367, 367, 0, 356, 368, 368, 360, 369, 369, 370, 370, 372, 372, 358, 0, 365, 371, 371, 373, 373, 361, 374, 374, 375, 375, 376, 376, 377, 377, 378, 378, 379, 379, 369, 380, 380, 372, 381, 381, 382, 382, 383, 383, 368, 384, 384, 385, 385, 371, 373, 378, 0, 374, 386, 386, 0, 379, 381, 0, 387, 387, 0, 375, 388, 388, 390, 390, 384, 389, 389, 391, 391, 392, 392, 393, 393, 395, 395, 382, 0, 394, 394, 0, 385, 387, 396, 396, 0, 390, 397, 397, 398, 398, 399, 399, 391, 400, 400, 0, 393, 388, 401, 401, 389, 394, 402, 402, 403, 403, 0, 396, 404, 404, 405, 405, 406, 406, 407, 407, 400, 408, 408, 409, 409, 410, 410, 411, 411, 0, 398, 402, 412, 412, 413, 413, 404, 414, 414, 407, 415, 415, 416, 416, 417, 417, 418, 418, 419, 419, 420, 420, 0, 406, 0, 413, 421, 421, 422, 422, 423, 423, 424, 424, 425, 425, 0, 416, 426, 426, 0, 412, 427, 427, 428, 428, 429, 429, 430, 430, 423, 0, 417, 0, 0, 0, 419, 0, 0, 420, 0, 426, 0, 427, 0, 421, 0, 422, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 428, 0, 0, 429, 432, 432, 432, 432, 432, 432, 432, 432, 433, 433, 433, 433, 433, 433, 433, 433, 434, 434, 435, 0, 435, 435, 435, 435, 435, 435, 436, 436, 436, 437, 0, 0, 437, 0, 437, 437, 437, 438, 0, 0, 438, 438, 438, 438, 438, 439, 0, 0, 0, 439, 439, 439, 439, 440, 0, 440, 440, 440, 440, 440, 440, 441, 0, 0, 441, 441, 441, 441, 441, 442, 442, 443, 443, 443, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431, 431 } ; static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; extern int asm__flex_debug; int asm__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 *asm_text; #line 1 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" #define YY_NO_INPUT 1 #line 14 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" #include #include "tokenizer.h" #line 965 "asmlexer.cpp" #define INITIAL 0 #define comment 1 #define string_literal 2 #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 asm_lex_destroy (void ); int asm_get_debug (void ); void asm_set_debug (int debug_flag ); YY_EXTRA_TYPE asm_get_extra (void ); void asm_set_extra (YY_EXTRA_TYPE user_defined ); FILE *asm_get_in (void ); void asm_set_in (FILE * _in_str ); FILE *asm_get_out (void ); void asm_set_out (FILE * _out_str ); yy_size_t asm_get_leng (void ); char *asm_get_text (void ); int asm_get_lineno (void ); void asm_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 asm_wrap (void ); #else extern int asm_wrap (void ); #endif #endif #ifndef YY_NO_UNPUT #endif #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( asm_text, asm_leng, 1, asm_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( asm_in )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ if ( c == '\n' ) \ buf[n++] = (char) c; \ if ( c == EOF && ferror( asm_in ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ else \ { \ errno=0; \ while ( (result = fread(buf, 1, max_size, asm_in))==0 && ferror(asm_in)) \ { \ if( errno != EINTR) \ { \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ break; \ } \ errno=0; \ clearerr(asm_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 asm_lex (void); #define YY_DECL int asm_lex (void) #endif /* !YY_DECL */ /* Code executed at the beginning of each rule, after asm_text and asm_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 /*LINTED*/break; #endif #define YY_RULE_SETUP \ YY_USER_ACTION /** The main scanner function which does all the work. */ YY_DECL { yy_state_type yy_current_state; char *yy_cp, *yy_bp; int yy_act; if ( !(yy_init) ) { (yy_init) = 1; #ifdef YY_USER_INIT YY_USER_INIT; #endif if ( ! (yy_start) ) (yy_start) = 1; /* first start state */ if ( ! asm_in ) asm_in = stdin; if ( ! asm_out ) asm_out = stdout; if ( ! YY_CURRENT_BUFFER ) { asm_ensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = asm__create_buffer(asm_in,YY_BUF_SIZE ); } asm__load_buffer_state( ); } { #line 22 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" #line 1185 "asmlexer.cpp" while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ { yy_cp = (yy_c_buf_p); /* Support of asm_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 { 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 >= 432 ) 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] != 1415 ); 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 23 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 2: YY_RULE_SETUP #line 24 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 3: YY_RULE_SETUP #line 25 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 4: YY_RULE_SETUP #line 26 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 5: YY_RULE_SETUP #line 27 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 6: YY_RULE_SETUP #line 28 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 7: YY_RULE_SETUP #line 29 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 8: YY_RULE_SETUP #line 30 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 9: YY_RULE_SETUP #line 31 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 10: YY_RULE_SETUP #line 32 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 11: YY_RULE_SETUP #line 33 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 12: YY_RULE_SETUP #line 34 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 13: YY_RULE_SETUP #line 35 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 14: YY_RULE_SETUP #line 36 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 15: YY_RULE_SETUP #line 37 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 16: YY_RULE_SETUP #line 38 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 17: YY_RULE_SETUP #line 39 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 18: YY_RULE_SETUP #line 40 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 19: YY_RULE_SETUP #line 41 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 20: YY_RULE_SETUP #line 42 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 21: YY_RULE_SETUP #line 43 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 22: YY_RULE_SETUP #line 44 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 23: YY_RULE_SETUP #line 45 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 24: YY_RULE_SETUP #line 46 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 25: YY_RULE_SETUP #line 47 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 26: YY_RULE_SETUP #line 48 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 27: YY_RULE_SETUP #line 49 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 28: YY_RULE_SETUP #line 51 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 29: YY_RULE_SETUP #line 52 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 30: YY_RULE_SETUP #line 53 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 31: YY_RULE_SETUP #line 54 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 32: YY_RULE_SETUP #line 55 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 33: YY_RULE_SETUP #line 56 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 34: YY_RULE_SETUP #line 57 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 35: YY_RULE_SETUP #line 58 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 36: YY_RULE_SETUP #line 59 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 37: YY_RULE_SETUP #line 60 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 38: YY_RULE_SETUP #line 61 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 39: YY_RULE_SETUP #line 62 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 40: YY_RULE_SETUP #line 63 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 41: YY_RULE_SETUP #line 64 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 42: YY_RULE_SETUP #line 65 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 43: YY_RULE_SETUP #line 66 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 44: YY_RULE_SETUP #line 67 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 45: YY_RULE_SETUP #line 68 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 46: YY_RULE_SETUP #line 69 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 47: YY_RULE_SETUP #line 70 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 48: YY_RULE_SETUP #line 71 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 49: YY_RULE_SETUP #line 72 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 50: YY_RULE_SETUP #line 73 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 51: YY_RULE_SETUP #line 74 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 52: YY_RULE_SETUP #line 75 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 53: YY_RULE_SETUP #line 76 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 54: YY_RULE_SETUP #line 77 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 55: YY_RULE_SETUP #line 78 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 56: YY_RULE_SETUP #line 79 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 57: YY_RULE_SETUP #line 80 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 58: YY_RULE_SETUP #line 81 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 59: YY_RULE_SETUP #line 82 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 60: YY_RULE_SETUP #line 83 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 61: YY_RULE_SETUP #line 84 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 62: YY_RULE_SETUP #line 85 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 63: YY_RULE_SETUP #line 86 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 64: YY_RULE_SETUP #line 87 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 65: YY_RULE_SETUP #line 88 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 66: YY_RULE_SETUP #line 89 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 67: YY_RULE_SETUP #line 90 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 68: YY_RULE_SETUP #line 91 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 69: YY_RULE_SETUP #line 92 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 70: YY_RULE_SETUP #line 93 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 71: YY_RULE_SETUP #line 94 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 72: YY_RULE_SETUP #line 95 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 73: YY_RULE_SETUP #line 96 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 74: YY_RULE_SETUP #line 97 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 75: YY_RULE_SETUP #line 99 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 76: YY_RULE_SETUP #line 100 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 77: YY_RULE_SETUP #line 101 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 78: YY_RULE_SETUP #line 102 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 79: YY_RULE_SETUP #line 103 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 80: YY_RULE_SETUP #line 104 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 81: YY_RULE_SETUP #line 106 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { BEGIN(comment); return(TOKENIZER_COMMENT); } YY_BREAK case 82: YY_RULE_SETUP #line 107 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_COMMENT); } YY_BREAK case 83: YY_RULE_SETUP #line 108 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_COMMENT); } YY_BREAK case 84: /* rule 84 can match eol */ YY_RULE_SETUP #line 109 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_NEWLINE); } YY_BREAK case 85: YY_RULE_SETUP #line 110 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_NEWLINE); } YY_BREAK case 86: /* rule 86 can match eol */ YY_RULE_SETUP #line 111 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_NEWLINE); } YY_BREAK case 87: YY_RULE_SETUP #line 112 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { BEGIN(INITIAL); return(TOKENIZER_COMMENT); } YY_BREAK case 88: YY_RULE_SETUP #line 114 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_COMMENT); } YY_BREAK case 89: YY_RULE_SETUP #line 116 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_DIRECTIVE); } YY_BREAK case 90: YY_RULE_SETUP #line 118 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { BEGIN(string_literal); return(TOKENIZER_LITERAL); } YY_BREAK case 91: YY_RULE_SETUP #line 119 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 92: /* rule 92 can match eol */ YY_RULE_SETUP #line 120 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_NEWLINE); } YY_BREAK case 93: YY_RULE_SETUP #line 121 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_NEWLINE); } YY_BREAK case 94: /* rule 94 can match eol */ YY_RULE_SETUP #line 122 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_NEWLINE); } YY_BREAK case 95: YY_RULE_SETUP #line 123 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { BEGIN(INITIAL); return(TOKENIZER_LITERAL); } YY_BREAK case 96: YY_RULE_SETUP #line 126 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 97: YY_RULE_SETUP #line 127 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 98: YY_RULE_SETUP #line 128 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 99: YY_RULE_SETUP #line 129 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 100: YY_RULE_SETUP #line 130 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 101: YY_RULE_SETUP #line 131 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 102: YY_RULE_SETUP #line 132 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 103: YY_RULE_SETUP #line 133 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 104: YY_RULE_SETUP #line 134 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 105: YY_RULE_SETUP #line 135 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 106: YY_RULE_SETUP #line 136 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 107: YY_RULE_SETUP #line 137 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 108: YY_RULE_SETUP #line 138 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 109: YY_RULE_SETUP #line 139 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 110: YY_RULE_SETUP #line 140 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 111: YY_RULE_SETUP #line 141 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 112: YY_RULE_SETUP #line 143 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 113: YY_RULE_SETUP #line 144 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 114: YY_RULE_SETUP #line 145 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 115: YY_RULE_SETUP #line 147 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 116: YY_RULE_SETUP #line 148 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 117: /* rule 117 can match eol */ YY_RULE_SETUP #line 150 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_NEWLINE); } YY_BREAK case 118: /* rule 118 can match eol */ YY_RULE_SETUP #line 151 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_NEWLINE); } YY_BREAK case 119: YY_RULE_SETUP #line 152 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_NEWLINE); } YY_BREAK case 120: YY_RULE_SETUP #line 153 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_TEXT); } YY_BREAK case 121: YY_RULE_SETUP #line 154 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_TEXT); } YY_BREAK case 122: YY_RULE_SETUP #line 155 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" { return(TOKENIZER_TEXT); } YY_BREAK case 123: YY_RULE_SETUP #line 157 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" ECHO; YY_BREAK #line 1863 "asmlexer.cpp" 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_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 asm_in at a new source and called * asm_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 = asm_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 ( asm_wrap( ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up * asm_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 user's declarations */ } /* end of asm_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) { char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; char *source = (yytext_ptr); yy_size_t 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 = (yy_size_t) ((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_LVALUE; 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. */ asm_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; asm_restart(asm_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 ((int) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) asm_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) { yy_state_type yy_current_state; char *yy_cp; yy_current_state = (yy_start); for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) { 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 >= 432 ) 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 ) { int yy_is_jam; char *yy_cp = (yy_c_buf_p); 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 >= 432 ) 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 == 431); return yy_is_jam ? 0 : yy_current_state; } #ifndef YY_NO_UNPUT #endif #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. */ asm_restart(asm_in ); /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { if ( asm_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 asm_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 asm_restart (FILE * input_file ) { if ( ! YY_CURRENT_BUFFER ){ asm_ensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = asm__create_buffer(asm_in,YY_BUF_SIZE ); } asm__init_buffer(YY_CURRENT_BUFFER,input_file ); asm__load_buffer_state( ); } /** Switch to a different input buffer. * @param new_buffer The new input buffer. * */ void asm__switch_to_buffer (YY_BUFFER_STATE new_buffer ) { /* TODO. We should be able to replace this entire function body * with * asm_pop_buffer_state(); * asm_push_buffer_state(new_buffer); */ asm_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; asm__load_buffer_state( ); /* We don't actually know whether we did this switch during * EOF (asm_wrap()) processing, but the only time this flag * is looked at is after asm_wrap() is called, so it's safe * to go ahead and always set it. */ (yy_did_buffer_switch_on_eof) = 1; } static void asm__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; asm_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 asm__create_buffer (FILE * file, int size ) { YY_BUFFER_STATE b; b = (YY_BUFFER_STATE) asm_alloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in asm__create_buffer()" ); b->yy_buf_size = (yy_size_t)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 *) asm_alloc(b->yy_buf_size + 2 ); if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in asm__create_buffer()" ); b->yy_is_our_buffer = 1; asm__init_buffer(b,file ); return b; } /** Destroy the buffer. * @param b a buffer created with asm__create_buffer() * */ void asm__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 ) asm_free((void *) b->yy_ch_buf ); asm_free((void *) b ); } /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, * such as during a asm_restart() or at EOF. */ static void asm__init_buffer (YY_BUFFER_STATE b, FILE * file ) { int oerrno = errno; asm__flush_buffer(b ); b->yy_input_file = file; b->yy_fill_buffer = 1; /* If b is the current buffer, then asm__init_buffer was _probably_ * called from asm_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 asm__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 ) asm__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 asm_push_buffer_state (YY_BUFFER_STATE new_buffer ) { if (new_buffer == NULL) return; asm_ensure_buffer_stack(); /* This block is copied from asm__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 asm__switch_to_buffer. */ asm__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 asm_pop_buffer_state (void) { if (!YY_CURRENT_BUFFER) return; asm__delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; if ((yy_buffer_stack_top) > 0) --(yy_buffer_stack_top); if (YY_CURRENT_BUFFER) { asm__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 asm_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; /* After all that talk, this was set to 1 anyways... */ (yy_buffer_stack) = (struct yy_buffer_state**)asm_alloc (num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in asm_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. */ yy_size_t grow_size = 8 /* arbitrary grow size */; num_to_alloc = (yy_buffer_stack_max) + grow_size; (yy_buffer_stack) = (struct yy_buffer_state**)asm_realloc ((yy_buffer_stack), num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in asm_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 asm__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) asm_alloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in asm__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; asm__switch_to_buffer(b ); return b; } /** Setup the input buffer state to scan a string. The next call to asm_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 * asm__scan_bytes() instead. */ YY_BUFFER_STATE asm__scan_string (yyconst char * yystr ) { return asm__scan_bytes(yystr,strlen(yystr) ); } /** Setup the input buffer state to scan the given bytes. The next call to asm_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 asm__scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len ) { YY_BUFFER_STATE b; char *buf; yy_size_t n; yy_size_t i; /* Get memory for full buffer, including space for trailing EOB's. */ n = _yybytes_len + 2; buf = (char *) asm_alloc(n ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in asm__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 = asm__scan_buffer(buf,n ); if ( ! b ) YY_FATAL_ERROR( "bad buffer in asm__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 asm_text. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ asm_text[asm_leng] = (yy_hold_char); \ (yy_c_buf_p) = asm_text + yyless_macro_arg; \ (yy_hold_char) = *(yy_c_buf_p); \ *(yy_c_buf_p) = '\0'; \ asm_leng = yyless_macro_arg; \ } \ while ( 0 ) /* Accessor methods (get/set functions) to struct members. */ /** Get the current line number. * */ int asm_get_lineno (void) { return asm_lineno; } /** Get the input stream. * */ FILE *asm_get_in (void) { return asm_in; } /** Get the output stream. * */ FILE *asm_get_out (void) { return asm_out; } /** Get the length of the current token. * */ yy_size_t asm_get_leng (void) { return asm_leng; } /** Get the current token. * */ char *asm_get_text (void) { return asm_text; } /** Set the current line number. * @param _line_number line number * */ void asm_set_lineno (int _line_number ) { asm_lineno = _line_number; } /** Set the input stream. This does not discard the current * input buffer. * @param _in_str A readable stream. * * @see asm__switch_to_buffer */ void asm_set_in (FILE * _in_str ) { asm_in = _in_str ; } void asm_set_out (FILE * _out_str ) { asm_out = _out_str ; } int asm_get_debug (void) { return asm__flex_debug; } void asm_set_debug (int _bdebug ) { asm__flex_debug = _bdebug ; } static int yy_init_globals (void) { /* Initialization is the same as for the non-reentrant scanner. * This function is called from asm_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 asm_in = stdin; asm_out = stdout; #else asm_in = (FILE *) 0; asm_out = (FILE *) 0; #endif /* For future reference: Set errno on error, since we are called by * asm_lex_init() */ return 0; } /* asm_lex_destroy is for both reentrant and non-reentrant scanners. */ int asm_lex_destroy (void) { /* Pop the buffer stack, destroying each element. */ while(YY_CURRENT_BUFFER){ asm__delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; asm_pop_buffer_state(); } /* Destroy the stack itself. */ asm_free((yy_buffer_stack) ); (yy_buffer_stack) = NULL; /* Reset the globals. This is important in a non-reentrant scanner so the next time * asm_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 ) { 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 ) { int n; for ( n = 0; s[n]; ++n ) ; return n; } #endif void *asm_alloc (yy_size_t size ) { return (void *) malloc( size ); } void *asm_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 asm_free (void * ptr ) { free( (char *) ptr ); /* see asm_realloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" #line 157 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/asmlexer.lpp" cgdb-0.8.0/lib/tokenizer/dlexer.lpp0000664000175000017500000003125513057302460014127 00000000000000%option prefix="d_" %option outfile="lex.yy.c" %option noyywrap %option nounput %option noinput B [01_] D [0-9_] H [0-9a-fA-F_] L [a-zA-Z_] T [0-9a-zA-Z_] SP [cwd] IDENTIFIER {L}+{T}* %{ #include #include "tokenizer.h" int nesting_level; %} %x comment %x nesting_comment %x string_literal %x wysiwyg_literal %x alt_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); } x\" { 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); } \"{SP} { BEGIN(INITIAL); return(TOKENIZER_LITERAL); } r\" { BEGIN(wysiwyg_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); } \"{SP} { BEGIN(INITIAL); return(TOKENIZER_LITERAL); } "`" { BEGIN(alt_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); } "`"{SP} { BEGIN(INITIAL); return(TOKENIZER_LITERAL); } {D}+ { return(TOKENIZER_LITERAL); } {D}+[fF] { return(TOKENIZER_LITERAL); } {D}+i { return(TOKENIZER_LITERAL); } {D}+L { return(TOKENIZER_LITERAL); } {D}+L[uU] { return(TOKENIZER_LITERAL); } {D}+[uU] { return(TOKENIZER_LITERAL); } {D}+[uU]L { return(TOKENIZER_LITERAL); } {D}+[eE]{D}+ { return(TOKENIZER_LITERAL); } {D}+[eE]{D}+[fF] { return(TOKENIZER_LITERAL); } {D}+[eE][-+]{D}+ { return(TOKENIZER_LITERAL); } {D}+[eE][-+]{D}+[fF] { return(TOKENIZER_LITERAL); } 0b{B}+ { return(TOKENIZER_LITERAL); } 0b{B}+L { return(TOKENIZER_LITERAL); } 0b{B}+L[uU] { return(TOKENIZER_LITERAL); } 0b{B}+[uU] { return(TOKENIZER_LITERAL); } 0b{B}+[uU]L { return(TOKENIZER_LITERAL); } 0x{H}+ { return(TOKENIZER_LITERAL); } 0x{H}+L { return(TOKENIZER_LITERAL); } 0x{H}+L[uU] { return(TOKENIZER_LITERAL); } 0x{H}+[uU] { return(TOKENIZER_LITERAL); } 0x{H}+[uU]L { return(TOKENIZER_LITERAL); } 0x{H}+[pP][-+]{D}+ { return(TOKENIZER_LITERAL); } 0x{H}+[pP][-+]{D}+i { return(TOKENIZER_LITERAL); } 0x{H}+[pP][-+]{D}+L { return(TOKENIZER_LITERAL); } 0x{H}+[pP][-+]{D}+L[uU] { return(TOKENIZER_LITERAL); } 0x{H}+[pP][-+]{D}+[uU] { return(TOKENIZER_LITERAL); } 0x{H}+[pP][-+]{D}+[uU]L { return(TOKENIZER_LITERAL); } 0x{H}+.{H}+[pP][-+]{D}+ { return(TOKENIZER_LITERAL); } 0x{H}+.{H}+[pP][-+]{D}+i { return(TOKENIZER_LITERAL); } 0x{H}+.{H}+[pP][-+]{D}+L { return(TOKENIZER_LITERAL); } 0x{H}+.{H}+[pP][-+]{D}+L[uU] { return(TOKENIZER_LITERAL); } 0x{H}+.{H}+[pP][-+]{D}+[uU] { return(TOKENIZER_LITERAL); } 0x{H}+.{H}+[pP][-+]{D}+[uU]L { 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); } %% cgdb-0.8.0/lib/tokenizer/cgdbhelplexer.lpp0000664000175000017500000000627513057302460015460 00000000000000%option prefix="cgdbhelp_" %option outfile="lex.yy.c" %option case-insensitive %option noyywrap %option nounput %option noinput D [0-9] L [a-zA-Z_] %{ /* System Includes */ #include #include "tokenizer.h" %} %% "CGDB" { return(TOKENIZER_KEYWORD); } [`']Statement' { return TOKENIZER_KEYWORD; } [`']Type' { return TOKENIZER_TYPE; } [`']Constant' { return TOKENIZER_LITERAL; } [`']Comment' { return TOKENIZER_COMMENT; } [`']PreProc' { return TOKENIZER_DIRECTIVE; } [`']Normal' { return TOKENIZER_TEXT; } [`']IncSearch' { return TOKENIZER_SEARCH; } [`']StatusLine' { return TOKENIZER_STATUS_BAR; } [`']ExecutingLineArrow' { return TOKENIZER_EXECUTING_LINE_ARROW; } [`']SelectedLineArrow' { return TOKENIZER_SELECTED_LINE_ARROW; } [`']ExecutingLineHighlight' { return TOKENIZER_EXECUTING_LINE_HIGHLIGHT; } [`']SelectedLineHighlight' { return TOKENIZER_SELECTED_LINE_HIGHLIGHT; } [`']ExecutingLineBlock' { return TOKENIZER_EXECUTING_LINE_BLOCK; } [`']SelectedLineBlock' { return TOKENIZER_SELECTED_LINE_BLOCK; } [`']Breakpoint' { return TOKENIZER_ENABLED_BREAKPOINT; } [`']DisabledBreakpoint' { return TOKENIZER_DISABLED_BREAKPOINT; } [`']SelectedLineNr' { return TOKENIZER_SELECTED_LINE_NUMBER; } [`']ScrollModeStatus' { return TOKENIZER_SCROLL_MODE_STATUS; } [`']Logo' { return TOKENIZER_LOGO; } "DarkBlue" { return TOKENIZER_COLOR; } "DarkGreen" { return TOKENIZER_COLOR; } "DarkCyan" { return TOKENIZER_COLOR; } "DarkRed" { return TOKENIZER_COLOR; } "DarkMagenta" { return TOKENIZER_COLOR; } "Brown" { return TOKENIZER_COLOR; } "DarkYellow" { return TOKENIZER_COLOR; } "LightGray" { return TOKENIZER_COLOR; } "LightGrey" { return TOKENIZER_COLOR; } "Gray" { return TOKENIZER_COLOR; } "Grey" { return TOKENIZER_COLOR; } "DarkGray" { return TOKENIZER_COLOR; } "DarkGrey" { return TOKENIZER_COLOR; } "Blue" { return TOKENIZER_COLOR; } "LightBlue" { return TOKENIZER_COLOR; } "Green" { return TOKENIZER_COLOR; } "LightGreen" { return TOKENIZER_COLOR; } "Cyan" { return TOKENIZER_COLOR; } "LightCyan" { return TOKENIZER_COLOR; } "Red" { return TOKENIZER_COLOR; } "LightRed" { return TOKENIZER_COLOR; } "Magenta" { return TOKENIZER_COLOR; } "LightMagenta" { return TOKENIZER_COLOR; } "Yellow" { return TOKENIZER_COLOR; } "LightYellow" { return TOKENIZER_COLOR; } "White" { return TOKENIZER_COLOR; } ^[=]+ { return(TOKENIZER_COMMENT); } ^[\*]+ { return(TOKENIZER_COMMENT); } \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); } %% cgdb-0.8.0/lib/tokenizer/tokenizer.h0000664000175000017500000000535513257311731014317 00000000000000#ifndef __TOKENIZER_H__ #define __TOKENIZER_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, TOKENIZER_SEARCH, TOKENIZER_STATUS_BAR, TOKENIZER_EXECUTING_LINE_ARROW, TOKENIZER_SELECTED_LINE_ARROW, TOKENIZER_EXECUTING_LINE_HIGHLIGHT, TOKENIZER_SELECTED_LINE_HIGHLIGHT, TOKENIZER_EXECUTING_LINE_BLOCK, TOKENIZER_SELECTED_LINE_BLOCK, TOKENIZER_ENABLED_BREAKPOINT, TOKENIZER_DISABLED_BREAKPOINT, TOKENIZER_SELECTED_LINE_NUMBER, TOKENIZER_SCROLL_MODE_STATUS, TOKENIZER_LOGO, TOKENIZER_COLOR, }; enum tokenizer_language_support { TOKENIZER_LANGUAGE_C = TOKENIZER_ENUM_START_POS, TOKENIZER_LANGUAGE_ASM, TOKENIZER_LANGUAGE_D, TOKENIZER_LANGUAGE_GO, TOKENIZER_LANGUAGE_RUST, TOKENIZER_LANGUAGE_ADA, TOKENIZER_LANGUAGE_CGDBHELP, 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); /** * This functions will prepare the tokenizer to parse a particular buffer. * * t: The tokenizer object to work on * * Return: -1 on error. 0 on success */ int tokenizer_set_buffer(struct tokenizer *t, const char *buffer, 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 */ struct token_data { enum tokenizer_type e; const char *data; }; int tokenizer_get_token(struct tokenizer *t, struct token_data *token_data); /* 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_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.8.0/lib/tokenizer/tokenizer_driver.cpp0000664000175000017500000000527013046227664016230 00000000000000#include #include #include #include "tokenizer.h" /** * Get file size from file pointer. * * \param file * file pointer * * \return * file size on success, or -1 on error. */ static long get_file_size(FILE *file) { if (fseek(file, 0, SEEK_END) != -1) { long size; size = ftell(file); fseek(file, 0, SEEK_SET); return size; } return -1; } /** * Read a file into memory. * * @param filename * The filename to read * * @return * The file in memory or NULL on error. * The caller must free the memory. */ static char *load_file(const char *filename) { FILE *file; long file_size; char *result = 0; file = fopen(filename, "rb"); if (file) { file_size = get_file_size(file); if (file_size > 0) { size_t bytes_read; result = (char*)malloc(sizeof(char) * (file_size + 1)); /* Read in the entire file */ bytes_read = fread(result, 1, file_size, file); /* If we had a partial read, bail */ if (bytes_read != file_size) { free(result); result = 0; } else { /* Zero terminate buffer */ result[bytes_read] = 0; } } fclose(file); } return result; } 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; struct token_data tok_data; if (argc != 3) usage(); if (strcmp(argv[2], "c") == 0) l = TOKENIZER_LANGUAGE_C; else if (strcmp(argv[2], "asm") == 0) l = TOKENIZER_LANGUAGE_ASM; else if (strcmp(argv[2], "d") == 0) l = TOKENIZER_LANGUAGE_D; else if (strcmp(argv[2], "go") == 0) l = TOKENIZER_LANGUAGE_GO; else if (strcmp(argv[2], "rust") == 0) l = TOKENIZER_LANGUAGE_GO; else if (strcmp(argv[2], "ada") == 0) l = TOKENIZER_LANGUAGE_ADA; else usage(); char *buffer = load_file(argv[1]); if (tokenizer_set_buffer(t, buffer, l) == -1) { printf("%s:%d tokenizer_set_file error\n", __FILE__, __LINE__); return -1; } while ((ret = tokenizer_get_token(t, &tok_data)) > 0) { printf("Token:\n"); printf("\tNumber: %d\n", tok_data.e); printf("\tType: %s\n", tokenizer_get_printable_enum(tok_data.e)); printf("\tData: %s\n", tok_data.data); } if (ret == 0) printf("finished!\n"); else if (ret == -1) printf("Error!\n"); return 0; } cgdb-0.8.0/lib/tokenizer/adalexer.cpp0000664000175000017500000022621414171036457014431 00000000000000#line 2 "adalexer.cpp" #line 4 "adalexer.cpp" #define YY_INT_ALIGNED short int /* A lexical scanner generated by flex */ #define yy_create_buffer ada__create_buffer #define yy_delete_buffer ada__delete_buffer #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 yylineno ada_lineno #define yyout ada_out #define yyrestart ada_restart #define yytext ada_text #define yywrap ada_wrap #define yyalloc ada_alloc #define yyrealloc ada_realloc #define yyfree ada_free #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 6 #define YY_FLEX_SUBMINOR_VERSION 0 #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 ada_restart(ada_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 #ifndef YY_TYPEDEF_YY_SIZE_T #define YY_TYPEDEF_YY_SIZE_T typedef size_t yy_size_t; #endif extern yy_size_t ada_leng; extern FILE *ada_in, *ada_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) #define YY_LINENO_REWIND_TO(ptr) /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ do \ { \ /* Undo effects of setting up ada_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 ada_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. */ 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 ada_restart()), so that the user can continue scanning by * just pointing ada_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 ada_text is formed. */ static char yy_hold_char; static int yy_n_chars; /* number of characters read into yy_ch_buf */ yy_size_t ada_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 ada_wrap()'s to do buffer switches * instead of setting up a fresh ada_in. A bit of a hack ... */ static int yy_did_buffer_switch_on_eof; void ada_restart (FILE *input_file ); void ada__switch_to_buffer (YY_BUFFER_STATE new_buffer ); YY_BUFFER_STATE ada__create_buffer (FILE *file,int size ); void ada__delete_buffer (YY_BUFFER_STATE b ); void ada__flush_buffer (YY_BUFFER_STATE b ); void ada_push_buffer_state (YY_BUFFER_STATE new_buffer ); void ada_pop_buffer_state (void ); static void ada_ensure_buffer_stack (void ); static void ada__load_buffer_state (void ); static void ada__init_buffer (YY_BUFFER_STATE b,FILE *file ); #define YY_FLUSH_BUFFER ada__flush_buffer(YY_CURRENT_BUFFER ) YY_BUFFER_STATE ada__scan_buffer (char *base,yy_size_t size ); YY_BUFFER_STATE ada__scan_string (yyconst char *yy_str ); YY_BUFFER_STATE ada__scan_bytes (yyconst char *bytes,yy_size_t len ); void *ada_alloc (yy_size_t ); void *ada_realloc (void *,yy_size_t ); void ada_free (void * ); #define yy_new_buffer ada__create_buffer #define yy_set_interactive(is_interactive) \ { \ if ( ! YY_CURRENT_BUFFER ){ \ ada_ensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ ada__create_buffer(ada_in,YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } #define yy_set_bol(at_bol) \ { \ if ( ! YY_CURRENT_BUFFER ){\ ada_ensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ ada__create_buffer(ada_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 */ #define ada_wrap() (/*CONSTCOND*/1) #define YY_SKIP_YYWRAP typedef unsigned char YY_CHAR; FILE *ada_in = (FILE *) 0, *ada_out = (FILE *) 0; typedef int yy_state_type; extern int ada_lineno; int ada_lineno = 1; extern char *ada_text; #ifdef yytext_ptr #undef yytext_ptr #endif #define yytext_ptr ada_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 ); #if defined(__GNUC__) && __GNUC__ >= 3 __attribute__((__noreturn__)) #endif static void yy_fatal_error (yyconst char msg[] ); /* Done after the current pattern has been matched and before the * corresponding action - sets up ada_text. */ #define YY_DO_BEFORE_ACTION \ (yytext_ptr) = yy_bp; \ ada_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 95 #define YY_END_OF_BUFFER 96 /* 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[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 YY_CHAR 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, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 20, 1, 1, 1, 1, 36, 1, 37, 38, 39, 40, 41, 42, 43, 44, 45, 20, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 20, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 YY_CHAR yy_meta[61] = { 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, 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 flex_uint16_t yy_base[405] = { 0, 0, 0, 164, 823, 823, 823, 145, 131, 0, 123, 109, 49, 49, 57, 70, 59, 78, 97, 0, 97, 91, 41, 118, 114, 129, 147, 145, 162, 161, 173, 42, 823, 111, 108, 79, 0, 74, 0, 158, 92, 105, 121, 125, 0, 155, 179, 142, 170, 171, 189, 188, 0, 180, 200, 208, 179, 191, 195, 200, 201, 196, 0, 202, 0, 210, 218, 221, 207, 206, 214, 223, 0, 0, 228, 222, 241, 227, 254, 247, 292, 237, 235, 247, 264, 266, 250, 267, 260, 257, 282, 291, 259, 265, 74, 72, 823, 0, 273, 283, 292, 306, 0, 0, 314, 308, 286, 307, 315, 306, 306, 315, 328, 323, 333, 0, 317, 335, 325, 346, 352, 0, 351, 351, 332, 352, 350, 354, 347, 0, 344, 0, 0, 355, 364, 0, 360, 365, 368, 356, 373, 362, 377, 371, 0, 388, 370, 373, 392, 393, 398, 386, 396, 387, 401, 401, 400, 400, 404, 408, 0, 406, 409, 414, 0, 406, 409, 414, 409, 411, 426, 0, 436, 0, 441, 424, 446, 424, 449, 434, 0, 450, 434, 444, 0, 453, 442, 443, 446, 0, 459, 450, 40, 0, 453, 0, 454, 474, 457, 465, 479, 476, 481, 485, 486, 475, 481, 493, 482, 486, 502, 490, 489, 496, 486, 508, 0, 505, 0, 0, 508, 0, 510, 0, 0, 520, 503, 507, 522, 0, 0, 527, 527, 531, 519, 0, 0, 519, 0, 0, 522, 0, 0, 534, 535, 541, 544, 559, 549, 533, 548, 548, 558, 541, 560, 563, 0, 0, 569, 569, 557, 565, 561, 562, 583, 36, 580, 573, 589, 581, 0, 0, 594, 0, 0, 594, 587, 582, 592, 603, 0, 600, 596, 609, 597, 612, 606, 607, 607, 613, 0, 623, 608, 0, 627, 616, 619, 62, 622, 628, 0, 639, 0, 628, 659, 0, 640, 0, 648, 631, 0, 0, 648, 632, 0, 641, 643, 0, 0, 0, 645, 641, 649, 0, 0, 662, 0, 654, 664, 823, 0, 0, 0, 669, 668, 669, 676, 0, 667, 0, 671, 0, 676, 0, 691, 691, 691, 0, 694, 697, 0, 689, 686, 692, 697, 0, 0, 689, 704, 33, 0, 0, 712, 711, 701, 0, 0, 712, 714, 706, 714, 710, 715, 723, 722, 0, 733, 29, 0, 725, 721, 727, 739, 749, 747, 0, 740, 736, 750, 739, 0, 757, 758, 749, 761, 0, 764, 753, 0, 823, 806, 810, 59, 814, 818 } ; static yyconst flex_int16_t 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 flex_uint16_t yy_nxt[884] = { 0, 4, 5, 6, 5, 7, 8, 9, 4, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 19, 19, 21, 22, 23, 24, 25, 19, 26, 27, 28, 29, 19, 30, 31, 19, 19, 12, 13, 14, 15, 16, 17, 18, 19, 20, 19, 21, 22, 23, 24, 25, 19, 26, 27, 28, 29, 19, 30, 31, 19, 39, 40, 38, 45, 382, 67, 93, 47, 368, 329, 41, 304, 42, 46, 48, 247, 43, 95, 44, 34, 53, 49, 54, 37, 50, 96, 39, 40, 51, 45, 67, 93, 55, 47, 52, 41, 56, 42, 46, 57, 48, 43, 58, 44, 100, 53, 49, 54, 59, 65, 50, 60, 62, 95, 51, 66, 34, 55, 37, 52, 63, 61, 56, 101, 57, 64, 102, 58, 68, 72, 100, 36, 69, 59, 103, 65, 34, 60, 62, 76, 66, 73, 70, 74, 75, 63, 61, 32, 71, 101, 64, 102, 104, 77, 68, 72, 78, 79, 69, 81, 103, 80, 82, 399, 399, 76, 73, 70, 74, 75, 108, 105, 85, 71, 83, 84, 86, 104, 77, 87, 109, 78, 98, 79, 89, 81, 99, 80, 82, 90, 91, 92, 106, 399, 110, 108, 88, 105, 85, 83, 84, 111, 86, 107, 113, 87, 109, 98, 114, 89, 112, 99, 119, 115, 90, 120, 91, 92, 106, 110, 117, 88, 121, 122, 123, 124, 118, 111, 107, 116, 113, 125, 126, 114, 129, 112, 130, 119, 131, 115, 120, 127, 128, 132, 133, 134, 117, 121, 122, 123, 124, 135, 118, 136, 116, 137, 125, 126, 149, 151, 129, 130, 150, 131, 138, 141, 127, 128, 132, 133, 142, 134, 139, 399, 152, 153, 135, 156, 140, 136, 137, 157, 154, 149, 151, 158, 159, 150, 163, 399, 138, 141, 164, 399, 155, 142, 160, 399, 139, 152, 165, 153, 156, 140, 143, 161, 167, 157, 154, 162, 158, 159, 166, 163, 144, 145, 168, 164, 146, 155, 171, 147, 160, 148, 169, 165, 170, 399, 172, 173, 143, 161, 167, 174, 175, 162, 176, 166, 177, 144, 145, 179, 168, 146, 182, 171, 147, 180, 148, 183, 169, 181, 170, 172, 184, 173, 189, 178, 174, 175, 185, 176, 186, 187, 177, 188, 190, 179, 191, 182, 192, 399, 193, 180, 194, 183, 195, 181, 196, 184, 197, 189, 178, 198, 199, 201, 185, 200, 186, 187, 203, 188, 190, 204, 191, 205, 192, 193, 206, 194, 207, 195, 202, 208, 196, 197, 209, 210, 211, 198, 199, 201, 200, 212, 213, 203, 214, 215, 219, 204, 205, 216, 217, 218, 206, 207, 220, 202, 208, 221, 222, 223, 209, 210, 211, 224, 225, 228, 212, 226, 213, 214, 227, 215, 219, 229, 216, 217, 218, 230, 231, 232, 220, 233, 221, 222, 234, 223, 235, 236, 224, 225, 228, 237, 226, 238, 241, 227, 239, 240, 229, 242, 243, 244, 230, 245, 231, 232, 233, 246, 248, 249, 234, 235, 250, 236, 251, 252, 237, 253, 254, 238, 241, 239, 240, 255, 242, 243, 244, 256, 257, 245, 258, 259, 246, 248, 249, 260, 399, 261, 250, 251, 252, 262, 263, 253, 254, 264, 265, 266, 267, 255, 268, 269, 271, 256, 257, 258, 259, 270, 272, 399, 273, 260, 261, 274, 275, 276, 262, 277, 263, 278, 264, 265, 266, 267, 279, 280, 268, 269, 271, 281, 282, 283, 270, 284, 272, 273, 285, 289, 274, 290, 275, 276, 291, 277, 292, 278, 293, 399, 294, 279, 280, 295, 286, 296, 281, 287, 282, 283, 288, 284, 297, 298, 285, 289, 290, 299, 300, 301, 291, 302, 292, 303, 293, 294, 305, 399, 306, 295, 286, 296, 307, 287, 308, 288, 309, 310, 297, 298, 311, 312, 299, 300, 301, 313, 302, 314, 315, 303, 316, 317, 305, 306, 318, 319, 399, 320, 307, 308, 321, 322, 309, 310, 323, 311, 312, 324, 399, 325, 313, 326, 331, 314, 315, 316, 327, 317, 328, 318, 330, 319, 320, 332, 337, 321, 322, 333, 338, 323, 339, 341, 340, 324, 325, 342, 343, 326, 331, 344, 345, 327, 346, 328, 334, 330, 347, 335, 349, 332, 337, 348, 333, 350, 338, 339, 341, 336, 340, 351, 342, 343, 352, 353, 344, 345, 354, 346, 355, 356, 334, 357, 347, 335, 349, 358, 348, 359, 360, 350, 361, 365, 336, 362, 351, 363, 364, 352, 366, 353, 367, 354, 369, 355, 356, 370, 372, 357, 371, 373, 376, 358, 374, 359, 360, 375, 361, 365, 362, 377, 363, 364, 378, 366, 379, 380, 367, 381, 369, 383, 384, 370, 372, 371, 385, 373, 376, 386, 374, 387, 375, 388, 399, 389, 377, 390, 391, 378, 392, 379, 380, 393, 394, 381, 383, 384, 395, 396, 397, 385, 398, 399, 399, 386, 399, 387, 399, 388, 389, 399, 390, 399, 391, 392, 399, 399, 399, 393, 394, 399, 399, 395, 399, 396, 397, 398, 33, 399, 33, 33, 35, 399, 35, 35, 94, 399, 94, 94, 97, 399, 399, 97, 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, 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 flex_int16_t yy_chk[884] = { 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 12, 12, 402, 13, 377, 22, 31, 14, 359, 297, 12, 265, 12, 13, 14, 192, 12, 95, 12, 94, 16, 14, 16, 37, 15, 35, 12, 12, 15, 13, 22, 31, 16, 14, 15, 12, 17, 12, 13, 17, 14, 12, 17, 12, 40, 16, 14, 16, 17, 21, 15, 18, 20, 34, 15, 21, 33, 16, 11, 15, 20, 18, 17, 41, 17, 20, 41, 17, 23, 24, 40, 10, 23, 17, 42, 21, 8, 18, 20, 25, 21, 24, 23, 24, 24, 20, 18, 7, 23, 41, 20, 41, 43, 25, 23, 24, 25, 26, 23, 27, 42, 26, 27, 3, 0, 25, 24, 23, 24, 24, 47, 45, 28, 23, 27, 27, 28, 43, 25, 28, 48, 25, 39, 26, 29, 27, 39, 26, 27, 29, 30, 30, 46, 0, 49, 47, 28, 45, 28, 27, 27, 50, 28, 46, 51, 28, 48, 39, 53, 29, 50, 39, 56, 54, 29, 57, 30, 30, 46, 49, 55, 28, 58, 59, 60, 61, 55, 50, 46, 54, 51, 63, 65, 53, 67, 50, 68, 56, 69, 54, 57, 66, 66, 70, 71, 74, 55, 58, 59, 60, 61, 75, 55, 76, 54, 77, 63, 65, 81, 82, 67, 68, 81, 69, 78, 79, 66, 66, 70, 71, 79, 74, 78, 0, 83, 84, 75, 86, 78, 76, 77, 87, 85, 81, 82, 88, 89, 81, 92, 0, 78, 79, 93, 0, 85, 79, 90, 0, 78, 83, 98, 84, 86, 78, 80, 91, 100, 87, 85, 91, 88, 89, 99, 92, 80, 80, 101, 93, 80, 85, 106, 80, 90, 80, 104, 98, 105, 0, 107, 108, 80, 91, 100, 109, 110, 91, 111, 99, 112, 80, 80, 113, 101, 80, 116, 106, 80, 114, 80, 117, 104, 114, 105, 107, 118, 108, 124, 112, 109, 110, 119, 111, 120, 122, 112, 123, 125, 113, 126, 116, 127, 0, 128, 114, 130, 117, 133, 114, 134, 118, 136, 124, 112, 137, 138, 140, 119, 139, 120, 122, 141, 123, 125, 142, 126, 143, 127, 128, 145, 130, 146, 133, 140, 147, 134, 136, 148, 149, 150, 137, 138, 140, 139, 151, 152, 141, 153, 154, 158, 142, 143, 155, 156, 157, 145, 146, 159, 140, 147, 161, 162, 163, 148, 149, 150, 165, 166, 168, 151, 167, 152, 153, 167, 154, 158, 169, 155, 156, 157, 170, 172, 174, 159, 175, 161, 162, 176, 163, 177, 178, 165, 166, 168, 179, 167, 181, 185, 167, 182, 183, 169, 186, 187, 188, 170, 190, 172, 174, 175, 191, 194, 196, 176, 177, 197, 178, 198, 199, 179, 200, 201, 181, 185, 182, 183, 202, 186, 187, 188, 203, 204, 190, 205, 206, 191, 194, 196, 207, 0, 208, 197, 198, 199, 209, 210, 200, 201, 211, 212, 213, 214, 202, 215, 217, 222, 203, 204, 205, 206, 220, 225, 0, 226, 207, 208, 227, 228, 231, 209, 232, 210, 233, 211, 212, 213, 214, 234, 237, 215, 217, 222, 240, 243, 244, 220, 245, 225, 226, 246, 248, 227, 249, 228, 231, 250, 232, 251, 233, 252, 0, 253, 234, 237, 254, 247, 255, 240, 247, 243, 244, 247, 245, 258, 259, 246, 248, 249, 260, 261, 262, 250, 263, 251, 264, 252, 253, 266, 0, 267, 254, 247, 255, 268, 247, 269, 247, 272, 275, 258, 259, 276, 277, 260, 261, 262, 278, 263, 279, 281, 264, 282, 283, 266, 267, 284, 285, 0, 286, 268, 269, 287, 288, 272, 275, 289, 276, 277, 291, 0, 292, 278, 294, 299, 279, 281, 282, 295, 283, 296, 284, 298, 285, 286, 301, 306, 287, 288, 303, 308, 289, 309, 313, 312, 291, 292, 315, 316, 294, 299, 320, 321, 295, 322, 296, 304, 298, 325, 304, 328, 301, 306, 327, 303, 333, 308, 309, 313, 304, 312, 334, 315, 316, 335, 336, 320, 321, 338, 322, 340, 342, 304, 344, 325, 304, 328, 345, 327, 346, 348, 333, 349, 354, 304, 351, 334, 352, 353, 335, 357, 336, 358, 338, 362, 340, 342, 363, 367, 344, 364, 368, 370, 345, 368, 346, 348, 369, 349, 354, 351, 371, 352, 353, 372, 357, 373, 374, 358, 376, 362, 379, 380, 363, 367, 364, 381, 368, 370, 382, 368, 383, 369, 384, 0, 386, 371, 387, 388, 372, 389, 373, 374, 391, 392, 376, 379, 380, 393, 394, 396, 381, 397, 0, 0, 382, 0, 383, 0, 384, 386, 0, 387, 0, 388, 389, 0, 0, 0, 391, 392, 0, 0, 393, 0, 394, 396, 397, 400, 0, 400, 400, 401, 0, 401, 401, 403, 0, 403, 403, 404, 0, 0, 404, 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, 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; extern int ada__flex_debug; int ada__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 *ada_text; #line 1 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" #define YY_NO_INPUT 1 #line 12 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" /* System Includes */ #include #include "tokenizer.h" #line 823 "adalexer.cpp" #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 ada_lex_destroy (void ); int ada_get_debug (void ); void ada_set_debug (int debug_flag ); YY_EXTRA_TYPE ada_get_extra (void ); void ada_set_extra (YY_EXTRA_TYPE user_defined ); FILE *ada_get_in (void ); void ada_set_in (FILE * _in_str ); FILE *ada_get_out (void ); void ada_set_out (FILE * _out_str ); yy_size_t ada_get_leng (void ); char *ada_get_text (void ); int ada_get_lineno (void ); void ada_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 ada_wrap (void ); #else extern int ada_wrap (void ); #endif #endif #ifndef YY_NO_UNPUT #endif #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( ada_text, ada_leng, 1, ada_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( ada_in )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ if ( c == '\n' ) \ buf[n++] = (char) c; \ if ( c == EOF && ferror( ada_in ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ else \ { \ errno=0; \ while ( (result = fread(buf, 1, max_size, ada_in))==0 && ferror(ada_in)) \ { \ if( errno != EINTR) \ { \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ break; \ } \ errno=0; \ clearerr(ada_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 ada_lex (void); #define YY_DECL int ada_lex (void) #endif /* !YY_DECL */ /* Code executed at the beginning of each rule, after ada_text and ada_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 /*LINTED*/break; #endif #define YY_RULE_SETUP \ YY_USER_ACTION /** The main scanner function which does all the work. */ YY_DECL { yy_state_type yy_current_state; char *yy_cp, *yy_bp; int yy_act; if ( !(yy_init) ) { (yy_init) = 1; #ifdef YY_USER_INIT YY_USER_INIT; #endif if ( ! (yy_start) ) (yy_start) = 1; /* first start state */ if ( ! ada_in ) ada_in = stdin; if ( ! ada_out ) ada_out = stdout; if ( ! YY_CURRENT_BUFFER ) { ada_ensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = ada__create_buffer(ada_in,YY_BUF_SIZE ); } ada__load_buffer_state( ); } { #line 19 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" #line 1041 "adalexer.cpp" while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ { yy_cp = (yy_c_buf_p); /* Support of ada_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 { 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] != 823 ); 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 20 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 2: YY_RULE_SETUP #line 21 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 3: YY_RULE_SETUP #line 22 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 4: YY_RULE_SETUP #line 23 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 5: YY_RULE_SETUP #line 24 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 6: YY_RULE_SETUP #line 25 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 7: YY_RULE_SETUP #line 26 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 8: YY_RULE_SETUP #line 27 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 9: YY_RULE_SETUP #line 28 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 10: YY_RULE_SETUP #line 29 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 11: YY_RULE_SETUP #line 30 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 12: YY_RULE_SETUP #line 31 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 13: YY_RULE_SETUP #line 32 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 14: YY_RULE_SETUP #line 33 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 15: YY_RULE_SETUP #line 34 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 16: YY_RULE_SETUP #line 35 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 17: YY_RULE_SETUP #line 36 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 18: YY_RULE_SETUP #line 38 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 19: YY_RULE_SETUP #line 39 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 20: YY_RULE_SETUP #line 40 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 21: YY_RULE_SETUP #line 41 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 22: YY_RULE_SETUP #line 42 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 23: YY_RULE_SETUP #line 43 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 24: YY_RULE_SETUP #line 44 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 25: YY_RULE_SETUP #line 45 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 26: YY_RULE_SETUP #line 46 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 27: YY_RULE_SETUP #line 47 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 28: YY_RULE_SETUP #line 48 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 29: YY_RULE_SETUP #line 49 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 30: YY_RULE_SETUP #line 50 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 31: YY_RULE_SETUP #line 51 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 32: YY_RULE_SETUP #line 52 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 33: YY_RULE_SETUP #line 53 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 34: YY_RULE_SETUP #line 54 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 35: YY_RULE_SETUP #line 55 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 36: YY_RULE_SETUP #line 56 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 37: YY_RULE_SETUP #line 57 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 38: YY_RULE_SETUP #line 58 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 39: YY_RULE_SETUP #line 59 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 40: YY_RULE_SETUP #line 60 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 41: YY_RULE_SETUP #line 61 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 42: YY_RULE_SETUP #line 62 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 43: YY_RULE_SETUP #line 63 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 44: YY_RULE_SETUP #line 64 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 45: YY_RULE_SETUP #line 65 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 46: YY_RULE_SETUP #line 66 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 47: YY_RULE_SETUP #line 67 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 48: YY_RULE_SETUP #line 68 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 49: YY_RULE_SETUP #line 69 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 50: YY_RULE_SETUP #line 70 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 51: YY_RULE_SETUP #line 71 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 52: YY_RULE_SETUP #line 72 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 53: YY_RULE_SETUP #line 73 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 54: YY_RULE_SETUP #line 74 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 55: YY_RULE_SETUP #line 75 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 56: YY_RULE_SETUP #line 76 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 57: YY_RULE_SETUP #line 77 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 58: YY_RULE_SETUP #line 78 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 59: YY_RULE_SETUP #line 79 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 60: YY_RULE_SETUP #line 80 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 61: YY_RULE_SETUP #line 81 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 62: YY_RULE_SETUP #line 82 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 63: YY_RULE_SETUP #line 83 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 64: YY_RULE_SETUP #line 84 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 65: YY_RULE_SETUP #line 85 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 66: YY_RULE_SETUP #line 86 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 67: YY_RULE_SETUP #line 87 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 68: YY_RULE_SETUP #line 88 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 69: YY_RULE_SETUP #line 89 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 70: YY_RULE_SETUP #line 90 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 71: YY_RULE_SETUP #line 91 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 72: YY_RULE_SETUP #line 92 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 73: YY_RULE_SETUP #line 93 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 74: YY_RULE_SETUP #line 94 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 75: YY_RULE_SETUP #line 95 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 76: YY_RULE_SETUP #line 96 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 77: YY_RULE_SETUP #line 97 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 78: YY_RULE_SETUP #line 98 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 79: YY_RULE_SETUP #line 99 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 80: YY_RULE_SETUP #line 100 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 81: YY_RULE_SETUP #line 101 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 82: YY_RULE_SETUP #line 102 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 83: YY_RULE_SETUP #line 103 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 84: YY_RULE_SETUP #line 104 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 85: YY_RULE_SETUP #line 106 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_COMMENT); } YY_BREAK case 86: YY_RULE_SETUP #line 107 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 87: YY_RULE_SETUP #line 108 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 88: YY_RULE_SETUP #line 109 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 89: /* rule 89 can match eol */ YY_RULE_SETUP #line 111 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_NEWLINE); } YY_BREAK case 90: /* rule 90 can match eol */ YY_RULE_SETUP #line 112 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_NEWLINE); } YY_BREAK case 91: YY_RULE_SETUP #line 113 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_NEWLINE); } YY_BREAK case 92: YY_RULE_SETUP #line 114 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_TEXT); } YY_BREAK case 93: YY_RULE_SETUP #line 115 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_TEXT); } YY_BREAK case 94: YY_RULE_SETUP #line 116 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" { return(TOKENIZER_TEXT); } YY_BREAK case 95: YY_RULE_SETUP #line 117 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" ECHO; YY_BREAK #line 1575 "adalexer.cpp" 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 ada_in at a new source and called * ada_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 = ada_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 ( ada_wrap( ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up * ada_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 user's declarations */ } /* end of ada_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) { char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; char *source = (yytext_ptr); yy_size_t 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 = (yy_size_t) ((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_LVALUE; 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. */ ada_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; ada_restart(ada_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 ((int) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) ada_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) { yy_state_type yy_current_state; char *yy_cp; yy_current_state = (yy_start); for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) { 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 ); */ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) { int yy_is_jam; char *yy_cp = (yy_c_buf_p); 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 #endif #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. */ ada_restart(ada_in ); /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { if ( ada_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 ada_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 ada_restart (FILE * input_file ) { if ( ! YY_CURRENT_BUFFER ){ ada_ensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = ada__create_buffer(ada_in,YY_BUF_SIZE ); } ada__init_buffer(YY_CURRENT_BUFFER,input_file ); ada__load_buffer_state( ); } /** Switch to a different input buffer. * @param new_buffer The new input buffer. * */ void ada__switch_to_buffer (YY_BUFFER_STATE new_buffer ) { /* TODO. We should be able to replace this entire function body * with * ada_pop_buffer_state(); * ada_push_buffer_state(new_buffer); */ ada_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; ada__load_buffer_state( ); /* We don't actually know whether we did this switch during * EOF (ada_wrap()) processing, but the only time this flag * is looked at is after ada_wrap() is called, so it's safe * to go ahead and always set it. */ (yy_did_buffer_switch_on_eof) = 1; } static void ada__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; ada_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 ada__create_buffer (FILE * file, int size ) { YY_BUFFER_STATE b; b = (YY_BUFFER_STATE) ada_alloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in ada__create_buffer()" ); b->yy_buf_size = (yy_size_t)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 *) ada_alloc(b->yy_buf_size + 2 ); if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in ada__create_buffer()" ); b->yy_is_our_buffer = 1; ada__init_buffer(b,file ); return b; } /** Destroy the buffer. * @param b a buffer created with ada__create_buffer() * */ void ada__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 ) ada_free((void *) b->yy_ch_buf ); ada_free((void *) b ); } /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, * such as during a ada_restart() or at EOF. */ static void ada__init_buffer (YY_BUFFER_STATE b, FILE * file ) { int oerrno = errno; ada__flush_buffer(b ); b->yy_input_file = file; b->yy_fill_buffer = 1; /* If b is the current buffer, then ada__init_buffer was _probably_ * called from ada_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 ada__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 ) ada__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 ada_push_buffer_state (YY_BUFFER_STATE new_buffer ) { if (new_buffer == NULL) return; ada_ensure_buffer_stack(); /* This block is copied from ada__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 ada__switch_to_buffer. */ ada__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 ada_pop_buffer_state (void) { if (!YY_CURRENT_BUFFER) return; ada__delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; if ((yy_buffer_stack_top) > 0) --(yy_buffer_stack_top); if (YY_CURRENT_BUFFER) { ada__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 ada_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; /* After all that talk, this was set to 1 anyways... */ (yy_buffer_stack) = (struct yy_buffer_state**)ada_alloc (num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in ada_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. */ yy_size_t grow_size = 8 /* arbitrary grow size */; num_to_alloc = (yy_buffer_stack_max) + grow_size; (yy_buffer_stack) = (struct yy_buffer_state**)ada_realloc ((yy_buffer_stack), num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in ada_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 ada__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) ada_alloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in ada__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; ada__switch_to_buffer(b ); return b; } /** Setup the input buffer state to scan a string. The next call to ada_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 * ada__scan_bytes() instead. */ YY_BUFFER_STATE ada__scan_string (yyconst char * yystr ) { return ada__scan_bytes(yystr,strlen(yystr) ); } /** Setup the input buffer state to scan the given bytes. The next call to ada_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 ada__scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len ) { YY_BUFFER_STATE b; char *buf; yy_size_t n; yy_size_t i; /* Get memory for full buffer, including space for trailing EOB's. */ n = _yybytes_len + 2; buf = (char *) ada_alloc(n ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in ada__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 = ada__scan_buffer(buf,n ); if ( ! b ) YY_FATAL_ERROR( "bad buffer in ada__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 ada_text. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ ada_text[ada_leng] = (yy_hold_char); \ (yy_c_buf_p) = ada_text + yyless_macro_arg; \ (yy_hold_char) = *(yy_c_buf_p); \ *(yy_c_buf_p) = '\0'; \ ada_leng = yyless_macro_arg; \ } \ while ( 0 ) /* Accessor methods (get/set functions) to struct members. */ /** Get the current line number. * */ int ada_get_lineno (void) { return ada_lineno; } /** Get the input stream. * */ FILE *ada_get_in (void) { return ada_in; } /** Get the output stream. * */ FILE *ada_get_out (void) { return ada_out; } /** Get the length of the current token. * */ yy_size_t ada_get_leng (void) { return ada_leng; } /** Get the current token. * */ char *ada_get_text (void) { return ada_text; } /** Set the current line number. * @param _line_number line number * */ void ada_set_lineno (int _line_number ) { ada_lineno = _line_number; } /** Set the input stream. This does not discard the current * input buffer. * @param _in_str A readable stream. * * @see ada__switch_to_buffer */ void ada_set_in (FILE * _in_str ) { ada_in = _in_str ; } void ada_set_out (FILE * _out_str ) { ada_out = _out_str ; } int ada_get_debug (void) { return ada__flex_debug; } void ada_set_debug (int _bdebug ) { ada__flex_debug = _bdebug ; } static int yy_init_globals (void) { /* Initialization is the same as for the non-reentrant scanner. * This function is called from ada_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 ada_in = stdin; ada_out = stdout; #else ada_in = (FILE *) 0; ada_out = (FILE *) 0; #endif /* For future reference: Set errno on error, since we are called by * ada_lex_init() */ return 0; } /* ada_lex_destroy is for both reentrant and non-reentrant scanners. */ int ada_lex_destroy (void) { /* Pop the buffer stack, destroying each element. */ while(YY_CURRENT_BUFFER){ ada__delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; ada_pop_buffer_state(); } /* Destroy the stack itself. */ ada_free((yy_buffer_stack) ); (yy_buffer_stack) = NULL; /* Reset the globals. This is important in a non-reentrant scanner so the next time * ada_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 ) { 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 ) { int n; for ( n = 0; s[n]; ++n ) ; return n; } #endif void *ada_alloc (yy_size_t size ) { return (void *) malloc( size ); } void *ada_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 ada_free (void * ptr ) { free( (char *) ptr ); /* see ada_realloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" #line 117 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/adalexer.lpp" cgdb-0.8.0/lib/tokenizer/dlexer.cpp0000664000175000017500000037443514171036460014132 00000000000000#line 2 "dlexer.cpp" #line 4 "dlexer.cpp" #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 6 #define YY_FLEX_SUBMINOR_VERSION 0 #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 #ifndef YY_TYPEDEF_YY_SIZE_T #define YY_TYPEDEF_YY_SIZE_T typedef size_t yy_size_t; #endif extern yy_size_t 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) #define YY_LINENO_REWIND_TO(ptr) /* 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_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 */ yy_size_t 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,yy_size_t 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 */ #define d_wrap() (/*CONSTCOND*/1) #define YY_SKIP_YYWRAP 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; #ifdef yytext_ptr #undef yytext_ptr #endif #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 ); #if defined(__GNUC__) && __GNUC__ >= 3 __attribute__((__noreturn__)) #endif 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 210 #define YY_END_OF_BUFFER 211 /* 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[732] = { 0, 0, 0, 111, 111, 118, 118, 146, 146, 153, 153, 160, 160, 211, 209, 207, 204, 206, 144, 209, 209, 209, 166, 166, 209, 208, 166, 159, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 111, 113, 114, 112, 118, 122, 123, 119, 120, 146, 147, 148, 150, 210, 153, 154, 155, 157, 210, 160, 161, 162, 164, 205, 127, 0, 0, 110, 117, 126, 166, 0, 167, 169, 171, 0, 168, 0, 0, 0, 0, 0, 208, 208, 166, 208, 167, 169, 171, 166, 208, 208, 208, 168, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 77, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 85, 208, 86, 208, 88, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 152, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 145, 111, 115, 112, 112, 116, 118, 124, 119, 119, 125, 120, 121, 120, 146, 0, 149, 151, 153, 0, 156, 158, 160, 163, 165, 199, 0, 199, 126, 0, 173, 170, 172, 177, 182, 0, 0, 0, 0, 0, 208, 167, 169, 171, 168, 173, 173, 170, 172, 166, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 65, 208, 208, 8, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 80, 208, 208, 208, 208, 208, 208, 208, 208, 6, 208, 208, 208, 208, 208, 208, 90, 208, 208, 91, 208, 208, 208, 208, 208, 208, 208, 208, 208, 41, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 102, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 200, 175, 174, 178, 180, 0, 182, 183, 0, 185, 0, 0, 0, 0, 0, 170, 172, 174, 174, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 5, 67, 9, 208, 7, 69, 71, 208, 208, 12, 208, 10, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 78, 18, 208, 208, 208, 208, 208, 208, 208, 208, 84, 208, 208, 208, 208, 208, 208, 208, 208, 208, 34, 35, 208, 208, 208, 202, 208, 208, 208, 208, 208, 208, 208, 39, 40, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 99, 208, 203, 208, 208, 208, 53, 208, 208, 208, 208, 208, 57, 208, 208, 208, 109, 208, 176, 179, 181, 0, 182, 184, 0, 186, 0, 0, 139, 0, 0, 208, 208, 208, 208, 208, 208, 208, 208, 208, 137, 138, 208, 63, 64, 208, 68, 70, 208, 208, 14, 15, 208, 16, 21, 74, 208, 208, 208, 208, 208, 208, 208, 208, 208, 201, 27, 28, 208, 208, 208, 208, 208, 208, 208, 31, 208, 208, 33, 89, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 42, 208, 44, 208, 208, 208, 208, 208, 208, 100, 208, 208, 208, 101, 208, 208, 208, 51, 52, 54, 55, 208, 208, 208, 208, 59, 108, 208, 0, 0, 187, 0, 0, 0, 0, 136, 208, 208, 208, 208, 208, 134, 208, 208, 208, 66, 208, 13, 208, 208, 208, 76, 208, 23, 208, 208, 19, 20, 208, 208, 208, 25, 208, 29, 208, 128, 208, 208, 129, 208, 208, 208, 131, 208, 208, 208, 94, 95, 43, 45, 208, 96, 47, 48, 49, 97, 208, 208, 208, 104, 105, 208, 56, 208, 208, 208, 208, 0, 0, 189, 191, 188, 0, 0, 141, 0, 208, 208, 208, 208, 208, 133, 208, 208, 11, 208, 73, 208, 208, 22, 208, 79, 81, 208, 26, 208, 208, 208, 36, 208, 130, 92, 208, 208, 208, 208, 208, 103, 208, 107, 208, 60, 61, 193, 187, 190, 192, 143, 0, 140, 208, 208, 2, 62, 3, 208, 4, 72, 75, 208, 24, 208, 83, 208, 208, 208, 37, 208, 208, 208, 208, 98, 106, 58, 195, 197, 194, 189, 191, 188, 142, 1, 135, 208, 208, 208, 30, 32, 87, 93, 38, 208, 208, 196, 198, 190, 192, 132, 17, 208, 46, 208, 208, 208, 208, 50, 208, 208, 82, 0 } ; static yyconst YY_CHAR 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, 10, 1, 11, 12, 13, 14, 14, 14, 14, 14, 14, 14, 14, 1, 1, 1, 1, 1, 1, 15, 16, 16, 16, 16, 17, 18, 19, 19, 19, 19, 19, 20, 19, 19, 19, 21, 19, 19, 19, 19, 22, 19, 19, 19, 19, 19, 1, 23, 1, 1, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 19, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 YY_CHAR yy_meta[51] = { 0, 1, 1, 2, 3, 4, 1, 1, 5, 6, 1, 6, 7, 7, 7, 1, 8, 8, 8, 9, 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_uint16_t yy_base[754] = { 0, 0, 0, 48, 50, 56, 59, 68, 71, 74, 77, 80, 82, 525, 3113, 3113, 3113, 520, 3113, 0, 476, 79, 96, 69, 92, 89, 133, 3113, 156, 161, 199, 176, 195, 232, 126, 167, 266, 208, 184, 237, 240, 247, 172, 298, 251, 336, 305, 324, 243, 0, 3113, 490, 53, 0, 3113, 489, 46, 84, 466, 3113, 481, 96, 468, 447, 3113, 462, 105, 458, 0, 3113, 453, 241, 3113, 0, 444, 430, 3113, 3113, 0, 71, 315, 3113, 44, 403, 136, 3113, 0, 388, 377, 43, 375, 0, 293, 368, 391, 301, 308, 342, 392, 347, 363, 381, 396, 414, 418, 421, 427, 430, 433, 436, 441, 447, 455, 463, 466, 469, 474, 484, 491, 494, 497, 500, 503, 506, 517, 522, 526, 529, 538, 541, 544, 547, 559, 565, 570, 575, 578, 581, 584, 587, 592, 609, 616, 619, 622, 626, 631, 637, 641, 644, 639, 647, 673, 3113, 678, 681, 684, 689, 693, 700, 704, 712, 715, 719, 729, 732, 735, 743, 750, 746, 753, 756, 763, 767, 778, 781, 784, 794, 3113, 0, 3113, 104, 120, 3113, 0, 3113, 95, 145, 3113, 205, 3113, 215, 391, 407, 3113, 3113, 388, 401, 3113, 3113, 0, 3113, 3113, 3113, 390, 380, 0, 800, 805, 3113, 3113, 813, 847, 341, 344, 347, 328, 324, 830, 0, 77, 346, 0, 867, 870, 808, 818, 270, 883, 843, 833, 890, 894, 838, 897, 900, 903, 916, 906, 931, 937, 940, 943, 946, 951, 954, 957, 960, 966, 977, 981, 984, 990, 993, 996, 1001, 1004, 1016, 1011, 1026, 1031, 1034, 1039, 1042, 1047, 1050, 1053, 1058, 1068, 1072, 1078, 1083, 1090, 1093, 1100, 1103, 1106, 1109, 1118, 1122, 1127, 1142, 1145, 1148, 1152, 1157, 1160, 1163, 1169, 1175, 1178, 1186, 1194, 1197, 1200, 1203, 1210, 1215, 1221, 1224, 1227, 1235, 1238, 1241, 1246, 1249, 1252, 1255, 1265, 1275, 1278, 1282, 1287, 1292, 1298, 1301, 1307, 1315, 1320, 1323, 1326, 1329, 1332, 1342, 1336, 1346, 1364, 1368, 1371, 3113, 1374, 3113, 149, 345, 0, 1402, 160, 230, 331, 315, 300, 286, 257, 247, 0, 0, 0, 1377, 1381, 1394, 1397, 1424, 1427, 1431, 1390, 1436, 1442, 1448, 1451, 1455, 1458, 1461, 1465, 1473, 1487, 1492, 1495, 1498, 1501, 1504, 1507, 1510, 1516, 1519, 1526, 1531, 1534, 1537, 1540, 1544, 1547, 1551, 1558, 1565, 1572, 1577, 1584, 1590, 1595, 1598, 1601, 1605, 1608, 1616, 1611, 1620, 1632, 1635, 1645, 1651, 1654, 1660, 1663, 1666, 1670, 1673, 1676, 1679, 1685, 1688, 1697, 1700, 1706, 1710, 1713, 1721, 1724, 1731, 1736, 1740, 1743, 1747, 1750, 1754, 1757, 1760, 1770, 1775, 1778, 1787, 1792, 1797, 1800, 1804, 1809, 1814, 1817, 1822, 1825, 1828, 1832, 1842, 1845, 1849, 1855, 1859, 1862, 1865, 1868, 1876, 3113, 3113, 3113, 151, 262, 3113, 1884, 3113, 260, 242, 3113, 232, 198, 1879, 1887, 1893, 1902, 1905, 1908, 1911, 1916, 1921, 1924, 1928, 1931, 1934, 1937, 1942, 1949, 1952, 1955, 1958, 1961, 1964, 1967, 1970, 1975, 1980, 1983, 1986, 1994, 1997, 2001, 2004, 2008, 2014, 2021, 2024, 2027, 2031, 2034, 2040, 2043, 2052, 2055, 2058, 2063, 2066, 2069, 2077, 2080, 2083, 2089, 2092, 2096, 2100, 2103, 2108, 2111, 2114, 2121, 2124, 2128, 2134, 2141, 2144, 2147, 2152, 2156, 2159, 2162, 2165, 2180, 2173, 2183, 2186, 2189, 2198, 2204, 2208, 2211, 2216, 2219, 2224, 2227, 2230, 2233, 2236, 2239, 2243, 265, 324, 2270, 201, 185, 180, 157, 2249, 2260, 2252, 2263, 2266, 2273, 2285, 2293, 2304, 2308, 2311, 2314, 2317, 2325, 2328, 2333, 2336, 2339, 2342, 2346, 2349, 2354, 2362, 2367, 2370, 2373, 2376, 2379, 2382, 2386, 2392, 2405, 2408, 2411, 2414, 2423, 2426, 2429, 2432, 2435, 2441, 2445, 2451, 2454, 2457, 2461, 2464, 2468, 2471, 2474, 2477, 2481, 2484, 2487, 2490, 2493, 2496, 2499, 2502, 2509, 2512, 2517, 2520, 2523, 301, 156, 3113, 136, 114, 3113, 113, 2529, 2538, 2541, 2548, 2551, 2554, 2559, 2562, 2566, 2569, 2572, 2575, 2582, 2588, 2595, 2598, 2601, 2604, 2607, 2610, 2615, 2618, 2621, 2624, 2635, 2638, 2645, 2648, 2651, 2654, 2657, 2664, 2667, 2671, 2676, 2681, 2684, 2700, 2734, 3113, 3113, 3113, 88, 3113, 2687, 2690, 2695, 2705, 2713, 2716, 2723, 2726, 2729, 2737, 2749, 2752, 2757, 2760, 2763, 2768, 2771, 2774, 2783, 2786, 2792, 2795, 2801, 2804, 346, 109, 3113, 351, 91, 3113, 3113, 2807, 2810, 2816, 2819, 2822, 2825, 2828, 2831, 2837, 2841, 2844, 2848, 3113, 3113, 3113, 3113, 2851, 2854, 2857, 2860, 2863, 2866, 2870, 2873, 2877, 2888, 2892, 2895, 3113, 2931, 2941, 2951, 2961, 2971, 2974, 2983, 2987, 2996, 3006, 3016, 3026, 3036, 3046, 3056, 3066, 3075, 3085, 3089, 3091, 3100, 3104 } ; static yyconst flex_int16_t yy_def[754] = { 0, 731, 1, 732, 732, 733, 733, 734, 734, 735, 735, 736, 736, 731, 731, 731, 731, 731, 731, 737, 738, 731, 731, 22, 731, 739, 739, 731, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 740, 731, 731, 741, 742, 731, 731, 743, 744, 745, 731, 731, 731, 745, 746, 731, 731, 731, 746, 747, 731, 731, 731, 731, 737, 731, 748, 731, 731, 749, 22, 731, 731, 731, 731, 731, 731, 750, 731, 731, 731, 731, 751, 739, 751, 739, 739, 739, 739, 26, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 33, 739, 739, 731, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 731, 740, 731, 741, 741, 731, 742, 731, 743, 743, 731, 744, 731, 744, 745, 745, 731, 731, 746, 746, 731, 731, 747, 731, 731, 731, 731, 731, 749, 731, 731, 731, 731, 731, 752, 731, 731, 731, 731, 731, 751, 751, 751, 751, 751, 751, 739, 739, 739, 26, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 731, 731, 731, 731, 731, 753, 752, 753, 753, 753, 731, 731, 731, 731, 731, 751, 751, 751, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 731, 731, 731, 753, 335, 731, 731, 731, 731, 731, 731, 731, 731, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 731, 753, 731, 731, 731, 731, 731, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 731, 731, 731, 731, 731, 731, 731, 731, 731, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 731, 731, 731, 731, 731, 731, 731, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 731, 731, 731, 731, 731, 731, 731, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 731, 731, 731, 731, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, 0, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731 } ; static yyconst flex_uint16_t yy_nxt[3164] = { 0, 14, 15, 16, 17, 18, 19, 20, 14, 14, 14, 21, 22, 23, 23, 24, 25, 25, 25, 25, 25, 25, 25, 14, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 25, 37, 38, 39, 40, 41, 25, 42, 43, 44, 45, 46, 47, 48, 25, 25, 50, 51, 50, 51, 187, 52, 188, 52, 54, 55, 182, 54, 55, 183, 56, 209, 57, 56, 215, 57, 59, 60, 61, 59, 60, 61, 64, 65, 66, 64, 65, 66, 69, 70, 69, 70, 76, 77, 209, 78, 62, 216, 190, 62, 191, 731, 67, 731, 344, 67, 91, 91, 91, 731, 71, 731, 71, 79, 79, 79, 718, 731, 80, 81, 731, 82, 731, 83, 731, 79, 87, 344, 84, 195, 195, 80, 81, 182, 716, 85, 183, 88, 199, 199, 89, 90, 702, 91, 91, 91, 83, 671, 195, 86, 93, 93, 93, 211, 211, 94, 95, 199, 96, 187, 97, 188, 98, 670, 99, 211, 100, 101, 94, 95, 132, 669, 102, 91, 91, 91, 451, 550, 91, 91, 91, 668, 153, 97, 91, 91, 91, 455, 103, 91, 91, 91, 627, 91, 91, 91, 550, 104, 133, 451, 107, 91, 91, 91, 105, 108, 106, 154, 109, 119, 455, 120, 91, 91, 91, 110, 91, 91, 91, 731, 121, 731, 626, 142, 122, 91, 91, 91, 143, 731, 111, 191, 625, 112, 113, 114, 123, 115, 124, 140, 116, 125, 624, 117, 456, 456, 118, 556, 126, 91, 91, 91, 141, 178, 91, 91, 91, 91, 91, 91, 91, 91, 91, 127, 91, 91, 91, 555, 91, 91, 91, 128, 144, 129, 202, 202, 130, 554, 149, 619, 619, 145, 131, 91, 91, 91, 162, 146, 551, 163, 147, 148, 553, 202, 150, 462, 151, 152, 164, 227, 134, 92, 135, 92, 92, 165, 461, 551, 136, 137, 91, 91, 91, 138, 139, 91, 91, 91, 91, 91, 91, 460, 91, 91, 91, 91, 91, 91, 667, 207, 207, 155, 208, 208, 208, 225, 156, 157, 620, 620, 172, 91, 91, 91, 208, 459, 458, 158, 159, 173, 160, 667, 161, 91, 91, 91, 457, 174, 225, 91, 91, 91, 175, 176, 91, 91, 91, 226, 166, 167, 452, 345, 177, 715, 343, 168, 342, 169, 717, 170, 91, 91, 91, 341, 171, 93, 93, 93, 340, 339, 218, 219, 329, 220, 233, 221, 715, 93, 91, 91, 91, 717, 329, 218, 219, 207, 207, 222, 223, 223, 223, 196, 234, 91, 91, 91, 197, 192, 221, 193, 224, 227, 217, 92, 214, 228, 92, 213, 210, 229, 235, 91, 91, 91, 230, 91, 91, 91, 91, 91, 91, 231, 205, 232, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 203, 237, 91, 91, 91, 201, 236, 238, 91, 91, 91, 242, 196, 239, 198, 244, 91, 91, 91, 197, 240, 243, 192, 241, 91, 91, 91, 91, 91, 91, 91, 91, 91, 194, 245, 91, 91, 91, 193, 246, 247, 185, 180, 248, 251, 91, 91, 91, 75, 252, 249, 250, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 254, 253, 72, 256, 731, 731, 255, 257, 91, 91, 91, 731, 258, 91, 91, 91, 259, 91, 91, 91, 91, 91, 91, 731, 260, 731, 261, 731, 262, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 263, 731, 731, 267, 265, 264, 731, 731, 266, 91, 91, 91, 731, 731, 268, 91, 91, 91, 269, 731, 91, 91, 91, 271, 270, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 731, 272, 91, 91, 91, 731, 273, 274, 731, 275, 731, 731, 281, 276, 731, 731, 277, 731, 278, 91, 91, 91, 731, 279, 731, 280, 91, 91, 91, 91, 91, 91, 91, 91, 91, 731, 91, 91, 91, 731, 282, 91, 91, 91, 731, 283, 285, 91, 91, 91, 731, 91, 91, 91, 91, 91, 91, 91, 91, 91, 731, 731, 284, 292, 731, 288, 731, 286, 287, 290, 291, 293, 731, 92, 731, 731, 294, 731, 731, 289, 731, 731, 92, 91, 91, 91, 731, 295, 91, 91, 91, 91, 91, 91, 91, 91, 91, 731, 296, 91, 91, 91, 298, 91, 91, 91, 731, 299, 302, 731, 91, 91, 91, 297, 91, 91, 91, 305, 301, 731, 300, 303, 91, 91, 91, 91, 91, 91, 731, 91, 91, 91, 731, 306, 731, 731, 308, 304, 307, 91, 91, 91, 91, 91, 91, 91, 91, 91, 309, 731, 310, 311, 731, 91, 91, 91, 91, 91, 91, 312, 91, 91, 91, 91, 91, 91, 91, 91, 91, 731, 315, 317, 313, 91, 91, 91, 314, 91, 91, 91, 731, 731, 316, 319, 731, 320, 318, 321, 91, 91, 91, 91, 91, 91, 91, 91, 91, 731, 731, 323, 731, 324, 731, 322, 91, 91, 91, 731, 731, 325, 330, 330, 330, 326, 731, 208, 208, 208, 91, 91, 91, 331, 330, 211, 211, 731, 327, 208, 91, 91, 91, 332, 731, 333, 331, 211, 328, 207, 207, 731, 223, 223, 223, 91, 91, 91, 731, 731, 91, 91, 91, 731, 223, 91, 91, 91, 333, 335, 335, 335, 731, 335, 335, 335, 731, 336, 337, 338, 355, 335, 350, 335, 335, 335, 335, 335, 335, 223, 223, 223, 223, 223, 223, 346, 349, 337, 347, 731, 731, 223, 338, 731, 224, 91, 91, 91, 346, 731, 731, 347, 91, 91, 91, 731, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 731, 731, 351, 353, 731, 731, 348, 91, 91, 91, 731, 352, 731, 354, 731, 356, 731, 731, 357, 731, 731, 359, 91, 91, 91, 731, 358, 360, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 361, 731, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 731, 362, 365, 91, 91, 91, 731, 364, 731, 366, 731, 731, 367, 369, 91, 91, 91, 363, 91, 91, 91, 91, 91, 91, 731, 731, 368, 91, 91, 91, 91, 91, 91, 91, 91, 91, 370, 731, 91, 91, 91, 91, 91, 91, 731, 372, 371, 377, 91, 91, 91, 373, 378, 91, 91, 91, 731, 731, 374, 731, 731, 375, 376, 91, 91, 91, 381, 380, 91, 91, 91, 91, 91, 91, 379, 731, 91, 91, 91, 91, 91, 91, 731, 383, 91, 91, 91, 91, 91, 91, 91, 91, 91, 382, 385, 91, 91, 91, 387, 731, 731, 384, 731, 731, 386, 91, 91, 91, 389, 91, 91, 91, 731, 731, 388, 91, 91, 91, 731, 391, 91, 91, 91, 392, 731, 731, 390, 91, 91, 91, 91, 91, 91, 393, 731, 731, 394, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 731, 731, 396, 731, 731, 395, 91, 91, 91, 731, 91, 91, 91, 731, 731, 91, 91, 91, 398, 731, 731, 397, 731, 731, 400, 731, 731, 399, 402, 403, 91, 91, 91, 91, 91, 91, 91, 91, 91, 401, 91, 91, 91, 731, 404, 91, 91, 91, 91, 91, 91, 91, 91, 91, 731, 731, 406, 91, 91, 91, 731, 731, 407, 91, 91, 91, 91, 91, 91, 731, 405, 731, 409, 731, 91, 91, 91, 731, 408, 731, 731, 410, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 731, 731, 411, 412, 91, 91, 91, 731, 413, 91, 91, 91, 731, 731, 416, 91, 91, 91, 91, 91, 91, 91, 91, 91, 731, 414, 415, 418, 417, 91, 91, 91, 91, 91, 91, 91, 91, 91, 731, 419, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 731, 731, 420, 731, 731, 421, 424, 91, 91, 91, 422, 731, 731, 423, 731, 428, 426, 91, 91, 91, 91, 91, 91, 425, 91, 91, 91, 427, 731, 91, 91, 91, 731, 430, 91, 91, 91, 731, 731, 429, 91, 91, 91, 91, 91, 91, 731, 731, 431, 91, 91, 91, 434, 731, 731, 432, 433, 91, 91, 91, 731, 435, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 731, 91, 91, 91, 436, 731, 437, 91, 91, 91, 731, 91, 91, 91, 439, 445, 731, 438, 440, 731, 731, 442, 731, 441, 444, 446, 731, 731, 443, 91, 91, 91, 731, 91, 91, 91, 91, 91, 91, 330, 330, 330, 91, 91, 91, 450, 91, 91, 91, 731, 731, 330, 731, 447, 448, 91, 91, 91, 450, 91, 91, 91, 91, 91, 91, 463, 449, 454, 454, 454, 731, 454, 454, 454, 731, 336, 337, 338, 731, 454, 464, 454, 454, 454, 454, 454, 454, 469, 465, 91, 91, 91, 91, 91, 91, 337, 91, 91, 91, 731, 338, 91, 91, 91, 731, 731, 467, 91, 91, 91, 731, 731, 468, 91, 91, 91, 91, 91, 91, 466, 91, 91, 91, 91, 91, 91, 91, 91, 91, 470, 91, 91, 91, 731, 471, 731, 731, 472, 91, 91, 91, 731, 731, 473, 731, 731, 474, 731, 731, 476, 731, 475, 91, 91, 91, 731, 477, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 731, 731, 478, 91, 91, 91, 91, 91, 91, 480, 731, 731, 479, 91, 91, 91, 731, 481, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 731, 91, 91, 91, 91, 91, 91, 731, 91, 91, 91, 731, 731, 484, 482, 91, 91, 91, 485, 731, 483, 487, 91, 91, 91, 731, 731, 486, 489, 91, 91, 91, 731, 491, 91, 91, 91, 488, 731, 731, 490, 91, 91, 91, 731, 731, 492, 91, 91, 91, 731, 493, 91, 91, 91, 91, 91, 91, 91, 91, 91, 731, 91, 91, 91, 91, 91, 91, 91, 91, 91, 494, 731, 91, 91, 91, 497, 91, 91, 91, 731, 731, 495, 731, 731, 496, 498, 500, 731, 91, 91, 91, 91, 91, 91, 731, 731, 499, 731, 731, 501, 502, 91, 91, 91, 731, 731, 503, 91, 91, 91, 91, 91, 91, 731, 731, 504, 91, 91, 91, 91, 91, 91, 91, 91, 91, 731, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 731, 505, 506, 91, 91, 91, 91, 91, 91, 731, 507, 508, 510, 731, 509, 91, 91, 91, 91, 91, 91, 731, 731, 511, 91, 91, 91, 512, 91, 91, 91, 91, 91, 91, 731, 731, 513, 731, 515, 91, 91, 91, 91, 91, 91, 517, 731, 731, 514, 91, 91, 91, 731, 516, 91, 91, 91, 518, 91, 91, 91, 91, 91, 91, 519, 91, 91, 91, 91, 91, 91, 520, 91, 91, 91, 91, 91, 91, 91, 91, 91, 731, 731, 522, 731, 731, 523, 525, 91, 91, 91, 521, 526, 91, 91, 91, 91, 91, 91, 731, 528, 731, 527, 731, 524, 91, 91, 91, 731, 530, 91, 91, 91, 731, 529, 91, 91, 91, 91, 91, 91, 532, 91, 91, 91, 731, 531, 91, 91, 91, 731, 533, 91, 91, 91, 91, 91, 91, 731, 534, 91, 91, 91, 91, 91, 91, 91, 91, 91, 536, 91, 91, 91, 539, 537, 731, 731, 535, 731, 538, 91, 91, 91, 91, 91, 91, 541, 91, 91, 91, 731, 731, 540, 91, 91, 91, 542, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 545, 731, 731, 543, 544, 91, 91, 91, 91, 91, 91, 731, 548, 552, 552, 552, 91, 91, 91, 731, 546, 547, 91, 91, 91, 552, 557, 549, 731, 731, 558, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 731, 559, 91, 91, 91, 731, 560, 91, 91, 91, 91, 91, 91, 561, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 562, 563, 91, 91, 91, 566, 565, 731, 564, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 731, 567, 91, 91, 91, 731, 568, 91, 91, 91, 91, 91, 91, 91, 91, 91, 731, 569, 731, 731, 570, 91, 91, 91, 91, 91, 91, 572, 91, 91, 91, 91, 91, 91, 571, 91, 91, 91, 731, 573, 574, 91, 91, 91, 731, 731, 575, 731, 91, 91, 91, 91, 91, 91, 91, 91, 91, 576, 91, 91, 91, 91, 91, 91, 731, 731, 577, 91, 91, 91, 91, 91, 91, 578, 579, 731, 731, 581, 580, 91, 91, 91, 91, 91, 91, 91, 91, 91, 731, 582, 91, 91, 91, 91, 91, 91, 91, 91, 91, 586, 731, 731, 583, 584, 91, 91, 91, 91, 91, 91, 91, 91, 91, 731, 585, 588, 91, 91, 91, 91, 91, 91, 587, 91, 91, 91, 589, 91, 91, 91, 91, 91, 91, 731, 590, 91, 91, 91, 91, 91, 91, 91, 91, 91, 594, 592, 591, 593, 91, 91, 91, 91, 91, 91, 596, 91, 91, 91, 731, 731, 597, 91, 91, 91, 598, 731, 731, 595, 91, 91, 91, 91, 91, 91, 91, 91, 91, 599, 600, 91, 91, 91, 731, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 731, 602, 731, 603, 604, 91, 91, 91, 601, 731, 731, 605, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 731, 731, 606, 731, 731, 609, 91, 91, 91, 607, 731, 608, 91, 91, 91, 610, 91, 91, 91, 91, 91, 91, 731, 611, 91, 91, 91, 91, 91, 91, 731, 612, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 613, 91, 91, 91, 731, 731, 617, 91, 91, 91, 91, 91, 91, 616, 731, 615, 731, 614, 91, 91, 91, 91, 91, 91, 91, 91, 91, 618, 552, 552, 552, 91, 91, 91, 731, 630, 621, 731, 622, 731, 552, 731, 629, 91, 91, 91, 731, 731, 628, 731, 623, 91, 91, 91, 731, 731, 631, 731, 632, 731, 731, 622, 91, 91, 91, 731, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 731, 731, 634, 633, 635, 91, 91, 91, 91, 91, 91, 731, 636, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 731, 91, 91, 91, 91, 91, 91, 731, 640, 91, 91, 91, 731, 637, 731, 638, 642, 91, 91, 91, 639, 641, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 731, 91, 91, 91, 731, 731, 644, 91, 91, 91, 731, 731, 646, 731, 731, 645, 647, 731, 731, 643, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 731, 731, 648, 731, 731, 649, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 731, 731, 651, 91, 91, 91, 652, 91, 91, 91, 731, 650, 653, 91, 91, 91, 91, 91, 91, 91, 91, 91, 655, 91, 91, 91, 91, 91, 91, 654, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 656, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 731, 659, 731, 657, 91, 91, 91, 91, 91, 91, 731, 658, 91, 91, 91, 665, 665, 665, 666, 666, 666, 731, 660, 661, 91, 91, 91, 665, 662, 731, 666, 731, 664, 91, 91, 91, 91, 91, 91, 663, 731, 731, 672, 91, 91, 91, 91, 91, 91, 91, 91, 91, 731, 674, 91, 91, 91, 91, 91, 91, 673, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 731, 675, 731, 676, 91, 91, 91, 677, 731, 679, 91, 91, 91, 731, 731, 680, 678, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 683, 681, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 682, 731, 731, 684, 686, 731, 731, 685, 91, 91, 91, 91, 91, 91, 731, 688, 731, 687, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 690, 731, 731, 689, 91, 91, 91, 91, 91, 91, 691, 91, 91, 91, 731, 693, 91, 91, 91, 731, 692, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 731, 695, 91, 91, 91, 731, 694, 665, 665, 665, 731, 703, 91, 91, 91, 696, 731, 697, 731, 665, 91, 91, 91, 91, 91, 91, 731, 704, 731, 698, 91, 91, 91, 91, 91, 91, 91, 91, 91, 731, 697, 666, 666, 666, 91, 91, 91, 731, 731, 699, 731, 700, 731, 666, 731, 705, 91, 91, 91, 91, 91, 91, 706, 701, 91, 91, 91, 91, 91, 91, 91, 91, 91, 731, 700, 91, 91, 91, 91, 91, 91, 91, 91, 91, 731, 708, 731, 731, 709, 707, 91, 91, 91, 91, 91, 91, 731, 731, 711, 91, 91, 91, 91, 91, 91, 713, 731, 710, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 731, 714, 712, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 731, 731, 720, 91, 91, 91, 721, 91, 91, 91, 91, 91, 91, 719, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 731, 91, 91, 91, 91, 91, 91, 722, 91, 91, 91, 731, 725, 731, 731, 726, 731, 723, 727, 91, 91, 91, 724, 91, 91, 91, 91, 91, 91, 731, 731, 731, 731, 731, 728, 731, 731, 731, 731, 731, 731, 730, 731, 731, 731, 731, 731, 731, 731, 731, 729, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 73, 73, 74, 731, 74, 74, 74, 74, 74, 74, 74, 74, 92, 92, 92, 179, 731, 731, 179, 731, 179, 179, 179, 179, 179, 181, 731, 731, 181, 181, 181, 181, 181, 181, 181, 184, 731, 731, 184, 184, 731, 184, 184, 184, 184, 186, 731, 731, 186, 186, 186, 186, 186, 186, 186, 189, 731, 731, 189, 189, 189, 189, 189, 189, 189, 192, 731, 731, 731, 192, 192, 192, 192, 192, 192, 196, 731, 731, 731, 196, 196, 196, 196, 196, 196, 200, 731, 731, 200, 200, 200, 200, 200, 200, 204, 731, 204, 204, 204, 204, 204, 204, 204, 204, 206, 731, 731, 206, 206, 206, 206, 206, 206, 206, 212, 212, 91, 91, 91, 334, 731, 334, 334, 334, 334, 334, 334, 334, 334, 453, 453, 13, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731 } ; static yyconst flex_int16_t yy_chk[3164] = { 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, 1, 1, 1, 1, 1, 3, 3, 4, 4, 56, 3, 56, 4, 5, 5, 52, 6, 6, 52, 5, 82, 5, 6, 89, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 12, 12, 21, 21, 82, 21, 7, 89, 57, 8, 57, 23, 9, 79, 220, 10, 25, 25, 25, 186, 11, 186, 12, 22, 22, 22, 700, 181, 22, 22, 181, 22, 23, 22, 79, 22, 24, 220, 22, 61, 61, 22, 22, 182, 697, 22, 182, 24, 66, 66, 24, 24, 670, 34, 34, 34, 22, 627, 61, 22, 26, 26, 26, 84, 84, 26, 26, 66, 26, 187, 26, 187, 26, 625, 26, 84, 26, 26, 26, 26, 34, 624, 26, 28, 28, 28, 332, 453, 29, 29, 29, 622, 42, 26, 35, 35, 35, 336, 28, 42, 42, 42, 556, 31, 31, 31, 453, 28, 35, 332, 29, 38, 38, 38, 28, 29, 28, 42, 29, 31, 336, 31, 32, 32, 32, 29, 30, 30, 30, 189, 31, 189, 555, 38, 31, 37, 37, 37, 38, 191, 30, 191, 554, 30, 30, 30, 32, 30, 32, 37, 30, 32, 553, 30, 337, 337, 30, 462, 32, 33, 33, 33, 37, 48, 39, 39, 39, 40, 40, 40, 48, 48, 48, 33, 41, 41, 41, 461, 44, 44, 44, 33, 39, 33, 71, 71, 33, 459, 41, 550, 550, 39, 33, 36, 36, 36, 44, 39, 454, 44, 40, 40, 458, 71, 41, 343, 41, 41, 44, 227, 36, 227, 36, 227, 227, 44, 342, 454, 36, 36, 92, 92, 92, 36, 36, 43, 43, 43, 95, 95, 95, 341, 46, 46, 46, 96, 96, 96, 621, 80, 80, 43, 80, 80, 80, 96, 43, 43, 551, 551, 46, 47, 47, 47, 80, 340, 339, 43, 43, 46, 43, 621, 43, 45, 45, 45, 338, 47, 96, 97, 97, 97, 47, 47, 99, 99, 99, 97, 45, 45, 333, 221, 47, 696, 217, 45, 216, 45, 699, 45, 100, 100, 100, 215, 45, 93, 93, 93, 214, 213, 93, 93, 205, 93, 99, 93, 696, 93, 101, 101, 101, 699, 204, 93, 93, 94, 94, 93, 94, 94, 94, 197, 100, 102, 102, 102, 196, 193, 93, 192, 94, 98, 90, 98, 88, 98, 98, 87, 83, 98, 101, 103, 103, 103, 98, 104, 104, 104, 105, 105, 105, 98, 75, 98, 106, 106, 106, 107, 107, 107, 108, 108, 108, 109, 109, 109, 74, 104, 110, 110, 110, 70, 103, 105, 111, 111, 111, 108, 67, 105, 65, 109, 112, 112, 112, 63, 106, 108, 62, 107, 113, 113, 113, 114, 114, 114, 115, 115, 115, 60, 110, 116, 116, 116, 58, 111, 111, 55, 51, 112, 115, 117, 117, 117, 20, 116, 113, 114, 118, 118, 118, 119, 119, 119, 120, 120, 120, 121, 121, 121, 122, 122, 122, 123, 123, 123, 118, 117, 17, 120, 13, 0, 119, 120, 124, 124, 124, 0, 120, 125, 125, 125, 120, 126, 126, 126, 127, 127, 127, 0, 121, 0, 122, 0, 123, 128, 128, 128, 129, 129, 129, 130, 130, 130, 131, 131, 131, 124, 0, 0, 127, 126, 125, 0, 0, 126, 132, 132, 132, 0, 0, 128, 133, 133, 133, 129, 0, 134, 134, 134, 131, 130, 135, 135, 135, 136, 136, 136, 137, 137, 137, 138, 138, 138, 139, 139, 139, 0, 132, 140, 140, 140, 0, 133, 134, 0, 135, 0, 0, 138, 136, 0, 0, 136, 0, 137, 141, 141, 141, 0, 137, 0, 137, 142, 142, 142, 143, 143, 143, 144, 144, 144, 0, 145, 145, 145, 0, 140, 146, 146, 146, 0, 141, 143, 147, 147, 147, 0, 148, 148, 148, 149, 149, 149, 151, 151, 151, 0, 0, 142, 150, 0, 146, 0, 144, 145, 148, 149, 150, 0, 150, 0, 0, 150, 0, 0, 147, 0, 0, 150, 152, 152, 152, 0, 151, 154, 154, 154, 155, 155, 155, 156, 156, 156, 0, 152, 157, 157, 157, 154, 158, 158, 158, 0, 154, 156, 0, 159, 159, 159, 152, 160, 160, 160, 158, 155, 0, 154, 156, 161, 161, 161, 162, 162, 162, 0, 163, 163, 163, 0, 158, 0, 0, 160, 157, 159, 164, 164, 164, 165, 165, 165, 166, 166, 166, 161, 0, 162, 163, 0, 167, 167, 167, 169, 169, 169, 163, 168, 168, 168, 170, 170, 170, 171, 171, 171, 0, 165, 167, 164, 172, 172, 172, 164, 173, 173, 173, 0, 0, 166, 169, 0, 170, 168, 171, 174, 174, 174, 175, 175, 175, 176, 176, 176, 0, 0, 173, 0, 173, 0, 172, 177, 177, 177, 0, 0, 174, 207, 207, 207, 175, 0, 208, 208, 208, 225, 225, 225, 208, 207, 211, 211, 0, 176, 208, 226, 226, 226, 211, 0, 211, 208, 211, 177, 218, 218, 0, 218, 218, 218, 230, 230, 230, 0, 0, 233, 233, 233, 0, 218, 229, 229, 229, 211, 212, 212, 212, 0, 212, 212, 212, 0, 212, 212, 212, 233, 212, 230, 212, 212, 212, 212, 212, 212, 223, 223, 223, 224, 224, 224, 223, 229, 212, 224, 0, 0, 223, 212, 0, 224, 228, 228, 228, 223, 0, 0, 224, 231, 231, 231, 0, 232, 232, 232, 234, 234, 234, 235, 235, 235, 236, 236, 236, 238, 238, 238, 0, 0, 231, 232, 0, 0, 228, 237, 237, 237, 0, 231, 0, 232, 0, 234, 0, 0, 235, 0, 0, 237, 239, 239, 239, 0, 236, 237, 240, 240, 240, 241, 241, 241, 242, 242, 242, 243, 243, 243, 239, 0, 244, 244, 244, 245, 245, 245, 246, 246, 246, 247, 247, 247, 0, 240, 244, 248, 248, 248, 0, 243, 0, 245, 0, 0, 246, 247, 249, 249, 249, 242, 250, 250, 250, 251, 251, 251, 0, 0, 246, 252, 252, 252, 253, 253, 253, 254, 254, 254, 248, 0, 255, 255, 255, 256, 256, 256, 0, 250, 249, 254, 258, 258, 258, 251, 255, 257, 257, 257, 0, 0, 252, 0, 0, 253, 253, 259, 259, 259, 258, 257, 260, 260, 260, 261, 261, 261, 256, 0, 262, 262, 262, 263, 263, 263, 0, 260, 264, 264, 264, 265, 265, 265, 266, 266, 266, 259, 262, 267, 267, 267, 264, 0, 0, 261, 0, 0, 263, 268, 268, 268, 266, 269, 269, 269, 0, 0, 265, 270, 270, 270, 0, 268, 271, 271, 271, 269, 0, 0, 267, 272, 272, 272, 273, 273, 273, 270, 0, 0, 271, 274, 274, 274, 275, 275, 275, 276, 276, 276, 277, 277, 277, 0, 0, 273, 0, 0, 272, 278, 278, 278, 0, 279, 279, 279, 0, 0, 280, 280, 280, 275, 0, 0, 274, 0, 0, 277, 0, 0, 276, 279, 280, 281, 281, 281, 282, 282, 282, 283, 283, 283, 278, 284, 284, 284, 0, 281, 285, 285, 285, 286, 286, 286, 287, 287, 287, 0, 0, 283, 288, 288, 288, 0, 0, 284, 289, 289, 289, 290, 290, 290, 0, 282, 0, 287, 0, 291, 291, 291, 0, 285, 0, 0, 288, 292, 292, 292, 293, 293, 293, 294, 294, 294, 295, 295, 295, 0, 0, 290, 291, 296, 296, 296, 0, 292, 297, 297, 297, 0, 0, 295, 298, 298, 298, 299, 299, 299, 300, 300, 300, 0, 293, 294, 297, 296, 301, 301, 301, 302, 302, 302, 303, 303, 303, 0, 298, 304, 304, 304, 305, 305, 305, 306, 306, 306, 307, 307, 307, 0, 0, 300, 0, 0, 301, 304, 308, 308, 308, 302, 0, 0, 303, 0, 307, 306, 309, 309, 309, 310, 310, 310, 305, 311, 311, 311, 306, 0, 312, 312, 312, 0, 309, 313, 313, 313, 0, 0, 308, 314, 314, 314, 315, 315, 315, 0, 0, 310, 316, 316, 316, 313, 0, 0, 311, 312, 317, 317, 317, 0, 315, 318, 318, 318, 319, 319, 319, 320, 320, 320, 321, 321, 321, 322, 322, 322, 0, 324, 324, 324, 316, 0, 317, 323, 323, 323, 0, 325, 325, 325, 319, 324, 0, 318, 320, 0, 0, 321, 0, 320, 323, 325, 0, 0, 322, 326, 326, 326, 0, 327, 327, 327, 328, 328, 328, 330, 330, 330, 347, 347, 347, 330, 348, 348, 348, 0, 0, 330, 0, 326, 327, 354, 354, 354, 330, 349, 349, 349, 350, 350, 350, 348, 328, 335, 335, 335, 0, 335, 335, 335, 0, 335, 335, 335, 0, 335, 349, 335, 335, 335, 335, 335, 335, 354, 350, 351, 351, 351, 352, 352, 352, 335, 353, 353, 353, 0, 335, 355, 355, 355, 0, 0, 352, 356, 356, 356, 0, 0, 353, 357, 357, 357, 358, 358, 358, 351, 359, 359, 359, 360, 360, 360, 361, 361, 361, 355, 362, 362, 362, 0, 355, 0, 0, 356, 363, 363, 363, 0, 0, 357, 0, 0, 358, 0, 0, 360, 0, 359, 364, 364, 364, 0, 361, 365, 365, 365, 366, 366, 366, 367, 367, 367, 368, 368, 368, 369, 369, 369, 370, 370, 370, 371, 371, 371, 0, 0, 365, 372, 372, 372, 373, 373, 373, 370, 0, 0, 369, 374, 374, 374, 0, 372, 375, 375, 375, 376, 376, 376, 377, 377, 377, 378, 378, 378, 0, 379, 379, 379, 380, 380, 380, 0, 381, 381, 381, 0, 0, 376, 374, 382, 382, 382, 377, 0, 375, 379, 383, 383, 383, 0, 0, 378, 381, 384, 384, 384, 0, 382, 385, 385, 385, 380, 0, 0, 381, 386, 386, 386, 0, 0, 383, 387, 387, 387, 0, 384, 388, 388, 388, 389, 389, 389, 390, 390, 390, 0, 391, 391, 391, 392, 392, 392, 394, 394, 394, 387, 0, 393, 393, 393, 390, 395, 395, 395, 0, 0, 388, 0, 0, 389, 391, 393, 0, 396, 396, 396, 397, 397, 397, 0, 0, 392, 0, 0, 394, 396, 398, 398, 398, 0, 0, 397, 399, 399, 399, 400, 400, 400, 0, 0, 398, 401, 401, 401, 402, 402, 402, 403, 403, 403, 0, 404, 404, 404, 405, 405, 405, 406, 406, 406, 407, 407, 407, 0, 399, 400, 408, 408, 408, 409, 409, 409, 0, 401, 402, 404, 0, 403, 410, 410, 410, 411, 411, 411, 0, 0, 407, 412, 412, 412, 408, 413, 413, 413, 414, 414, 414, 0, 0, 409, 0, 412, 415, 415, 415, 416, 416, 416, 414, 0, 0, 411, 417, 417, 417, 0, 413, 418, 418, 418, 415, 419, 419, 419, 420, 420, 420, 416, 421, 421, 421, 422, 422, 422, 417, 423, 423, 423, 424, 424, 424, 425, 425, 425, 0, 0, 421, 0, 0, 422, 424, 426, 426, 426, 420, 424, 427, 427, 427, 428, 428, 428, 0, 425, 0, 424, 0, 423, 429, 429, 429, 0, 427, 430, 430, 430, 0, 426, 431, 431, 431, 432, 432, 432, 429, 433, 433, 433, 0, 428, 434, 434, 434, 0, 430, 435, 435, 435, 436, 436, 436, 0, 431, 437, 437, 437, 438, 438, 438, 439, 439, 439, 435, 440, 440, 440, 436, 435, 0, 0, 433, 0, 435, 441, 441, 441, 442, 442, 442, 439, 443, 443, 443, 0, 0, 437, 444, 444, 444, 440, 445, 445, 445, 446, 446, 446, 447, 447, 447, 448, 448, 448, 443, 0, 0, 441, 442, 449, 449, 449, 463, 463, 463, 0, 447, 456, 456, 456, 464, 464, 464, 0, 445, 446, 465, 465, 465, 456, 463, 449, 0, 0, 464, 466, 466, 466, 467, 467, 467, 468, 468, 468, 469, 469, 469, 0, 465, 470, 470, 470, 0, 466, 471, 471, 471, 472, 472, 472, 467, 473, 473, 473, 474, 474, 474, 475, 475, 475, 476, 476, 476, 468, 469, 477, 477, 477, 474, 471, 0, 470, 478, 478, 478, 479, 479, 479, 480, 480, 480, 481, 481, 481, 482, 482, 482, 483, 483, 483, 484, 484, 484, 485, 485, 485, 0, 477, 486, 486, 486, 0, 480, 487, 487, 487, 488, 488, 488, 489, 489, 489, 0, 481, 0, 0, 484, 490, 490, 490, 491, 491, 491, 489, 492, 492, 492, 493, 493, 493, 488, 494, 494, 494, 0, 490, 491, 495, 495, 495, 0, 0, 492, 0, 496, 496, 496, 497, 497, 497, 498, 498, 498, 493, 499, 499, 499, 500, 500, 500, 0, 0, 494, 501, 501, 501, 502, 502, 502, 495, 496, 0, 0, 500, 498, 503, 503, 503, 504, 504, 504, 505, 505, 505, 0, 501, 506, 506, 506, 507, 507, 507, 508, 508, 508, 505, 0, 0, 502, 503, 509, 509, 509, 510, 510, 510, 511, 511, 511, 0, 504, 508, 512, 512, 512, 513, 513, 513, 506, 514, 514, 514, 509, 515, 515, 515, 516, 516, 516, 0, 512, 517, 517, 517, 518, 518, 518, 519, 519, 519, 516, 514, 513, 515, 520, 520, 520, 521, 521, 521, 518, 522, 522, 522, 0, 0, 519, 523, 523, 523, 520, 0, 0, 517, 524, 524, 524, 525, 525, 525, 526, 526, 526, 521, 523, 527, 527, 527, 0, 528, 528, 528, 529, 529, 529, 530, 530, 530, 531, 531, 531, 0, 526, 0, 527, 528, 533, 533, 533, 525, 0, 0, 529, 532, 532, 532, 534, 534, 534, 535, 535, 535, 536, 536, 536, 0, 0, 530, 0, 0, 534, 537, 537, 537, 532, 0, 533, 538, 538, 538, 536, 539, 539, 539, 540, 540, 540, 0, 537, 541, 541, 541, 542, 542, 542, 0, 538, 543, 543, 543, 544, 544, 544, 545, 545, 545, 546, 546, 546, 547, 547, 547, 548, 548, 548, 543, 549, 549, 549, 0, 0, 547, 557, 557, 557, 559, 559, 559, 546, 0, 545, 0, 544, 558, 558, 558, 560, 560, 560, 561, 561, 561, 549, 552, 552, 552, 562, 562, 562, 0, 560, 552, 0, 552, 0, 552, 0, 559, 563, 563, 563, 0, 0, 558, 0, 552, 564, 564, 564, 0, 0, 561, 0, 562, 0, 0, 552, 565, 565, 565, 0, 566, 566, 566, 567, 567, 567, 568, 568, 568, 569, 569, 569, 0, 0, 565, 564, 566, 570, 570, 570, 571, 571, 571, 0, 568, 572, 572, 572, 573, 573, 573, 574, 574, 574, 575, 575, 575, 0, 576, 576, 576, 577, 577, 577, 0, 574, 578, 578, 578, 0, 570, 0, 571, 577, 579, 579, 579, 572, 576, 580, 580, 580, 581, 581, 581, 582, 582, 582, 583, 583, 583, 584, 584, 584, 585, 585, 585, 0, 586, 586, 586, 0, 0, 581, 587, 587, 587, 0, 0, 584, 0, 0, 582, 586, 0, 0, 580, 588, 588, 588, 589, 589, 589, 590, 590, 590, 591, 591, 591, 0, 0, 588, 0, 0, 589, 592, 592, 592, 593, 593, 593, 594, 594, 594, 595, 595, 595, 596, 596, 596, 0, 0, 592, 597, 597, 597, 593, 598, 598, 598, 0, 591, 595, 599, 599, 599, 600, 600, 600, 601, 601, 601, 597, 602, 602, 602, 603, 603, 603, 596, 604, 604, 604, 605, 605, 605, 606, 606, 606, 607, 607, 607, 602, 608, 608, 608, 609, 609, 609, 610, 610, 610, 611, 611, 611, 612, 612, 612, 613, 613, 613, 614, 614, 614, 615, 615, 615, 0, 610, 0, 608, 616, 616, 616, 617, 617, 617, 0, 609, 618, 618, 618, 619, 619, 619, 620, 620, 620, 0, 613, 615, 628, 628, 628, 619, 616, 0, 620, 0, 618, 629, 629, 629, 630, 630, 630, 617, 0, 0, 628, 631, 631, 631, 632, 632, 632, 633, 633, 633, 0, 630, 634, 634, 634, 635, 635, 635, 629, 636, 636, 636, 637, 637, 637, 638, 638, 638, 639, 639, 639, 0, 631, 0, 632, 640, 640, 640, 634, 0, 637, 641, 641, 641, 0, 0, 639, 635, 642, 642, 642, 643, 643, 643, 644, 644, 644, 645, 645, 645, 646, 646, 646, 647, 647, 647, 644, 640, 648, 648, 648, 649, 649, 649, 650, 650, 650, 651, 651, 651, 642, 0, 0, 645, 648, 0, 0, 647, 652, 652, 652, 653, 653, 653, 0, 651, 0, 649, 654, 654, 654, 655, 655, 655, 656, 656, 656, 657, 657, 657, 658, 658, 658, 655, 0, 0, 654, 659, 659, 659, 660, 660, 660, 656, 661, 661, 661, 0, 658, 662, 662, 662, 0, 657, 663, 663, 663, 664, 664, 664, 672, 672, 672, 673, 673, 673, 0, 662, 674, 674, 674, 0, 660, 665, 665, 665, 0, 672, 675, 675, 675, 665, 0, 665, 0, 665, 676, 676, 676, 677, 677, 677, 0, 673, 0, 665, 678, 678, 678, 679, 679, 679, 680, 680, 680, 0, 665, 666, 666, 666, 681, 681, 681, 0, 0, 666, 0, 666, 0, 666, 0, 677, 682, 682, 682, 683, 683, 683, 681, 666, 684, 684, 684, 685, 685, 685, 686, 686, 686, 0, 666, 687, 687, 687, 688, 688, 688, 689, 689, 689, 0, 685, 0, 0, 686, 683, 690, 690, 690, 691, 691, 691, 0, 0, 689, 692, 692, 692, 693, 693, 693, 691, 0, 687, 694, 694, 694, 695, 695, 695, 703, 703, 703, 704, 704, 704, 0, 692, 690, 705, 705, 705, 706, 706, 706, 707, 707, 707, 708, 708, 708, 709, 709, 709, 710, 710, 710, 0, 0, 706, 711, 711, 711, 707, 712, 712, 712, 713, 713, 713, 705, 714, 714, 714, 719, 719, 719, 720, 720, 720, 721, 721, 721, 722, 722, 722, 723, 723, 723, 724, 724, 724, 0, 725, 725, 725, 726, 726, 726, 713, 727, 727, 727, 0, 723, 0, 0, 724, 0, 714, 725, 728, 728, 728, 721, 729, 729, 729, 730, 730, 730, 0, 0, 0, 0, 0, 726, 0, 0, 0, 0, 0, 0, 729, 0, 0, 0, 0, 0, 0, 0, 0, 728, 732, 732, 732, 732, 732, 732, 732, 732, 732, 732, 733, 733, 733, 733, 733, 733, 733, 733, 733, 733, 734, 734, 734, 734, 734, 734, 734, 734, 734, 734, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 737, 737, 738, 0, 738, 738, 738, 738, 738, 738, 738, 738, 739, 739, 739, 740, 0, 0, 740, 0, 740, 740, 740, 740, 740, 741, 0, 0, 741, 741, 741, 741, 741, 741, 741, 742, 0, 0, 742, 742, 0, 742, 742, 742, 742, 743, 0, 0, 743, 743, 743, 743, 743, 743, 743, 744, 0, 0, 744, 744, 744, 744, 744, 744, 744, 745, 0, 0, 0, 745, 745, 745, 745, 745, 745, 746, 0, 0, 0, 746, 746, 746, 746, 746, 746, 747, 0, 0, 747, 747, 747, 747, 747, 747, 748, 0, 748, 748, 748, 748, 748, 748, 748, 748, 749, 0, 0, 749, 749, 749, 749, 749, 749, 749, 750, 750, 751, 751, 751, 752, 0, 752, 752, 752, 752, 752, 752, 752, 752, 753, 753, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731 } ; 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 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" #define YY_NO_INPUT 1 #line 16 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" #include #include "tokenizer.h" int nesting_level; #line 1442 "dlexer.cpp" #define INITIAL 0 #define comment 1 #define nesting_comment 2 #define string_literal 3 #define wysiwyg_literal 4 #define alt_wysiwyg_literal 5 #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 ); yy_size_t 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 #ifndef YY_NO_UNPUT #endif #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 /*LINTED*/break; #endif #define YY_RULE_SETUP \ YY_USER_ACTION /** The main scanner function which does all the work. */ YY_DECL { yy_state_type yy_current_state; char *yy_cp, *yy_bp; int yy_act; 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( ); } { #line 29 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" #line 1665 "dlexer.cpp" while ( /*CONSTCOND*/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 { 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 >= 732 ) 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] != 3113 ); 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 30 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 2: YY_RULE_SETUP #line 31 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 3: YY_RULE_SETUP #line 32 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 4: YY_RULE_SETUP #line 33 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 5: YY_RULE_SETUP #line 34 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 6: YY_RULE_SETUP #line 35 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 7: YY_RULE_SETUP #line 36 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 8: YY_RULE_SETUP #line 37 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 9: YY_RULE_SETUP #line 38 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 10: YY_RULE_SETUP #line 39 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 11: YY_RULE_SETUP #line 40 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 12: YY_RULE_SETUP #line 41 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 13: YY_RULE_SETUP #line 42 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 14: YY_RULE_SETUP #line 43 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 15: YY_RULE_SETUP #line 44 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 16: YY_RULE_SETUP #line 45 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 17: YY_RULE_SETUP #line 46 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 18: YY_RULE_SETUP #line 47 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 19: YY_RULE_SETUP #line 48 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 20: YY_RULE_SETUP #line 49 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 21: YY_RULE_SETUP #line 50 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 22: YY_RULE_SETUP #line 51 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 23: YY_RULE_SETUP #line 52 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 24: YY_RULE_SETUP #line 53 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 25: YY_RULE_SETUP #line 54 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 26: YY_RULE_SETUP #line 55 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 27: YY_RULE_SETUP #line 56 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 28: YY_RULE_SETUP #line 57 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 29: YY_RULE_SETUP #line 58 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 30: YY_RULE_SETUP #line 59 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 31: YY_RULE_SETUP #line 60 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 32: YY_RULE_SETUP #line 61 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 33: YY_RULE_SETUP #line 62 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 34: YY_RULE_SETUP #line 63 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 35: YY_RULE_SETUP #line 64 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 36: YY_RULE_SETUP #line 65 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 37: YY_RULE_SETUP #line 66 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 38: YY_RULE_SETUP #line 67 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 39: YY_RULE_SETUP #line 68 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 40: YY_RULE_SETUP #line 69 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 41: YY_RULE_SETUP #line 70 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 42: YY_RULE_SETUP #line 71 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 43: YY_RULE_SETUP #line 72 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 44: YY_RULE_SETUP #line 73 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 45: YY_RULE_SETUP #line 74 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 46: YY_RULE_SETUP #line 75 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 47: YY_RULE_SETUP #line 76 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 48: YY_RULE_SETUP #line 77 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 49: YY_RULE_SETUP #line 78 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 50: YY_RULE_SETUP #line 79 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 51: YY_RULE_SETUP #line 80 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 52: YY_RULE_SETUP #line 81 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 53: YY_RULE_SETUP #line 82 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 54: YY_RULE_SETUP #line 83 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 55: YY_RULE_SETUP #line 84 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 56: YY_RULE_SETUP #line 85 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 57: YY_RULE_SETUP #line 86 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 58: YY_RULE_SETUP #line 87 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 59: YY_RULE_SETUP #line 88 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 60: YY_RULE_SETUP #line 89 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 61: YY_RULE_SETUP #line 90 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 62: YY_RULE_SETUP #line 92 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 63: YY_RULE_SETUP #line 93 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 64: YY_RULE_SETUP #line 94 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 65: YY_RULE_SETUP #line 95 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 66: YY_RULE_SETUP #line 96 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 67: YY_RULE_SETUP #line 97 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 68: YY_RULE_SETUP #line 98 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 69: YY_RULE_SETUP #line 99 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 70: YY_RULE_SETUP #line 100 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 71: YY_RULE_SETUP #line 101 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 72: YY_RULE_SETUP #line 102 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 73: YY_RULE_SETUP #line 103 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 74: YY_RULE_SETUP #line 104 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 75: YY_RULE_SETUP #line 105 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 76: YY_RULE_SETUP #line 106 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 77: YY_RULE_SETUP #line 107 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 78: YY_RULE_SETUP #line 108 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 79: YY_RULE_SETUP #line 109 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 80: YY_RULE_SETUP #line 110 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 81: YY_RULE_SETUP #line 111 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 82: YY_RULE_SETUP #line 112 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 83: YY_RULE_SETUP #line 113 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 84: YY_RULE_SETUP #line 114 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 85: YY_RULE_SETUP #line 115 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 86: YY_RULE_SETUP #line 116 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 87: YY_RULE_SETUP #line 117 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 88: YY_RULE_SETUP #line 118 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 89: YY_RULE_SETUP #line 119 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 90: YY_RULE_SETUP #line 120 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 91: YY_RULE_SETUP #line 121 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 92: YY_RULE_SETUP #line 122 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 93: YY_RULE_SETUP #line 123 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 94: YY_RULE_SETUP #line 124 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 95: YY_RULE_SETUP #line 125 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 96: YY_RULE_SETUP #line 126 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 97: YY_RULE_SETUP #line 127 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 98: YY_RULE_SETUP #line 128 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 99: YY_RULE_SETUP #line 129 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 100: YY_RULE_SETUP #line 130 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 101: YY_RULE_SETUP #line 131 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 102: YY_RULE_SETUP #line 132 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 103: YY_RULE_SETUP #line 133 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 104: YY_RULE_SETUP #line 134 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 105: YY_RULE_SETUP #line 135 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 106: YY_RULE_SETUP #line 136 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 107: YY_RULE_SETUP #line 137 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 108: YY_RULE_SETUP #line 138 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 109: YY_RULE_SETUP #line 139 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 110: YY_RULE_SETUP #line 141 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { BEGIN(comment); return(TOKENIZER_COMMENT); } YY_BREAK case 111: YY_RULE_SETUP #line 142 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_COMMENT); } YY_BREAK case 112: YY_RULE_SETUP #line 143 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_COMMENT); } YY_BREAK case 113: /* rule 113 can match eol */ YY_RULE_SETUP #line 144 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_NEWLINE); } YY_BREAK case 114: YY_RULE_SETUP #line 145 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_NEWLINE); } YY_BREAK case 115: /* rule 115 can match eol */ YY_RULE_SETUP #line 146 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_NEWLINE); } YY_BREAK case 116: YY_RULE_SETUP #line 147 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { BEGIN(INITIAL); return(TOKENIZER_COMMENT); } YY_BREAK case 117: YY_RULE_SETUP #line 149 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { BEGIN(nesting_comment); nesting_level = (0); return(TOKENIZER_COMMENT); } YY_BREAK case 118: YY_RULE_SETUP #line 150 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_COMMENT); } YY_BREAK case 119: YY_RULE_SETUP #line 151 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_COMMENT); } YY_BREAK case 120: YY_RULE_SETUP #line 152 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_COMMENT); } YY_BREAK case 121: YY_RULE_SETUP #line 153 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { nesting_level++; return(TOKENIZER_COMMENT); } YY_BREAK case 122: /* rule 122 can match eol */ YY_RULE_SETUP #line 154 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_NEWLINE); } YY_BREAK case 123: YY_RULE_SETUP #line 155 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_NEWLINE); } YY_BREAK case 124: /* rule 124 can match eol */ YY_RULE_SETUP #line 156 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_NEWLINE); } YY_BREAK case 125: YY_RULE_SETUP #line 157 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { if (nesting_level-- == 0) BEGIN(INITIAL); return(TOKENIZER_COMMENT); } YY_BREAK case 126: YY_RULE_SETUP #line 159 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_COMMENT); } YY_BREAK case 127: YY_RULE_SETUP #line 161 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_DIRECTIVE); } YY_BREAK case 128: YY_RULE_SETUP #line 162 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_DIRECTIVE); } YY_BREAK case 129: YY_RULE_SETUP #line 163 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_DIRECTIVE); } YY_BREAK case 130: YY_RULE_SETUP #line 164 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_DIRECTIVE); } YY_BREAK case 131: YY_RULE_SETUP #line 165 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_DIRECTIVE); } YY_BREAK case 132: YY_RULE_SETUP #line 166 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_DIRECTIVE); } YY_BREAK case 133: YY_RULE_SETUP #line 167 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_DIRECTIVE); } YY_BREAK case 134: YY_RULE_SETUP #line 168 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_DIRECTIVE); } YY_BREAK case 135: YY_RULE_SETUP #line 169 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_DIRECTIVE); } YY_BREAK case 136: YY_RULE_SETUP #line 170 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_DIRECTIVE); } YY_BREAK case 137: YY_RULE_SETUP #line 171 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_DIRECTIVE); } YY_BREAK case 138: YY_RULE_SETUP #line 172 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_DIRECTIVE); } YY_BREAK case 139: YY_RULE_SETUP #line 173 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_DIRECTIVE); } YY_BREAK case 140: YY_RULE_SETUP #line 174 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_DIRECTIVE); } YY_BREAK case 141: YY_RULE_SETUP #line 175 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_DIRECTIVE); } YY_BREAK case 142: YY_RULE_SETUP #line 176 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_DIRECTIVE); } YY_BREAK case 143: YY_RULE_SETUP #line 177 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_DIRECTIVE); } YY_BREAK case 144: YY_RULE_SETUP #line 180 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { BEGIN(string_literal); return(TOKENIZER_LITERAL); } YY_BREAK case 145: YY_RULE_SETUP #line 181 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { BEGIN(string_literal); return(TOKENIZER_LITERAL); } YY_BREAK case 146: YY_RULE_SETUP #line 182 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 147: /* rule 147 can match eol */ YY_RULE_SETUP #line 183 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_NEWLINE); } YY_BREAK case 148: YY_RULE_SETUP #line 184 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_NEWLINE); } YY_BREAK case 149: /* rule 149 can match eol */ YY_RULE_SETUP #line 185 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_NEWLINE); } YY_BREAK case 150: YY_RULE_SETUP #line 186 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { BEGIN(INITIAL); return(TOKENIZER_LITERAL); } YY_BREAK case 151: YY_RULE_SETUP #line 187 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { BEGIN(INITIAL); return(TOKENIZER_LITERAL); } YY_BREAK case 152: YY_RULE_SETUP #line 189 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { BEGIN(wysiwyg_literal); return(TOKENIZER_LITERAL); } YY_BREAK case 153: YY_RULE_SETUP #line 190 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 154: /* rule 154 can match eol */ YY_RULE_SETUP #line 191 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_NEWLINE); } YY_BREAK case 155: YY_RULE_SETUP #line 192 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_NEWLINE); } YY_BREAK case 156: /* rule 156 can match eol */ YY_RULE_SETUP #line 193 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_NEWLINE); } YY_BREAK case 157: YY_RULE_SETUP #line 194 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { BEGIN(INITIAL); return(TOKENIZER_LITERAL); } YY_BREAK case 158: YY_RULE_SETUP #line 195 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { BEGIN(INITIAL); return(TOKENIZER_LITERAL); } YY_BREAK case 159: YY_RULE_SETUP #line 197 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { BEGIN(alt_wysiwyg_literal); return(TOKENIZER_LITERAL); } YY_BREAK case 160: YY_RULE_SETUP #line 198 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 161: /* rule 161 can match eol */ YY_RULE_SETUP #line 199 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_NEWLINE); } YY_BREAK case 162: YY_RULE_SETUP #line 200 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_NEWLINE); } YY_BREAK case 163: /* rule 163 can match eol */ YY_RULE_SETUP #line 201 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_NEWLINE); } YY_BREAK case 164: YY_RULE_SETUP #line 202 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { BEGIN(INITIAL); return(TOKENIZER_LITERAL); } YY_BREAK case 165: YY_RULE_SETUP #line 203 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { BEGIN(INITIAL); return(TOKENIZER_LITERAL); } YY_BREAK case 166: YY_RULE_SETUP #line 206 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 167: YY_RULE_SETUP #line 207 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 168: YY_RULE_SETUP #line 208 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 169: YY_RULE_SETUP #line 209 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 170: YY_RULE_SETUP #line 210 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 171: YY_RULE_SETUP #line 211 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 172: YY_RULE_SETUP #line 212 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 173: YY_RULE_SETUP #line 213 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 174: YY_RULE_SETUP #line 214 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 175: YY_RULE_SETUP #line 215 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 176: YY_RULE_SETUP #line 216 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 177: YY_RULE_SETUP #line 218 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 178: YY_RULE_SETUP #line 219 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 179: YY_RULE_SETUP #line 220 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 180: YY_RULE_SETUP #line 221 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 181: YY_RULE_SETUP #line 222 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 182: YY_RULE_SETUP #line 224 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 183: YY_RULE_SETUP #line 225 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 184: YY_RULE_SETUP #line 226 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 185: YY_RULE_SETUP #line 227 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 186: YY_RULE_SETUP #line 228 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 187: YY_RULE_SETUP #line 229 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 188: YY_RULE_SETUP #line 230 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 189: YY_RULE_SETUP #line 231 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 190: YY_RULE_SETUP #line 232 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 191: YY_RULE_SETUP #line 233 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 192: YY_RULE_SETUP #line 234 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 193: YY_RULE_SETUP #line 235 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 194: YY_RULE_SETUP #line 236 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 195: YY_RULE_SETUP #line 237 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 196: YY_RULE_SETUP #line 238 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 197: YY_RULE_SETUP #line 239 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 198: YY_RULE_SETUP #line 240 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 199: YY_RULE_SETUP #line 242 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 200: YY_RULE_SETUP #line 243 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 201: YY_RULE_SETUP #line 244 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 202: YY_RULE_SETUP #line 245 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 203: YY_RULE_SETUP #line 246 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 204: /* rule 204 can match eol */ YY_RULE_SETUP #line 248 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_NEWLINE); } YY_BREAK case 205: /* rule 205 can match eol */ YY_RULE_SETUP #line 249 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_NEWLINE); } YY_BREAK case 206: YY_RULE_SETUP #line 250 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_NEWLINE); } YY_BREAK case 207: YY_RULE_SETUP #line 251 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_TEXT); } YY_BREAK case 208: YY_RULE_SETUP #line 252 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_TEXT); } YY_BREAK case 209: YY_RULE_SETUP #line 253 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" { return(TOKENIZER_TEXT); } YY_BREAK case 210: YY_RULE_SETUP #line 255 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" ECHO; YY_BREAK #line 2784 "dlexer.cpp" 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): case YY_STATE_EOF(alt_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 user's declarations */ } /* 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) { char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; char *source = (yytext_ptr); yy_size_t 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 = (yy_size_t) ((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_LVALUE; 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. */ 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), 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 ((int) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ int 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) { yy_state_type yy_current_state; char *yy_cp; yy_current_state = (yy_start); for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) { 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 >= 732 ) 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 ) { int yy_is_jam; char *yy_cp = (yy_c_buf_p); 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 >= 732 ) 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 == 731); return yy_is_jam ? 0 : yy_current_state; } #ifndef YY_NO_UNPUT #endif #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. */ 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 = (yy_size_t)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 ); } /* 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) { 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; /* After all that talk, this was set to 1 anyways... */ (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. */ yy_size_t 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, yy_size_t _yybytes_len ) { YY_BUFFER_STATE b; char *buf; yy_size_t n; yy_size_t 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. * */ yy_size_t 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 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 ) { 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 ) { 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 255 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/dlexer.lpp" cgdb-0.8.0/lib/tokenizer/clexer.cpp0000664000175000017500000024764714171036460014135 00000000000000#line 2 "clexer.cpp" #line 4 "clexer.cpp" #define YY_INT_ALIGNED short int /* A lexical scanner generated by flex */ #define yy_create_buffer c__create_buffer #define yy_delete_buffer c__delete_buffer #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 yylineno c_lineno #define yyout c_out #define yyrestart c_restart #define yytext c_text #define yywrap c_wrap #define yyalloc c_alloc #define yyrealloc c_realloc #define yyfree c_free #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 6 #define YY_FLEX_SUBMINOR_VERSION 0 #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 c_restart(c_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 #ifndef YY_TYPEDEF_YY_SIZE_T #define YY_TYPEDEF_YY_SIZE_T typedef size_t yy_size_t; #endif extern yy_size_t c_leng; extern FILE *c_in, *c_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) #define YY_LINENO_REWIND_TO(ptr) /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ do \ { \ /* Undo effects of setting up c_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 c_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. */ 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 c_restart()), so that the user can continue scanning by * just pointing c_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 c_text is formed. */ static char yy_hold_char; static int yy_n_chars; /* number of characters read into yy_ch_buf */ yy_size_t c_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 c_wrap()'s to do buffer switches * instead of setting up a fresh c_in. A bit of a hack ... */ static int yy_did_buffer_switch_on_eof; void c_restart (FILE *input_file ); void c__switch_to_buffer (YY_BUFFER_STATE new_buffer ); YY_BUFFER_STATE c__create_buffer (FILE *file,int size ); void c__delete_buffer (YY_BUFFER_STATE b ); void c__flush_buffer (YY_BUFFER_STATE b ); void c_push_buffer_state (YY_BUFFER_STATE new_buffer ); void c_pop_buffer_state (void ); static void c_ensure_buffer_stack (void ); static void c__load_buffer_state (void ); static void c__init_buffer (YY_BUFFER_STATE b,FILE *file ); #define YY_FLUSH_BUFFER c__flush_buffer(YY_CURRENT_BUFFER ) YY_BUFFER_STATE c__scan_buffer (char *base,yy_size_t size ); YY_BUFFER_STATE c__scan_string (yyconst char *yy_str ); YY_BUFFER_STATE c__scan_bytes (yyconst char *bytes,yy_size_t len ); void *c_alloc (yy_size_t ); void *c_realloc (void *,yy_size_t ); void c_free (void * ); #define yy_new_buffer c__create_buffer #define yy_set_interactive(is_interactive) \ { \ if ( ! YY_CURRENT_BUFFER ){ \ c_ensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ c__create_buffer(c_in,YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } #define yy_set_bol(at_bol) \ { \ if ( ! YY_CURRENT_BUFFER ){\ c_ensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ c__create_buffer(c_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 */ #define c_wrap() (/*CONSTCOND*/1) #define YY_SKIP_YYWRAP typedef unsigned char YY_CHAR; FILE *c_in = (FILE *) 0, *c_out = (FILE *) 0; typedef int yy_state_type; extern int c_lineno; int c_lineno = 1; extern char *c_text; #ifdef yytext_ptr #undef yytext_ptr #endif #define yytext_ptr c_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 ); #if defined(__GNUC__) && __GNUC__ >= 3 __attribute__((__noreturn__)) #endif static void yy_fatal_error (yyconst char msg[] ); /* Done after the current pattern has been matched and before the * corresponding action - sets up c_text. */ #define YY_DO_BEFORE_ACTION \ (yytext_ptr) = yy_bp; \ c_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 117 #define YY_END_OF_BUFFER 118 /* 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[404] = { 0, 0, 0, 76, 76, 85, 85, 118, 116, 114, 111, 113, 84, 116, 116, 116, 116, 90, 90, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 76, 78, 79, 77, 85, 86, 87, 89, 117, 112, 83, 0, 0, 106, 75, 82, 0, 90, 0, 107, 91, 92, 0, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 41, 115, 115, 115, 115, 115, 115, 115, 115, 115, 48, 115, 115, 115, 115, 115, 115, 115, 53, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 76, 80, 77, 77, 81, 85, 0, 88, 109, 0, 109, 108, 82, 106, 0, 106, 93, 96, 94, 98, 28, 30, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 46, 115, 115, 115, 13, 115, 115, 115, 49, 50, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 67, 115, 115, 115, 115, 115, 115, 115, 115, 115, 73, 110, 97, 95, 99, 100, 115, 1, 115, 115, 2, 115, 34, 115, 3, 115, 115, 115, 115, 115, 115, 115, 115, 43, 7, 115, 115, 115, 115, 115, 115, 47, 115, 14, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 64, 115, 66, 115, 115, 115, 115, 115, 25, 115, 115, 115, 115, 101, 104, 102, 115, 115, 32, 33, 35, 4, 36, 5, 115, 115, 115, 115, 115, 115, 115, 115, 45, 10, 115, 115, 115, 115, 115, 115, 54, 115, 115, 115, 115, 115, 115, 18, 115, 115, 115, 115, 115, 115, 65, 115, 115, 115, 22, 115, 71, 115, 115, 115, 72, 115, 105, 103, 29, 31, 115, 115, 115, 40, 6, 115, 115, 44, 8, 11, 12, 115, 115, 51, 115, 115, 115, 57, 115, 115, 59, 19, 60, 20, 21, 62, 115, 115, 69, 115, 115, 115, 115, 115, 74, 115, 115, 39, 115, 115, 15, 115, 115, 55, 115, 115, 115, 115, 115, 68, 115, 115, 24, 115, 27, 115, 38, 115, 9, 115, 52, 115, 17, 115, 115, 63, 70, 23, 26, 115, 115, 16, 56, 115, 115, 37, 115, 115, 115, 115, 115, 61, 42, 115, 115, 115, 115, 58, 0 } ; static yyconst YY_CHAR 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, 9, 10, 11, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 1, 1, 1, 1, 1, 1, 1, 14, 14, 14, 14, 15, 16, 17, 17, 17, 17, 17, 18, 17, 17, 17, 17, 17, 17, 17, 17, 19, 17, 17, 17, 17, 17, 1, 20, 1, 1, 21, 1, 22, 23, 24, 25, 26, 27, 28, 29, 30, 17, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 YY_CHAR yy_meta[47] = { 0, 1, 1, 2, 3, 4, 1, 1, 5, 1, 1, 1, 6, 6, 7, 7, 7, 8, 8, 8, 1, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8 } ; static yyconst flex_uint16_t yy_base[416] = { 0, 0, 0, 44, 46, 52, 55, 229, 1319, 1319, 1319, 215, 1319, 0, 173, 49, 55, 66, 144, 52, 55, 74, 89, 87, 93, 104, 116, 61, 118, 78, 121, 102, 132, 57, 136, 142, 147, 162, 165, 149, 0, 1319, 182, 69, 147, 1319, 149, 1319, 141, 1319, 0, 128, 101, 183, 1319, 0, 188, 59, 193, 1319, 189, 132, 0, 0, 145, 178, 199, 201, 204, 207, 210, 212, 215, 221, 226, 234, 236, 241, 243, 245, 251, 256, 258, 260, 266, 268, 170, 271, 282, 277, 287, 289, 293, 297, 300, 306, 302, 314, 316, 318, 325, 322, 327, 336, 343, 345, 355, 349, 357, 359, 363, 370, 365, 0, 1319, 112, 161, 1319, 77, 66, 1319, 1319, 46, 44, 1319, 0, 386, 374, 384, 122, 1319, 208, 386, 394, 396, 398, 404, 408, 410, 412, 417, 422, 424, 430, 432, 434, 436, 438, 442, 455, 440, 445, 457, 462, 466, 472, 474, 477, 479, 481, 483, 485, 490, 492, 501, 505, 507, 511, 514, 516, 519, 522, 524, 526, 528, 532, 534, 538, 547, 554, 556, 558, 560, 563, 565, 568, 570, 572, 576, 584, 586, 589, 592, 600, 1319, 1319, 1319, 596, 213, 605, 607, 610, 613, 617, 621, 623, 626, 628, 630, 633, 635, 637, 641, 644, 646, 648, 650, 658, 660, 664, 667, 673, 675, 679, 681, 683, 685, 688, 691, 694, 696, 709, 711, 713, 715, 719, 722, 725, 728, 730, 735, 737, 740, 742, 747, 759, 761, 763, 765, 768, 770, 772, 774, 776, 779, 784, 781, 797, 266, 1319, 244, 793, 799, 801, 804, 808, 813, 815, 819, 821, 824, 826, 831, 829, 834, 836, 838, 841, 848, 850, 852, 854, 856, 858, 861, 867, 869, 872, 875, 877, 881, 885, 890, 893, 898, 900, 902, 908, 910, 914, 917, 921, 923, 926, 928, 935, 937, 939, 942, 944, 948, 1319, 1319, 952, 954, 958, 960, 962, 964, 966, 968, 974, 971, 976, 978, 981, 983, 985, 987, 993, 998, 1000, 1002, 1004, 1006, 1008, 1010, 1013, 1020, 1022, 1024, 1026, 1030, 1033, 1035, 1037, 1039, 1041, 1043, 1046, 1048, 1052, 1062, 1064, 1067, 1069, 1074, 1076, 1078, 1080, 1082, 1087, 1084, 1089, 1091, 1098, 1100, 1104, 1106, 1109, 1114, 1116, 1118, 1121, 1123, 1125, 1127, 1131, 1133, 1135, 1138, 1142, 1146, 1148, 1150, 1152, 1154, 1156, 1160, 1163, 1165, 1167, 1169, 1171, 1175, 1179, 1181, 1183, 1186, 1191, 1195, 1204, 1206, 1319, 1244, 1252, 1254, 1262, 1265, 1273, 1281, 1289, 1297, 1305, 1308, 1310 } ; static yyconst flex_int16_t yy_def[416] = { 0, 403, 1, 404, 404, 405, 405, 403, 403, 403, 403, 403, 403, 406, 407, 403, 403, 403, 17, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 409, 403, 403, 410, 411, 403, 403, 403, 411, 403, 406, 403, 412, 403, 403, 413, 403, 17, 403, 403, 403, 403, 414, 415, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 409, 403, 410, 410, 403, 411, 411, 403, 403, 403, 403, 403, 413, 403, 403, 403, 403, 403, 403, 414, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 403, 403, 403, 403, 403, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 403, 403, 403, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 403, 403, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 408, 0, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403 } ; static yyconst flex_uint16_t yy_nxt[1366] = { 0, 8, 9, 10, 11, 12, 13, 14, 8, 8, 15, 16, 17, 18, 19, 19, 19, 19, 19, 19, 8, 19, 20, 21, 22, 23, 24, 25, 26, 19, 27, 19, 28, 29, 30, 31, 32, 19, 33, 34, 35, 36, 37, 38, 39, 19, 19, 41, 42, 41, 42, 194, 43, 194, 43, 45, 46, 47, 45, 46, 47, 53, 53, 54, 63, 63, 55, 63, 63, 63, 63, 118, 48, 63, 63, 48, 56, 116, 57, 57, 117, 58, 59, 97, 60, 61, 63, 63, 86, 65, 63, 63, 58, 59, 66, 87, 67, 119, 60, 63, 63, 63, 63, 403, 68, 63, 63, 61, 123, 69, 62, 71, 70, 75, 63, 63, 63, 63, 72, 89, 403, 73, 76, 403, 74, 78, 81, 79, 63, 63, 63, 63, 77, 63, 63, 121, 82, 80, 93, 83, 94, 195, 84, 90, 63, 63, 118, 91, 63, 63, 131, 85, 120, 88, 63, 63, 92, 63, 63, 63, 63, 63, 63, 195, 131, 98, 99, 119, 102, 116, 95, 103, 117, 96, 63, 63, 100, 63, 63, 101, 104, 106, 63, 63, 112, 114, 107, 105, 403, 110, 63, 63, 108, 52, 111, 53, 53, 109, 58, 124, 126, 126, 127, 133, 59, 128, 128, 129, 130, 58, 124, 63, 63, 63, 63, 59, 63, 63, 49, 63, 63, 129, 63, 63, 63, 63, 196, 63, 63, 403, 130, 260, 134, 63, 63, 403, 138, 141, 63, 63, 196, 135, 137, 142, 136, 260, 63, 63, 63, 63, 403, 139, 140, 63, 63, 63, 63, 63, 63, 143, 144, 145, 312, 63, 63, 403, 146, 403, 63, 63, 63, 63, 63, 63, 403, 148, 312, 147, 63, 63, 63, 63, 149, 63, 63, 311, 150, 151, 153, 63, 63, 152, 403, 154, 63, 63, 156, 403, 155, 63, 63, 63, 63, 158, 403, 63, 63, 311, 157, 63, 63, 159, 63, 63, 63, 63, 160, 161, 63, 63, 162, 166, 403, 165, 403, 169, 63, 63, 63, 63, 63, 63, 163, 164, 63, 63, 167, 63, 63, 63, 63, 168, 170, 403, 171, 403, 174, 176, 63, 63, 403, 173, 178, 403, 172, 63, 63, 63, 63, 403, 179, 63, 63, 177, 175, 403, 180, 63, 63, 63, 63, 63, 63, 403, 181, 63, 63, 63, 63, 187, 403, 184, 63, 63, 182, 185, 128, 128, 183, 189, 403, 190, 191, 403, 186, 188, 128, 128, 126, 126, 192, 58, 59, 193, 197, 198, 63, 63, 63, 63, 63, 63, 58, 59, 403, 199, 63, 63, 197, 403, 63, 63, 63, 63, 63, 63, 201, 198, 403, 63, 63, 403, 204, 200, 63, 63, 63, 63, 205, 202, 203, 206, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 212, 63, 63, 403, 207, 214, 213, 208, 215, 403, 209, 63, 63, 63, 63, 210, 211, 217, 63, 63, 403, 218, 63, 63, 219, 216, 403, 220, 63, 63, 63, 63, 222, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 403, 223, 221, 63, 63, 63, 63, 403, 227, 403, 225, 403, 226, 224, 63, 63, 403, 228, 63, 63, 63, 63, 403, 229, 63, 63, 403, 63, 63, 63, 63, 403, 63, 63, 231, 63, 63, 63, 63, 63, 63, 63, 63, 403, 230, 63, 63, 63, 63, 234, 235, 63, 63, 403, 232, 233, 403, 236, 403, 240, 63, 63, 403, 239, 403, 238, 237, 63, 63, 63, 63, 63, 63, 63, 63, 241, 63, 63, 63, 63, 242, 63, 63, 63, 63, 63, 63, 247, 243, 63, 63, 244, 248, 403, 246, 403, 245, 63, 63, 63, 63, 250, 63, 63, 249, 63, 63, 251, 403, 254, 253, 403, 255, 63, 63, 258, 259, 252, 63, 63, 63, 63, 257, 63, 63, 256, 63, 63, 403, 258, 63, 63, 261, 403, 63, 63, 63, 63, 259, 63, 63, 63, 63, 63, 63, 262, 63, 63, 63, 63, 63, 63, 263, 264, 63, 63, 265, 63, 63, 63, 63, 63, 63, 63, 63, 403, 267, 403, 269, 403, 266, 63, 63, 63, 63, 403, 268, 63, 63, 272, 63, 63, 273, 270, 403, 271, 63, 63, 63, 63, 403, 274, 63, 63, 63, 63, 63, 63, 63, 63, 277, 63, 63, 275, 63, 63, 276, 63, 63, 63, 63, 403, 281, 403, 279, 403, 278, 403, 280, 284, 403, 283, 63, 63, 63, 63, 63, 63, 63, 63, 403, 282, 63, 63, 286, 63, 63, 403, 63, 63, 287, 63, 63, 63, 63, 403, 288, 285, 63, 63, 63, 63, 403, 63, 63, 63, 63, 293, 403, 289, 63, 63, 403, 290, 291, 296, 403, 297, 295, 292, 403, 294, 63, 63, 63, 63, 63, 63, 63, 63, 298, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 300, 63, 63, 63, 63, 301, 63, 63, 304, 302, 305, 403, 303, 403, 299, 63, 63, 309, 403, 63, 63, 63, 63, 63, 63, 306, 63, 63, 403, 307, 63, 63, 308, 310, 314, 63, 63, 63, 63, 403, 313, 63, 63, 63, 63, 403, 63, 63, 63, 63, 315, 63, 63, 63, 63, 403, 63, 63, 63, 63, 63, 63, 318, 63, 63, 316, 317, 319, 321, 320, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 323, 63, 63, 324, 322, 403, 325, 63, 63, 63, 63, 403, 63, 63, 326, 63, 63, 63, 63, 403, 327, 63, 63, 328, 331, 63, 63, 332, 403, 329, 63, 63, 403, 63, 63, 334, 403, 330, 63, 63, 63, 63, 63, 63, 403, 333, 336, 335, 63, 63, 63, 63, 338, 337, 63, 63, 403, 63, 63, 403, 341, 63, 63, 63, 63, 340, 63, 63, 63, 63, 339, 342, 403, 344, 343, 63, 63, 63, 63, 63, 63, 403, 63, 63, 63, 63, 403, 346, 63, 63, 345, 348, 63, 63, 63, 63, 403, 347, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 350, 63, 63, 349, 63, 63, 63, 63, 63, 63, 353, 63, 63, 63, 63, 63, 63, 63, 63, 351, 352, 403, 354, 63, 63, 356, 403, 355, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 358, 63, 63, 403, 357, 403, 360, 403, 63, 63, 63, 63, 63, 63, 63, 63, 359, 362, 63, 63, 361, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 364, 63, 63, 63, 63, 403, 366, 63, 63, 363, 403, 365, 403, 370, 367, 403, 368, 63, 63, 63, 63, 371, 63, 63, 63, 63, 369, 403, 372, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 374, 63, 63, 63, 63, 63, 63, 403, 376, 373, 379, 403, 63, 63, 63, 63, 375, 380, 63, 63, 63, 63, 377, 63, 63, 378, 381, 382, 63, 63, 63, 63, 63, 63, 383, 63, 63, 63, 63, 63, 63, 63, 63, 403, 385, 63, 63, 63, 63, 63, 63, 386, 63, 63, 387, 384, 63, 63, 403, 389, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 403, 388, 63, 63, 391, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 403, 392, 63, 63, 403, 390, 63, 63, 63, 63, 63, 63, 403, 63, 63, 398, 403, 393, 63, 63, 403, 394, 63, 63, 395, 399, 396, 403, 400, 403, 397, 63, 63, 63, 63, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 401, 403, 403, 403, 403, 403, 403, 403, 403, 403, 402, 40, 40, 40, 40, 40, 40, 40, 40, 44, 44, 44, 44, 44, 44, 44, 44, 50, 50, 51, 403, 51, 51, 51, 51, 51, 51, 64, 64, 64, 113, 403, 403, 113, 403, 113, 113, 113, 115, 403, 403, 115, 115, 115, 115, 115, 118, 403, 403, 403, 118, 118, 118, 118, 122, 403, 122, 122, 122, 122, 122, 122, 125, 403, 403, 125, 125, 125, 125, 125, 132, 132, 63, 63, 63, 7, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403 } ; static yyconst flex_int16_t yy_chk[1366] = { 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, 1, 3, 3, 4, 4, 123, 3, 122, 4, 5, 5, 5, 6, 6, 6, 15, 15, 16, 19, 19, 16, 20, 20, 33, 33, 119, 5, 27, 27, 6, 17, 43, 17, 17, 43, 17, 17, 33, 17, 17, 21, 21, 27, 20, 29, 29, 17, 17, 20, 27, 20, 118, 17, 23, 23, 22, 22, 57, 21, 24, 24, 17, 52, 21, 17, 22, 21, 23, 31, 31, 25, 25, 22, 29, 115, 22, 23, 115, 22, 24, 25, 24, 26, 26, 28, 28, 23, 30, 30, 51, 25, 24, 31, 25, 31, 129, 25, 30, 32, 32, 48, 30, 34, 34, 61, 26, 46, 28, 35, 35, 30, 64, 64, 36, 36, 39, 39, 129, 61, 34, 34, 44, 35, 116, 32, 35, 116, 32, 37, 37, 34, 38, 38, 34, 35, 36, 86, 86, 39, 42, 36, 35, 18, 38, 65, 65, 37, 14, 38, 53, 53, 37, 53, 53, 56, 56, 58, 65, 56, 58, 58, 60, 60, 53, 53, 66, 66, 67, 67, 56, 68, 68, 11, 69, 69, 60, 70, 70, 71, 71, 131, 72, 72, 7, 60, 198, 66, 73, 73, 0, 70, 72, 74, 74, 131, 67, 69, 73, 68, 198, 75, 75, 76, 76, 0, 71, 71, 77, 77, 78, 78, 79, 79, 74, 74, 75, 260, 80, 80, 0, 75, 0, 81, 81, 82, 82, 83, 83, 0, 77, 260, 76, 84, 84, 85, 85, 78, 87, 87, 258, 79, 80, 81, 89, 89, 80, 0, 82, 88, 88, 84, 0, 83, 90, 90, 91, 91, 87, 0, 92, 92, 258, 85, 93, 93, 87, 94, 94, 96, 96, 88, 89, 95, 95, 90, 94, 0, 93, 0, 96, 97, 97, 98, 98, 99, 99, 91, 92, 101, 101, 95, 100, 100, 102, 102, 95, 97, 0, 97, 0, 99, 100, 103, 103, 0, 98, 101, 0, 97, 104, 104, 105, 105, 0, 102, 107, 107, 100, 99, 0, 103, 106, 106, 108, 108, 109, 109, 0, 103, 110, 110, 112, 112, 107, 0, 105, 111, 111, 104, 106, 127, 127, 104, 109, 0, 109, 110, 0, 106, 108, 128, 128, 126, 126, 111, 126, 126, 112, 132, 132, 133, 133, 134, 134, 135, 135, 126, 126, 0, 133, 136, 136, 132, 0, 137, 137, 138, 138, 139, 139, 136, 132, 0, 140, 140, 0, 138, 135, 141, 141, 142, 142, 139, 136, 137, 140, 143, 143, 144, 144, 145, 145, 146, 146, 147, 147, 150, 150, 148, 148, 145, 151, 151, 0, 141, 147, 146, 142, 148, 0, 143, 149, 149, 152, 152, 144, 144, 150, 153, 153, 0, 151, 154, 154, 151, 149, 0, 152, 155, 155, 156, 156, 154, 157, 157, 158, 158, 159, 159, 160, 160, 161, 161, 0, 156, 153, 162, 162, 163, 163, 0, 161, 0, 158, 0, 160, 157, 164, 164, 0, 162, 165, 165, 166, 166, 0, 164, 167, 167, 0, 168, 168, 169, 169, 0, 170, 170, 166, 171, 171, 172, 172, 173, 173, 174, 174, 0, 165, 175, 175, 176, 176, 169, 170, 177, 177, 0, 167, 168, 0, 171, 0, 175, 178, 178, 0, 174, 0, 173, 172, 179, 179, 180, 180, 181, 181, 182, 182, 176, 183, 183, 184, 184, 177, 185, 185, 186, 186, 187, 187, 182, 178, 188, 188, 179, 184, 0, 181, 0, 180, 189, 189, 190, 190, 186, 191, 191, 185, 192, 192, 187, 0, 190, 189, 0, 191, 193, 193, 197, 197, 188, 199, 199, 200, 200, 193, 201, 201, 192, 202, 202, 0, 197, 203, 203, 199, 0, 204, 204, 205, 205, 197, 206, 206, 207, 207, 208, 208, 201, 209, 209, 210, 210, 211, 211, 202, 204, 212, 212, 206, 213, 213, 214, 214, 215, 215, 216, 216, 0, 209, 0, 211, 0, 208, 217, 217, 218, 218, 0, 210, 219, 219, 214, 220, 220, 215, 212, 0, 213, 221, 221, 222, 222, 0, 218, 223, 223, 224, 224, 225, 225, 226, 226, 221, 227, 227, 219, 228, 228, 220, 229, 229, 230, 230, 0, 227, 0, 223, 0, 222, 0, 225, 230, 0, 229, 231, 231, 232, 232, 233, 233, 234, 234, 0, 228, 235, 235, 232, 236, 236, 0, 237, 237, 233, 238, 238, 239, 239, 0, 234, 231, 240, 240, 241, 241, 0, 242, 242, 243, 243, 239, 0, 235, 244, 244, 0, 236, 237, 242, 0, 243, 241, 238, 0, 240, 245, 245, 246, 246, 247, 247, 248, 248, 244, 249, 249, 250, 250, 251, 251, 252, 252, 253, 253, 248, 254, 254, 256, 256, 248, 255, 255, 250, 248, 251, 0, 249, 0, 246, 261, 261, 256, 0, 257, 257, 262, 262, 263, 263, 252, 264, 264, 0, 254, 265, 265, 255, 257, 262, 266, 266, 267, 267, 0, 261, 268, 268, 269, 269, 0, 270, 270, 271, 271, 268, 273, 273, 272, 272, 0, 274, 274, 275, 275, 276, 276, 271, 277, 277, 269, 270, 272, 274, 273, 278, 278, 279, 279, 280, 280, 281, 281, 282, 282, 283, 283, 276, 284, 284, 279, 275, 0, 280, 285, 285, 286, 286, 0, 287, 287, 281, 288, 288, 289, 289, 0, 282, 290, 290, 283, 287, 291, 291, 288, 0, 284, 292, 292, 0, 293, 293, 290, 0, 286, 294, 294, 295, 295, 296, 296, 0, 289, 293, 291, 297, 297, 298, 298, 295, 294, 299, 299, 0, 300, 300, 0, 298, 301, 301, 302, 302, 297, 303, 303, 304, 304, 296, 300, 0, 302, 301, 305, 305, 306, 306, 307, 307, 0, 308, 308, 309, 309, 0, 306, 310, 310, 304, 308, 313, 313, 314, 314, 0, 307, 315, 315, 316, 316, 317, 317, 318, 318, 319, 319, 320, 320, 315, 322, 322, 310, 321, 321, 323, 323, 324, 324, 320, 325, 325, 326, 326, 327, 327, 328, 328, 316, 317, 0, 321, 329, 329, 327, 0, 326, 330, 330, 331, 331, 332, 332, 333, 333, 334, 334, 335, 335, 336, 336, 330, 337, 337, 0, 329, 0, 333, 0, 338, 338, 339, 339, 340, 340, 341, 341, 331, 338, 342, 342, 334, 343, 343, 344, 344, 345, 345, 346, 346, 347, 347, 348, 348, 342, 349, 349, 350, 350, 0, 345, 351, 351, 341, 0, 344, 0, 350, 346, 0, 347, 352, 352, 353, 353, 351, 354, 354, 355, 355, 348, 0, 353, 356, 356, 357, 357, 358, 358, 359, 359, 360, 360, 362, 362, 356, 361, 361, 363, 363, 364, 364, 0, 359, 354, 362, 0, 365, 365, 366, 366, 357, 363, 367, 367, 368, 368, 360, 369, 369, 361, 365, 366, 370, 370, 371, 371, 372, 372, 368, 373, 373, 374, 374, 375, 375, 376, 376, 0, 372, 377, 377, 378, 378, 379, 379, 374, 380, 380, 376, 370, 381, 381, 0, 379, 382, 382, 383, 383, 384, 384, 385, 385, 386, 386, 387, 387, 0, 378, 388, 388, 385, 389, 389, 390, 390, 391, 391, 392, 392, 393, 393, 0, 388, 394, 394, 0, 384, 395, 395, 396, 396, 397, 397, 0, 398, 398, 395, 0, 389, 399, 399, 0, 391, 400, 400, 392, 398, 393, 0, 399, 0, 394, 401, 401, 402, 402, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 400, 0, 0, 0, 0, 0, 0, 0, 0, 0, 401, 404, 404, 404, 404, 404, 404, 404, 404, 405, 405, 405, 405, 405, 405, 405, 405, 406, 406, 407, 0, 407, 407, 407, 407, 407, 407, 408, 408, 408, 409, 0, 0, 409, 0, 409, 409, 409, 410, 0, 0, 410, 410, 410, 410, 410, 411, 0, 0, 0, 411, 411, 411, 411, 412, 0, 412, 412, 412, 412, 412, 412, 413, 0, 0, 413, 413, 413, 413, 413, 414, 414, 415, 415, 415, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403 } ; static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; extern int c__flex_debug; int c__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 *c_text; #line 1 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" #define YY_NO_INPUT 1 #line 14 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" #include #include "tokenizer.h" #line 931 "clexer.cpp" #define INITIAL 0 #define comment 1 #define string_literal 2 #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 c_lex_destroy (void ); int c_get_debug (void ); void c_set_debug (int debug_flag ); YY_EXTRA_TYPE c_get_extra (void ); void c_set_extra (YY_EXTRA_TYPE user_defined ); FILE *c_get_in (void ); void c_set_in (FILE * _in_str ); FILE *c_get_out (void ); void c_set_out (FILE * _out_str ); yy_size_t c_get_leng (void ); char *c_get_text (void ); int c_get_lineno (void ); void c_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 c_wrap (void ); #else extern int c_wrap (void ); #endif #endif #ifndef YY_NO_UNPUT #endif #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( c_text, c_leng, 1, c_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( c_in )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ if ( c == '\n' ) \ buf[n++] = (char) c; \ if ( c == EOF && ferror( c_in ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ else \ { \ errno=0; \ while ( (result = fread(buf, 1, max_size, c_in))==0 && ferror(c_in)) \ { \ if( errno != EINTR) \ { \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ break; \ } \ errno=0; \ clearerr(c_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 c_lex (void); #define YY_DECL int c_lex (void) #endif /* !YY_DECL */ /* Code executed at the beginning of each rule, after c_text and c_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 /*LINTED*/break; #endif #define YY_RULE_SETUP \ YY_USER_ACTION /** The main scanner function which does all the work. */ YY_DECL { yy_state_type yy_current_state; char *yy_cp, *yy_bp; int yy_act; if ( !(yy_init) ) { (yy_init) = 1; #ifdef YY_USER_INIT YY_USER_INIT; #endif if ( ! (yy_start) ) (yy_start) = 1; /* first start state */ if ( ! c_in ) c_in = stdin; if ( ! c_out ) c_out = stdout; if ( ! YY_CURRENT_BUFFER ) { c_ensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = c__create_buffer(c_in,YY_BUF_SIZE ); } c__load_buffer_state( ); } { #line 22 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" #line 1151 "clexer.cpp" while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ { yy_cp = (yy_c_buf_p); /* Support of c_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 { 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 >= 404 ) 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] != 1319 ); 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 23 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 2: YY_RULE_SETUP #line 24 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 3: YY_RULE_SETUP #line 25 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 4: YY_RULE_SETUP #line 26 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 5: YY_RULE_SETUP #line 27 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 6: YY_RULE_SETUP #line 28 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 7: YY_RULE_SETUP #line 29 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 8: YY_RULE_SETUP #line 30 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 9: YY_RULE_SETUP #line 31 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 10: YY_RULE_SETUP #line 32 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 11: YY_RULE_SETUP #line 33 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 12: YY_RULE_SETUP #line 34 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 13: YY_RULE_SETUP #line 35 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 14: YY_RULE_SETUP #line 36 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 15: YY_RULE_SETUP #line 37 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 16: YY_RULE_SETUP #line 38 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 17: YY_RULE_SETUP #line 39 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 18: YY_RULE_SETUP #line 40 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 19: YY_RULE_SETUP #line 41 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 20: YY_RULE_SETUP #line 42 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 21: YY_RULE_SETUP #line 43 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 22: YY_RULE_SETUP #line 44 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 23: YY_RULE_SETUP #line 45 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 24: YY_RULE_SETUP #line 46 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 25: YY_RULE_SETUP #line 47 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 26: YY_RULE_SETUP #line 48 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 27: YY_RULE_SETUP #line 49 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 28: YY_RULE_SETUP #line 51 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 29: YY_RULE_SETUP #line 52 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 30: YY_RULE_SETUP #line 53 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 31: YY_RULE_SETUP #line 54 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 32: YY_RULE_SETUP #line 55 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 33: YY_RULE_SETUP #line 56 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 34: YY_RULE_SETUP #line 57 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 35: YY_RULE_SETUP #line 58 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 36: YY_RULE_SETUP #line 59 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 37: YY_RULE_SETUP #line 60 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 38: YY_RULE_SETUP #line 61 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 39: YY_RULE_SETUP #line 62 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 40: YY_RULE_SETUP #line 63 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 41: YY_RULE_SETUP #line 64 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 42: YY_RULE_SETUP #line 65 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 43: YY_RULE_SETUP #line 66 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 44: YY_RULE_SETUP #line 67 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 45: YY_RULE_SETUP #line 68 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 46: YY_RULE_SETUP #line 69 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 47: YY_RULE_SETUP #line 70 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 48: YY_RULE_SETUP #line 71 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 49: YY_RULE_SETUP #line 72 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 50: YY_RULE_SETUP #line 73 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 51: YY_RULE_SETUP #line 74 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 52: YY_RULE_SETUP #line 75 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 53: YY_RULE_SETUP #line 76 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 54: YY_RULE_SETUP #line 77 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 55: YY_RULE_SETUP #line 78 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 56: YY_RULE_SETUP #line 79 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 57: YY_RULE_SETUP #line 80 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 58: YY_RULE_SETUP #line 81 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 59: YY_RULE_SETUP #line 82 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 60: YY_RULE_SETUP #line 83 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 61: YY_RULE_SETUP #line 84 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 62: YY_RULE_SETUP #line 85 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 63: YY_RULE_SETUP #line 86 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 64: YY_RULE_SETUP #line 87 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 65: YY_RULE_SETUP #line 88 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 66: YY_RULE_SETUP #line 89 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 67: YY_RULE_SETUP #line 90 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 68: YY_RULE_SETUP #line 91 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 69: YY_RULE_SETUP #line 92 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 70: YY_RULE_SETUP #line 93 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 71: YY_RULE_SETUP #line 94 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 72: YY_RULE_SETUP #line 95 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 73: YY_RULE_SETUP #line 96 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 74: YY_RULE_SETUP #line 97 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 75: YY_RULE_SETUP #line 99 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { BEGIN(comment); return(TOKENIZER_COMMENT); } YY_BREAK case 76: YY_RULE_SETUP #line 100 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_COMMENT); } YY_BREAK case 77: YY_RULE_SETUP #line 101 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_COMMENT); } YY_BREAK case 78: /* rule 78 can match eol */ YY_RULE_SETUP #line 102 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_NEWLINE); } YY_BREAK case 79: YY_RULE_SETUP #line 103 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_NEWLINE); } YY_BREAK case 80: /* rule 80 can match eol */ YY_RULE_SETUP #line 104 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_NEWLINE); } YY_BREAK case 81: YY_RULE_SETUP #line 105 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { BEGIN(INITIAL); return(TOKENIZER_COMMENT); } YY_BREAK case 82: YY_RULE_SETUP #line 107 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_COMMENT); } YY_BREAK case 83: YY_RULE_SETUP #line 109 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_DIRECTIVE); } YY_BREAK case 84: YY_RULE_SETUP #line 111 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { BEGIN(string_literal); return(TOKENIZER_LITERAL); } YY_BREAK case 85: YY_RULE_SETUP #line 112 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 86: /* rule 86 can match eol */ YY_RULE_SETUP #line 113 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_NEWLINE); } YY_BREAK case 87: YY_RULE_SETUP #line 114 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_NEWLINE); } YY_BREAK case 88: /* rule 88 can match eol */ YY_RULE_SETUP #line 115 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_NEWLINE); } YY_BREAK case 89: YY_RULE_SETUP #line 116 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { BEGIN(INITIAL); return(TOKENIZER_LITERAL); } YY_BREAK case 90: YY_RULE_SETUP #line 119 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 91: YY_RULE_SETUP #line 120 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 92: YY_RULE_SETUP #line 121 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 93: YY_RULE_SETUP #line 122 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 94: YY_RULE_SETUP #line 123 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 95: YY_RULE_SETUP #line 124 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 96: YY_RULE_SETUP #line 125 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 97: YY_RULE_SETUP #line 126 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 98: YY_RULE_SETUP #line 127 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 99: YY_RULE_SETUP #line 128 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 100: YY_RULE_SETUP #line 129 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 101: YY_RULE_SETUP #line 130 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 102: YY_RULE_SETUP #line 131 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 103: YY_RULE_SETUP #line 132 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 104: YY_RULE_SETUP #line 133 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 105: YY_RULE_SETUP #line 134 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 106: YY_RULE_SETUP #line 136 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 107: YY_RULE_SETUP #line 137 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 108: YY_RULE_SETUP #line 138 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 109: YY_RULE_SETUP #line 140 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 110: YY_RULE_SETUP #line 141 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 111: /* rule 111 can match eol */ YY_RULE_SETUP #line 143 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_NEWLINE); } YY_BREAK case 112: /* rule 112 can match eol */ YY_RULE_SETUP #line 144 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_NEWLINE); } YY_BREAK case 113: YY_RULE_SETUP #line 145 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_NEWLINE); } YY_BREAK case 114: YY_RULE_SETUP #line 146 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_TEXT); } YY_BREAK case 115: YY_RULE_SETUP #line 147 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_TEXT); } YY_BREAK case 116: YY_RULE_SETUP #line 148 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" { return(TOKENIZER_TEXT); } YY_BREAK case 117: YY_RULE_SETUP #line 150 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" ECHO; YY_BREAK #line 1799 "clexer.cpp" 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_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 c_in at a new source and called * c_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 = c_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 ( c_wrap( ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up * c_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 user's declarations */ } /* end of c_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) { char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; char *source = (yytext_ptr); yy_size_t 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 = (yy_size_t) ((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_LVALUE; 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. */ c_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; c_restart(c_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 ((int) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) c_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) { yy_state_type yy_current_state; char *yy_cp; yy_current_state = (yy_start); for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) { 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 >= 404 ) 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 ) { int yy_is_jam; char *yy_cp = (yy_c_buf_p); 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 >= 404 ) 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 == 403); return yy_is_jam ? 0 : yy_current_state; } #ifndef YY_NO_UNPUT #endif #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. */ c_restart(c_in ); /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { if ( c_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 c_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 c_restart (FILE * input_file ) { if ( ! YY_CURRENT_BUFFER ){ c_ensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = c__create_buffer(c_in,YY_BUF_SIZE ); } c__init_buffer(YY_CURRENT_BUFFER,input_file ); c__load_buffer_state( ); } /** Switch to a different input buffer. * @param new_buffer The new input buffer. * */ void c__switch_to_buffer (YY_BUFFER_STATE new_buffer ) { /* TODO. We should be able to replace this entire function body * with * c_pop_buffer_state(); * c_push_buffer_state(new_buffer); */ c_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; c__load_buffer_state( ); /* We don't actually know whether we did this switch during * EOF (c_wrap()) processing, but the only time this flag * is looked at is after c_wrap() is called, so it's safe * to go ahead and always set it. */ (yy_did_buffer_switch_on_eof) = 1; } static void c__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; c_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 c__create_buffer (FILE * file, int size ) { YY_BUFFER_STATE b; b = (YY_BUFFER_STATE) c_alloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in c__create_buffer()" ); b->yy_buf_size = (yy_size_t)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 *) c_alloc(b->yy_buf_size + 2 ); if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in c__create_buffer()" ); b->yy_is_our_buffer = 1; c__init_buffer(b,file ); return b; } /** Destroy the buffer. * @param b a buffer created with c__create_buffer() * */ void c__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 ) c_free((void *) b->yy_ch_buf ); c_free((void *) b ); } /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, * such as during a c_restart() or at EOF. */ static void c__init_buffer (YY_BUFFER_STATE b, FILE * file ) { int oerrno = errno; c__flush_buffer(b ); b->yy_input_file = file; b->yy_fill_buffer = 1; /* If b is the current buffer, then c__init_buffer was _probably_ * called from c_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 c__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 ) c__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 c_push_buffer_state (YY_BUFFER_STATE new_buffer ) { if (new_buffer == NULL) return; c_ensure_buffer_stack(); /* This block is copied from c__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 c__switch_to_buffer. */ c__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 c_pop_buffer_state (void) { if (!YY_CURRENT_BUFFER) return; c__delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; if ((yy_buffer_stack_top) > 0) --(yy_buffer_stack_top); if (YY_CURRENT_BUFFER) { c__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 c_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; /* After all that talk, this was set to 1 anyways... */ (yy_buffer_stack) = (struct yy_buffer_state**)c_alloc (num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in c_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. */ yy_size_t grow_size = 8 /* arbitrary grow size */; num_to_alloc = (yy_buffer_stack_max) + grow_size; (yy_buffer_stack) = (struct yy_buffer_state**)c_realloc ((yy_buffer_stack), num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in c_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 c__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) c_alloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in c__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; c__switch_to_buffer(b ); return b; } /** Setup the input buffer state to scan a string. The next call to c_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 * c__scan_bytes() instead. */ YY_BUFFER_STATE c__scan_string (yyconst char * yystr ) { return c__scan_bytes(yystr,strlen(yystr) ); } /** Setup the input buffer state to scan the given bytes. The next call to c_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 c__scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len ) { YY_BUFFER_STATE b; char *buf; yy_size_t n; yy_size_t i; /* Get memory for full buffer, including space for trailing EOB's. */ n = _yybytes_len + 2; buf = (char *) c_alloc(n ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in c__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 = c__scan_buffer(buf,n ); if ( ! b ) YY_FATAL_ERROR( "bad buffer in c__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 c_text. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ c_text[c_leng] = (yy_hold_char); \ (yy_c_buf_p) = c_text + yyless_macro_arg; \ (yy_hold_char) = *(yy_c_buf_p); \ *(yy_c_buf_p) = '\0'; \ c_leng = yyless_macro_arg; \ } \ while ( 0 ) /* Accessor methods (get/set functions) to struct members. */ /** Get the current line number. * */ int c_get_lineno (void) { return c_lineno; } /** Get the input stream. * */ FILE *c_get_in (void) { return c_in; } /** Get the output stream. * */ FILE *c_get_out (void) { return c_out; } /** Get the length of the current token. * */ yy_size_t c_get_leng (void) { return c_leng; } /** Get the current token. * */ char *c_get_text (void) { return c_text; } /** Set the current line number. * @param _line_number line number * */ void c_set_lineno (int _line_number ) { c_lineno = _line_number; } /** Set the input stream. This does not discard the current * input buffer. * @param _in_str A readable stream. * * @see c__switch_to_buffer */ void c_set_in (FILE * _in_str ) { c_in = _in_str ; } void c_set_out (FILE * _out_str ) { c_out = _out_str ; } int c_get_debug (void) { return c__flex_debug; } void c_set_debug (int _bdebug ) { c__flex_debug = _bdebug ; } static int yy_init_globals (void) { /* Initialization is the same as for the non-reentrant scanner. * This function is called from c_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 c_in = stdin; c_out = stdout; #else c_in = (FILE *) 0; c_out = (FILE *) 0; #endif /* For future reference: Set errno on error, since we are called by * c_lex_init() */ return 0; } /* c_lex_destroy is for both reentrant and non-reentrant scanners. */ int c_lex_destroy (void) { /* Pop the buffer stack, destroying each element. */ while(YY_CURRENT_BUFFER){ c__delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; c_pop_buffer_state(); } /* Destroy the stack itself. */ c_free((yy_buffer_stack) ); (yy_buffer_stack) = NULL; /* Reset the globals. This is important in a non-reentrant scanner so the next time * c_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 ) { 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 ) { int n; for ( n = 0; s[n]; ++n ) ; return n; } #endif void *c_alloc (yy_size_t size ) { return (void *) malloc( size ); } void *c_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 c_free (void * ptr ) { free( (char *) ptr ); /* see c_realloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" #line 150 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/clexer.lpp" cgdb-0.8.0/lib/tokenizer/golexer.lpp0000664000175000017500000001377513057302460014320 00000000000000%option prefix="go_" %option outfile="lex.yy.c" %option noyywrap %option nounput %option noinput O [0-7] D [0-9] H [0-9a-fA-F_] L [a-zA-Z_] T [0-9a-zA-Z_] IDENTIFIER {L}+{T}* esc_char \\[abfnrtv\\'"] big_u_val \\U{H}{H}{H}{H} little_u_val \\u{H}{H}{H}{H} hex_byte_val \\x{H}{H} oct_byte_val \\{O}{O}{O} byte_val ({oct_byte_val}|{hex_byte_val}) unicode_char [^'] unicode_val ({unicode_char}|{little_u_val}|{big_u_val}|{esc_char}) %{ #include #include "tokenizer.h" %} %x comment %x string_literal %x alt_wysiwyg_literal %x unicode_literal %% "bool" { return(TOKENIZER_TYPE); } "uint" { return(TOKENIZER_TYPE); } "int" { return(TOKENIZER_TYPE); } "uintptr" { return(TOKENIZER_TYPE); } "uint16" { return(TOKENIZER_TYPE); } "uint32" { return(TOKENIZER_TYPE); } "uint64" { return(TOKENIZER_TYPE); } "int8" { return(TOKENIZER_TYPE); } "int16" { return(TOKENIZER_TYPE); } "int32" { return(TOKENIZER_TYPE); } "int64" { return(TOKENIZER_TYPE); } "float32" { return(TOKENIZER_TYPE); } "float64" { return(TOKENIZER_TYPE); } "complex64" { return(TOKENIZER_TYPE); } "complex128" { return(TOKENIZER_TYPE); } "byte" { return(TOKENIZER_TYPE); } "rune" { return(TOKENIZER_TYPE); } "string" { return(TOKENIZER_TYPE); } "struct" { return(TOKENIZER_TYPE); } "func" { return(TOKENIZER_TYPE); } "interface" { return(TOKENIZER_TYPE); } "map" { return(TOKENIZER_TYPE); } "chan" { return(TOKENIZER_TYPE); } "break" { return(TOKENIZER_KEYWORD); } "case" { return(TOKENIZER_KEYWORD); } "const" { return(TOKENIZER_KEYWORD); } "continue" { return(TOKENIZER_KEYWORD); } "default" { return(TOKENIZER_KEYWORD); } "defer" { return(TOKENIZER_KEYWORD); } "else" { return(TOKENIZER_KEYWORD); } "fallthrough" { return(TOKENIZER_KEYWORD); } "false" { return(TOKENIZER_KEYWORD); } "for" { return(TOKENIZER_KEYWORD); } "go" { return(TOKENIZER_KEYWORD); } "goto" { return(TOKENIZER_KEYWORD); } "if" { return(TOKENIZER_KEYWORD); } "range" { return(TOKENIZER_KEYWORD); } "return" { return(TOKENIZER_KEYWORD); } "select" { return(TOKENIZER_KEYWORD); } "switch" { return(TOKENIZER_KEYWORD); } "true" { return(TOKENIZER_KEYWORD); } "type" { return(TOKENIZER_KEYWORD); } "var" { 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); } "import" { return(TOKENIZER_DIRECTIVE); } "package" { 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(alt_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); } 0x{H}+ { return(TOKENIZER_LITERAL); } 0X{H}+ { return(TOKENIZER_LITERAL); } {D}+\.?{D}*([eE][-+]?{D}+)? { return(TOKENIZER_LITERAL); } {D}*\.?{D}+([eE][-+]?{D}+)? { return(TOKENIZER_LITERAL); } /* imaginary */ {D}+i { return(TOKENIZER_LITERAL); } {D}*\.?{D}*([eE][-+]?{D}+)?i { return(TOKENIZER_LITERAL); } /* rune */ /* It's a dirty little trick, since cgdb will never see ilegal program that can't pass compiler * check we just assume anything between single quote would be unicode literal */ "'" { BEGIN(unicode_literal); return(TOKENIZER_LITERAL); } /* {unicode_val}|{byte_val} { 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); } '.' { 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); } %% cgdb-0.8.0/lib/tokenizer/cgdbhelplexer.cpp0000664000175000017500000020640614171036460015447 00000000000000#line 2 "cgdbhelplexer.cpp" #line 4 "cgdbhelplexer.cpp" #define YY_INT_ALIGNED short int /* A lexical scanner generated by flex */ #define yy_create_buffer cgdbhelp__create_buffer #define yy_delete_buffer cgdbhelp__delete_buffer #define yy_flex_debug cgdbhelp__flex_debug #define yy_init_buffer cgdbhelp__init_buffer #define yy_flush_buffer cgdbhelp__flush_buffer #define yy_load_buffer_state cgdbhelp__load_buffer_state #define yy_switch_to_buffer cgdbhelp__switch_to_buffer #define yyin cgdbhelp_in #define yyleng cgdbhelp_leng #define yylex cgdbhelp_lex #define yylineno cgdbhelp_lineno #define yyout cgdbhelp_out #define yyrestart cgdbhelp_restart #define yytext cgdbhelp_text #define yywrap cgdbhelp_wrap #define yyalloc cgdbhelp_alloc #define yyrealloc cgdbhelp_realloc #define yyfree cgdbhelp_free #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 6 #define YY_FLEX_SUBMINOR_VERSION 0 #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 cgdbhelp_restart(cgdbhelp_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 #ifndef YY_TYPEDEF_YY_SIZE_T #define YY_TYPEDEF_YY_SIZE_T typedef size_t yy_size_t; #endif extern yy_size_t cgdbhelp_leng; extern FILE *cgdbhelp_in, *cgdbhelp_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) #define YY_LINENO_REWIND_TO(ptr) /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ do \ { \ /* Undo effects of setting up cgdbhelp_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 cgdbhelp_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. */ 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 cgdbhelp_restart()), so that the user can continue scanning by * just pointing cgdbhelp_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 cgdbhelp_text is formed. */ static char yy_hold_char; static int yy_n_chars; /* number of characters read into yy_ch_buf */ yy_size_t cgdbhelp_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 cgdbhelp_wrap()'s to do buffer switches * instead of setting up a fresh cgdbhelp_in. A bit of a hack ... */ static int yy_did_buffer_switch_on_eof; void cgdbhelp_restart (FILE *input_file ); void cgdbhelp__switch_to_buffer (YY_BUFFER_STATE new_buffer ); YY_BUFFER_STATE cgdbhelp__create_buffer (FILE *file,int size ); void cgdbhelp__delete_buffer (YY_BUFFER_STATE b ); void cgdbhelp__flush_buffer (YY_BUFFER_STATE b ); void cgdbhelp_push_buffer_state (YY_BUFFER_STATE new_buffer ); void cgdbhelp_pop_buffer_state (void ); static void cgdbhelp_ensure_buffer_stack (void ); static void cgdbhelp__load_buffer_state (void ); static void cgdbhelp__init_buffer (YY_BUFFER_STATE b,FILE *file ); #define YY_FLUSH_BUFFER cgdbhelp__flush_buffer(YY_CURRENT_BUFFER ) YY_BUFFER_STATE cgdbhelp__scan_buffer (char *base,yy_size_t size ); YY_BUFFER_STATE cgdbhelp__scan_string (yyconst char *yy_str ); YY_BUFFER_STATE cgdbhelp__scan_bytes (yyconst char *bytes,yy_size_t len ); void *cgdbhelp_alloc (yy_size_t ); void *cgdbhelp_realloc (void *,yy_size_t ); void cgdbhelp_free (void * ); #define yy_new_buffer cgdbhelp__create_buffer #define yy_set_interactive(is_interactive) \ { \ if ( ! YY_CURRENT_BUFFER ){ \ cgdbhelp_ensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ cgdbhelp__create_buffer(cgdbhelp_in,YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } #define yy_set_bol(at_bol) \ { \ if ( ! YY_CURRENT_BUFFER ){\ cgdbhelp_ensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ cgdbhelp__create_buffer(cgdbhelp_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 */ #define cgdbhelp_wrap() (/*CONSTCOND*/1) #define YY_SKIP_YYWRAP typedef unsigned char YY_CHAR; FILE *cgdbhelp_in = (FILE *) 0, *cgdbhelp_out = (FILE *) 0; typedef int yy_state_type; extern int cgdbhelp_lineno; int cgdbhelp_lineno = 1; extern char *cgdbhelp_text; #ifdef yytext_ptr #undef yytext_ptr #endif #define yytext_ptr cgdbhelp_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 ); #if defined(__GNUC__) && __GNUC__ >= 3 __attribute__((__noreturn__)) #endif static void yy_fatal_error (yyconst char msg[] ); /* Done after the current pattern has been matched and before the * corresponding action - sets up cgdbhelp_text. */ #define YY_DO_BEFORE_ACTION \ (yytext_ptr) = yy_bp; \ cgdbhelp_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 55 #define YY_END_OF_BUFFER 56 /* 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[318] = { 0, 0, 0, 56, 54, 52, 49, 51, 54, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 48, 47, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 48, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 53, 53, 53, 53, 53, 53, 53, 53, 53, 40, 53, 53, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 53, 1, 38, 53, 30, 53, 31, 53, 53, 53, 53, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 26, 53, 53, 53, 53, 53, 53, 36, 53, 53, 46, 53, 0, 0, 0, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 3, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 53, 53, 53, 53, 53, 24, 53, 53, 53, 53, 53, 53, 53, 42, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 21, 23, 32, 53, 33, 53, 53, 53, 53, 53, 53, 53, 41, 53, 0, 5, 0, 0, 0, 0, 6, 0, 0, 0, 0, 22, 53, 53, 35, 39, 28, 53, 29, 53, 53, 0, 4, 0, 0, 0, 0, 0, 0, 0, 53, 27, 37, 53, 53, 0, 0, 0, 8, 0, 0, 2, 0, 25, 53, 45, 16, 0, 0, 0, 0, 9, 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, 0, 0, 0, 0, 0, 0, 11, 15, 0, 17, 10, 14, 0, 0, 0, 0, 0, 0, 0, 13, 12, 0 } ; static yyconst YY_CHAR 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, 1, 1, 1, 1, 1, 5, 1, 1, 6, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 7, 1, 1, 1, 8, 9, 10, 11, 12, 13, 14, 15, 16, 13, 17, 18, 19, 20, 21, 22, 13, 23, 24, 25, 26, 13, 27, 28, 29, 13, 1, 1, 1, 1, 13, 30, 31, 32, 33, 34, 35, 13, 36, 37, 38, 13, 39, 40, 41, 42, 43, 44, 13, 45, 46, 47, 48, 13, 49, 50, 51, 13, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 YY_CHAR yy_meta[52] = { 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 } ; static yyconst flex_uint16_t yy_base[319] = { 0, 0, 46, 621, 633, 633, 633, 615, 45, 0, 41, 46, 63, 39, 50, 64, 61, 53, 64, 611, 607, 633, 70, 77, 84, 73, 82, 82, 83, 82, 96, 81, 0, 85, 91, 96, 105, 93, 106, 103, 114, 108, 119, 122, 605, 572, 132, 127, 124, 137, 141, 139, 131, 143, 135, 141, 148, 138, 149, 136, 155, 146, 154, 144, 165, 168, 174, 0, 164, 172, 183, 177, 173, 184, 188, 177, 181, 184, 182, 185, 187, 182, 196, 0, 190, 0, 0, 224, 0, 193, 0, 192, 200, 215, 209, 219, 228, 212, 232, 218, 233, 529, 240, 228, 236, 239, 255, 525, 0, 237, 232, 239, 262, 262, 266, 0, 295, 255, 0, 258, 264, 268, 281, 273, 269, 284, 633, 277, 277, 281, 275, 292, 295, 633, 297, 298, 318, 311, 321, 316, 317, 308, 315, 331, 330, 331, 336, 0, 327, 325, 331, 340, 338, 335, 512, 351, 344, 352, 356, 353, 357, 354, 348, 366, 367, 0, 363, 356, 375, 378, 374, 378, 376, 0, 381, 508, 373, 389, 385, 397, 633, 505, 390, 397, 394, 399, 0, 0, 0, 398, 0, 401, 401, 412, 406, 399, 417, 420, 0, 416, 415, 633, 501, 429, 427, 427, 633, 428, 427, 424, 431, 0, 428, 427, 0, 0, 0, 438, 0, 439, 439, 440, 633, 443, 451, 480, 458, 456, 473, 462, 469, 0, 0, 454, 456, 420, 472, 470, 633, 465, 470, 633, 291, 0, 484, 0, 633, 487, 478, 474, 484, 633, 0, 485, 491, 496, 520, 487, 524, 489, 493, 504, 507, 502, 516, 518, 524, 527, 520, 525, 528, 536, 282, 537, 531, 537, 546, 542, 546, 559, 558, 633, 554, 556, 568, 566, 277, 556, 567, 567, 561, 560, 573, 573, 633, 274, 241, 577, 160, 147, 140, 578, 633, 633, 583, 633, 633, 633, 584, 585, 587, 579, 585, 104, 69, 633, 633, 633, 56 } ; static yyconst flex_int16_t yy_def[319] = { 0, 317, 1, 317, 317, 317, 317, 317, 317, 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, 317, 317, 317, 317, 317, 317, 317, 317, 317, 318, 318, 318, 318, 318, 317, 317, 317, 317, 317, 317, 317, 317, 318, 318, 318, 317, 317, 317, 317, 317, 317, 318, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 0, 317 } ; static yyconst flex_uint16_t yy_nxt[685] = { 0, 4, 5, 6, 7, 8, 4, 4, 9, 10, 11, 12, 9, 9, 13, 9, 9, 9, 14, 15, 9, 9, 9, 16, 9, 9, 9, 17, 9, 18, 8, 9, 10, 11, 12, 9, 13, 9, 9, 9, 14, 15, 9, 9, 9, 16, 9, 9, 9, 17, 9, 18, 19, 20, 22, 23, 24, 25, 32, 33, 35, 26, 38, 27, 34, 28, 39, 29, 42, 30, 31, 37, 40, 41, 316, 36, 43, 22, 23, 24, 25, 33, 35, 26, 38, 27, 34, 28, 39, 29, 42, 30, 31, 46, 37, 40, 41, 36, 47, 43, 48, 49, 50, 51, 52, 53, 54, 60, 55, 315, 57, 58, 59, 61, 63, 46, 62, 65, 64, 67, 47, 56, 48, 49, 50, 51, 52, 53, 66, 54, 60, 55, 57, 58, 59, 68, 61, 63, 62, 65, 69, 64, 67, 56, 70, 307, 71, 72, 73, 74, 66, 75, 306, 76, 77, 78, 81, 68, 79, 80, 82, 83, 69, 84, 85, 305, 86, 70, 71, 72, 73, 87, 74, 88, 75, 76, 77, 89, 78, 81, 79, 80, 82, 91, 83, 84, 92, 85, 86, 93, 94, 95, 98, 87, 90, 88, 96, 97, 99, 105, 89, 100, 101, 102, 103, 91, 104, 106, 107, 92, 108, 93, 94, 115, 95, 98, 90, 116, 96, 97, 117, 99, 105, 100, 101, 102, 103, 118, 104, 106, 119, 107, 108, 109, 110, 115, 120, 122, 111, 116, 121, 123, 117, 112, 124, 125, 303, 113, 127, 130, 118, 128, 119, 114, 129, 134, 109, 110, 120, 122, 111, 135, 136, 121, 123, 112, 124, 131, 125, 113, 137, 127, 130, 128, 138, 114, 129, 134, 139, 302, 146, 132, 294, 135, 136, 147, 148, 281, 149, 150, 131, 151, 153, 137, 152, 154, 251, 138, 155, 156, 157, 139, 146, 132, 140, 141, 161, 147, 148, 142, 149, 158, 150, 151, 143, 153, 152, 154, 144, 159, 155, 156, 157, 160, 145, 164, 162, 140, 141, 161, 163, 142, 165, 158, 166, 167, 143, 168, 169, 170, 144, 159, 171, 172, 173, 160, 145, 164, 174, 162, 175, 176, 177, 163, 178, 165, 166, 167, 179, 168, 169, 181, 170, 182, 183, 171, 172, 173, 184, 186, 174, 185, 175, 176, 187, 177, 178, 188, 189, 191, 179, 192, 193, 194, 181, 182, 195, 183, 197, 198, 196, 184, 186, 185, 199, 190, 187, 200, 202, 188, 203, 189, 191, 192, 193, 204, 194, 205, 208, 195, 197, 207, 198, 196, 209, 210, 199, 190, 211, 200, 202, 212, 213, 203, 214, 246, 215, 204, 216, 217, 205, 208, 219, 207, 220, 221, 209, 210, 223, 226, 211, 224, 225, 212, 213, 227, 218, 214, 215, 228, 216, 229, 217, 230, 231, 219, 220, 221, 232, 233, 234, 223, 226, 224, 225, 235, 236, 227, 218, 237, 239, 228, 240, 229, 242, 230, 231, 243, 241, 244, 232, 233, 234, 245, 247, 238, 248, 235, 236, 249, 250, 237, 252, 239, 240, 253, 256, 242, 254, 255, 243, 244, 257, 258, 259, 245, 222, 247, 248, 264, 206, 249, 250, 201, 268, 252, 269, 180, 253, 256, 254, 255, 270, 271, 257, 272, 258, 259, 260, 261, 133, 264, 265, 266, 126, 262, 268, 273, 269, 267, 263, 274, 275, 276, 270, 271, 277, 272, 278, 279, 280, 260, 261, 282, 283, 265, 266, 262, 284, 273, 285, 267, 263, 274, 275, 276, 286, 287, 277, 288, 278, 279, 280, 289, 290, 282, 283, 291, 292, 45, 284, 293, 285, 295, 296, 297, 298, 299, 286, 287, 300, 301, 288, 304, 308, 289, 290, 309, 310, 291, 311, 292, 312, 293, 313, 295, 296, 297, 298, 299, 314, 44, 300, 301, 45, 304, 308, 44, 21, 309, 310, 317, 311, 317, 312, 317, 313, 317, 317, 317, 317, 317, 314, 3, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317 } ; static yyconst flex_int16_t yy_chk[685] = { 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, 1, 1, 1, 1, 1, 1, 2, 2, 8, 8, 8, 8, 318, 10, 11, 8, 13, 8, 10, 8, 14, 8, 17, 8, 8, 12, 15, 16, 314, 11, 18, 8, 8, 8, 8, 10, 11, 8, 13, 8, 10, 8, 14, 8, 17, 8, 8, 22, 12, 15, 16, 11, 23, 18, 24, 25, 26, 27, 28, 29, 30, 35, 30, 313, 31, 33, 34, 36, 38, 22, 37, 39, 38, 41, 23, 30, 24, 25, 26, 27, 28, 29, 40, 30, 35, 30, 31, 33, 34, 42, 36, 38, 37, 39, 43, 38, 41, 30, 46, 300, 47, 47, 48, 49, 40, 50, 299, 51, 52, 53, 56, 42, 54, 55, 57, 58, 43, 59, 60, 298, 61, 46, 47, 47, 48, 62, 49, 63, 50, 51, 52, 64, 53, 56, 54, 55, 57, 65, 58, 59, 66, 60, 61, 68, 69, 70, 73, 62, 64, 63, 71, 72, 74, 80, 64, 75, 76, 77, 78, 65, 79, 81, 82, 66, 84, 68, 69, 89, 70, 73, 64, 91, 71, 72, 92, 74, 80, 75, 76, 77, 78, 93, 79, 81, 94, 82, 84, 87, 87, 89, 95, 97, 87, 91, 96, 98, 92, 87, 99, 100, 296, 87, 102, 105, 93, 103, 94, 87, 104, 109, 87, 87, 95, 97, 87, 110, 111, 96, 98, 87, 99, 106, 100, 87, 112, 102, 105, 103, 113, 87, 104, 109, 114, 295, 117, 106, 286, 110, 111, 119, 120, 272, 121, 122, 106, 123, 125, 112, 124, 127, 242, 113, 128, 129, 130, 114, 117, 106, 116, 116, 135, 119, 120, 116, 121, 131, 122, 123, 116, 125, 124, 127, 116, 132, 128, 129, 130, 134, 116, 137, 136, 116, 116, 135, 136, 116, 138, 131, 139, 140, 116, 141, 142, 143, 116, 132, 144, 145, 146, 134, 116, 137, 148, 136, 149, 150, 151, 136, 152, 138, 139, 140, 153, 141, 142, 155, 143, 156, 157, 144, 145, 146, 158, 160, 148, 159, 149, 150, 161, 151, 152, 162, 163, 164, 153, 166, 167, 168, 155, 156, 169, 157, 170, 171, 169, 158, 160, 159, 172, 163, 161, 174, 176, 162, 177, 163, 164, 166, 167, 178, 168, 179, 183, 169, 170, 182, 171, 169, 184, 185, 172, 163, 189, 174, 176, 191, 192, 177, 193, 235, 194, 178, 195, 196, 179, 183, 197, 182, 199, 200, 184, 185, 203, 207, 189, 204, 205, 191, 192, 208, 196, 193, 194, 209, 195, 210, 196, 212, 213, 197, 199, 200, 217, 219, 220, 203, 207, 204, 205, 221, 223, 208, 196, 224, 226, 209, 227, 210, 229, 212, 213, 230, 228, 233, 217, 219, 220, 234, 236, 225, 237, 221, 223, 239, 240, 224, 244, 226, 227, 247, 250, 229, 248, 249, 230, 233, 253, 254, 255, 234, 202, 236, 237, 257, 181, 239, 240, 175, 259, 244, 260, 154, 247, 250, 248, 249, 261, 262, 253, 263, 254, 255, 256, 256, 107, 257, 258, 258, 101, 256, 259, 264, 260, 258, 256, 265, 266, 267, 261, 262, 268, 263, 269, 270, 271, 256, 256, 273, 274, 258, 258, 256, 275, 264, 276, 258, 256, 265, 266, 267, 277, 278, 268, 279, 269, 270, 271, 280, 282, 273, 274, 283, 284, 45, 275, 285, 276, 287, 288, 289, 290, 291, 277, 278, 292, 293, 279, 297, 301, 280, 282, 304, 308, 283, 309, 284, 310, 285, 311, 287, 288, 289, 290, 291, 312, 44, 292, 293, 20, 297, 301, 19, 7, 304, 308, 3, 309, 0, 310, 0, 311, 0, 0, 0, 0, 0, 312, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317 } ; static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; extern int cgdbhelp__flex_debug; int cgdbhelp__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 *cgdbhelp_text; #line 1 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/cgdbhelplexer.lpp" #define YY_NO_INPUT 1 #line 12 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/cgdbhelplexer.lpp" /* System Includes */ #include #include "tokenizer.h" #line 750 "cgdbhelplexer.cpp" #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 cgdbhelp_lex_destroy (void ); int cgdbhelp_get_debug (void ); void cgdbhelp_set_debug (int debug_flag ); YY_EXTRA_TYPE cgdbhelp_get_extra (void ); void cgdbhelp_set_extra (YY_EXTRA_TYPE user_defined ); FILE *cgdbhelp_get_in (void ); void cgdbhelp_set_in (FILE * _in_str ); FILE *cgdbhelp_get_out (void ); void cgdbhelp_set_out (FILE * _out_str ); yy_size_t cgdbhelp_get_leng (void ); char *cgdbhelp_get_text (void ); int cgdbhelp_get_lineno (void ); void cgdbhelp_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 cgdbhelp_wrap (void ); #else extern int cgdbhelp_wrap (void ); #endif #endif #ifndef YY_NO_UNPUT #endif #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( cgdbhelp_text, cgdbhelp_leng, 1, cgdbhelp_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( cgdbhelp_in )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ if ( c == '\n' ) \ buf[n++] = (char) c; \ if ( c == EOF && ferror( cgdbhelp_in ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ else \ { \ errno=0; \ while ( (result = fread(buf, 1, max_size, cgdbhelp_in))==0 && ferror(cgdbhelp_in)) \ { \ if( errno != EINTR) \ { \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ break; \ } \ errno=0; \ clearerr(cgdbhelp_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 cgdbhelp_lex (void); #define YY_DECL int cgdbhelp_lex (void) #endif /* !YY_DECL */ /* Code executed at the beginning of each rule, after cgdbhelp_text and cgdbhelp_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 /*LINTED*/break; #endif #define YY_RULE_SETUP \ if ( cgdbhelp_leng > 0 ) \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \ (cgdbhelp_text[cgdbhelp_leng - 1] == '\n'); \ YY_USER_ACTION /** The main scanner function which does all the work. */ YY_DECL { yy_state_type yy_current_state; char *yy_cp, *yy_bp; int yy_act; if ( !(yy_init) ) { (yy_init) = 1; #ifdef YY_USER_INIT YY_USER_INIT; #endif if ( ! (yy_start) ) (yy_start) = 1; /* first start state */ if ( ! cgdbhelp_in ) cgdbhelp_in = stdin; if ( ! cgdbhelp_out ) cgdbhelp_out = stdout; if ( ! YY_CURRENT_BUFFER ) { cgdbhelp_ensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = cgdbhelp__create_buffer(cgdbhelp_in,YY_BUF_SIZE ); } cgdbhelp__load_buffer_state( ); } { #line 19 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/cgdbhelplexer.lpp" #line 971 "cgdbhelplexer.cpp" while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ { yy_cp = (yy_c_buf_p); /* Support of cgdbhelp_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_current_state += YY_AT_BOL(); yy_match: do { 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 >= 318 ) 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] != 633 ); 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 20 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/cgdbhelplexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 2: YY_RULE_SETUP #line 22 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/cgdbhelplexer.lpp" { return TOKENIZER_KEYWORD; } YY_BREAK case 3: YY_RULE_SETUP #line 23 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/cgdbhelplexer.lpp" { return TOKENIZER_TYPE; } YY_BREAK case 4: YY_RULE_SETUP #line 24 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/cgdbhelplexer.lpp" { return TOKENIZER_LITERAL; } YY_BREAK case 5: YY_RULE_SETUP #line 25 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/cgdbhelplexer.lpp" { return TOKENIZER_COMMENT; } YY_BREAK case 6: YY_RULE_SETUP #line 26 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/cgdbhelplexer.lpp" { return TOKENIZER_DIRECTIVE; } YY_BREAK case 7: YY_RULE_SETUP #line 27 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/cgdbhelplexer.lpp" { return TOKENIZER_TEXT; } YY_BREAK case 8: YY_RULE_SETUP #line 28 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/cgdbhelplexer.lpp" { return TOKENIZER_SEARCH; } YY_BREAK case 9: YY_RULE_SETUP #line 29 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/cgdbhelplexer.lpp" { return TOKENIZER_STATUS_BAR; } YY_BREAK case 10: YY_RULE_SETUP #line 30 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/cgdbhelplexer.lpp" { return TOKENIZER_EXECUTING_LINE_ARROW; } YY_BREAK case 11: YY_RULE_SETUP #line 31 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/cgdbhelplexer.lpp" { return TOKENIZER_SELECTED_LINE_ARROW; } YY_BREAK case 12: YY_RULE_SETUP #line 32 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/cgdbhelplexer.lpp" { return TOKENIZER_EXECUTING_LINE_HIGHLIGHT; } YY_BREAK case 13: YY_RULE_SETUP #line 33 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/cgdbhelplexer.lpp" { return TOKENIZER_SELECTED_LINE_HIGHLIGHT; } YY_BREAK case 14: YY_RULE_SETUP #line 34 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/cgdbhelplexer.lpp" { return TOKENIZER_EXECUTING_LINE_BLOCK; } YY_BREAK case 15: YY_RULE_SETUP #line 35 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/cgdbhelplexer.lpp" { return TOKENIZER_SELECTED_LINE_BLOCK; } YY_BREAK case 16: YY_RULE_SETUP #line 36 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/cgdbhelplexer.lpp" { return TOKENIZER_ENABLED_BREAKPOINT; } YY_BREAK case 17: YY_RULE_SETUP #line 37 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/cgdbhelplexer.lpp" { return TOKENIZER_DISABLED_BREAKPOINT; } YY_BREAK case 18: YY_RULE_SETUP #line 38 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/cgdbhelplexer.lpp" { return TOKENIZER_SELECTED_LINE_NUMBER; } YY_BREAK case 19: YY_RULE_SETUP #line 39 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/cgdbhelplexer.lpp" { return TOKENIZER_SCROLL_MODE_STATUS; } YY_BREAK case 20: YY_RULE_SETUP #line 40 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/cgdbhelplexer.lpp" { return TOKENIZER_LOGO; } YY_BREAK case 21: YY_RULE_SETUP #line 42 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/cgdbhelplexer.lpp" { return TOKENIZER_COLOR; } YY_BREAK case 22: YY_RULE_SETUP #line 43 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/cgdbhelplexer.lpp" { return TOKENIZER_COLOR; } YY_BREAK case 23: YY_RULE_SETUP #line 44 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/cgdbhelplexer.lpp" { return TOKENIZER_COLOR; } YY_BREAK case 24: YY_RULE_SETUP #line 45 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/cgdbhelplexer.lpp" { return TOKENIZER_COLOR; } YY_BREAK case 25: YY_RULE_SETUP #line 46 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/cgdbhelplexer.lpp" { return TOKENIZER_COLOR; } YY_BREAK case 26: YY_RULE_SETUP #line 47 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/cgdbhelplexer.lpp" { return TOKENIZER_COLOR; } YY_BREAK case 27: YY_RULE_SETUP #line 48 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/cgdbhelplexer.lpp" { return TOKENIZER_COLOR; } YY_BREAK case 28: YY_RULE_SETUP #line 49 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/cgdbhelplexer.lpp" { return TOKENIZER_COLOR; } YY_BREAK case 29: YY_RULE_SETUP #line 50 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/cgdbhelplexer.lpp" { return TOKENIZER_COLOR; } YY_BREAK case 30: YY_RULE_SETUP #line 51 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/cgdbhelplexer.lpp" { return TOKENIZER_COLOR; } YY_BREAK case 31: YY_RULE_SETUP #line 52 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/cgdbhelplexer.lpp" { return TOKENIZER_COLOR; } YY_BREAK case 32: YY_RULE_SETUP #line 53 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/cgdbhelplexer.lpp" { return TOKENIZER_COLOR; } YY_BREAK case 33: YY_RULE_SETUP #line 54 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/cgdbhelplexer.lpp" { return TOKENIZER_COLOR; } YY_BREAK case 34: YY_RULE_SETUP #line 55 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/cgdbhelplexer.lpp" { return TOKENIZER_COLOR; } YY_BREAK case 35: YY_RULE_SETUP #line 56 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/cgdbhelplexer.lpp" { return TOKENIZER_COLOR; } YY_BREAK case 36: YY_RULE_SETUP #line 57 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/cgdbhelplexer.lpp" { return TOKENIZER_COLOR; } YY_BREAK case 37: YY_RULE_SETUP #line 58 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/cgdbhelplexer.lpp" { return TOKENIZER_COLOR; } YY_BREAK case 38: YY_RULE_SETUP #line 59 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/cgdbhelplexer.lpp" { return TOKENIZER_COLOR; } YY_BREAK case 39: YY_RULE_SETUP #line 60 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/cgdbhelplexer.lpp" { return TOKENIZER_COLOR; } YY_BREAK case 40: YY_RULE_SETUP #line 61 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/cgdbhelplexer.lpp" { return TOKENIZER_COLOR; } YY_BREAK case 41: YY_RULE_SETUP #line 62 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/cgdbhelplexer.lpp" { return TOKENIZER_COLOR; } YY_BREAK case 42: YY_RULE_SETUP #line 63 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/cgdbhelplexer.lpp" { return TOKENIZER_COLOR; } YY_BREAK case 43: YY_RULE_SETUP #line 64 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/cgdbhelplexer.lpp" { return TOKENIZER_COLOR; } YY_BREAK case 44: YY_RULE_SETUP #line 65 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/cgdbhelplexer.lpp" { return TOKENIZER_COLOR; } YY_BREAK case 45: YY_RULE_SETUP #line 66 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/cgdbhelplexer.lpp" { return TOKENIZER_COLOR; } YY_BREAK case 46: YY_RULE_SETUP #line 67 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/cgdbhelplexer.lpp" { return TOKENIZER_COLOR; } YY_BREAK case 47: YY_RULE_SETUP #line 69 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/cgdbhelplexer.lpp" { return(TOKENIZER_COMMENT); } YY_BREAK case 48: YY_RULE_SETUP #line 70 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/cgdbhelplexer.lpp" { return(TOKENIZER_COMMENT); } YY_BREAK case 49: /* rule 49 can match eol */ YY_RULE_SETUP #line 72 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/cgdbhelplexer.lpp" { return(TOKENIZER_NEWLINE); } YY_BREAK case 50: /* rule 50 can match eol */ YY_RULE_SETUP #line 73 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/cgdbhelplexer.lpp" { return(TOKENIZER_NEWLINE); } YY_BREAK case 51: YY_RULE_SETUP #line 74 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/cgdbhelplexer.lpp" { return(TOKENIZER_NEWLINE); } YY_BREAK case 52: YY_RULE_SETUP #line 75 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/cgdbhelplexer.lpp" { return(TOKENIZER_TEXT); } YY_BREAK case 53: YY_RULE_SETUP #line 76 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/cgdbhelplexer.lpp" { return(TOKENIZER_TEXT); } YY_BREAK case 54: YY_RULE_SETUP #line 77 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/cgdbhelplexer.lpp" { return(TOKENIZER_TEXT); } YY_BREAK case 55: YY_RULE_SETUP #line 78 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/cgdbhelplexer.lpp" ECHO; YY_BREAK #line 1306 "cgdbhelplexer.cpp" 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 cgdbhelp_in at a new source and called * cgdbhelp_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 = cgdbhelp_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 ( cgdbhelp_wrap( ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up * cgdbhelp_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 user's declarations */ } /* end of cgdbhelp_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) { char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; char *source = (yytext_ptr); yy_size_t 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 = (yy_size_t) ((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_LVALUE; 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. */ cgdbhelp_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; cgdbhelp_restart(cgdbhelp_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 ((int) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) cgdbhelp_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) { yy_state_type yy_current_state; char *yy_cp; yy_current_state = (yy_start); yy_current_state += YY_AT_BOL(); for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) { 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 >= 318 ) 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 ) { int yy_is_jam; char *yy_cp = (yy_c_buf_p); 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 >= 318 ) 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 == 317); return yy_is_jam ? 0 : yy_current_state; } #ifndef YY_NO_UNPUT #endif #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. */ cgdbhelp_restart(cgdbhelp_in ); /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { if ( cgdbhelp_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 cgdbhelp_text */ (yy_hold_char) = *++(yy_c_buf_p); YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n'); 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 cgdbhelp_restart (FILE * input_file ) { if ( ! YY_CURRENT_BUFFER ){ cgdbhelp_ensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = cgdbhelp__create_buffer(cgdbhelp_in,YY_BUF_SIZE ); } cgdbhelp__init_buffer(YY_CURRENT_BUFFER,input_file ); cgdbhelp__load_buffer_state( ); } /** Switch to a different input buffer. * @param new_buffer The new input buffer. * */ void cgdbhelp__switch_to_buffer (YY_BUFFER_STATE new_buffer ) { /* TODO. We should be able to replace this entire function body * with * cgdbhelp_pop_buffer_state(); * cgdbhelp_push_buffer_state(new_buffer); */ cgdbhelp_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; cgdbhelp__load_buffer_state( ); /* We don't actually know whether we did this switch during * EOF (cgdbhelp_wrap()) processing, but the only time this flag * is looked at is after cgdbhelp_wrap() is called, so it's safe * to go ahead and always set it. */ (yy_did_buffer_switch_on_eof) = 1; } static void cgdbhelp__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; cgdbhelp_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 cgdbhelp__create_buffer (FILE * file, int size ) { YY_BUFFER_STATE b; b = (YY_BUFFER_STATE) cgdbhelp_alloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in cgdbhelp__create_buffer()" ); b->yy_buf_size = (yy_size_t)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 *) cgdbhelp_alloc(b->yy_buf_size + 2 ); if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in cgdbhelp__create_buffer()" ); b->yy_is_our_buffer = 1; cgdbhelp__init_buffer(b,file ); return b; } /** Destroy the buffer. * @param b a buffer created with cgdbhelp__create_buffer() * */ void cgdbhelp__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 ) cgdbhelp_free((void *) b->yy_ch_buf ); cgdbhelp_free((void *) b ); } /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, * such as during a cgdbhelp_restart() or at EOF. */ static void cgdbhelp__init_buffer (YY_BUFFER_STATE b, FILE * file ) { int oerrno = errno; cgdbhelp__flush_buffer(b ); b->yy_input_file = file; b->yy_fill_buffer = 1; /* If b is the current buffer, then cgdbhelp__init_buffer was _probably_ * called from cgdbhelp_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 cgdbhelp__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 ) cgdbhelp__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 cgdbhelp_push_buffer_state (YY_BUFFER_STATE new_buffer ) { if (new_buffer == NULL) return; cgdbhelp_ensure_buffer_stack(); /* This block is copied from cgdbhelp__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 cgdbhelp__switch_to_buffer. */ cgdbhelp__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 cgdbhelp_pop_buffer_state (void) { if (!YY_CURRENT_BUFFER) return; cgdbhelp__delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; if ((yy_buffer_stack_top) > 0) --(yy_buffer_stack_top); if (YY_CURRENT_BUFFER) { cgdbhelp__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 cgdbhelp_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; /* After all that talk, this was set to 1 anyways... */ (yy_buffer_stack) = (struct yy_buffer_state**)cgdbhelp_alloc (num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in cgdbhelp_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. */ yy_size_t grow_size = 8 /* arbitrary grow size */; num_to_alloc = (yy_buffer_stack_max) + grow_size; (yy_buffer_stack) = (struct yy_buffer_state**)cgdbhelp_realloc ((yy_buffer_stack), num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in cgdbhelp_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 cgdbhelp__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) cgdbhelp_alloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in cgdbhelp__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; cgdbhelp__switch_to_buffer(b ); return b; } /** Setup the input buffer state to scan a string. The next call to cgdbhelp_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 * cgdbhelp__scan_bytes() instead. */ YY_BUFFER_STATE cgdbhelp__scan_string (yyconst char * yystr ) { return cgdbhelp__scan_bytes(yystr,strlen(yystr) ); } /** Setup the input buffer state to scan the given bytes. The next call to cgdbhelp_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 cgdbhelp__scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len ) { YY_BUFFER_STATE b; char *buf; yy_size_t n; yy_size_t i; /* Get memory for full buffer, including space for trailing EOB's. */ n = _yybytes_len + 2; buf = (char *) cgdbhelp_alloc(n ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in cgdbhelp__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 = cgdbhelp__scan_buffer(buf,n ); if ( ! b ) YY_FATAL_ERROR( "bad buffer in cgdbhelp__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 cgdbhelp_text. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ cgdbhelp_text[cgdbhelp_leng] = (yy_hold_char); \ (yy_c_buf_p) = cgdbhelp_text + yyless_macro_arg; \ (yy_hold_char) = *(yy_c_buf_p); \ *(yy_c_buf_p) = '\0'; \ cgdbhelp_leng = yyless_macro_arg; \ } \ while ( 0 ) /* Accessor methods (get/set functions) to struct members. */ /** Get the current line number. * */ int cgdbhelp_get_lineno (void) { return cgdbhelp_lineno; } /** Get the input stream. * */ FILE *cgdbhelp_get_in (void) { return cgdbhelp_in; } /** Get the output stream. * */ FILE *cgdbhelp_get_out (void) { return cgdbhelp_out; } /** Get the length of the current token. * */ yy_size_t cgdbhelp_get_leng (void) { return cgdbhelp_leng; } /** Get the current token. * */ char *cgdbhelp_get_text (void) { return cgdbhelp_text; } /** Set the current line number. * @param _line_number line number * */ void cgdbhelp_set_lineno (int _line_number ) { cgdbhelp_lineno = _line_number; } /** Set the input stream. This does not discard the current * input buffer. * @param _in_str A readable stream. * * @see cgdbhelp__switch_to_buffer */ void cgdbhelp_set_in (FILE * _in_str ) { cgdbhelp_in = _in_str ; } void cgdbhelp_set_out (FILE * _out_str ) { cgdbhelp_out = _out_str ; } int cgdbhelp_get_debug (void) { return cgdbhelp__flex_debug; } void cgdbhelp_set_debug (int _bdebug ) { cgdbhelp__flex_debug = _bdebug ; } static int yy_init_globals (void) { /* Initialization is the same as for the non-reentrant scanner. * This function is called from cgdbhelp_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 cgdbhelp_in = stdin; cgdbhelp_out = stdout; #else cgdbhelp_in = (FILE *) 0; cgdbhelp_out = (FILE *) 0; #endif /* For future reference: Set errno on error, since we are called by * cgdbhelp_lex_init() */ return 0; } /* cgdbhelp_lex_destroy is for both reentrant and non-reentrant scanners. */ int cgdbhelp_lex_destroy (void) { /* Pop the buffer stack, destroying each element. */ while(YY_CURRENT_BUFFER){ cgdbhelp__delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; cgdbhelp_pop_buffer_state(); } /* Destroy the stack itself. */ cgdbhelp_free((yy_buffer_stack) ); (yy_buffer_stack) = NULL; /* Reset the globals. This is important in a non-reentrant scanner so the next time * cgdbhelp_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 ) { 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 ) { int n; for ( n = 0; s[n]; ++n ) ; return n; } #endif void *cgdbhelp_alloc (yy_size_t size ) { return (void *) malloc( size ); } void *cgdbhelp_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 cgdbhelp_free (void * ptr ) { free( (char *) ptr ); /* see cgdbhelp_realloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" #line 78 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/cgdbhelplexer.lpp" cgdb-0.8.0/lib/tokenizer/tokenizer.cpp0000664000175000017500000001143313060627675014655 00000000000000#include #include #include "tokenizer.h" #include "sys_util.h" /* Some default file extensions */ const char *c_extensions[] = { ".c", ".cc", ".cpp", ".cxx", ".c++", ".h", ".hpp", ".hxx", ".hh", ".ipp", ".inl", ".moc", ".cu", ".cuh" }; const char *asm_extensions[] = { ".s" }; const char *d_extensions[] = { ".d", ".di" }; const char *go_extensions[] = { ".go" }; const char *rust_extensions[] = { ".rs" }; const char *ada_extensions[] = { ".adb", ".ads", ".ada" }; typedef struct yy_buffer_state *YY_BUFFER_STATE; #define DECLARE_LEX_FUNCTIONS(_LANG) \ extern int _LANG ## _lex(void); \ extern char *_LANG ## _text; \ extern YY_BUFFER_STATE _LANG ## __scan_string(const char *base); \ void _LANG ## __delete_buffer (YY_BUFFER_STATE b); DECLARE_LEX_FUNCTIONS(c) DECLARE_LEX_FUNCTIONS(asm) DECLARE_LEX_FUNCTIONS(d) DECLARE_LEX_FUNCTIONS(go) DECLARE_LEX_FUNCTIONS(rust) DECLARE_LEX_FUNCTIONS(ada) DECLARE_LEX_FUNCTIONS(cgdbhelp) #undef DECLARE_LEX_FUNCTIONS struct tokenizer { enum tokenizer_language_support lang; char **yy_tokenizer_text; int (*yy_lex_func) (void); void (*yy_delete_buffer_func)(YY_BUFFER_STATE b); YY_BUFFER_STATE str_buffer; }; struct tokenizer *tokenizer_init(void) { struct tokenizer *t = (struct tokenizer *) cgdb_malloc(sizeof (struct tokenizer)); t->lang = TOKENIZER_LANGUAGE_UNKNOWN; t->yy_lex_func = NULL; t->yy_delete_buffer_func = NULL; t->yy_tokenizer_text = NULL; t->str_buffer = NULL; return t; } void tokenizer_destroy(struct tokenizer *t) { if (t) { (*t->yy_delete_buffer_func)(t->str_buffer); t->str_buffer = NULL; free(t); } } int tokenizer_set_buffer(struct tokenizer *t, const char *buffer, enum tokenizer_language_support l) { if (t->str_buffer) { (*t->yy_delete_buffer_func)(t->str_buffer); t->str_buffer = NULL; } if (l < TOKENIZER_ENUM_START_POS || l >= TOKENIZER_LANGUAGE_UNKNOWN) return 0; t->lang = l; #define INIT_LEX(_LANG) \ t->yy_lex_func = _LANG ## _lex; \ t->yy_delete_buffer_func = _LANG ## __delete_buffer; \ t->yy_tokenizer_text = &(_LANG ## _text); \ t->str_buffer = _LANG ## __scan_string(buffer); if (l == TOKENIZER_LANGUAGE_C) { INIT_LEX(c); } else if (l == TOKENIZER_LANGUAGE_ASM) { INIT_LEX(asm); } else if (l == TOKENIZER_LANGUAGE_D) { INIT_LEX(d); } else if (l == TOKENIZER_LANGUAGE_GO) { INIT_LEX(go); } else if (l == TOKENIZER_LANGUAGE_CGDBHELP) { INIT_LEX(cgdbhelp); } else if (l == TOKENIZER_LANGUAGE_RUST) { INIT_LEX(rust); } else { INIT_LEX(ada); } #undef INIT_LEX return 0; } int tokenizer_get_token(struct tokenizer *t, struct token_data *token_data) { if (!t || !t->yy_lex_func) return 0; enum tokenizer_type tpacket = (enum tokenizer_type)(t->yy_lex_func)(); token_data->e = tpacket; token_data->data = *t->yy_tokenizer_text; return !!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; } 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 (strcasecmp(file_extension, c_extensions[i]) == 0) return TOKENIZER_LANGUAGE_C; for (i = 0; i < sizeof (asm_extensions) / sizeof (char *); i++) if (strcasecmp(file_extension, asm_extensions[i]) == 0) return TOKENIZER_LANGUAGE_ASM; for (i = 0; i < sizeof (d_extensions) / sizeof (char *); i++) if (strcasecmp(file_extension, d_extensions[i]) == 0) return TOKENIZER_LANGUAGE_D; for (i = 0; i < sizeof (go_extensions) / sizeof (char *); i++) if (strcasecmp(file_extension, go_extensions[i]) == 0) return TOKENIZER_LANGUAGE_GO; for (i = 0; i < sizeof (rust_extensions) / sizeof (char *); i++) if (strcasecmp(file_extension, rust_extensions[i]) == 0) l = TOKENIZER_LANGUAGE_RUST; for (i = 0; i < sizeof (ada_extensions) / sizeof (char *); i++) if (strcasecmp(file_extension, ada_extensions[i]) == 0) return TOKENIZER_LANGUAGE_ADA; return l; } cgdb-0.8.0/lib/tokenizer/Makefile.in0000664000175000017500000004611414171036450014175 00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/config/readline_check_version.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) 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) \ asmlexer.$(OBJEXT) dlexer.$(OBJEXT) golexer.$(OBJEXT) \ cgdbhelplexer.$(OBJEXT) rustlexer.$(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/util/libcgdbutil.a tokenizer_driver_LINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \ $(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 CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) AM_V_CXX = $(am__v_CXX_@AM_V@) am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) am__v_CXX_0 = @echo " CXX " $@; am__v_CXX_1 = CXXLD = $(CXX) CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ -o $@ AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) am__v_CXXLD_0 = @echo " CXXLD " $@; am__v_CXXLD_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 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 = $(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 am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/config/depcomp \ $(top_srcdir)/config/ylwrap adalexer.cpp asmlexer.cpp \ cgdbhelplexer.cpp clexer.cpp dlexer.cpp golexer.cpp \ rustlexer.cpp 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@ CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ 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@ HAS_MAKEINFO = @HAS_MAKEINFO@ 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@ ac_ct_CXX = @ac_ct_CXX@ 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@ runstatedir = @runstatedir@ 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_CXXFLAGS = \ -I$(top_srcdir)/lib/util \ -std=c++11 #AM_LFLAGS = -Pxx -olex.yy.c # create the input library noinst_LIBRARIES = libtokenizer.a libtokenizer_a_SOURCES = \ adalexer.lpp \ clexer.lpp \ asmlexer.lpp \ dlexer.lpp \ golexer.lpp \ cgdbhelplexer.lpp \ rustlexer.lpp \ tokenizer.cpp \ tokenizer.h # This is the input driver tokenizer_driver_LDFLAGS = -L. \ -L$(top_builddir)/lib/util tokenizer_driver_LDADD = ./libtokenizer.a \ $(top_builddir)/lib/util/libcgdbutil.a tokenizer_driver_SOURCES = tokenizer_driver.cpp input_driver_CXXFLAGS = $(AM_CXXFLAGS) all: all-am .SUFFIXES: .SUFFIXES: .cpp .lpp .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) --foreign lib/tokenizer/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign lib/tokenizer/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_CXXLD)$(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)/asmlexer.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cgdbhelplexer.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)/golexer.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rustlexer.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@ .cpp.o: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< .cpp.obj: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .lpp.cpp: $(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.cpp -rm -f asmlexer.cpp -rm -f cgdbhelplexer.cpp -rm -f clexer.cpp -rm -f dlexer.cpp -rm -f golexer.cpp -rm -f rustlexer.cpp 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 .PRECIOUS: Makefile # 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.8.0/lib/tokenizer/Makefile.am0000664000175000017500000000130113521324221014143 00000000000000AM_CXXFLAGS = \ -I$(top_srcdir)/lib/util \ -std=c++11 #AM_LFLAGS = -Pxx -olex.yy.c # create the input library noinst_LIBRARIES = libtokenizer.a libtokenizer_a_SOURCES = \ adalexer.lpp \ clexer.lpp \ asmlexer.lpp \ dlexer.lpp \ golexer.lpp \ cgdbhelplexer.lpp \ rustlexer.lpp \ tokenizer.cpp \ 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/util tokenizer_driver_LDADD = ./libtokenizer.a \ $(top_builddir)/lib/util/libcgdbutil.a tokenizer_driver_SOURCES = tokenizer_driver.cpp input_driver_CXXFLAGS = $(AM_CXXFLAGS) cgdb-0.8.0/lib/tokenizer/clexer.lpp0000664000175000017500000001522313057302460014123 00000000000000%option prefix="c_" %option outfile="lex.yy.c" %option noyywrap %option nounput %option noinput D [0-9] H [0-9a-fA-F_] 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); } {D}+[lL] { return(TOKENIZER_LITERAL); } {D}+[uU] { return(TOKENIZER_LITERAL); } {D}+[lL][lL] { return(TOKENIZER_LITERAL); } {D}+[uU][lL] { return(TOKENIZER_LITERAL); } {D}+[uU][lL][lL] { return(TOKENIZER_LITERAL); } {D}+[lL][uU] { return(TOKENIZER_LITERAL); } {D}+[lL][lL][uU] { return(TOKENIZER_LITERAL); } 0x{H}+ { return(TOKENIZER_LITERAL); } 0x{H}+[lL] { return(TOKENIZER_LITERAL); } 0x{H}+[uU] { return(TOKENIZER_LITERAL); } 0x{H}+[lL][lL] { return(TOKENIZER_LITERAL); } 0x{H}+[uU][lL] { return(TOKENIZER_LITERAL); } 0x{H}+[uU][lL][lL] { return(TOKENIZER_LITERAL); } 0x{H}+[lL][uU] { return(TOKENIZER_LITERAL); } 0x{H}+[lL][lL][uU] { return(TOKENIZER_LITERAL); } {D}*\.?{D}+([eE][-+]?{D}+)? { return(TOKENIZER_LITERAL); } {D}+\.?({D})?+[fF] { return(TOKENIZER_LITERAL); } \.{D}+[fF] { 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); } %% cgdb-0.8.0/lib/tokenizer/golexer.cpp0000664000175000017500000022504314171036460014302 00000000000000#line 2 "golexer.cpp" #line 4 "golexer.cpp" #define YY_INT_ALIGNED short int /* A lexical scanner generated by flex */ #define yy_create_buffer go__create_buffer #define yy_delete_buffer go__delete_buffer #define yy_flex_debug go__flex_debug #define yy_init_buffer go__init_buffer #define yy_flush_buffer go__flush_buffer #define yy_load_buffer_state go__load_buffer_state #define yy_switch_to_buffer go__switch_to_buffer #define yyin go_in #define yyleng go_leng #define yylex go_lex #define yylineno go_lineno #define yyout go_out #define yyrestart go_restart #define yytext go_text #define yywrap go_wrap #define yyalloc go_alloc #define yyrealloc go_realloc #define yyfree go_free #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 6 #define YY_FLEX_SUBMINOR_VERSION 0 #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 go_restart(go_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 #ifndef YY_TYPEDEF_YY_SIZE_T #define YY_TYPEDEF_YY_SIZE_T typedef size_t yy_size_t; #endif extern yy_size_t go_leng; extern FILE *go_in, *go_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) #define YY_LINENO_REWIND_TO(ptr) /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ do \ { \ /* Undo effects of setting up go_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 go_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. */ 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 go_restart()), so that the user can continue scanning by * just pointing go_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 go_text is formed. */ static char yy_hold_char; static int yy_n_chars; /* number of characters read into yy_ch_buf */ yy_size_t go_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 go_wrap()'s to do buffer switches * instead of setting up a fresh go_in. A bit of a hack ... */ static int yy_did_buffer_switch_on_eof; void go_restart (FILE *input_file ); void go__switch_to_buffer (YY_BUFFER_STATE new_buffer ); YY_BUFFER_STATE go__create_buffer (FILE *file,int size ); void go__delete_buffer (YY_BUFFER_STATE b ); void go__flush_buffer (YY_BUFFER_STATE b ); void go_push_buffer_state (YY_BUFFER_STATE new_buffer ); void go_pop_buffer_state (void ); static void go_ensure_buffer_stack (void ); static void go__load_buffer_state (void ); static void go__init_buffer (YY_BUFFER_STATE b,FILE *file ); #define YY_FLUSH_BUFFER go__flush_buffer(YY_CURRENT_BUFFER ) YY_BUFFER_STATE go__scan_buffer (char *base,yy_size_t size ); YY_BUFFER_STATE go__scan_string (yyconst char *yy_str ); YY_BUFFER_STATE go__scan_bytes (yyconst char *bytes,yy_size_t len ); void *go_alloc (yy_size_t ); void *go_realloc (void *,yy_size_t ); void go_free (void * ); #define yy_new_buffer go__create_buffer #define yy_set_interactive(is_interactive) \ { \ if ( ! YY_CURRENT_BUFFER ){ \ go_ensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ go__create_buffer(go_in,YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } #define yy_set_bol(at_bol) \ { \ if ( ! YY_CURRENT_BUFFER ){\ go_ensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ go__create_buffer(go_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 */ #define go_wrap() (/*CONSTCOND*/1) #define YY_SKIP_YYWRAP typedef unsigned char YY_CHAR; FILE *go_in = (FILE *) 0, *go_out = (FILE *) 0; typedef int yy_state_type; extern int go_lineno; int go_lineno = 1; extern char *go_text; #ifdef yytext_ptr #undef yytext_ptr #endif #define yytext_ptr go_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 ); #if defined(__GNUC__) && __GNUC__ >= 3 __attribute__((__noreturn__)) #endif static void yy_fatal_error (yyconst char msg[] ); /* Done after the current pattern has been matched and before the * corresponding action - sets up go_text. */ #define YY_DO_BEFORE_ACTION \ (yytext_ptr) = yy_bp; \ go_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 86 #define YY_END_OF_BUFFER 87 /* 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[262] = { 0, 0, 0, 45, 45, 55, 55, 61, 61, 73, 73, 87, 85, 83, 80, 82, 54, 72, 85, 85, 68, 68, 84, 84, 60, 84, 84, 84, 84, 84, 84, 71, 84, 84, 84, 84, 84, 84, 84, 45, 47, 48, 46, 55, 56, 57, 59, 86, 61, 62, 63, 65, 73, 74, 75, 77, 73, 81, 0, 0, 69, 0, 71, 44, 51, 68, 68, 0, 0, 70, 0, 84, 84, 0, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 34, 36, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 45, 49, 46, 46, 50, 55, 0, 58, 61, 64, 73, 73, 76, 73, 73, 78, 0, 78, 0, 0, 51, 68, 0, 0, 68, 67, 66, 71, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 33, 84, 84, 84, 3, 22, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 43, 79, 0, 69, 0, 68, 1, 84, 16, 25, 23, 84, 84, 84, 84, 84, 30, 84, 84, 84, 20, 35, 84, 84, 84, 84, 8, 84, 84, 84, 84, 17, 84, 84, 84, 84, 41, 42, 2, 24, 84, 26, 84, 84, 29, 84, 32, 84, 84, 9, 10, 11, 84, 84, 37, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 52, 84, 84, 38, 39, 18, 19, 40, 5, 6, 7, 84, 84, 84, 28, 84, 12, 13, 84, 53, 4, 84, 84, 27, 84, 84, 84, 14, 84, 21, 15, 84, 31, 0 } ; static yyconst YY_CHAR 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, 1, 6, 1, 1, 7, 8, 1, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 16, 18, 16, 1, 1, 1, 1, 1, 1, 1, 19, 19, 19, 19, 20, 19, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 21, 21, 1, 23, 1, 1, 19, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 21, 34, 35, 36, 37, 38, 39, 21, 40, 41, 42, 43, 44, 45, 46, 47, 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 YY_CHAR yy_meta[48] = { 0, 1, 1, 2, 3, 4, 5, 6, 7, 1, 1, 8, 8, 8, 8, 8, 8, 8, 8, 9, 10, 11, 11, 1, 12, 9, 9, 9, 9, 10, 9, 11, 11, 13, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11 } ; static yyconst flex_uint16_t yy_base[285] = { 0, 0, 0, 45, 47, 52, 55, 58, 60, 62, 66, 421, 1031, 1031, 1031, 410, 1031, 388, 47, 64, 81, 31, 117, 128, 1031, 136, 75, 79, 375, 130, 41, 142, 146, 150, 156, 162, 64, 168, 173, 0, 1031, 396, 76, 373, 1031, 382, 1031, 372, 0, 1031, 362, 1031, 340, 1031, 359, 1031, 100, 1031, 350, 325, 92, 322, 1031, 1031, 0, 185, 115, 320, 0, 1031, 0, 0, 119, 314, 210, 120, 200, 192, 195, 206, 212, 224, 220, 228, 172, 232, 236, 240, 246, 250, 254, 260, 264, 268, 272, 280, 286, 285, 296, 297, 307, 301, 311, 0, 1031, 185, 306, 1031, 286, 298, 1031, 0, 1031, 272, 336, 1031, 262, 344, 1031, 275, 271, 249, 83, 0, 236, 247, 243, 130, 0, 0, 0, 317, 328, 331, 332, 336, 342, 346, 365, 362, 357, 376, 368, 380, 379, 384, 420, 395, 405, 410, 416, 415, 432, 431, 435, 447, 451, 446, 443, 1031, 237, 154, 229, 208, 457, 462, 461, 465, 473, 479, 483, 489, 494, 493, 504, 505, 510, 516, 515, 521, 526, 200, 156, 149, 0, 527, 544, 541, 538, 549, 559, 555, 563, 567, 571, 575, 607, 588, 591, 592, 603, 607, 611, 621, 617, 646, 627, 0, 0, 0, 632, 635, 638, 643, 649, 657, 660, 671, 139, 111, 105, 668, 674, 679, 685, 654, 105, 94, 690, 691, 695, 696, 701, 706, 707, 711, 0, 0, 0, 712, 743, 727, 723, 724, 0, 0, 739, 735, 738, 92, 72, 749, 754, 755, 55, 0, 760, 765, 0, 776, 766, 1031, 823, 836, 849, 862, 875, 881, 887, 900, 913, 926, 939, 952, 965, 978, 985, 993, 999, 1006, 1007, 1010, 1013, 1020, 1022 } ; static yyconst flex_int16_t yy_def[285] = { 0, 261, 1, 262, 262, 263, 263, 264, 264, 265, 265, 261, 261, 261, 261, 261, 261, 266, 267, 261, 261, 20, 268, 268, 261, 268, 25, 25, 23, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 269, 261, 261, 270, 271, 261, 261, 261, 271, 272, 261, 261, 261, 273, 261, 261, 261, 274, 261, 261, 275, 267, 276, 261, 261, 277, 278, 20, 279, 280, 261, 281, 282, 25, 276, 282, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 269, 261, 270, 270, 261, 271, 271, 261, 272, 261, 273, 274, 261, 273, 274, 261, 261, 261, 283, 276, 277, 278, 284, 279, 279, 280, 281, 282, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 261, 283, 283, 284, 284, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 282, 282, 282, 282, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 146, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 282, 282, 282, 25, 25, 25, 25, 25, 25, 25, 25, 282, 282, 282, 25, 25, 25, 25, 25, 282, 282, 25, 25, 25, 25, 25, 25, 25, 25, 282, 282, 282, 25, 25, 25, 25, 25, 282, 282, 25, 25, 25, 282, 282, 25, 25, 25, 282, 282, 25, 25, 282, 25, 25, 0, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261 } ; static yyconst flex_uint16_t yy_nxt[1079] = { 0, 12, 13, 14, 15, 16, 17, 12, 12, 18, 19, 20, 21, 21, 21, 21, 21, 21, 21, 22, 23, 22, 22, 12, 24, 22, 25, 26, 27, 28, 29, 30, 22, 31, 22, 22, 32, 22, 22, 33, 34, 35, 36, 37, 38, 22, 22, 22, 40, 41, 40, 41, 42, 261, 42, 44, 45, 46, 44, 45, 46, 49, 50, 49, 50, 53, 54, 61, 55, 53, 54, 63, 55, 258, 64, 47, 61, 261, 47, 87, 62, 72, 51, 106, 51, 56, 107, 255, 72, 56, 65, 261, 66, 66, 66, 66, 66, 66, 66, 66, 78, 67, 72, 68, 99, 254, 113, 79, 81, 245, 67, 100, 121, 80, 69, 72, 62, 72, 244, 72, 238, 121, 72, 117, 237, 62, 72, 70, 71, 71, 71, 71, 71, 71, 71, 71, 73, 261, 261, 74, 74, 74, 74, 74, 74, 74, 74, 71, 71, 71, 71, 71, 71, 71, 71, 83, 236, 72, 131, 72, 72, 261, 261, 62, 209, 84, 72, 72, 85, 208, 72, 91, 88, 86, 75, 92, 76, 72, 89, 90, 72, 93, 72, 77, 72, 94, 72, 62, 72, 72, 72, 96, 261, 72, 72, 261, 72, 72, 102, 95, 72, 101, 72, 72, 97, 125, 72, 98, 72, 72, 141, 72, 72, 72, 125, 72, 261, 207, 62, 72, 72, 74, 74, 74, 74, 74, 74, 74, 74, 132, 72, 135, 72, 72, 133, 72, 134, 261, 72, 72, 72, 62, 72, 130, 72, 261, 72, 72, 136, 137, 72, 261, 72, 72, 138, 162, 67, 160, 72, 72, 72, 139, 72, 140, 72, 67, 72, 72, 72, 62, 72, 72, 142, 143, 72, 72, 72, 159, 72, 72, 72, 159, 144, 72, 72, 114, 72, 72, 72, 145, 72, 148, 72, 72, 72, 114, 146, 72, 72, 147, 72, 72, 72, 108, 72, 149, 72, 72, 72, 109, 72, 72, 72, 106, 150, 72, 107, 151, 72, 72, 72, 152, 261, 72, 72, 153, 72, 72, 126, 154, 73, 120, 72, 72, 72, 72, 72, 72, 157, 72, 155, 72, 113, 72, 72, 72, 156, 72, 72, 72, 113, 158, 164, 165, 72, 72, 118, 72, 72, 117, 166, 167, 115, 114, 72, 112, 72, 117, 72, 72, 72, 72, 72, 168, 72, 72, 72, 108, 72, 72, 72, 169, 72, 72, 72, 110, 72, 170, 171, 72, 172, 174, 175, 72, 173, 72, 109, 72, 176, 104, 72, 177, 72, 72, 72, 72, 72, 178, 72, 72, 82, 59, 72, 57, 72, 72, 72, 179, 72, 72, 72, 261, 180, 72, 72, 261, 72, 72, 261, 261, 261, 72, 181, 72, 182, 72, 261, 183, 184, 186, 261, 187, 72, 72, 189, 72, 261, 261, 72, 185, 72, 261, 72, 72, 72, 72, 72, 72, 72, 188, 72, 190, 72, 72, 191, 261, 261, 72, 261, 72, 72, 72, 72, 72, 192, 72, 194, 193, 72, 72, 195, 72, 72, 72, 72, 72, 72, 72, 196, 72, 72, 72, 261, 72, 72, 72, 197, 72, 72, 72, 72, 72, 72, 72, 72, 72, 261, 261, 72, 72, 261, 72, 72, 72, 198, 261, 261, 72, 261, 72, 72, 72, 200, 72, 261, 199, 72, 72, 261, 72, 72, 72, 72, 202, 72, 261, 72, 201, 261, 204, 72, 72, 72, 72, 72, 72, 261, 203, 72, 261, 72, 72, 72, 72, 72, 72, 72, 72, 205, 72, 261, 72, 72, 72, 72, 72, 206, 210, 72, 211, 212, 261, 261, 72, 72, 261, 72, 261, 213, 72, 261, 72, 72, 261, 72, 72, 214, 72, 72, 72, 216, 72, 215, 72, 217, 72, 72, 72, 261, 72, 261, 72, 72, 72, 261, 72, 72, 72, 261, 72, 72, 72, 261, 72, 72, 72, 261, 261, 72, 218, 222, 219, 72, 261, 220, 71, 72, 261, 72, 72, 72, 72, 72, 261, 261, 72, 72, 261, 72, 72, 223, 72, 224, 72, 261, 72, 221, 72, 261, 72, 72, 72, 261, 225, 72, 72, 261, 72, 72, 72, 226, 72, 229, 227, 72, 72, 230, 72, 72, 228, 72, 261, 72, 72, 72, 72, 72, 261, 72, 72, 231, 72, 72, 72, 72, 72, 72, 72, 233, 72, 72, 232, 72, 72, 243, 72, 72, 72, 72, 261, 72, 72, 234, 235, 72, 261, 72, 72, 72, 72, 239, 72, 72, 261, 72, 72, 246, 72, 72, 72, 240, 72, 241, 72, 247, 72, 72, 242, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 261, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 248, 72, 72, 249, 251, 261, 72, 72, 250, 72, 252, 72, 72, 72, 253, 72, 261, 261, 72, 72, 261, 72, 72, 72, 72, 72, 72, 72, 261, 72, 72, 72, 257, 72, 72, 72, 261, 72, 72, 259, 72, 72, 72, 72, 72, 256, 72, 261, 72, 72, 72, 72, 72, 72, 72, 72, 260, 261, 261, 261, 72, 72, 72, 261, 72, 261, 261, 261, 261, 261, 261, 72, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 58, 261, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 60, 261, 60, 261, 261, 60, 72, 72, 72, 72, 261, 72, 103, 261, 261, 103, 103, 261, 103, 103, 103, 103, 103, 103, 103, 105, 261, 261, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 108, 261, 261, 261, 108, 108, 108, 108, 108, 108, 108, 108, 108, 111, 261, 261, 111, 111, 111, 111, 111, 111, 111, 111, 261, 111, 113, 261, 261, 113, 261, 113, 113, 113, 113, 113, 113, 113, 113, 116, 261, 261, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 119, 261, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 122, 122, 123, 261, 261, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 124, 261, 124, 261, 261, 124, 127, 127, 128, 128, 128, 129, 129, 129, 71, 71, 71, 71, 261, 71, 161, 161, 163, 163, 11, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261 } ; static yyconst flex_int16_t yy_chk[1079] = { 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, 1, 1, 3, 3, 4, 4, 3, 21, 4, 5, 5, 5, 6, 6, 6, 7, 7, 8, 8, 9, 9, 18, 9, 10, 10, 19, 10, 254, 19, 5, 18, 21, 6, 30, 18, 30, 7, 42, 8, 9, 42, 250, 30, 10, 20, 122, 20, 20, 20, 20, 20, 20, 20, 20, 26, 20, 36, 20, 36, 249, 56, 26, 27, 227, 20, 36, 60, 26, 20, 26, 122, 27, 226, 27, 220, 60, 26, 56, 219, 60, 27, 20, 22, 22, 22, 22, 22, 22, 22, 22, 23, 66, 127, 23, 23, 23, 23, 23, 23, 23, 23, 25, 25, 25, 25, 25, 25, 25, 25, 29, 218, 72, 75, 72, 75, 66, 161, 127, 183, 29, 72, 75, 29, 182, 29, 32, 31, 29, 25, 33, 25, 29, 31, 31, 31, 34, 31, 25, 32, 34, 32, 161, 33, 31, 33, 35, 105, 32, 34, 105, 34, 33, 38, 34, 35, 37, 35, 34, 35, 65, 37, 35, 37, 35, 84, 38, 84, 38, 65, 37, 163, 181, 65, 84, 38, 74, 74, 74, 74, 74, 74, 74, 74, 76, 77, 79, 77, 78, 77, 78, 78, 162, 76, 77, 76, 163, 78, 74, 79, 160, 79, 76, 80, 80, 80, 126, 80, 79, 81, 125, 124, 121, 82, 80, 82, 82, 81, 83, 81, 124, 83, 82, 83, 124, 85, 81, 85, 86, 86, 83, 86, 120, 87, 85, 87, 119, 87, 86, 88, 116, 88, 87, 89, 89, 89, 92, 90, 88, 90, 113, 90, 89, 91, 91, 91, 90, 92, 109, 92, 93, 93, 91, 93, 108, 94, 92, 94, 106, 94, 93, 106, 95, 95, 94, 95, 96, 73, 97, 96, 97, 96, 95, 67, 98, 61, 59, 97, 96, 98, 99, 98, 99, 101, 101, 99, 101, 114, 98, 99, 100, 100, 100, 101, 102, 117, 102, 131, 132, 100, 131, 58, 131, 102, 114, 133, 134, 54, 52, 131, 50, 132, 117, 132, 133, 134, 133, 134, 135, 135, 132, 135, 47, 133, 134, 136, 136, 136, 135, 137, 45, 137, 137, 137, 136, 138, 139, 140, 137, 138, 140, 43, 140, 140, 41, 139, 141, 139, 138, 140, 138, 142, 143, 142, 139, 28, 17, 138, 15, 141, 142, 141, 144, 143, 144, 143, 11, 145, 141, 145, 0, 144, 143, 0, 0, 0, 145, 146, 147, 146, 147, 0, 146, 146, 148, 0, 149, 147, 148, 151, 148, 0, 0, 149, 146, 149, 0, 148, 151, 150, 151, 150, 149, 146, 150, 146, 152, 151, 150, 153, 0, 0, 146, 0, 153, 152, 153, 152, 154, 153, 154, 155, 154, 153, 152, 156, 158, 154, 158, 157, 155, 157, 155, 157, 156, 158, 156, 0, 157, 155, 164, 165, 164, 156, 166, 165, 166, 165, 167, 164, 167, 0, 0, 166, 165, 0, 168, 167, 168, 169, 0, 0, 169, 0, 169, 168, 170, 171, 170, 0, 170, 169, 171, 0, 171, 170, 173, 172, 173, 172, 0, 171, 172, 0, 176, 173, 172, 174, 175, 174, 175, 0, 175, 176, 0, 176, 174, 175, 178, 177, 178, 177, 176, 177, 179, 0, 179, 178, 177, 180, 185, 180, 185, 179, 186, 187, 0, 0, 180, 185, 0, 188, 0, 188, 187, 0, 187, 186, 0, 186, 188, 190, 189, 187, 189, 192, 186, 191, 191, 193, 191, 189, 190, 0, 190, 0, 192, 191, 192, 0, 193, 190, 193, 0, 194, 192, 194, 0, 195, 193, 195, 0, 0, 194, 196, 198, 196, 195, 0, 196, 196, 197, 0, 197, 198, 199, 198, 199, 0, 0, 197, 196, 0, 198, 199, 200, 200, 201, 200, 0, 201, 196, 201, 0, 202, 200, 202, 0, 203, 201, 204, 0, 204, 202, 203, 205, 203, 210, 205, 204, 206, 211, 206, 203, 206, 210, 0, 210, 211, 206, 211, 212, 0, 212, 210, 213, 213, 211, 213, 205, 212, 205, 214, 215, 214, 213, 214, 225, 205, 225, 215, 214, 215, 216, 0, 216, 225, 216, 217, 215, 0, 221, 216, 221, 217, 221, 217, 222, 0, 222, 221, 229, 223, 217, 223, 222, 222, 223, 224, 230, 224, 223, 224, 228, 229, 228, 229, 224, 230, 231, 230, 231, 228, 229, 232, 0, 232, 230, 231, 233, 234, 233, 234, 232, 235, 239, 235, 239, 233, 234, 240, 241, 0, 235, 239, 240, 242, 243, 242, 243, 241, 246, 241, 0, 0, 242, 243, 0, 247, 241, 247, 248, 246, 248, 246, 0, 240, 247, 240, 253, 248, 246, 251, 0, 251, 240, 256, 252, 253, 252, 253, 251, 252, 256, 0, 256, 252, 253, 257, 260, 257, 260, 256, 259, 0, 0, 0, 257, 260, 259, 0, 259, 0, 0, 0, 0, 0, 0, 259, 262, 262, 262, 262, 262, 262, 262, 262, 262, 262, 262, 262, 262, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, 266, 0, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 267, 0, 267, 0, 0, 267, 268, 268, 268, 268, 0, 268, 269, 0, 0, 269, 269, 0, 269, 269, 269, 269, 269, 269, 269, 270, 0, 0, 270, 270, 270, 270, 270, 270, 270, 270, 270, 270, 271, 0, 0, 0, 271, 271, 271, 271, 271, 271, 271, 271, 271, 272, 0, 0, 272, 272, 272, 272, 272, 272, 272, 272, 0, 272, 273, 0, 0, 273, 0, 273, 273, 273, 273, 273, 273, 273, 273, 274, 0, 0, 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, 275, 0, 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, 276, 276, 277, 0, 0, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 278, 0, 278, 0, 0, 278, 279, 279, 280, 280, 280, 281, 281, 281, 282, 282, 282, 282, 0, 282, 283, 283, 284, 284, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261 } ; static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; extern int go__flex_debug; int go__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 *go_text; #line 1 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" #define YY_NO_INPUT 1 #line 23 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" #include #include "tokenizer.h" #line 823 "golexer.cpp" #define INITIAL 0 #define comment 1 #define string_literal 2 #define alt_wysiwyg_literal 3 #define unicode_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 go_lex_destroy (void ); int go_get_debug (void ); void go_set_debug (int debug_flag ); YY_EXTRA_TYPE go_get_extra (void ); void go_set_extra (YY_EXTRA_TYPE user_defined ); FILE *go_get_in (void ); void go_set_in (FILE * _in_str ); FILE *go_get_out (void ); void go_set_out (FILE * _out_str ); yy_size_t go_get_leng (void ); char *go_get_text (void ); int go_get_lineno (void ); void go_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 go_wrap (void ); #else extern int go_wrap (void ); #endif #endif #ifndef YY_NO_UNPUT #endif #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( go_text, go_leng, 1, go_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( go_in )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ if ( c == '\n' ) \ buf[n++] = (char) c; \ if ( c == EOF && ferror( go_in ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ else \ { \ errno=0; \ while ( (result = fread(buf, 1, max_size, go_in))==0 && ferror(go_in)) \ { \ if( errno != EINTR) \ { \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ break; \ } \ errno=0; \ clearerr(go_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 go_lex (void); #define YY_DECL int go_lex (void) #endif /* !YY_DECL */ /* Code executed at the beginning of each rule, after go_text and go_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 /*LINTED*/break; #endif #define YY_RULE_SETUP \ YY_USER_ACTION /** The main scanner function which does all the work. */ YY_DECL { yy_state_type yy_current_state; char *yy_cp, *yy_bp; int yy_act; if ( !(yy_init) ) { (yy_init) = 1; #ifdef YY_USER_INIT YY_USER_INIT; #endif if ( ! (yy_start) ) (yy_start) = 1; /* first start state */ if ( ! go_in ) go_in = stdin; if ( ! go_out ) go_out = stdout; if ( ! YY_CURRENT_BUFFER ) { go_ensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = go__create_buffer(go_in,YY_BUF_SIZE ); } go__load_buffer_state( ); } { #line 33 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" #line 1045 "golexer.cpp" while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ { yy_cp = (yy_c_buf_p); /* Support of go_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 { 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 >= 262 ) 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] != 1031 ); 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 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 2: YY_RULE_SETUP #line 35 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 3: YY_RULE_SETUP #line 36 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 4: YY_RULE_SETUP #line 37 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 5: YY_RULE_SETUP #line 38 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 6: YY_RULE_SETUP #line 39 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 7: YY_RULE_SETUP #line 40 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 8: YY_RULE_SETUP #line 41 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 9: YY_RULE_SETUP #line 42 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 10: YY_RULE_SETUP #line 43 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 11: YY_RULE_SETUP #line 44 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 12: YY_RULE_SETUP #line 45 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 13: YY_RULE_SETUP #line 46 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 14: YY_RULE_SETUP #line 47 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 15: YY_RULE_SETUP #line 48 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 16: YY_RULE_SETUP #line 49 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 17: YY_RULE_SETUP #line 50 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 18: YY_RULE_SETUP #line 51 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 19: YY_RULE_SETUP #line 52 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 20: YY_RULE_SETUP #line 53 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 21: YY_RULE_SETUP #line 54 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 22: YY_RULE_SETUP #line 55 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 23: YY_RULE_SETUP #line 56 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 24: YY_RULE_SETUP #line 58 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 25: YY_RULE_SETUP #line 59 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 26: YY_RULE_SETUP #line 60 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 27: YY_RULE_SETUP #line 61 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 28: YY_RULE_SETUP #line 62 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 29: YY_RULE_SETUP #line 63 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 30: YY_RULE_SETUP #line 64 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 31: YY_RULE_SETUP #line 65 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 32: YY_RULE_SETUP #line 66 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 33: YY_RULE_SETUP #line 67 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 34: YY_RULE_SETUP #line 68 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 35: YY_RULE_SETUP #line 69 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 36: YY_RULE_SETUP #line 70 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 37: YY_RULE_SETUP #line 71 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 38: YY_RULE_SETUP #line 72 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 39: YY_RULE_SETUP #line 73 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 40: YY_RULE_SETUP #line 74 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 41: YY_RULE_SETUP #line 75 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 42: YY_RULE_SETUP #line 76 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 43: YY_RULE_SETUP #line 77 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 44: YY_RULE_SETUP #line 79 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { BEGIN(comment); return(TOKENIZER_COMMENT); } YY_BREAK case 45: YY_RULE_SETUP #line 80 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_COMMENT); } YY_BREAK case 46: YY_RULE_SETUP #line 81 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_COMMENT); } YY_BREAK case 47: /* rule 47 can match eol */ YY_RULE_SETUP #line 82 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_NEWLINE); } YY_BREAK case 48: YY_RULE_SETUP #line 83 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_NEWLINE); } YY_BREAK case 49: /* rule 49 can match eol */ YY_RULE_SETUP #line 84 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_NEWLINE); } YY_BREAK case 50: YY_RULE_SETUP #line 85 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { BEGIN(INITIAL); return(TOKENIZER_COMMENT); } YY_BREAK case 51: YY_RULE_SETUP #line 87 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_COMMENT); } YY_BREAK case 52: YY_RULE_SETUP #line 89 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_DIRECTIVE); } YY_BREAK case 53: YY_RULE_SETUP #line 90 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_DIRECTIVE); } YY_BREAK case 54: YY_RULE_SETUP #line 92 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { BEGIN(string_literal); return(TOKENIZER_LITERAL); } YY_BREAK case 55: YY_RULE_SETUP #line 93 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 56: /* rule 56 can match eol */ YY_RULE_SETUP #line 94 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_NEWLINE); } YY_BREAK case 57: YY_RULE_SETUP #line 95 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_NEWLINE); } YY_BREAK case 58: /* rule 58 can match eol */ YY_RULE_SETUP #line 96 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_NEWLINE); } YY_BREAK case 59: YY_RULE_SETUP #line 97 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { BEGIN(INITIAL); return(TOKENIZER_LITERAL); } YY_BREAK case 60: YY_RULE_SETUP #line 99 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { BEGIN(alt_wysiwyg_literal); return(TOKENIZER_LITERAL); } YY_BREAK case 61: YY_RULE_SETUP #line 100 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 62: /* rule 62 can match eol */ YY_RULE_SETUP #line 101 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_NEWLINE); } YY_BREAK case 63: YY_RULE_SETUP #line 102 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_NEWLINE); } YY_BREAK case 64: /* rule 64 can match eol */ YY_RULE_SETUP #line 103 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_NEWLINE); } YY_BREAK case 65: YY_RULE_SETUP #line 104 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { BEGIN(INITIAL); return(TOKENIZER_LITERAL); } YY_BREAK case 66: YY_RULE_SETUP #line 106 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 67: YY_RULE_SETUP #line 107 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 68: YY_RULE_SETUP #line 108 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 69: YY_RULE_SETUP #line 109 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK /* imaginary */ case 70: YY_RULE_SETUP #line 112 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 71: YY_RULE_SETUP #line 113 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK /* rune */ /* It's a dirty little trick, since cgdb will never see ilegal program that can't pass compiler * check we just assume anything between single quote would be unicode literal */ case 72: YY_RULE_SETUP #line 119 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { BEGIN(unicode_literal); return(TOKENIZER_LITERAL); } YY_BREAK /* {unicode_val}|{byte_val} { return(TOKENIZER_LITERAL); } */ case 73: YY_RULE_SETUP #line 123 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 74: /* rule 74 can match eol */ YY_RULE_SETUP #line 124 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_NEWLINE); } YY_BREAK case 75: YY_RULE_SETUP #line 125 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_NEWLINE); } YY_BREAK case 76: /* rule 76 can match eol */ YY_RULE_SETUP #line 126 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_NEWLINE); } YY_BREAK case 77: YY_RULE_SETUP #line 127 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { BEGIN(INITIAL); return(TOKENIZER_LITERAL); } YY_BREAK case 78: YY_RULE_SETUP #line 129 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 79: YY_RULE_SETUP #line 130 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 80: /* rule 80 can match eol */ YY_RULE_SETUP #line 132 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_NEWLINE); } YY_BREAK case 81: /* rule 81 can match eol */ YY_RULE_SETUP #line 133 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_NEWLINE); } YY_BREAK case 82: YY_RULE_SETUP #line 134 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_NEWLINE); } YY_BREAK case 83: YY_RULE_SETUP #line 135 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_TEXT); } YY_BREAK case 84: YY_RULE_SETUP #line 136 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_TEXT); } YY_BREAK case 85: YY_RULE_SETUP #line 137 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" { return(TOKENIZER_TEXT); } YY_BREAK case 86: YY_RULE_SETUP #line 139 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" ECHO; YY_BREAK #line 1550 "golexer.cpp" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(comment): case YY_STATE_EOF(string_literal): case YY_STATE_EOF(alt_wysiwyg_literal): case YY_STATE_EOF(unicode_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 go_in at a new source and called * go_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 = go_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 ( go_wrap( ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up * go_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 user's declarations */ } /* end of go_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) { char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; char *source = (yytext_ptr); yy_size_t 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 = (yy_size_t) ((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_LVALUE; 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. */ go_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; go_restart(go_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 ((int) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) go_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) { yy_state_type yy_current_state; char *yy_cp; yy_current_state = (yy_start); for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) { 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 >= 262 ) 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 ) { int yy_is_jam; char *yy_cp = (yy_c_buf_p); 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 >= 262 ) 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 == 261); return yy_is_jam ? 0 : yy_current_state; } #ifndef YY_NO_UNPUT #endif #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. */ go_restart(go_in ); /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { if ( go_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 go_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 go_restart (FILE * input_file ) { if ( ! YY_CURRENT_BUFFER ){ go_ensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = go__create_buffer(go_in,YY_BUF_SIZE ); } go__init_buffer(YY_CURRENT_BUFFER,input_file ); go__load_buffer_state( ); } /** Switch to a different input buffer. * @param new_buffer The new input buffer. * */ void go__switch_to_buffer (YY_BUFFER_STATE new_buffer ) { /* TODO. We should be able to replace this entire function body * with * go_pop_buffer_state(); * go_push_buffer_state(new_buffer); */ go_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; go__load_buffer_state( ); /* We don't actually know whether we did this switch during * EOF (go_wrap()) processing, but the only time this flag * is looked at is after go_wrap() is called, so it's safe * to go ahead and always set it. */ (yy_did_buffer_switch_on_eof) = 1; } static void go__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; go_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 go__create_buffer (FILE * file, int size ) { YY_BUFFER_STATE b; b = (YY_BUFFER_STATE) go_alloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in go__create_buffer()" ); b->yy_buf_size = (yy_size_t)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 *) go_alloc(b->yy_buf_size + 2 ); if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in go__create_buffer()" ); b->yy_is_our_buffer = 1; go__init_buffer(b,file ); return b; } /** Destroy the buffer. * @param b a buffer created with go__create_buffer() * */ void go__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 ) go_free((void *) b->yy_ch_buf ); go_free((void *) b ); } /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, * such as during a go_restart() or at EOF. */ static void go__init_buffer (YY_BUFFER_STATE b, FILE * file ) { int oerrno = errno; go__flush_buffer(b ); b->yy_input_file = file; b->yy_fill_buffer = 1; /* If b is the current buffer, then go__init_buffer was _probably_ * called from go_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 go__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 ) go__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 go_push_buffer_state (YY_BUFFER_STATE new_buffer ) { if (new_buffer == NULL) return; go_ensure_buffer_stack(); /* This block is copied from go__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 go__switch_to_buffer. */ go__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 go_pop_buffer_state (void) { if (!YY_CURRENT_BUFFER) return; go__delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; if ((yy_buffer_stack_top) > 0) --(yy_buffer_stack_top); if (YY_CURRENT_BUFFER) { go__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 go_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; /* After all that talk, this was set to 1 anyways... */ (yy_buffer_stack) = (struct yy_buffer_state**)go_alloc (num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in go_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. */ yy_size_t grow_size = 8 /* arbitrary grow size */; num_to_alloc = (yy_buffer_stack_max) + grow_size; (yy_buffer_stack) = (struct yy_buffer_state**)go_realloc ((yy_buffer_stack), num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in go_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 go__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) go_alloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in go__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; go__switch_to_buffer(b ); return b; } /** Setup the input buffer state to scan a string. The next call to go_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 * go__scan_bytes() instead. */ YY_BUFFER_STATE go__scan_string (yyconst char * yystr ) { return go__scan_bytes(yystr,strlen(yystr) ); } /** Setup the input buffer state to scan the given bytes. The next call to go_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 go__scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len ) { YY_BUFFER_STATE b; char *buf; yy_size_t n; yy_size_t i; /* Get memory for full buffer, including space for trailing EOB's. */ n = _yybytes_len + 2; buf = (char *) go_alloc(n ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in go__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 = go__scan_buffer(buf,n ); if ( ! b ) YY_FATAL_ERROR( "bad buffer in go__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 go_text. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ go_text[go_leng] = (yy_hold_char); \ (yy_c_buf_p) = go_text + yyless_macro_arg; \ (yy_hold_char) = *(yy_c_buf_p); \ *(yy_c_buf_p) = '\0'; \ go_leng = yyless_macro_arg; \ } \ while ( 0 ) /* Accessor methods (get/set functions) to struct members. */ /** Get the current line number. * */ int go_get_lineno (void) { return go_lineno; } /** Get the input stream. * */ FILE *go_get_in (void) { return go_in; } /** Get the output stream. * */ FILE *go_get_out (void) { return go_out; } /** Get the length of the current token. * */ yy_size_t go_get_leng (void) { return go_leng; } /** Get the current token. * */ char *go_get_text (void) { return go_text; } /** Set the current line number. * @param _line_number line number * */ void go_set_lineno (int _line_number ) { go_lineno = _line_number; } /** Set the input stream. This does not discard the current * input buffer. * @param _in_str A readable stream. * * @see go__switch_to_buffer */ void go_set_in (FILE * _in_str ) { go_in = _in_str ; } void go_set_out (FILE * _out_str ) { go_out = _out_str ; } int go_get_debug (void) { return go__flex_debug; } void go_set_debug (int _bdebug ) { go__flex_debug = _bdebug ; } static int yy_init_globals (void) { /* Initialization is the same as for the non-reentrant scanner. * This function is called from go_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 go_in = stdin; go_out = stdout; #else go_in = (FILE *) 0; go_out = (FILE *) 0; #endif /* For future reference: Set errno on error, since we are called by * go_lex_init() */ return 0; } /* go_lex_destroy is for both reentrant and non-reentrant scanners. */ int go_lex_destroy (void) { /* Pop the buffer stack, destroying each element. */ while(YY_CURRENT_BUFFER){ go__delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; go_pop_buffer_state(); } /* Destroy the stack itself. */ go_free((yy_buffer_stack) ); (yy_buffer_stack) = NULL; /* Reset the globals. This is important in a non-reentrant scanner so the next time * go_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 ) { 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 ) { int n; for ( n = 0; s[n]; ++n ) ; return n; } #endif void *go_alloc (yy_size_t size ) { return (void *) malloc( size ); } void *go_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 go_free (void * ptr ) { free( (char *) ptr ); /* see go_realloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" #line 139 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/golexer.lpp" cgdb-0.8.0/lib/tokenizer/rustlexer.lpp0000664000175000017500000001651713257311731014710 00000000000000%option prefix="rust_" %option outfile="lex.yy.c" %option noyywrap %option nounput %option noinput B [01_] O [0-7_] D [0-9_] H [0-9a-fA-F_] L [a-zA-Z_] T [0-9a-zA-Z_] IDENTIFIER {L}+{T}* %{ #include #include "tokenizer.h" %} %x comment %x string_literal %% "bool" { return(TOKENIZER_TYPE); } "isize" { return(TOKENIZER_TYPE); } "usize" { return(TOKENIZER_TYPE); } "char" { return(TOKENIZER_TYPE); } "u8" { return(TOKENIZER_TYPE); } "u16" { return(TOKENIZER_TYPE); } "u32" { return(TOKENIZER_TYPE); } "u64" { return(TOKENIZER_TYPE); } "f32" { return(TOKENIZER_TYPE); } "f64" { return(TOKENIZER_TYPE); } "i8" { return(TOKENIZER_TYPE); } "i16" { return(TOKENIZER_TYPE); } "i32" { return(TOKENIZER_TYPE); } "i64" { return(TOKENIZER_TYPE); } "str" { return(TOKENIZER_TYPE); } "Self" { return(TOKENIZER_TYPE); } "Copy" { return(TOKENIZER_TYPE); } "Display" { return(TOKENIZER_TYPE); } "Debug" { return(TOKENIZER_TYPE); } "Send" { return(TOKENIZER_TYPE); } "Sized" { return(TOKENIZER_TYPE); } "Sync" { return(TOKENIZER_TYPE); } "Drop" { return(TOKENIZER_TYPE); } "Fn" { return(TOKENIZER_TYPE); } "FnMut" { return(TOKENIZER_TYPE); } "Box" { return(TOKENIZER_TYPE); } "ToOwned" { return(TOKENIZER_TYPE); } "Clone" { return(TOKENIZER_TYPE); } "PartialEq" { return(TOKENIZER_TYPE); } "PartialOrd" { return(TOKENIZER_TYPE); } "Eq" { return(TOKENIZER_TYPE); } "Ord" { return(TOKENIZER_TYPE); } "AsRef" { return(TOKENIZER_TYPE); } "AsMut" { return(TOKENIZER_TYPE); } "Into" { return(TOKENIZER_TYPE); } "From" { return(TOKENIZER_TYPE); } "Default" { return(TOKENIZER_TYPE); } "Iterator" { return(TOKENIZER_TYPE); } "Extend" { return(TOKENIZER_TYPE); } "IntoIterator" { return(TOKENIZER_TYPE); } "DoubleEndedIterator" { return(TOKENIZER_TYPE); } "ExactSizeIterator" { return(TOKENIZER_TYPE); } "SliceConcatExt" { return(TOKENIZER_TYPE); } "String" { return(TOKENIZER_TYPE); } "ToString" { return(TOKENIZER_TYPE); } "Vec" { return(TOKENIZER_TYPE); } "Option" { return(TOKENIZER_TYPE); } "Result" { return(TOKENIZER_TYPE); } "Some" { return(TOKENIZER_TYPE); } "None" { return(TOKENIZER_TYPE); } "abstract" { return(TOKENIZER_KEYWORD); } "alignof" { return(TOKENIZER_KEYWORD); } "as" { return(TOKENIZER_KEYWORD); } "become" { return(TOKENIZER_KEYWORD); } "box" { return(TOKENIZER_KEYWORD); } "break" { return(TOKENIZER_KEYWORD); } "const" { return(TOKENIZER_KEYWORD); } "continue" { return(TOKENIZER_KEYWORD); } "crate" { return(TOKENIZER_KEYWORD); } "do" { return(TOKENIZER_KEYWORD); } "else" { return(TOKENIZER_KEYWORD); } "enum" { return(TOKENIZER_KEYWORD); } "extern" { return(TOKENIZER_KEYWORD); } "false" { return(TOKENIZER_KEYWORD); } "final" { return(TOKENIZER_KEYWORD); } "fn" { return(TOKENIZER_KEYWORD); } "for" { return(TOKENIZER_KEYWORD); } "if" { return(TOKENIZER_KEYWORD); } "impl" { return(TOKENIZER_KEYWORD); } "in" { return(TOKENIZER_KEYWORD); } "let" { return(TOKENIZER_KEYWORD); } "loop" { return(TOKENIZER_KEYWORD); } "macro" { return(TOKENIZER_KEYWORD); } "match" { return(TOKENIZER_KEYWORD); } "move" { return(TOKENIZER_KEYWORD); } "mut" { return(TOKENIZER_KEYWORD); } "offsetof" { return(TOKENIZER_KEYWORD); } "override" { return(TOKENIZER_KEYWORD); } "priv" { return(TOKENIZER_KEYWORD); } "proc" { return(TOKENIZER_KEYWORD); } "pub" { return(TOKENIZER_KEYWORD); } "pure" { return(TOKENIZER_KEYWORD); } "ref" { return(TOKENIZER_KEYWORD); } "return" { return(TOKENIZER_KEYWORD); } "self" { return(TOKENIZER_KEYWORD); } "sizeof" { return(TOKENIZER_KEYWORD); } "static" { return(TOKENIZER_KEYWORD); } "struct" { return(TOKENIZER_KEYWORD); } "super" { return(TOKENIZER_KEYWORD); } "trait" { return(TOKENIZER_KEYWORD); } "true" { return(TOKENIZER_KEYWORD); } "type" { return(TOKENIZER_KEYWORD); } "typeof" { return(TOKENIZER_KEYWORD); } "unsafe" { return(TOKENIZER_KEYWORD); } "unsized" { return(TOKENIZER_KEYWORD); } "virtual" { return(TOKENIZER_KEYWORD); } "where" { return(TOKENIZER_KEYWORD); } "while" { return(TOKENIZER_KEYWORD); } "yield" { 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); } "use" { return(TOKENIZER_DIRECTIVE); } "mod" { return(TOKENIZER_DIRECTIVE); } [a-z_]+! { return(TOKENIZER_DIRECTIVE); } #!?\[.*] { 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}{D}*([E|e][-+]?{D}+|\.{D}+([E|e][-+]?{D}+)?)? { return(TOKENIZER_LITERAL); } 0b{B}+ { return(TOKENIZER_LITERAL); } 0o{O}+ { return(TOKENIZER_LITERAL); } 0x{H}+ { 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); } %% cgdb-0.8.0/lib/tokenizer/adalexer.lpp0000664000175000017500000001232413133371576014436 00000000000000%option prefix="ada_" %option outfile="lex.yy.c" %option case-insensitive %option noyywrap %option nounput %option noinput 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); } %% cgdb-0.8.0/lib/tokenizer/asmlexer.lpp0000664000175000017500000001575513057302460014473 00000000000000%option prefix="asm_" %option outfile="lex.yy.c" %option noyywrap %option nounput %option noinput D [0-9] H [0-9a-fA-F_] 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); } "QWORD" { return(TOKENIZER_KEYWORD); } "XMMWORD" { return(TOKENIZER_KEYWORD); } "DWORD" { return(TOKENIZER_KEYWORD); } "WORD" { return(TOKENIZER_KEYWORD); } "BYTE" { return(TOKENIZER_KEYWORD); } "PTR" { 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); } {D}+[lL] { return(TOKENIZER_LITERAL); } {D}+[uU] { return(TOKENIZER_LITERAL); } {D}+[lL][lL] { return(TOKENIZER_LITERAL); } {D}+[uU][lL] { return(TOKENIZER_LITERAL); } {D}+[uU][lL][lL] { return(TOKENIZER_LITERAL); } {D}+[lL][uU] { return(TOKENIZER_LITERAL); } {D}+[lL][lL][uU] { return(TOKENIZER_LITERAL); } 0x{H}+ { return(TOKENIZER_LITERAL); } 0x{H}+[lL] { return(TOKENIZER_LITERAL); } 0x{H}+[uU] { return(TOKENIZER_LITERAL); } 0x{H}+[lL][lL] { return(TOKENIZER_LITERAL); } 0x{H}+[uU][lL] { return(TOKENIZER_LITERAL); } 0x{H}+[uU][lL][lL] { return(TOKENIZER_LITERAL); } 0x{H}+[lL][uU] { return(TOKENIZER_LITERAL); } 0x{H}+[lL][lL][uU] { return(TOKENIZER_LITERAL); } {D}*\.?{D}+([eE][-+]?{D}+)? { return(TOKENIZER_LITERAL); } {D}+\.?({D})?+[fF] { return(TOKENIZER_LITERAL); } \.{D}+[fF] { 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); } %% cgdb-0.8.0/lib/tokenizer/rustlexer.cpp0000664000175000017500000030203114171036461014664 00000000000000#line 2 "rustlexer.cpp" #line 4 "rustlexer.cpp" #define YY_INT_ALIGNED short int /* A lexical scanner generated by flex */ #define yy_create_buffer rust__create_buffer #define yy_delete_buffer rust__delete_buffer #define yy_flex_debug rust__flex_debug #define yy_init_buffer rust__init_buffer #define yy_flush_buffer rust__flush_buffer #define yy_load_buffer_state rust__load_buffer_state #define yy_switch_to_buffer rust__switch_to_buffer #define yyin rust_in #define yyleng rust_leng #define yylex rust_lex #define yylineno rust_lineno #define yyout rust_out #define yyrestart rust_restart #define yytext rust_text #define yywrap rust_wrap #define yyalloc rust_alloc #define yyrealloc rust_realloc #define yyfree rust_free #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 6 #define YY_FLEX_SUBMINOR_VERSION 0 #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 rust_restart(rust_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 #ifndef YY_TYPEDEF_YY_SIZE_T #define YY_TYPEDEF_YY_SIZE_T typedef size_t yy_size_t; #endif extern yy_size_t rust_leng; extern FILE *rust_in, *rust_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) #define YY_LINENO_REWIND_TO(ptr) /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ do \ { \ /* Undo effects of setting up rust_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 rust_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. */ 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 rust_restart()), so that the user can continue scanning by * just pointing rust_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 rust_text is formed. */ static char yy_hold_char; static int yy_n_chars; /* number of characters read into yy_ch_buf */ yy_size_t rust_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 rust_wrap()'s to do buffer switches * instead of setting up a fresh rust_in. A bit of a hack ... */ static int yy_did_buffer_switch_on_eof; void rust_restart (FILE *input_file ); void rust__switch_to_buffer (YY_BUFFER_STATE new_buffer ); YY_BUFFER_STATE rust__create_buffer (FILE *file,int size ); void rust__delete_buffer (YY_BUFFER_STATE b ); void rust__flush_buffer (YY_BUFFER_STATE b ); void rust_push_buffer_state (YY_BUFFER_STATE new_buffer ); void rust_pop_buffer_state (void ); static void rust_ensure_buffer_stack (void ); static void rust__load_buffer_state (void ); static void rust__init_buffer (YY_BUFFER_STATE b,FILE *file ); #define YY_FLUSH_BUFFER rust__flush_buffer(YY_CURRENT_BUFFER ) YY_BUFFER_STATE rust__scan_buffer (char *base,yy_size_t size ); YY_BUFFER_STATE rust__scan_string (yyconst char *yy_str ); YY_BUFFER_STATE rust__scan_bytes (yyconst char *bytes,yy_size_t len ); void *rust_alloc (yy_size_t ); void *rust_realloc (void *,yy_size_t ); void rust_free (void * ); #define yy_new_buffer rust__create_buffer #define yy_set_interactive(is_interactive) \ { \ if ( ! YY_CURRENT_BUFFER ){ \ rust_ensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ rust__create_buffer(rust_in,YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } #define yy_set_bol(at_bol) \ { \ if ( ! YY_CURRENT_BUFFER ){\ rust_ensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ rust__create_buffer(rust_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 */ #define rust_wrap() (/*CONSTCOND*/1) #define YY_SKIP_YYWRAP typedef unsigned char YY_CHAR; FILE *rust_in = (FILE *) 0, *rust_out = (FILE *) 0; typedef int yy_state_type; extern int rust_lineno; int rust_lineno = 1; extern char *rust_text; #ifdef yytext_ptr #undef yytext_ptr #endif #define yytext_ptr rust_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 ); #if defined(__GNUC__) && __GNUC__ >= 3 __attribute__((__noreturn__)) #endif static void yy_fatal_error (yyconst char msg[] ); /* Done after the current pattern has been matched and before the * corresponding action - sets up rust_text. */ #define YY_DO_BEFORE_ACTION \ (yytext_ptr) = yy_bp; \ rust_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 130 #define YY_END_OF_BUFFER 131 /* 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[486] = { 0, 0, 0, 101, 101, 113, 113, 131, 129, 127, 124, 126, 112, 129, 129, 129, 118, 118, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 118, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 101, 103, 104, 102, 113, 114, 115, 117, 130, 125, 0, 0, 0, 0, 100, 107, 0, 118, 0, 0, 0, 0, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 31, 128, 24, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 110, 118, 128, 118, 128, 128, 128, 128, 53, 128, 128, 128, 128, 128, 128, 60, 128, 128, 128, 128, 128, 128, 128, 66, 128, 128, 128, 128, 11, 68, 128, 70, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 5, 128, 128, 128, 128, 128, 101, 105, 102, 102, 106, 113, 0, 116, 0, 111, 122, 0, 122, 107, 118, 0, 118, 119, 120, 121, 128, 128, 26, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 32, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 46, 128, 118, 118, 118, 128, 128, 128, 128, 55, 128, 128, 128, 128, 128, 128, 128, 9, 10, 128, 128, 67, 12, 13, 14, 128, 128, 71, 128, 128, 128, 109, 128, 76, 128, 128, 128, 128, 81, 128, 83, 128, 128, 128, 128, 15, 128, 128, 128, 128, 6, 7, 8, 128, 108, 128, 128, 128, 128, 128, 123, 0, 128, 128, 128, 17, 128, 128, 128, 128, 23, 128, 128, 128, 36, 35, 128, 50, 128, 128, 128, 16, 20, 128, 128, 49, 128, 22, 128, 128, 128, 128, 128, 1, 128, 4, 128, 128, 128, 61, 62, 128, 128, 128, 69, 128, 72, 128, 128, 75, 128, 128, 79, 80, 82, 128, 85, 128, 128, 128, 128, 128, 91, 92, 128, 128, 128, 128, 128, 128, 128, 0, 118, 34, 33, 28, 19, 128, 128, 128, 128, 128, 25, 128, 128, 128, 128, 128, 21, 128, 128, 128, 128, 128, 128, 128, 56, 57, 128, 59, 128, 64, 65, 2, 73, 74, 128, 128, 128, 128, 128, 128, 89, 90, 128, 128, 128, 3, 128, 97, 98, 99, 128, 128, 128, 128, 39, 128, 128, 47, 128, 48, 128, 44, 128, 128, 128, 128, 54, 128, 63, 128, 128, 84, 86, 87, 88, 93, 94, 128, 128, 37, 18, 128, 128, 128, 128, 128, 128, 27, 128, 128, 52, 128, 128, 128, 95, 96, 128, 128, 128, 38, 128, 128, 128, 45, 51, 58, 77, 78, 128, 128, 128, 29, 128, 128, 128, 128, 128, 30, 128, 128, 128, 128, 128, 128, 128, 40, 128, 128, 128, 128, 128, 128, 43, 128, 128, 128, 128, 128, 42, 128, 41, 0 } ; static yyconst YY_CHAR 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, 5, 6, 7, 1, 1, 1, 8, 1, 1, 9, 10, 1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 18, 20, 21, 1, 1, 1, 1, 1, 1, 1, 22, 23, 24, 25, 26, 27, 28, 28, 29, 28, 28, 28, 30, 31, 32, 33, 28, 34, 35, 36, 28, 37, 28, 28, 28, 28, 38, 39, 40, 1, 41, 1, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 1, 68, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 YY_CHAR yy_meta[69] = { 0, 1, 1, 2, 3, 1, 4, 1, 1, 5, 6, 1, 1, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 9, 8, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 1, 1, 1, 7, 8, 8, 8, 8, 9, 8, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11 } ; static yyconst flex_uint16_t yy_base[501] = { 0, 0, 0, 66, 68, 70, 75, 350, 1977, 1977, 1977, 345, 1977, 75, 294, 73, 104, 40, 73, 121, 165, 51, 90, 47, 42, 96, 55, 105, 112, 110, 141, 73, 142, 217, 275, 150, 254, 255, 269, 304, 266, 322, 284, 310, 308, 330, 335, 341, 353, 391, 365, 296, 371, 0, 1977, 328, 119, 286, 1977, 314, 1977, 300, 1977, 262, 247, 249, 248, 1977, 0, 422, 0, 245, 160, 439, 0, 0, 114, 170, 152, 136, 158, 373, 160, 406, 171, 246, 408, 344, 374, 414, 420, 392, 418, 432, 425, 430, 436, 440, 444, 445, 449, 456, 471, 460, 1977, 517, 576, 0, 486, 608, 497, 499, 501, 512, 517, 521, 545, 523, 559, 556, 560, 588, 592, 214, 208, 587, 603, 611, 614, 200, 197, 182, 0, 612, 623, 617, 632, 626, 635, 646, 651, 655, 650, 659, 670, 674, 675, 678, 686, 698, 699, 701, 707, 171, 161, 158, 0, 702, 722, 726, 727, 728, 0, 1977, 505, 506, 1977, 132, 153, 1977, 113, 104, 1977, 124, 119, 0, 613, 776, 785, 291, 794, 0, 580, 495, 466, 470, 762, 581, 558, 551, 771, 763, 777, 776, 778, 515, 783, 785, 796, 795, 790, 794, 800, 807, 812, 813, 814, 818, 822, 829, 823, 827, 828, 879, 106, 102, 89, 723, 858, 859, 861, 864, 880, 882, 883, 885, 904, 905, 908, 0, 0, 896, 910, 919, 0, 0, 0, 923, 924, 928, 932, 937, 950, 952, 955, 956, 961, 964, 975, 976, 979, 984, 988, 990, 1002, 1008, 1003, 1014, 1026, 1027, 1032, 1038, 0, 0, 0, 1040, 1046, 1051, 1052, 1064, 1066, 1067, 1977, 74, 852, 1069, 881, 876, 1080, 1076, 1078, 1084, 1086, 1088, 1090, 1094, 1095, 1101, 1110, 1100, 1105, 1109, 1111, 1115, 1116, 1125, 1127, 1121, 1129, 1123, 1133, 1134, 1148, 1149, 1152, 1157, 1168, 1170, 1171, 1176, 1191, 1182, 1190, 1195, 1203, 1204, 1209, 1215, 1217, 1223, 1229, 1228, 1241, 1237, 1242, 1250, 1255, 1261, 1256, 1269, 1274, 1275, 1280, 1283, 1288, 1289, 1303, 1294, 1309, 1314, 1322, 1327, 1336, 1384, 1393, 1141, 1143, 1162, 1330, 1332, 1373, 1338, 1337, 1371, 1339, 1367, 1377, 1366, 1389, 1379, 1383, 1393, 1395, 1391, 1400, 1412, 1414, 1415, 1409, 1420, 1423, 1428, 1434, 1439, 1442, 1443, 1447, 1448, 1461, 1463, 1472, 1477, 1466, 1475, 1486, 1488, 1491, 1497, 1499, 1510, 1512, 1513, 1515, 1518, 1521, 1523, 1534, 1530, 1511, 1535, 1539, 1540, 1541, 1545, 1546, 1547, 1559, 1552, 1566, 1570, 1568, 1571, 1579, 1582, 1584, 1593, 1597, 1598, 1602, 1606, 1611, 1620, 1617, 1616, 1622, 1626, 1630, 1631, 1632, 1642, 1646, 1636, 1652, 1650, 1653, 1661, 1669, 1672, 1666, 1674, 1675, 1677, 1682, 1683, 1684, 1688, 1699, 1692, 1703, 1706, 1707, 1708, 1716, 1724, 1717, 1701, 1726, 1732, 1730, 1728, 1734, 1738, 1739, 1764, 1750, 1745, 1771, 1746, 1752, 1756, 1757, 1770, 1772, 1776, 1762, 1777, 1778, 1793, 1783, 1787, 1788, 1789, 1797, 1798, 1799, 1977, 1857, 1868, 1879, 1884, 1894, 1905, 1916, 1927, 1938, 1949, 1955, 1956, 1959, 1963, 1969 } ; static yyconst flex_int16_t yy_def[501] = { 0, 485, 1, 486, 486, 487, 487, 485, 485, 485, 485, 485, 485, 485, 488, 485, 485, 16, 489, 489, 489, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 485, 33, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 490, 485, 485, 491, 492, 485, 485, 485, 492, 485, 485, 493, 485, 494, 485, 495, 485, 17, 496, 485, 485, 497, 498, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 485, 498, 489, 33, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 498, 498, 34, 34, 34, 34, 498, 498, 498, 498, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 498, 498, 498, 498, 34, 34, 34, 34, 34, 490, 485, 491, 491, 485, 492, 492, 485, 493, 493, 485, 485, 485, 495, 499, 485, 485, 485, 485, 497, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 498, 213, 106, 109, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 498, 498, 34, 34, 34, 498, 498, 498, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 498, 498, 498, 34, 34, 34, 34, 34, 34, 34, 485, 500, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 485, 485, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 34, 34, 34, 34, 34, 34, 34, 20, 20, 20, 20, 20, 20, 20, 20, 34, 34, 34, 34, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 0, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485 } ; static yyconst flex_uint16_t yy_nxt[2046] = { 0, 8, 9, 10, 11, 8, 12, 13, 14, 8, 8, 8, 15, 16, 17, 17, 17, 17, 17, 17, 17, 17, 18, 19, 20, 21, 22, 23, 24, 25, 24, 26, 27, 28, 29, 30, 31, 32, 8, 8, 8, 33, 34, 35, 36, 37, 38, 39, 40, 40, 41, 40, 40, 42, 43, 40, 44, 45, 40, 46, 47, 48, 49, 50, 51, 40, 52, 40, 8, 54, 55, 54, 55, 58, 59, 56, 60, 56, 58, 59, 63, 60, 67, 485, 343, 68, 75, 75, 75, 75, 75, 75, 75, 75, 75, 76, 485, 81, 76, 485, 76, 82, 87, 76, 76, 485, 88, 83, 76, 61, 84, 91, 485, 64, 61, 69, 485, 70, 70, 70, 70, 70, 70, 70, 70, 70, 76, 272, 165, 102, 71, 166, 272, 77, 75, 75, 75, 75, 75, 75, 75, 75, 75, 76, 171, 70, 76, 72, 85, 76, 71, 89, 76, 171, 94, 86, 95, 90, 76, 167, 73, 76, 92, 76, 93, 76, 76, 76, 76, 74, 76, 168, 71, 179, 179, 264, 263, 78, 75, 75, 75, 75, 75, 75, 75, 75, 75, 96, 103, 76, 262, 97, 185, 108, 98, 76, 113, 99, 76, 236, 182, 179, 100, 108, 183, 76, 114, 101, 76, 115, 108, 76, 235, 76, 76, 186, 76, 184, 79, 234, 189, 80, 104, 76, 76, 230, 76, 191, 69, 229, 105, 105, 105, 105, 105, 105, 105, 105, 105, 76, 76, 76, 76, 106, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 177, 174, 172, 107, 108, 108, 108, 108, 109, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 71, 485, 171, 75, 75, 75, 75, 75, 75, 75, 75, 75, 108, 108, 76, 64, 76, 76, 116, 179, 179, 167, 108, 108, 108, 117, 119, 108, 118, 108, 108, 108, 169, 110, 108, 123, 108, 120, 124, 121, 168, 108, 108, 111, 108, 137, 163, 179, 66, 122, 112, 129, 108, 130, 108, 138, 131, 132, 485, 108, 160, 125, 108, 62, 108, 485, 108, 139, 108, 126, 142, 108, 108, 485, 127, 128, 108, 485, 108, 108, 108, 140, 485, 108, 133, 108, 143, 141, 108, 194, 108, 134, 135, 108, 485, 485, 146, 136, 108, 108, 485, 485, 147, 108, 144, 108, 148, 145, 485, 108, 108, 108, 76, 485, 485, 76, 108, 149, 150, 485, 153, 108, 154, 108, 485, 155, 156, 151, 108, 108, 159, 187, 485, 108, 152, 188, 161, 485, 485, 108, 108, 76, 76, 485, 76, 195, 108, 485, 485, 108, 176, 176, 176, 176, 176, 176, 176, 176, 176, 108, 76, 157, 198, 76, 485, 192, 158, 180, 180, 180, 180, 180, 180, 180, 76, 485, 76, 76, 176, 76, 485, 197, 76, 190, 193, 76, 76, 485, 76, 76, 196, 76, 200, 76, 199, 180, 76, 485, 76, 201, 76, 76, 485, 76, 203, 202, 204, 76, 76, 206, 485, 76, 76, 76, 207, 76, 76, 76, 210, 212, 76, 211, 205, 208, 76, 485, 209, 76, 76, 485, 165, 76, 485, 166, 76, 485, 485, 76, 76, 76, 276, 76, 76, 69, 108, 105, 105, 105, 105, 105, 105, 105, 105, 105, 108, 108, 275, 108, 213, 108, 485, 108, 485, 76, 218, 108, 76, 108, 485, 108, 108, 219, 217, 105, 108, 108, 108, 485, 213, 108, 108, 108, 222, 76, 286, 108, 76, 108, 220, 108, 485, 108, 108, 224, 485, 485, 108, 221, 108, 485, 71, 177, 223, 108, 214, 214, 214, 214, 214, 214, 214, 214, 214, 108, 108, 279, 225, 108, 108, 76, 108, 485, 76, 280, 108, 485, 76, 108, 108, 76, 485, 108, 215, 177, 108, 226, 214, 214, 214, 214, 214, 214, 214, 214, 214, 108, 108, 485, 76, 76, 108, 76, 76, 485, 273, 231, 108, 274, 278, 485, 108, 108, 108, 108, 216, 227, 108, 108, 228, 108, 108, 108, 108, 232, 273, 108, 108, 485, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 233, 108, 108, 108, 108, 108, 108, 237, 273, 238, 108, 485, 108, 108, 239, 108, 108, 241, 240, 108, 108, 108, 108, 243, 246, 108, 108, 485, 485, 108, 108, 108, 247, 108, 242, 108, 485, 108, 108, 108, 108, 244, 108, 245, 250, 108, 108, 248, 108, 252, 108, 485, 485, 249, 108, 108, 108, 108, 254, 485, 251, 108, 108, 253, 485, 108, 108, 256, 108, 108, 259, 108, 108, 108, 485, 485, 485, 108, 108, 108, 255, 108, 108, 258, 257, 108, 108, 108, 108, 265, 260, 261, 108, 108, 108, 266, 108, 108, 108, 267, 269, 271, 108, 108, 270, 485, 108, 108, 108, 108, 108, 302, 268, 108, 108, 108, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 180, 180, 180, 180, 180, 180, 180, 281, 76, 76, 178, 76, 76, 282, 283, 284, 485, 76, 485, 178, 76, 277, 76, 76, 76, 76, 76, 76, 180, 76, 485, 76, 287, 285, 76, 289, 76, 288, 290, 76, 76, 76, 76, 76, 76, 76, 76, 293, 291, 76, 294, 296, 295, 76, 485, 292, 76, 297, 76, 76, 76, 76, 76, 76, 76, 298, 299, 76, 76, 76, 485, 76, 76, 76, 76, 76, 76, 76, 76, 485, 300, 301, 177, 485, 485, 214, 214, 214, 214, 214, 214, 214, 214, 214, 108, 108, 485, 108, 76, 303, 108, 76, 485, 485, 108, 108, 345, 305, 304, 485, 108, 108, 108, 214, 108, 306, 108, 108, 108, 108, 347, 108, 76, 485, 485, 76, 108, 76, 108, 108, 76, 108, 108, 108, 307, 108, 308, 309, 108, 310, 108, 108, 108, 311, 108, 315, 108, 313, 485, 314, 108, 108, 312, 485, 108, 108, 108, 108, 108, 108, 108, 108, 485, 108, 108, 108, 485, 485, 108, 316, 108, 485, 108, 108, 108, 485, 108, 108, 108, 485, 485, 108, 318, 108, 317, 108, 108, 320, 108, 319, 108, 108, 108, 485, 321, 485, 108, 108, 108, 485, 108, 108, 108, 108, 485, 108, 485, 108, 108, 108, 108, 108, 108, 325, 322, 108, 323, 108, 485, 485, 108, 108, 108, 326, 108, 108, 108, 485, 108, 108, 108, 324, 108, 485, 108, 485, 108, 108, 108, 108, 485, 108, 328, 108, 108, 327, 485, 329, 108, 108, 108, 485, 485, 485, 108, 108, 108, 330, 485, 485, 108, 108, 108, 108, 485, 332, 485, 108, 108, 331, 333, 334, 108, 108, 108, 336, 108, 335, 108, 108, 108, 485, 108, 337, 108, 108, 108, 108, 108, 485, 485, 108, 108, 108, 485, 485, 485, 108, 108, 108, 108, 485, 108, 108, 108, 108, 339, 485, 485, 346, 108, 338, 341, 342, 485, 76, 340, 108, 76, 108, 108, 348, 76, 355, 350, 76, 76, 76, 485, 76, 351, 349, 76, 76, 76, 76, 76, 76, 353, 76, 76, 76, 352, 76, 76, 356, 76, 76, 354, 76, 76, 76, 358, 485, 357, 76, 76, 359, 76, 76, 76, 76, 76, 360, 76, 76, 361, 76, 485, 76, 76, 76, 76, 76, 76, 76, 76, 362, 76, 76, 76, 363, 76, 76, 108, 108, 364, 76, 108, 76, 76, 485, 76, 108, 108, 108, 485, 366, 108, 367, 365, 108, 108, 108, 108, 108, 108, 108, 76, 485, 108, 76, 108, 368, 108, 485, 108, 108, 108, 370, 485, 108, 108, 108, 108, 369, 108, 108, 108, 108, 371, 108, 485, 485, 485, 108, 108, 108, 485, 108, 108, 108, 373, 108, 108, 108, 485, 372, 108, 108, 374, 108, 485, 108, 375, 108, 108, 108, 485, 108, 485, 108, 108, 108, 108, 108, 485, 485, 108, 108, 108, 377, 376, 108, 108, 108, 108, 108, 108, 485, 378, 108, 108, 108, 485, 485, 108, 108, 108, 379, 108, 108, 108, 485, 108, 108, 108, 108, 485, 485, 485, 108, 108, 108, 485, 108, 485, 108, 108, 108, 108, 108, 383, 380, 108, 108, 108, 382, 381, 108, 108, 108, 108, 485, 108, 108, 108, 108, 108, 108, 108, 485, 384, 108, 108, 108, 108, 385, 386, 108, 108, 108, 108, 387, 485, 108, 485, 108, 389, 108, 108, 485, 485, 485, 388, 108, 108, 485, 108, 485, 108, 391, 108, 108, 485, 397, 392, 108, 108, 390, 485, 485, 108, 108, 393, 108, 76, 396, 394, 76, 108, 76, 108, 76, 76, 76, 76, 76, 76, 108, 344, 344, 344, 344, 344, 344, 344, 344, 344, 344, 344, 344, 344, 344, 344, 344, 344, 344, 395, 398, 404, 485, 76, 76, 401, 76, 76, 76, 344, 76, 76, 399, 76, 76, 402, 76, 76, 344, 76, 76, 406, 400, 76, 403, 485, 76, 405, 76, 76, 76, 76, 76, 76, 407, 76, 108, 76, 408, 108, 76, 108, 108, 485, 485, 410, 108, 108, 485, 108, 108, 108, 108, 108, 409, 108, 108, 108, 108, 108, 108, 108, 411, 485, 108, 108, 108, 108, 485, 108, 108, 108, 108, 412, 108, 108, 108, 485, 108, 108, 108, 485, 485, 108, 108, 108, 108, 108, 108, 485, 108, 108, 108, 108, 417, 485, 485, 414, 108, 108, 108, 485, 108, 108, 108, 108, 413, 108, 416, 108, 108, 415, 108, 108, 108, 108, 108, 485, 108, 108, 418, 108, 419, 108, 108, 108, 108, 420, 108, 421, 108, 485, 108, 485, 108, 108, 108, 108, 422, 108, 108, 108, 108, 108, 425, 108, 485, 108, 76, 108, 108, 76, 108, 485, 108, 108, 108, 108, 76, 108, 76, 76, 108, 76, 426, 427, 423, 76, 485, 485, 76, 76, 76, 424, 76, 76, 76, 76, 429, 428, 76, 76, 76, 76, 76, 76, 430, 76, 431, 76, 485, 432, 76, 108, 433, 108, 76, 108, 108, 76, 485, 434, 485, 108, 485, 108, 108, 108, 108, 108, 108, 108, 108, 437, 108, 108, 108, 435, 485, 108, 108, 108, 436, 108, 108, 108, 108, 485, 108, 108, 108, 485, 485, 108, 108, 108, 485, 108, 108, 108, 485, 108, 108, 108, 108, 485, 108, 108, 108, 438, 108, 485, 444, 76, 439, 108, 76, 108, 445, 76, 485, 108, 76, 76, 108, 440, 76, 76, 76, 76, 76, 76, 76, 76, 442, 443, 76, 108, 485, 76, 108, 441, 76, 76, 447, 446, 76, 108, 108, 76, 108, 449, 76, 108, 108, 448, 108, 108, 108, 108, 450, 108, 451, 108, 452, 108, 108, 453, 454, 108, 108, 108, 76, 108, 76, 76, 108, 76, 108, 76, 76, 76, 76, 76, 76, 76, 455, 457, 76, 76, 108, 456, 76, 108, 108, 108, 76, 459, 76, 76, 108, 76, 485, 108, 108, 108, 458, 108, 485, 485, 108, 108, 108, 76, 76, 461, 76, 76, 462, 463, 485, 76, 460, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 464, 465, 76, 76, 467, 76, 76, 468, 470, 76, 76, 466, 76, 76, 76, 469, 76, 76, 471, 76, 76, 76, 472, 76, 76, 475, 76, 474, 76, 76, 485, 76, 477, 473, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 479, 76, 476, 478, 480, 76, 76, 76, 76, 76, 483, 76, 482, 481, 76, 76, 76, 76, 76, 76, 76, 485, 484, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 65, 485, 65, 65, 65, 65, 65, 65, 65, 65, 65, 76, 76, 76, 76, 162, 485, 485, 162, 485, 162, 162, 162, 162, 162, 162, 164, 485, 485, 164, 164, 164, 164, 164, 164, 164, 164, 167, 485, 485, 485, 167, 167, 167, 167, 167, 167, 167, 170, 485, 170, 170, 170, 170, 170, 170, 170, 170, 170, 173, 485, 173, 173, 173, 173, 173, 173, 173, 173, 173, 175, 485, 485, 175, 175, 175, 175, 175, 175, 175, 175, 178, 178, 181, 181, 181, 75, 75, 75, 75, 176, 485, 176, 485, 176, 344, 344, 7, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485 } ; static yyconst flex_int16_t yy_chk[2046] = { 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, 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, 5, 5, 3, 5, 4, 6, 6, 13, 6, 15, 17, 273, 15, 18, 18, 18, 18, 18, 18, 18, 18, 18, 24, 17, 21, 24, 216, 23, 21, 23, 23, 21, 17, 23, 21, 26, 5, 21, 26, 215, 13, 6, 16, 214, 16, 16, 16, 16, 16, 16, 16, 16, 16, 31, 174, 56, 31, 16, 56, 173, 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, 22, 171, 16, 22, 16, 22, 25, 16, 25, 25, 170, 28, 22, 29, 25, 27, 168, 16, 27, 27, 29, 27, 28, 29, 76, 28, 16, 76, 167, 16, 72, 72, 155, 154, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 30, 32, 79, 153, 30, 79, 35, 30, 32, 35, 30, 32, 131, 77, 72, 30, 35, 77, 78, 35, 30, 78, 35, 35, 80, 130, 82, 80, 80, 82, 78, 20, 129, 82, 20, 33, 77, 84, 124, 77, 84, 33, 123, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 71, 66, 65, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 34, 64, 34, 34, 34, 34, 34, 34, 34, 34, 34, 36, 37, 85, 63, 34, 85, 36, 179, 179, 61, 36, 37, 40, 36, 37, 38, 36, 36, 37, 34, 59, 34, 40, 39, 34, 38, 39, 38, 57, 40, 42, 34, 38, 42, 55, 179, 14, 38, 34, 41, 42, 41, 51, 42, 41, 41, 34, 42, 51, 39, 39, 11, 51, 7, 44, 43, 43, 39, 44, 51, 39, 0, 39, 39, 44, 0, 43, 39, 41, 43, 0, 44, 41, 43, 44, 43, 45, 87, 41, 41, 41, 46, 0, 0, 46, 41, 45, 47, 0, 0, 47, 46, 45, 45, 47, 45, 0, 47, 46, 48, 87, 0, 0, 87, 47, 47, 47, 0, 49, 48, 49, 50, 0, 49, 49, 48, 48, 52, 50, 81, 0, 50, 48, 81, 52, 0, 0, 52, 50, 81, 88, 0, 81, 88, 52, 0, 0, 49, 69, 69, 69, 69, 69, 69, 69, 69, 69, 49, 91, 49, 91, 91, 0, 86, 49, 73, 73, 73, 73, 73, 73, 73, 83, 0, 86, 83, 69, 86, 0, 90, 89, 83, 86, 89, 92, 0, 90, 92, 89, 90, 93, 94, 92, 73, 94, 0, 95, 94, 93, 95, 0, 93, 96, 95, 96, 96, 97, 98, 0, 97, 98, 99, 99, 98, 99, 100, 102, 103, 100, 102, 97, 100, 101, 0, 101, 101, 103, 164, 165, 103, 164, 165, 184, 0, 0, 184, 185, 102, 185, 185, 102, 105, 108, 105, 105, 105, 105, 105, 105, 105, 105, 105, 108, 110, 183, 111, 105, 112, 0, 108, 0, 183, 111, 110, 183, 111, 0, 112, 113, 113, 110, 105, 111, 114, 112, 0, 105, 115, 113, 117, 115, 195, 195, 114, 195, 113, 114, 115, 0, 117, 114, 117, 0, 0, 115, 114, 117, 0, 105, 106, 116, 116, 106, 106, 106, 106, 106, 106, 106, 106, 106, 116, 119, 188, 118, 118, 120, 189, 116, 0, 189, 189, 119, 0, 188, 118, 120, 188, 0, 119, 106, 109, 118, 120, 109, 109, 109, 109, 109, 109, 109, 109, 109, 125, 121, 0, 182, 187, 122, 182, 187, 0, 176, 125, 121, 182, 187, 0, 122, 126, 125, 121, 109, 121, 109, 122, 122, 127, 133, 126, 128, 126, 176, 135, 109, 0, 126, 127, 133, 134, 128, 109, 137, 135, 127, 133, 128, 128, 136, 134, 135, 138, 137, 134, 176, 136, 134, 0, 136, 137, 137, 138, 139, 139, 138, 136, 142, 140, 138, 140, 142, 141, 139, 0, 0, 143, 142, 140, 143, 139, 139, 141, 0, 142, 140, 143, 144, 140, 141, 141, 145, 146, 143, 144, 147, 146, 144, 0, 0, 144, 145, 146, 148, 144, 147, 0, 145, 145, 146, 146, 0, 147, 148, 149, 149, 150, 151, 151, 157, 148, 0, 0, 0, 152, 149, 150, 148, 151, 157, 150, 149, 149, 150, 152, 151, 157, 151, 152, 158, 217, 152, 158, 159, 160, 161, 158, 160, 161, 158, 217, 160, 0, 159, 160, 161, 158, 217, 217, 159, 159, 160, 161, 177, 177, 177, 177, 177, 177, 177, 177, 177, 178, 178, 178, 178, 178, 178, 178, 178, 178, 180, 180, 180, 180, 180, 180, 180, 190, 186, 191, 177, 186, 191, 191, 192, 193, 0, 190, 0, 178, 190, 186, 193, 192, 194, 193, 192, 194, 180, 196, 0, 197, 196, 194, 197, 198, 200, 197, 199, 200, 201, 199, 198, 201, 199, 198, 202, 203, 201, 202, 204, 206, 205, 203, 0, 202, 203, 207, 204, 205, 206, 204, 205, 206, 207, 208, 209, 207, 208, 210, 0, 208, 210, 211, 212, 209, 211, 212, 209, 0, 210, 211, 213, 0, 0, 213, 213, 213, 213, 213, 213, 213, 213, 213, 218, 219, 0, 220, 274, 218, 221, 274, 0, 0, 218, 219, 274, 220, 219, 0, 221, 218, 219, 213, 220, 222, 222, 221, 223, 224, 276, 225, 277, 0, 0, 277, 222, 276, 223, 224, 276, 225, 231, 222, 223, 223, 224, 224, 225, 225, 226, 227, 231, 226, 228, 232, 232, 228, 0, 231, 226, 227, 227, 0, 228, 233, 232, 226, 227, 237, 238, 228, 0, 232, 239, 233, 0, 0, 240, 237, 238, 0, 233, 241, 239, 0, 237, 238, 240, 0, 0, 239, 240, 241, 238, 240, 242, 242, 243, 241, 241, 244, 245, 0, 244, 0, 242, 246, 243, 0, 247, 244, 245, 242, 0, 243, 0, 246, 244, 245, 247, 248, 249, 249, 246, 250, 247, 247, 0, 0, 251, 248, 249, 251, 252, 250, 253, 0, 248, 249, 251, 248, 250, 0, 252, 0, 253, 251, 254, 256, 0, 252, 254, 253, 255, 253, 0, 255, 254, 256, 257, 0, 0, 0, 255, 254, 256, 256, 0, 0, 257, 255, 258, 259, 0, 258, 0, 257, 260, 257, 259, 260, 258, 259, 261, 265, 265, 261, 260, 258, 259, 0, 266, 265, 261, 260, 265, 267, 268, 0, 0, 261, 266, 265, 0, 0, 0, 267, 268, 266, 269, 0, 270, 271, 267, 268, 268, 0, 0, 275, 269, 267, 270, 271, 0, 275, 269, 269, 275, 270, 271, 278, 279, 287, 280, 279, 278, 280, 0, 278, 281, 279, 282, 281, 283, 282, 284, 283, 284, 284, 285, 286, 283, 285, 286, 288, 289, 287, 285, 289, 287, 290, 291, 0, 290, 291, 288, 292, 291, 288, 292, 293, 294, 295, 293, 294, 296, 297, 0, 299, 297, 295, 299, 296, 295, 298, 296, 298, 298, 300, 301, 300, 300, 301, 302, 303, 301, 345, 304, 346, 345, 0, 346, 305, 302, 303, 0, 303, 304, 304, 302, 302, 303, 305, 306, 304, 307, 308, 347, 0, 305, 347, 309, 306, 306, 0, 307, 308, 311, 309, 0, 306, 309, 307, 308, 308, 312, 310, 311, 309, 310, 313, 0, 0, 0, 311, 312, 310, 0, 314, 315, 313, 314, 312, 310, 316, 0, 313, 313, 314, 315, 317, 0, 318, 317, 316, 314, 315, 0, 319, 0, 317, 316, 318, 321, 320, 0, 0, 317, 319, 318, 320, 319, 323, 321, 320, 319, 322, 324, 0, 322, 321, 320, 323, 0, 0, 325, 322, 324, 323, 323, 326, 328, 0, 322, 324, 325, 327, 0, 0, 0, 326, 328, 325, 0, 329, 0, 327, 326, 328, 330, 331, 331, 327, 327, 329, 332, 330, 329, 333, 330, 331, 329, 0, 334, 335, 332, 330, 331, 333, 337, 0, 332, 332, 334, 335, 333, 333, 335, 336, 337, 334, 335, 336, 0, 338, 0, 337, 338, 336, 339, 0, 0, 0, 337, 338, 336, 0, 340, 0, 339, 340, 338, 341, 0, 352, 341, 339, 340, 339, 0, 0, 342, 341, 342, 340, 348, 351, 349, 348, 341, 349, 342, 352, 351, 354, 352, 351, 354, 342, 343, 343, 343, 343, 343, 343, 343, 343, 343, 344, 344, 344, 344, 344, 344, 344, 344, 344, 350, 353, 361, 0, 357, 355, 357, 357, 355, 353, 343, 350, 353, 355, 350, 356, 358, 359, 356, 344, 359, 360, 363, 356, 360, 359, 0, 358, 362, 363, 358, 361, 363, 362, 361, 364, 362, 368, 364, 365, 365, 364, 366, 367, 0, 0, 367, 368, 369, 0, 365, 370, 366, 367, 368, 366, 371, 365, 369, 366, 367, 370, 372, 370, 0, 369, 371, 373, 370, 0, 374, 375, 372, 371, 372, 376, 377, 373, 0, 372, 374, 375, 0, 0, 373, 376, 377, 374, 375, 378, 0, 379, 376, 377, 382, 382, 0, 0, 379, 378, 380, 379, 0, 383, 382, 381, 378, 378, 379, 381, 380, 382, 380, 383, 384, 381, 385, 380, 0, 386, 383, 383, 381, 386, 384, 387, 385, 388, 387, 386, 388, 384, 0, 385, 0, 387, 386, 388, 389, 390, 390, 391, 387, 392, 388, 396, 393, 0, 389, 398, 390, 391, 398, 392, 0, 389, 393, 390, 391, 394, 392, 395, 394, 393, 395, 397, 399, 394, 397, 0, 0, 397, 396, 399, 395, 396, 399, 400, 401, 402, 400, 401, 402, 403, 404, 405, 403, 404, 405, 406, 407, 0, 407, 407, 408, 408, 410, 406, 409, 411, 406, 0, 409, 0, 408, 0, 410, 412, 409, 411, 413, 408, 414, 410, 414, 409, 411, 412, 411, 0, 413, 415, 414, 413, 412, 416, 417, 413, 0, 414, 418, 415, 0, 0, 419, 416, 417, 0, 415, 420, 418, 0, 416, 417, 419, 422, 0, 418, 421, 420, 421, 419, 0, 429, 423, 422, 420, 423, 421, 429, 424, 0, 422, 424, 425, 421, 425, 425, 426, 427, 428, 426, 427, 428, 431, 427, 428, 431, 433, 0, 429, 434, 426, 429, 430, 432, 430, 430, 433, 435, 432, 434, 435, 432, 438, 433, 433, 436, 434, 435, 437, 436, 439, 437, 438, 440, 435, 436, 441, 442, 437, 438, 439, 440, 436, 441, 440, 437, 441, 439, 442, 443, 444, 442, 443, 444, 445, 444, 446, 445, 447, 448, 445, 447, 449, 450, 451, 446, 453, 455, 446, 448, 455, 0, 449, 450, 451, 452, 448, 0, 0, 449, 450, 451, 452, 454, 456, 452, 454, 457, 458, 0, 453, 454, 456, 453, 459, 456, 458, 459, 457, 458, 460, 457, 459, 460, 461, 462, 463, 461, 462, 464, 466, 465, 467, 462, 465, 467, 464, 465, 468, 464, 467, 468, 469, 470, 468, 469, 470, 472, 474, 471, 463, 474, 0, 463, 474, 470, 471, 466, 472, 471, 466, 472, 473, 475, 476, 473, 475, 476, 477, 478, 473, 475, 478, 479, 480, 481, 479, 480, 481, 477, 480, 479, 477, 482, 483, 484, 482, 483, 484, 0, 483, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 487, 487, 487, 487, 487, 487, 487, 487, 487, 487, 487, 488, 0, 488, 488, 488, 488, 488, 488, 488, 488, 488, 489, 489, 489, 489, 490, 0, 0, 490, 0, 490, 490, 490, 490, 490, 490, 491, 0, 0, 491, 491, 491, 491, 491, 491, 491, 491, 492, 0, 0, 0, 492, 492, 492, 492, 492, 492, 492, 493, 0, 493, 493, 493, 493, 493, 493, 493, 493, 493, 494, 0, 494, 494, 494, 494, 494, 494, 494, 494, 494, 495, 0, 0, 495, 495, 495, 495, 495, 495, 495, 495, 496, 496, 497, 497, 497, 498, 498, 498, 498, 499, 0, 499, 0, 499, 500, 500, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, 485 } ; static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; extern int rust__flex_debug; int rust__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 *rust_text; #line 1 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" #define YY_NO_INPUT 1 #line 16 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" #include #include "tokenizer.h" #line 1109 "rustlexer.cpp" #define INITIAL 0 #define comment 1 #define string_literal 2 #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 rust_lex_destroy (void ); int rust_get_debug (void ); void rust_set_debug (int debug_flag ); YY_EXTRA_TYPE rust_get_extra (void ); void rust_set_extra (YY_EXTRA_TYPE user_defined ); FILE *rust_get_in (void ); void rust_set_in (FILE * _in_str ); FILE *rust_get_out (void ); void rust_set_out (FILE * _out_str ); yy_size_t rust_get_leng (void ); char *rust_get_text (void ); int rust_get_lineno (void ); void rust_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 rust_wrap (void ); #else extern int rust_wrap (void ); #endif #endif #ifndef YY_NO_UNPUT #endif #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( rust_text, rust_leng, 1, rust_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( rust_in )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ if ( c == '\n' ) \ buf[n++] = (char) c; \ if ( c == EOF && ferror( rust_in ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ else \ { \ errno=0; \ while ( (result = fread(buf, 1, max_size, rust_in))==0 && ferror(rust_in)) \ { \ if( errno != EINTR) \ { \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ break; \ } \ errno=0; \ clearerr(rust_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 rust_lex (void); #define YY_DECL int rust_lex (void) #endif /* !YY_DECL */ /* Code executed at the beginning of each rule, after rust_text and rust_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 /*LINTED*/break; #endif #define YY_RULE_SETUP \ YY_USER_ACTION /** The main scanner function which does all the work. */ YY_DECL { yy_state_type yy_current_state; char *yy_cp, *yy_bp; int yy_act; if ( !(yy_init) ) { (yy_init) = 1; #ifdef YY_USER_INIT YY_USER_INIT; #endif if ( ! (yy_start) ) (yy_start) = 1; /* first start state */ if ( ! rust_in ) rust_in = stdin; if ( ! rust_out ) rust_out = stdout; if ( ! YY_CURRENT_BUFFER ) { rust_ensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = rust__create_buffer(rust_in,YY_BUF_SIZE ); } rust__load_buffer_state( ); } { #line 24 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" #line 1329 "rustlexer.cpp" while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ { yy_cp = (yy_c_buf_p); /* Support of rust_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 { 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 >= 486 ) 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] != 1977 ); 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 25 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 2: YY_RULE_SETUP #line 26 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 3: YY_RULE_SETUP #line 27 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 4: YY_RULE_SETUP #line 28 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 5: YY_RULE_SETUP #line 29 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 6: YY_RULE_SETUP #line 30 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 7: YY_RULE_SETUP #line 31 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 8: YY_RULE_SETUP #line 32 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 9: YY_RULE_SETUP #line 33 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 10: YY_RULE_SETUP #line 34 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 11: YY_RULE_SETUP #line 35 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 12: YY_RULE_SETUP #line 36 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 13: YY_RULE_SETUP #line 37 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 14: YY_RULE_SETUP #line 38 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 15: YY_RULE_SETUP #line 39 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 16: YY_RULE_SETUP #line 40 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 17: YY_RULE_SETUP #line 41 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 18: YY_RULE_SETUP #line 42 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 19: YY_RULE_SETUP #line 43 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 20: YY_RULE_SETUP #line 44 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 21: YY_RULE_SETUP #line 45 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 22: YY_RULE_SETUP #line 46 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 23: YY_RULE_SETUP #line 47 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 24: YY_RULE_SETUP #line 48 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 25: YY_RULE_SETUP #line 49 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 26: YY_RULE_SETUP #line 50 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 27: YY_RULE_SETUP #line 51 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 28: YY_RULE_SETUP #line 52 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 29: YY_RULE_SETUP #line 53 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 30: YY_RULE_SETUP #line 54 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 31: YY_RULE_SETUP #line 55 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 32: YY_RULE_SETUP #line 56 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 33: YY_RULE_SETUP #line 57 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 34: YY_RULE_SETUP #line 58 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 35: YY_RULE_SETUP #line 59 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 36: YY_RULE_SETUP #line 60 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 37: YY_RULE_SETUP #line 61 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 38: YY_RULE_SETUP #line 62 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 39: YY_RULE_SETUP #line 63 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 40: YY_RULE_SETUP #line 64 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 41: YY_RULE_SETUP #line 65 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 42: YY_RULE_SETUP #line 66 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 43: YY_RULE_SETUP #line 67 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 44: YY_RULE_SETUP #line 68 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 45: YY_RULE_SETUP #line 69 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 46: YY_RULE_SETUP #line 70 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 47: YY_RULE_SETUP #line 71 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 48: YY_RULE_SETUP #line 72 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 49: YY_RULE_SETUP #line 73 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 50: YY_RULE_SETUP #line 74 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_TYPE); } YY_BREAK case 51: YY_RULE_SETUP #line 76 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 52: YY_RULE_SETUP #line 77 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 53: YY_RULE_SETUP #line 78 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 54: YY_RULE_SETUP #line 79 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 55: YY_RULE_SETUP #line 80 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 56: YY_RULE_SETUP #line 81 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 57: YY_RULE_SETUP #line 82 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 58: YY_RULE_SETUP #line 83 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 59: YY_RULE_SETUP #line 84 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 60: YY_RULE_SETUP #line 85 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 61: YY_RULE_SETUP #line 86 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 62: YY_RULE_SETUP #line 87 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 63: YY_RULE_SETUP #line 88 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 64: YY_RULE_SETUP #line 89 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 65: YY_RULE_SETUP #line 90 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 66: YY_RULE_SETUP #line 91 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 67: YY_RULE_SETUP #line 92 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 68: YY_RULE_SETUP #line 93 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 69: YY_RULE_SETUP #line 94 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 70: YY_RULE_SETUP #line 95 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 71: YY_RULE_SETUP #line 96 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 72: YY_RULE_SETUP #line 97 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 73: YY_RULE_SETUP #line 98 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 74: YY_RULE_SETUP #line 99 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 75: YY_RULE_SETUP #line 100 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 76: YY_RULE_SETUP #line 101 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 77: YY_RULE_SETUP #line 102 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 78: YY_RULE_SETUP #line 103 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 79: YY_RULE_SETUP #line 104 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 80: YY_RULE_SETUP #line 105 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 81: YY_RULE_SETUP #line 106 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 82: YY_RULE_SETUP #line 107 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 83: YY_RULE_SETUP #line 108 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 84: YY_RULE_SETUP #line 109 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 85: YY_RULE_SETUP #line 110 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 86: YY_RULE_SETUP #line 111 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 87: YY_RULE_SETUP #line 112 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 88: YY_RULE_SETUP #line 113 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 89: YY_RULE_SETUP #line 114 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 90: YY_RULE_SETUP #line 115 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 91: YY_RULE_SETUP #line 116 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 92: YY_RULE_SETUP #line 117 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 93: YY_RULE_SETUP #line 118 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 94: YY_RULE_SETUP #line 119 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 95: YY_RULE_SETUP #line 120 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 96: YY_RULE_SETUP #line 121 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 97: YY_RULE_SETUP #line 122 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 98: YY_RULE_SETUP #line 123 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 99: YY_RULE_SETUP #line 124 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_KEYWORD); } YY_BREAK case 100: YY_RULE_SETUP #line 126 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { BEGIN(comment); return(TOKENIZER_COMMENT); } YY_BREAK case 101: YY_RULE_SETUP #line 127 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_COMMENT); } YY_BREAK case 102: YY_RULE_SETUP #line 128 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_COMMENT); } YY_BREAK case 103: /* rule 103 can match eol */ YY_RULE_SETUP #line 129 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_NEWLINE); } YY_BREAK case 104: YY_RULE_SETUP #line 130 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_NEWLINE); } YY_BREAK case 105: /* rule 105 can match eol */ YY_RULE_SETUP #line 131 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_NEWLINE); } YY_BREAK case 106: YY_RULE_SETUP #line 132 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { BEGIN(INITIAL); return(TOKENIZER_COMMENT); } YY_BREAK case 107: YY_RULE_SETUP #line 134 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_COMMENT); } YY_BREAK case 108: YY_RULE_SETUP #line 136 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_DIRECTIVE); } YY_BREAK case 109: YY_RULE_SETUP #line 137 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_DIRECTIVE); } YY_BREAK case 110: YY_RULE_SETUP #line 138 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_DIRECTIVE); } YY_BREAK case 111: YY_RULE_SETUP #line 139 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_DIRECTIVE); } YY_BREAK case 112: YY_RULE_SETUP #line 141 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { BEGIN(string_literal); return(TOKENIZER_LITERAL); } YY_BREAK case 113: YY_RULE_SETUP #line 142 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 114: /* rule 114 can match eol */ YY_RULE_SETUP #line 143 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_NEWLINE); } YY_BREAK case 115: YY_RULE_SETUP #line 144 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_NEWLINE); } YY_BREAK case 116: /* rule 116 can match eol */ YY_RULE_SETUP #line 145 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_NEWLINE); } YY_BREAK case 117: YY_RULE_SETUP #line 146 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { BEGIN(INITIAL); return(TOKENIZER_LITERAL); } YY_BREAK case 118: YY_RULE_SETUP #line 148 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 119: YY_RULE_SETUP #line 149 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 120: YY_RULE_SETUP #line 150 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 121: YY_RULE_SETUP #line 151 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 122: YY_RULE_SETUP #line 153 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 123: YY_RULE_SETUP #line 154 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_LITERAL); } YY_BREAK case 124: /* rule 124 can match eol */ YY_RULE_SETUP #line 156 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_NEWLINE); } YY_BREAK case 125: /* rule 125 can match eol */ YY_RULE_SETUP #line 157 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_NEWLINE); } YY_BREAK case 126: YY_RULE_SETUP #line 158 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_NEWLINE); } YY_BREAK case 127: YY_RULE_SETUP #line 159 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_TEXT); } YY_BREAK case 128: YY_RULE_SETUP #line 160 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_TEXT); } YY_BREAK case 129: YY_RULE_SETUP #line 161 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" { return(TOKENIZER_TEXT); } YY_BREAK case 130: YY_RULE_SETUP #line 163 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" ECHO; YY_BREAK #line 2042 "rustlexer.cpp" 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_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 rust_in at a new source and called * rust_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 = rust_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 ( rust_wrap( ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up * rust_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 user's declarations */ } /* end of rust_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) { char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; char *source = (yytext_ptr); yy_size_t 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 = (yy_size_t) ((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_LVALUE; 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. */ rust_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; rust_restart(rust_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 ((int) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) rust_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) { yy_state_type yy_current_state; char *yy_cp; yy_current_state = (yy_start); for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) { 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 >= 486 ) 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 ) { int yy_is_jam; char *yy_cp = (yy_c_buf_p); 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 >= 486 ) 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 == 485); return yy_is_jam ? 0 : yy_current_state; } #ifndef YY_NO_UNPUT #endif #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. */ rust_restart(rust_in ); /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { if ( rust_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 rust_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 rust_restart (FILE * input_file ) { if ( ! YY_CURRENT_BUFFER ){ rust_ensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = rust__create_buffer(rust_in,YY_BUF_SIZE ); } rust__init_buffer(YY_CURRENT_BUFFER,input_file ); rust__load_buffer_state( ); } /** Switch to a different input buffer. * @param new_buffer The new input buffer. * */ void rust__switch_to_buffer (YY_BUFFER_STATE new_buffer ) { /* TODO. We should be able to replace this entire function body * with * rust_pop_buffer_state(); * rust_push_buffer_state(new_buffer); */ rust_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; rust__load_buffer_state( ); /* We don't actually know whether we did this switch during * EOF (rust_wrap()) processing, but the only time this flag * is looked at is after rust_wrap() is called, so it's safe * to go ahead and always set it. */ (yy_did_buffer_switch_on_eof) = 1; } static void rust__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; rust_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 rust__create_buffer (FILE * file, int size ) { YY_BUFFER_STATE b; b = (YY_BUFFER_STATE) rust_alloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in rust__create_buffer()" ); b->yy_buf_size = (yy_size_t)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 *) rust_alloc(b->yy_buf_size + 2 ); if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in rust__create_buffer()" ); b->yy_is_our_buffer = 1; rust__init_buffer(b,file ); return b; } /** Destroy the buffer. * @param b a buffer created with rust__create_buffer() * */ void rust__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 ) rust_free((void *) b->yy_ch_buf ); rust_free((void *) b ); } /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, * such as during a rust_restart() or at EOF. */ static void rust__init_buffer (YY_BUFFER_STATE b, FILE * file ) { int oerrno = errno; rust__flush_buffer(b ); b->yy_input_file = file; b->yy_fill_buffer = 1; /* If b is the current buffer, then rust__init_buffer was _probably_ * called from rust_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 rust__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 ) rust__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 rust_push_buffer_state (YY_BUFFER_STATE new_buffer ) { if (new_buffer == NULL) return; rust_ensure_buffer_stack(); /* This block is copied from rust__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 rust__switch_to_buffer. */ rust__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 rust_pop_buffer_state (void) { if (!YY_CURRENT_BUFFER) return; rust__delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; if ((yy_buffer_stack_top) > 0) --(yy_buffer_stack_top); if (YY_CURRENT_BUFFER) { rust__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 rust_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; /* After all that talk, this was set to 1 anyways... */ (yy_buffer_stack) = (struct yy_buffer_state**)rust_alloc (num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in rust_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. */ yy_size_t grow_size = 8 /* arbitrary grow size */; num_to_alloc = (yy_buffer_stack_max) + grow_size; (yy_buffer_stack) = (struct yy_buffer_state**)rust_realloc ((yy_buffer_stack), num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in rust_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 rust__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) rust_alloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in rust__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; rust__switch_to_buffer(b ); return b; } /** Setup the input buffer state to scan a string. The next call to rust_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 * rust__scan_bytes() instead. */ YY_BUFFER_STATE rust__scan_string (yyconst char * yystr ) { return rust__scan_bytes(yystr,strlen(yystr) ); } /** Setup the input buffer state to scan the given bytes. The next call to rust_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 rust__scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len ) { YY_BUFFER_STATE b; char *buf; yy_size_t n; yy_size_t i; /* Get memory for full buffer, including space for trailing EOB's. */ n = _yybytes_len + 2; buf = (char *) rust_alloc(n ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in rust__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 = rust__scan_buffer(buf,n ); if ( ! b ) YY_FATAL_ERROR( "bad buffer in rust__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 rust_text. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ rust_text[rust_leng] = (yy_hold_char); \ (yy_c_buf_p) = rust_text + yyless_macro_arg; \ (yy_hold_char) = *(yy_c_buf_p); \ *(yy_c_buf_p) = '\0'; \ rust_leng = yyless_macro_arg; \ } \ while ( 0 ) /* Accessor methods (get/set functions) to struct members. */ /** Get the current line number. * */ int rust_get_lineno (void) { return rust_lineno; } /** Get the input stream. * */ FILE *rust_get_in (void) { return rust_in; } /** Get the output stream. * */ FILE *rust_get_out (void) { return rust_out; } /** Get the length of the current token. * */ yy_size_t rust_get_leng (void) { return rust_leng; } /** Get the current token. * */ char *rust_get_text (void) { return rust_text; } /** Set the current line number. * @param _line_number line number * */ void rust_set_lineno (int _line_number ) { rust_lineno = _line_number; } /** Set the input stream. This does not discard the current * input buffer. * @param _in_str A readable stream. * * @see rust__switch_to_buffer */ void rust_set_in (FILE * _in_str ) { rust_in = _in_str ; } void rust_set_out (FILE * _out_str ) { rust_out = _out_str ; } int rust_get_debug (void) { return rust__flex_debug; } void rust_set_debug (int _bdebug ) { rust__flex_debug = _bdebug ; } static int yy_init_globals (void) { /* Initialization is the same as for the non-reentrant scanner. * This function is called from rust_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 rust_in = stdin; rust_out = stdout; #else rust_in = (FILE *) 0; rust_out = (FILE *) 0; #endif /* For future reference: Set errno on error, since we are called by * rust_lex_init() */ return 0; } /* rust_lex_destroy is for both reentrant and non-reentrant scanners. */ int rust_lex_destroy (void) { /* Pop the buffer stack, destroying each element. */ while(YY_CURRENT_BUFFER){ rust__delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; rust_pop_buffer_state(); } /* Destroy the stack itself. */ rust_free((yy_buffer_stack) ); (yy_buffer_stack) = NULL; /* Reset the globals. This is important in a non-reentrant scanner so the next time * rust_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 ) { 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 ) { int n; for ( n = 0; s[n]; ++n ) ; return n; } #endif void *rust_alloc (yy_size_t size ) { return (void *) malloc( size ); } void *rust_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 rust_free (void * ptr ) { free( (char *) ptr ); /* see rust_realloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" #line 163 "/home/bob/rcs/git/cgdb/master/cgdb/lib/tokenizer/rustlexer.lpp" cgdb-0.8.0/lib/vterm/0000775000175000017500000000000014171036467011335 500000000000000cgdb-0.8.0/lib/vterm/rect.h0000644000175000017500000000374614160506715012367 00000000000000/* * Some utility functions on VTermRect structures */ #define STRFrect "(%d,%d-%d,%d)" #define ARGSrect(r) (r).start_row, (r).start_col, (r).end_row, (r).end_col /* Expand dst to contain src as well */ static void rect_expand(VTermRect *dst, VTermRect *src) { if(dst->start_row > src->start_row) dst->start_row = src->start_row; if(dst->start_col > src->start_col) dst->start_col = src->start_col; if(dst->end_row < src->end_row) dst->end_row = src->end_row; if(dst->end_col < src->end_col) dst->end_col = src->end_col; } /* Clip the dst to ensure it does not step outside of bounds */ static void rect_clip(VTermRect *dst, VTermRect *bounds) { if(dst->start_row < bounds->start_row) dst->start_row = bounds->start_row; if(dst->start_col < bounds->start_col) dst->start_col = bounds->start_col; if(dst->end_row > bounds->end_row) dst->end_row = bounds->end_row; if(dst->end_col > bounds->end_col) dst->end_col = bounds->end_col; /* Ensure it doesn't end up negatively-sized */ if(dst->end_row < dst->start_row) dst->end_row = dst->start_row; if(dst->end_col < dst->start_col) dst->end_col = dst->start_col; } /* True if the two rectangles are equal */ static int rect_equal(VTermRect *a, VTermRect *b) { return (a->start_row == b->start_row) && (a->start_col == b->start_col) && (a->end_row == b->end_row) && (a->end_col == b->end_col); } /* True if small is contained entirely within big */ static int rect_contains(VTermRect *big, VTermRect *small) { if(small->start_row < big->start_row) return 0; if(small->start_col < big->start_col) return 0; if(small->end_row > big->end_row) return 0; if(small->end_col > big->end_col) return 0; return 1; } /* True if the rectangles overlap at all */ static int rect_intersects(VTermRect *a, VTermRect *b) { if(a->start_row > b->end_row || b->start_row > a->end_row) return 0; if(a->start_col > b->end_col || b->start_col > a->end_col) return 0; return 1; } cgdb-0.8.0/lib/vterm/state.c0000644000175000017500000016410514160506403012534 00000000000000#include "vterm_internal.h" #include #include #define strneq(a,b,n) (strncmp(a,b,n)==0) #if defined(DEBUG) && DEBUG > 1 # define DEBUG_GLYPH_COMBINE #endif /* Some convenient wrappers to make callback functions easier */ static void putglyph(VTermState *state, const uint32_t chars[], int width, VTermPos pos) { VTermGlyphInfo info = { .chars = chars, .width = width, .protected_cell = state->protected_cell, .dwl = state->lineinfo[pos.row].doublewidth, .dhl = state->lineinfo[pos.row].doubleheight, }; if(state->callbacks && state->callbacks->putglyph) if((*state->callbacks->putglyph)(&info, pos, state->cbdata)) return; DEBUG_LOG("libvterm: Unhandled putglyph U+%04x at (%d,%d)\n", chars[0], pos.col, pos.row); } static void updatecursor(VTermState *state, VTermPos *oldpos, int cancel_phantom) { if(state->pos.col == oldpos->col && state->pos.row == oldpos->row) return; if(cancel_phantom) state->at_phantom = 0; if(state->callbacks && state->callbacks->movecursor) if((*state->callbacks->movecursor)(state->pos, *oldpos, state->mode.cursor_visible, state->cbdata)) return; } static void erase(VTermState *state, VTermRect rect, int selective) { if(rect.end_col == state->cols) { /* If we're erasing the final cells of any lines, cancel the continuation * marker on the subsequent line */ for(int row = rect.start_row + 1; row < rect.end_row + 1 && row < state->rows; row++) state->lineinfo[row].continuation = 0; } if(state->callbacks && state->callbacks->erase) if((*state->callbacks->erase)(rect, selective, state->cbdata)) return; } static VTermState *vterm_state_new(VTerm *vt) { VTermState *state = vterm_allocator_malloc(vt, sizeof(VTermState)); state->vt = vt; state->rows = vt->rows; state->cols = vt->cols; state->mouse_col = 0; state->mouse_row = 0; state->mouse_buttons = 0; state->mouse_protocol = MOUSE_X10; state->callbacks = NULL; state->cbdata = NULL; state->selection.callbacks = NULL; state->selection.user = NULL; state->selection.buffer = NULL; vterm_state_newpen(state); state->bold_is_highbright = 0; state->combine_chars_size = 16; state->combine_chars = vterm_allocator_malloc(state->vt, state->combine_chars_size * sizeof(state->combine_chars[0])); state->tabstops = vterm_allocator_malloc(state->vt, (state->cols + 7) / 8); state->lineinfos[BUFIDX_PRIMARY] = vterm_allocator_malloc(state->vt, state->rows * sizeof(VTermLineInfo)); /* TODO: Make an 'enable' function */ state->lineinfos[BUFIDX_ALTSCREEN] = vterm_allocator_malloc(state->vt, state->rows * sizeof(VTermLineInfo)); state->lineinfo = state->lineinfos[BUFIDX_PRIMARY]; state->encoding_utf8.enc = vterm_lookup_encoding(ENC_UTF8, 'u'); if(*state->encoding_utf8.enc->init) (*state->encoding_utf8.enc->init)(state->encoding_utf8.enc, state->encoding_utf8.data); return state; } INTERNAL void vterm_state_free(VTermState *state) { vterm_allocator_free(state->vt, state->tabstops); vterm_allocator_free(state->vt, state->lineinfos[BUFIDX_PRIMARY]); if(state->lineinfos[BUFIDX_ALTSCREEN]) vterm_allocator_free(state->vt, state->lineinfos[BUFIDX_ALTSCREEN]); vterm_allocator_free(state->vt, state->combine_chars); vterm_allocator_free(state->vt, state); } static void scroll(VTermState *state, VTermRect rect, int downward, int rightward) { if(!downward && !rightward) return; int rows = rect.end_row - rect.start_row; if(downward > rows) downward = rows; else if(downward < -rows) downward = -rows; int cols = rect.end_col - rect.start_col; if(rightward > cols) rightward = cols; else if(rightward < -cols) rightward = -cols; // Update lineinfo if full line if(rect.start_col == 0 && rect.end_col == state->cols && rightward == 0) { int height = rect.end_row - rect.start_row - abs(downward); if(downward > 0) { memmove(state->lineinfo + rect.start_row, state->lineinfo + rect.start_row + downward, height * sizeof(state->lineinfo[0])); for(int row = rect.end_row - downward; row < rect.end_row; row++) state->lineinfo[row] = (VTermLineInfo){ 0 }; } else { memmove(state->lineinfo + rect.start_row - downward, state->lineinfo + rect.start_row, height * sizeof(state->lineinfo[0])); for(int row = rect.start_row; row < rect.start_row - downward; row++) state->lineinfo[row] = (VTermLineInfo){ 0 }; } } if(state->callbacks && state->callbacks->scrollrect) if((*state->callbacks->scrollrect)(rect, downward, rightward, state->cbdata)) return; if(state->callbacks) vterm_scroll_rect(rect, downward, rightward, state->callbacks->moverect, state->callbacks->erase, state->cbdata); } static void linefeed(VTermState *state) { if(state->pos.row == SCROLLREGION_BOTTOM(state) - 1) { VTermRect rect = { .start_row = state->scrollregion_top, .end_row = SCROLLREGION_BOTTOM(state), .start_col = SCROLLREGION_LEFT(state), .end_col = SCROLLREGION_RIGHT(state), }; scroll(state, rect, 1, 0); } else if(state->pos.row < state->rows-1) state->pos.row++; } static void grow_combine_buffer(VTermState *state) { size_t new_size = state->combine_chars_size * 2; uint32_t *new_chars = vterm_allocator_malloc(state->vt, new_size * sizeof(new_chars[0])); memcpy(new_chars, state->combine_chars, state->combine_chars_size * sizeof(new_chars[0])); vterm_allocator_free(state->vt, state->combine_chars); state->combine_chars = new_chars; state->combine_chars_size = new_size; } static void set_col_tabstop(VTermState *state, int col) { unsigned char mask = 1 << (col & 7); state->tabstops[col >> 3] |= mask; } static void clear_col_tabstop(VTermState *state, int col) { unsigned char mask = 1 << (col & 7); state->tabstops[col >> 3] &= ~mask; } static int is_col_tabstop(VTermState *state, int col) { unsigned char mask = 1 << (col & 7); return state->tabstops[col >> 3] & mask; } static int is_cursor_in_scrollregion(const VTermState *state) { if(state->pos.row < state->scrollregion_top || state->pos.row >= SCROLLREGION_BOTTOM(state)) return 0; if(state->pos.col < SCROLLREGION_LEFT(state) || state->pos.col >= SCROLLREGION_RIGHT(state)) return 0; return 1; } static void tab(VTermState *state, int count, int direction) { while(count > 0) { if(direction > 0) { if(state->pos.col >= THISROWWIDTH(state)-1) return; state->pos.col++; } else if(direction < 0) { if(state->pos.col < 1) return; state->pos.col--; } if(is_col_tabstop(state, state->pos.col)) count--; } } #define NO_FORCE 0 #define FORCE 1 #define DWL_OFF 0 #define DWL_ON 1 #define DHL_OFF 0 #define DHL_TOP 1 #define DHL_BOTTOM 2 static void set_lineinfo(VTermState *state, int row, int force, int dwl, int dhl) { VTermLineInfo info = state->lineinfo[row]; if(dwl == DWL_OFF) info.doublewidth = DWL_OFF; else if(dwl == DWL_ON) info.doublewidth = DWL_ON; // else -1 to ignore if(dhl == DHL_OFF) info.doubleheight = DHL_OFF; else if(dhl == DHL_TOP) info.doubleheight = DHL_TOP; else if(dhl == DHL_BOTTOM) info.doubleheight = DHL_BOTTOM; if((state->callbacks && state->callbacks->setlineinfo && (*state->callbacks->setlineinfo)(row, &info, state->lineinfo + row, state->cbdata)) || force) state->lineinfo[row] = info; } static int on_text(const char bytes[], size_t len, void *user) { VTermState *state = user; VTermPos oldpos = state->pos; // We'll have at most len codepoints uint32_t codepoints[len]; int npoints = 0; size_t eaten = 0; VTermEncodingInstance *encoding = state->gsingle_set ? &state->encoding[state->gsingle_set] : !(bytes[eaten] & 0x80) ? &state->encoding[state->gl_set] : state->vt->mode.utf8 ? &state->encoding_utf8 : &state->encoding[state->gr_set]; (*encoding->enc->decode)(encoding->enc, encoding->data, codepoints, &npoints, state->gsingle_set ? 1 : len, bytes, &eaten, len); /* There's a chance an encoding (e.g. UTF-8) hasn't found enough bytes yet * for even a single codepoint */ if(!npoints) return eaten; if(state->gsingle_set && npoints) state->gsingle_set = 0; int i = 0; /* This is a combining char. that needs to be merged with the previous * glyph output */ if(vterm_unicode_is_combining(codepoints[i])) { /* See if the cursor has moved since */ if(state->pos.row == state->combine_pos.row && state->pos.col == state->combine_pos.col + state->combine_width) { #ifdef DEBUG_GLYPH_COMBINE int printpos; printf("DEBUG: COMBINING SPLIT GLYPH of chars {"); for(printpos = 0; state->combine_chars[printpos]; printpos++) printf("U+%04x ", state->combine_chars[printpos]); printf("} + {"); #endif /* Find where we need to append these combining chars */ int saved_i = 0; while(state->combine_chars[saved_i]) saved_i++; /* Add extra ones */ while(i < npoints && vterm_unicode_is_combining(codepoints[i])) { if(saved_i >= state->combine_chars_size) grow_combine_buffer(state); state->combine_chars[saved_i++] = codepoints[i++]; } if(saved_i >= state->combine_chars_size) grow_combine_buffer(state); state->combine_chars[saved_i] = 0; #ifdef DEBUG_GLYPH_COMBINE for(; state->combine_chars[printpos]; printpos++) printf("U+%04x ", state->combine_chars[printpos]); printf("}\n"); #endif /* Now render it */ putglyph(state, state->combine_chars, state->combine_width, state->combine_pos); } else { DEBUG_LOG("libvterm: TODO: Skip over split char+combining\n"); } } for(; i < npoints; i++) { // Try to find combining characters following this int glyph_starts = i; int glyph_ends; for(glyph_ends = i + 1; glyph_ends < npoints; glyph_ends++) if(!vterm_unicode_is_combining(codepoints[glyph_ends])) break; int width = 0; uint32_t chars[glyph_ends - glyph_starts + 1]; for( ; i < glyph_ends; i++) { chars[i - glyph_starts] = codepoints[i]; int this_width = vterm_unicode_width(codepoints[i]); #ifdef DEBUG if(this_width < 0) { fprintf(stderr, "Text with negative-width codepoint U+%04x\n", codepoints[i]); abort(); } #endif width += this_width; } chars[glyph_ends - glyph_starts] = 0; i--; #ifdef DEBUG_GLYPH_COMBINE int printpos; printf("DEBUG: COMBINED GLYPH of %d chars {", glyph_ends - glyph_starts); for(printpos = 0; printpos < glyph_ends - glyph_starts; printpos++) printf("U+%04x ", chars[printpos]); printf("}, onscreen width %d\n", width); #endif if(state->at_phantom || state->pos.col + width > THISROWWIDTH(state)) { linefeed(state); state->pos.col = 0; state->at_phantom = 0; state->lineinfo[state->pos.row].continuation = 1; } if(state->mode.insert) { /* TODO: This will be a little inefficient for large bodies of text, as * it'll have to 'ICH' effectively before every glyph. We should scan * ahead and ICH as many times as required */ VTermRect rect = { .start_row = state->pos.row, .end_row = state->pos.row + 1, .start_col = state->pos.col, .end_col = THISROWWIDTH(state), }; scroll(state, rect, 0, -1); } putglyph(state, chars, width, state->pos); if(i == npoints - 1) { /* End of the buffer. Save the chars in case we have to combine with * more on the next call */ int save_i; for(save_i = 0; chars[save_i]; save_i++) { if(save_i >= state->combine_chars_size) grow_combine_buffer(state); state->combine_chars[save_i] = chars[save_i]; } if(save_i >= state->combine_chars_size) grow_combine_buffer(state); state->combine_chars[save_i] = 0; state->combine_width = width; state->combine_pos = state->pos; } if(state->pos.col + width >= THISROWWIDTH(state)) { if(state->mode.autowrap) state->at_phantom = 1; } else { state->pos.col += width; } } updatecursor(state, &oldpos, 0); #ifdef DEBUG if(state->pos.row < 0 || state->pos.row >= state->rows || state->pos.col < 0 || state->pos.col >= state->cols) { fprintf(stderr, "Position out of bounds after text: (%d,%d)\n", state->pos.row, state->pos.col); abort(); } #endif return eaten; } static int on_control(unsigned char control, void *user) { VTermState *state = user; VTermPos oldpos = state->pos; switch(control) { case 0x07: // BEL - ECMA-48 8.3.3 if(state->callbacks && state->callbacks->bell) (*state->callbacks->bell)(state->cbdata); break; case 0x08: // BS - ECMA-48 8.3.5 if(state->pos.col > 0) state->pos.col--; break; case 0x09: // HT - ECMA-48 8.3.60 tab(state, 1, +1); break; case 0x0a: // LF - ECMA-48 8.3.74 case 0x0b: // VT case 0x0c: // FF linefeed(state); if(state->mode.newline) state->pos.col = 0; break; case 0x0d: // CR - ECMA-48 8.3.15 state->pos.col = 0; break; case 0x0e: // LS1 - ECMA-48 8.3.76 state->gl_set = 1; break; case 0x0f: // LS0 - ECMA-48 8.3.75 state->gl_set = 0; break; case 0x84: // IND - DEPRECATED but implemented for completeness linefeed(state); break; case 0x85: // NEL - ECMA-48 8.3.86 linefeed(state); state->pos.col = 0; break; case 0x88: // HTS - ECMA-48 8.3.62 set_col_tabstop(state, state->pos.col); break; case 0x8d: // RI - ECMA-48 8.3.104 if(state->pos.row == state->scrollregion_top) { VTermRect rect = { .start_row = state->scrollregion_top, .end_row = SCROLLREGION_BOTTOM(state), .start_col = SCROLLREGION_LEFT(state), .end_col = SCROLLREGION_RIGHT(state), }; scroll(state, rect, -1, 0); } else if(state->pos.row > 0) state->pos.row--; break; case 0x8e: // SS2 - ECMA-48 8.3.141 state->gsingle_set = 2; break; case 0x8f: // SS3 - ECMA-48 8.3.142 state->gsingle_set = 3; break; default: if(state->fallbacks && state->fallbacks->control) if((*state->fallbacks->control)(control, state->fbdata)) return 1; return 0; } updatecursor(state, &oldpos, 1); #ifdef DEBUG if(state->pos.row < 0 || state->pos.row >= state->rows || state->pos.col < 0 || state->pos.col >= state->cols) { fprintf(stderr, "Position out of bounds after Ctrl %02x: (%d,%d)\n", control, state->pos.row, state->pos.col); abort(); } #endif return 1; } static int settermprop_bool(VTermState *state, VTermProp prop, int v) { VTermValue val = { .boolean = v }; return vterm_state_set_termprop(state, prop, &val); } static int settermprop_int(VTermState *state, VTermProp prop, int v) { VTermValue val = { .number = v }; return vterm_state_set_termprop(state, prop, &val); } static int settermprop_string(VTermState *state, VTermProp prop, VTermStringFragment frag) { VTermValue val = { .string = frag }; return vterm_state_set_termprop(state, prop, &val); } static void savecursor(VTermState *state, int save) { if(save) { state->saved.pos = state->pos; state->saved.mode.cursor_visible = state->mode.cursor_visible; state->saved.mode.cursor_blink = state->mode.cursor_blink; state->saved.mode.cursor_shape = state->mode.cursor_shape; vterm_state_savepen(state, 1); } else { VTermPos oldpos = state->pos; state->pos = state->saved.pos; settermprop_bool(state, VTERM_PROP_CURSORVISIBLE, state->saved.mode.cursor_visible); settermprop_bool(state, VTERM_PROP_CURSORBLINK, state->saved.mode.cursor_blink); settermprop_int (state, VTERM_PROP_CURSORSHAPE, state->saved.mode.cursor_shape); vterm_state_savepen(state, 0); updatecursor(state, &oldpos, 1); } } static int on_escape(const char *bytes, size_t len, void *user) { VTermState *state = user; /* Easier to decode this from the first byte, even though the final * byte terminates it */ switch(bytes[0]) { case ' ': if(len != 2) return 0; switch(bytes[1]) { case 'F': // S7C1T state->vt->mode.ctrl8bit = 0; break; case 'G': // S8C1T state->vt->mode.ctrl8bit = 1; break; default: return 0; } return 2; case '#': if(len != 2) return 0; switch(bytes[1]) { case '3': // DECDHL top if(state->mode.leftrightmargin) break; set_lineinfo(state, state->pos.row, NO_FORCE, DWL_ON, DHL_TOP); break; case '4': // DECDHL bottom if(state->mode.leftrightmargin) break; set_lineinfo(state, state->pos.row, NO_FORCE, DWL_ON, DHL_BOTTOM); break; case '5': // DECSWL if(state->mode.leftrightmargin) break; set_lineinfo(state, state->pos.row, NO_FORCE, DWL_OFF, DHL_OFF); break; case '6': // DECDWL if(state->mode.leftrightmargin) break; set_lineinfo(state, state->pos.row, NO_FORCE, DWL_ON, DHL_OFF); break; case '8': // DECALN { VTermPos pos; uint32_t E[] = { 'E', 0 }; for(pos.row = 0; pos.row < state->rows; pos.row++) for(pos.col = 0; pos.col < ROWWIDTH(state, pos.row); pos.col++) putglyph(state, E, 1, pos); break; } default: return 0; } return 2; case '(': case ')': case '*': case '+': // SCS if(len != 2) return 0; { int setnum = bytes[0] - 0x28; VTermEncoding *newenc = vterm_lookup_encoding(ENC_SINGLE_94, bytes[1]); if(newenc) { state->encoding[setnum].enc = newenc; if(newenc->init) (*newenc->init)(newenc, state->encoding[setnum].data); } } return 2; case '7': // DECSC savecursor(state, 1); return 1; case '8': // DECRC savecursor(state, 0); return 1; case '<': // Ignored by VT100. Used in VT52 mode to switch up to VT100 return 1; case '=': // DECKPAM state->mode.keypad = 1; return 1; case '>': // DECKPNM state->mode.keypad = 0; return 1; case 'c': // RIS - ECMA-48 8.3.105 { VTermPos oldpos = state->pos; vterm_state_reset(state, 1); if(state->callbacks && state->callbacks->movecursor) (*state->callbacks->movecursor)(state->pos, oldpos, state->mode.cursor_visible, state->cbdata); return 1; } case 'n': // LS2 - ECMA-48 8.3.78 state->gl_set = 2; return 1; case 'o': // LS3 - ECMA-48 8.3.80 state->gl_set = 3; return 1; case '~': // LS1R - ECMA-48 8.3.77 state->gr_set = 1; return 1; case '}': // LS2R - ECMA-48 8.3.79 state->gr_set = 2; return 1; case '|': // LS3R - ECMA-48 8.3.81 state->gr_set = 3; return 1; default: return 0; } } static void set_mode(VTermState *state, int num, int val) { switch(num) { case 4: // IRM - ECMA-48 7.2.10 state->mode.insert = val; break; case 20: // LNM - ANSI X3.4-1977 state->mode.newline = val; break; default: DEBUG_LOG("libvterm: Unknown mode %d\n", num); return; } } static void set_dec_mode(VTermState *state, int num, int val) { switch(num) { case 1: state->mode.cursor = val; break; case 5: // DECSCNM - screen mode settermprop_bool(state, VTERM_PROP_REVERSE, val); break; case 6: // DECOM - origin mode { VTermPos oldpos = state->pos; state->mode.origin = val; state->pos.row = state->mode.origin ? state->scrollregion_top : 0; state->pos.col = state->mode.origin ? SCROLLREGION_LEFT(state) : 0; updatecursor(state, &oldpos, 1); } break; case 7: state->mode.autowrap = val; break; case 12: settermprop_bool(state, VTERM_PROP_CURSORBLINK, val); break; case 25: settermprop_bool(state, VTERM_PROP_CURSORVISIBLE, val); break; case 69: // DECVSSM - vertical split screen mode // DECLRMM - left/right margin mode state->mode.leftrightmargin = val; if(val) { // Setting DECVSSM must clear doublewidth/doubleheight state of every line for(int row = 0; row < state->rows; row++) set_lineinfo(state, row, FORCE, DWL_OFF, DHL_OFF); } break; case 1000: case 1002: case 1003: settermprop_int(state, VTERM_PROP_MOUSE, !val ? VTERM_PROP_MOUSE_NONE : (num == 1000) ? VTERM_PROP_MOUSE_CLICK : (num == 1002) ? VTERM_PROP_MOUSE_DRAG : VTERM_PROP_MOUSE_MOVE); break; case 1004: state->mode.report_focus = val; break; case 1005: state->mouse_protocol = val ? MOUSE_UTF8 : MOUSE_X10; break; case 1006: state->mouse_protocol = val ? MOUSE_SGR : MOUSE_X10; break; case 1015: state->mouse_protocol = val ? MOUSE_RXVT : MOUSE_X10; break; case 1047: settermprop_bool(state, VTERM_PROP_ALTSCREEN, val); break; case 1048: savecursor(state, val); break; case 1049: settermprop_bool(state, VTERM_PROP_ALTSCREEN, val); savecursor(state, val); break; case 2004: state->mode.bracketpaste = val; break; default: DEBUG_LOG("libvterm: Unknown DEC mode %d\n", num); return; } } static void request_dec_mode(VTermState *state, int num) { int reply; switch(num) { case 1: reply = state->mode.cursor; break; case 5: reply = state->mode.screen; break; case 6: reply = state->mode.origin; break; case 7: reply = state->mode.autowrap; break; case 12: reply = state->mode.cursor_blink; break; case 25: reply = state->mode.cursor_visible; break; case 69: reply = state->mode.leftrightmargin; break; case 1000: reply = state->mouse_flags == MOUSE_WANT_CLICK; break; case 1002: reply = state->mouse_flags == (MOUSE_WANT_CLICK|MOUSE_WANT_DRAG); break; case 1003: reply = state->mouse_flags == (MOUSE_WANT_CLICK|MOUSE_WANT_MOVE); break; case 1004: reply = state->mode.report_focus; break; case 1005: reply = state->mouse_protocol == MOUSE_UTF8; break; case 1006: reply = state->mouse_protocol == MOUSE_SGR; break; case 1015: reply = state->mouse_protocol == MOUSE_RXVT; break; case 1047: reply = state->mode.alt_screen; break; case 2004: reply = state->mode.bracketpaste; break; default: vterm_push_output_sprintf_ctrl(state->vt, C1_CSI, "?%d;%d$y", num, 0); return; } vterm_push_output_sprintf_ctrl(state->vt, C1_CSI, "?%d;%d$y", num, reply ? 1 : 2); } static int on_csi(const char *leader, const long args[], int argcount, const char *intermed, char command, void *user) { VTermState *state = user; int leader_byte = 0; int intermed_byte = 0; int cancel_phantom = 1; if(leader && leader[0]) { if(leader[1]) // longer than 1 char return 0; switch(leader[0]) { case '?': case '>': leader_byte = leader[0]; break; default: return 0; } } if(intermed && intermed[0]) { if(intermed[1]) // longer than 1 char return 0; switch(intermed[0]) { case ' ': case '"': case '$': case '\'': intermed_byte = intermed[0]; break; default: return 0; } } VTermPos oldpos = state->pos; // Some temporaries for later code int count, val; int row, col; VTermRect rect; int selective; #define LBOUND(v,min) if((v) < (min)) (v) = (min) #define UBOUND(v,max) if((v) > (max)) (v) = (max) #define LEADER(l,b) ((l << 8) | b) #define INTERMED(i,b) ((i << 16) | b) switch(intermed_byte << 16 | leader_byte << 8 | command) { case 0x40: // ICH - ECMA-48 8.3.64 count = CSI_ARG_COUNT(args[0]); if(!is_cursor_in_scrollregion(state)) break; rect.start_row = state->pos.row; rect.end_row = state->pos.row + 1; rect.start_col = state->pos.col; if(state->mode.leftrightmargin) rect.end_col = SCROLLREGION_RIGHT(state); else rect.end_col = THISROWWIDTH(state); scroll(state, rect, 0, -count); break; case 0x41: // CUU - ECMA-48 8.3.22 count = CSI_ARG_COUNT(args[0]); state->pos.row -= count; state->at_phantom = 0; break; case 0x42: // CUD - ECMA-48 8.3.19 count = CSI_ARG_COUNT(args[0]); state->pos.row += count; state->at_phantom = 0; break; case 0x43: // CUF - ECMA-48 8.3.20 count = CSI_ARG_COUNT(args[0]); state->pos.col += count; state->at_phantom = 0; break; case 0x44: // CUB - ECMA-48 8.3.18 count = CSI_ARG_COUNT(args[0]); state->pos.col -= count; state->at_phantom = 0; break; case 0x45: // CNL - ECMA-48 8.3.12 count = CSI_ARG_COUNT(args[0]); state->pos.col = 0; state->pos.row += count; state->at_phantom = 0; break; case 0x46: // CPL - ECMA-48 8.3.13 count = CSI_ARG_COUNT(args[0]); state->pos.col = 0; state->pos.row -= count; state->at_phantom = 0; break; case 0x47: // CHA - ECMA-48 8.3.9 val = CSI_ARG_OR(args[0], 1); state->pos.col = val-1; state->at_phantom = 0; break; case 0x48: // CUP - ECMA-48 8.3.21 row = CSI_ARG_OR(args[0], 1); col = argcount < 2 || CSI_ARG_IS_MISSING(args[1]) ? 1 : CSI_ARG(args[1]); // zero-based state->pos.row = row-1; state->pos.col = col-1; if(state->mode.origin) { state->pos.row += state->scrollregion_top; state->pos.col += SCROLLREGION_LEFT(state); } state->at_phantom = 0; break; case 0x49: // CHT - ECMA-48 8.3.10 count = CSI_ARG_COUNT(args[0]); tab(state, count, +1); break; case 0x4a: // ED - ECMA-48 8.3.39 case LEADER('?', 0x4a): // DECSED - Selective Erase in Display selective = (leader_byte == '?'); switch(CSI_ARG(args[0])) { case CSI_ARG_MISSING: case 0: rect.start_row = state->pos.row; rect.end_row = state->pos.row + 1; rect.start_col = state->pos.col; rect.end_col = state->cols; if(rect.end_col > rect.start_col) erase(state, rect, selective); rect.start_row = state->pos.row + 1; rect.end_row = state->rows; rect.start_col = 0; for(int row = rect.start_row; row < rect.end_row; row++) set_lineinfo(state, row, FORCE, DWL_OFF, DHL_OFF); if(rect.end_row > rect.start_row) erase(state, rect, selective); break; case 1: rect.start_row = 0; rect.end_row = state->pos.row; rect.start_col = 0; rect.end_col = state->cols; for(int row = rect.start_row; row < rect.end_row; row++) set_lineinfo(state, row, FORCE, DWL_OFF, DHL_OFF); if(rect.end_col > rect.start_col) erase(state, rect, selective); rect.start_row = state->pos.row; rect.end_row = state->pos.row + 1; rect.end_col = state->pos.col + 1; if(rect.end_row > rect.start_row) erase(state, rect, selective); break; case 2: rect.start_row = 0; rect.end_row = state->rows; rect.start_col = 0; rect.end_col = state->cols; for(int row = rect.start_row; row < rect.end_row; row++) set_lineinfo(state, row, FORCE, DWL_OFF, DHL_OFF); erase(state, rect, selective); break; } break; case 0x4b: // EL - ECMA-48 8.3.41 case LEADER('?', 0x4b): // DECSEL - Selective Erase in Line selective = (leader_byte == '?'); rect.start_row = state->pos.row; rect.end_row = state->pos.row + 1; switch(CSI_ARG(args[0])) { case CSI_ARG_MISSING: case 0: rect.start_col = state->pos.col; rect.end_col = THISROWWIDTH(state); break; case 1: rect.start_col = 0; rect.end_col = state->pos.col + 1; break; case 2: rect.start_col = 0; rect.end_col = THISROWWIDTH(state); break; default: return 0; } if(rect.end_col > rect.start_col) erase(state, rect, selective); break; case 0x4c: // IL - ECMA-48 8.3.67 count = CSI_ARG_COUNT(args[0]); if(!is_cursor_in_scrollregion(state)) break; rect.start_row = state->pos.row; rect.end_row = SCROLLREGION_BOTTOM(state); rect.start_col = SCROLLREGION_LEFT(state); rect.end_col = SCROLLREGION_RIGHT(state); scroll(state, rect, -count, 0); break; case 0x4d: // DL - ECMA-48 8.3.32 count = CSI_ARG_COUNT(args[0]); if(!is_cursor_in_scrollregion(state)) break; rect.start_row = state->pos.row; rect.end_row = SCROLLREGION_BOTTOM(state); rect.start_col = SCROLLREGION_LEFT(state); rect.end_col = SCROLLREGION_RIGHT(state); scroll(state, rect, count, 0); break; case 0x50: // DCH - ECMA-48 8.3.26 count = CSI_ARG_COUNT(args[0]); if(!is_cursor_in_scrollregion(state)) break; rect.start_row = state->pos.row; rect.end_row = state->pos.row + 1; rect.start_col = state->pos.col; if(state->mode.leftrightmargin) rect.end_col = SCROLLREGION_RIGHT(state); else rect.end_col = THISROWWIDTH(state); scroll(state, rect, 0, count); break; case 0x53: // SU - ECMA-48 8.3.147 count = CSI_ARG_COUNT(args[0]); rect.start_row = state->scrollregion_top; rect.end_row = SCROLLREGION_BOTTOM(state); rect.start_col = SCROLLREGION_LEFT(state); rect.end_col = SCROLLREGION_RIGHT(state); scroll(state, rect, count, 0); break; case 0x54: // SD - ECMA-48 8.3.113 count = CSI_ARG_COUNT(args[0]); rect.start_row = state->scrollregion_top; rect.end_row = SCROLLREGION_BOTTOM(state); rect.start_col = SCROLLREGION_LEFT(state); rect.end_col = SCROLLREGION_RIGHT(state); scroll(state, rect, -count, 0); break; case 0x58: // ECH - ECMA-48 8.3.38 count = CSI_ARG_COUNT(args[0]); rect.start_row = state->pos.row; rect.end_row = state->pos.row + 1; rect.start_col = state->pos.col; rect.end_col = state->pos.col + count; UBOUND(rect.end_col, THISROWWIDTH(state)); erase(state, rect, 0); break; case 0x5a: // CBT - ECMA-48 8.3.7 count = CSI_ARG_COUNT(args[0]); tab(state, count, -1); break; case 0x60: // HPA - ECMA-48 8.3.57 col = CSI_ARG_OR(args[0], 1); state->pos.col = col-1; state->at_phantom = 0; break; case 0x61: // HPR - ECMA-48 8.3.59 count = CSI_ARG_COUNT(args[0]); state->pos.col += count; state->at_phantom = 0; break; case 0x62: { // REP - ECMA-48 8.3.103 const int row_width = THISROWWIDTH(state); count = CSI_ARG_COUNT(args[0]); col = state->pos.col + count; UBOUND(col, row_width); while (state->pos.col < col) { putglyph(state, state->combine_chars, state->combine_width, state->pos); state->pos.col += state->combine_width; } if (state->pos.col + state->combine_width >= row_width) { if (state->mode.autowrap) { state->at_phantom = 1; cancel_phantom = 0; } } break; } case 0x63: // DA - ECMA-48 8.3.24 val = CSI_ARG_OR(args[0], 0); if(val == 0) // DEC VT100 response vterm_push_output_sprintf_ctrl(state->vt, C1_CSI, "?1;2c"); break; case LEADER('>', 0x63): // DEC secondary Device Attributes vterm_push_output_sprintf_ctrl(state->vt, C1_CSI, ">%d;%d;%dc", 0, 100, 0); break; case 0x64: // VPA - ECMA-48 8.3.158 row = CSI_ARG_OR(args[0], 1); state->pos.row = row-1; if(state->mode.origin) state->pos.row += state->scrollregion_top; state->at_phantom = 0; break; case 0x65: // VPR - ECMA-48 8.3.160 count = CSI_ARG_COUNT(args[0]); state->pos.row += count; state->at_phantom = 0; break; case 0x66: // HVP - ECMA-48 8.3.63 row = CSI_ARG_OR(args[0], 1); col = argcount < 2 || CSI_ARG_IS_MISSING(args[1]) ? 1 : CSI_ARG(args[1]); // zero-based state->pos.row = row-1; state->pos.col = col-1; if(state->mode.origin) { state->pos.row += state->scrollregion_top; state->pos.col += SCROLLREGION_LEFT(state); } state->at_phantom = 0; break; case 0x67: // TBC - ECMA-48 8.3.154 val = CSI_ARG_OR(args[0], 0); switch(val) { case 0: clear_col_tabstop(state, state->pos.col); break; case 3: case 5: for(col = 0; col < state->cols; col++) clear_col_tabstop(state, col); break; case 1: case 2: case 4: break; /* TODO: 1, 2 and 4 aren't meaningful yet without line tab stops */ default: return 0; } break; case 0x68: // SM - ECMA-48 8.3.125 if(!CSI_ARG_IS_MISSING(args[0])) set_mode(state, CSI_ARG(args[0]), 1); break; case LEADER('?', 0x68): // DEC private mode set if(!CSI_ARG_IS_MISSING(args[0])) set_dec_mode(state, CSI_ARG(args[0]), 1); break; case 0x6a: // HPB - ECMA-48 8.3.58 count = CSI_ARG_COUNT(args[0]); state->pos.col -= count; state->at_phantom = 0; break; case 0x6b: // VPB - ECMA-48 8.3.159 count = CSI_ARG_COUNT(args[0]); state->pos.row -= count; state->at_phantom = 0; break; case 0x6c: // RM - ECMA-48 8.3.106 if(!CSI_ARG_IS_MISSING(args[0])) set_mode(state, CSI_ARG(args[0]), 0); break; case LEADER('?', 0x6c): // DEC private mode reset if(!CSI_ARG_IS_MISSING(args[0])) set_dec_mode(state, CSI_ARG(args[0]), 0); break; case 0x6d: // SGR - ECMA-48 8.3.117 vterm_state_setpen(state, args, argcount); break; case 0x6e: // DSR - ECMA-48 8.3.35 case LEADER('?', 0x6e): // DECDSR val = CSI_ARG_OR(args[0], 0); { char *qmark = (leader_byte == '?') ? "?" : ""; switch(val) { case 0: case 1: case 2: case 3: case 4: // ignore - these are replies break; case 5: vterm_push_output_sprintf_ctrl(state->vt, C1_CSI, "%s0n", qmark); break; case 6: // CPR - cursor position report vterm_push_output_sprintf_ctrl(state->vt, C1_CSI, "%s%d;%dR", qmark, state->pos.row + 1, state->pos.col + 1); break; } } break; case LEADER('!', 0x70): // DECSTR - DEC soft terminal reset vterm_state_reset(state, 0); break; case LEADER('?', INTERMED('$', 0x70)): request_dec_mode(state, CSI_ARG(args[0])); break; case INTERMED(' ', 0x71): // DECSCUSR - DEC set cursor shape val = CSI_ARG_OR(args[0], 1); switch(val) { case 0: case 1: settermprop_bool(state, VTERM_PROP_CURSORBLINK, 1); settermprop_int (state, VTERM_PROP_CURSORSHAPE, VTERM_PROP_CURSORSHAPE_BLOCK); break; case 2: settermprop_bool(state, VTERM_PROP_CURSORBLINK, 0); settermprop_int (state, VTERM_PROP_CURSORSHAPE, VTERM_PROP_CURSORSHAPE_BLOCK); break; case 3: settermprop_bool(state, VTERM_PROP_CURSORBLINK, 1); settermprop_int (state, VTERM_PROP_CURSORSHAPE, VTERM_PROP_CURSORSHAPE_UNDERLINE); break; case 4: settermprop_bool(state, VTERM_PROP_CURSORBLINK, 0); settermprop_int (state, VTERM_PROP_CURSORSHAPE, VTERM_PROP_CURSORSHAPE_UNDERLINE); break; case 5: settermprop_bool(state, VTERM_PROP_CURSORBLINK, 1); settermprop_int (state, VTERM_PROP_CURSORSHAPE, VTERM_PROP_CURSORSHAPE_BAR_LEFT); break; case 6: settermprop_bool(state, VTERM_PROP_CURSORBLINK, 0); settermprop_int (state, VTERM_PROP_CURSORSHAPE, VTERM_PROP_CURSORSHAPE_BAR_LEFT); break; } break; case INTERMED('"', 0x71): // DECSCA - DEC select character protection attribute val = CSI_ARG_OR(args[0], 0); switch(val) { case 0: case 2: state->protected_cell = 0; break; case 1: state->protected_cell = 1; break; } break; case 0x72: // DECSTBM - DEC custom state->scrollregion_top = CSI_ARG_OR(args[0], 1) - 1; state->scrollregion_bottom = argcount < 2 || CSI_ARG_IS_MISSING(args[1]) ? -1 : CSI_ARG(args[1]); LBOUND(state->scrollregion_top, 0); UBOUND(state->scrollregion_top, state->rows); LBOUND(state->scrollregion_bottom, -1); if(state->scrollregion_top == 0 && state->scrollregion_bottom == state->rows) state->scrollregion_bottom = -1; else UBOUND(state->scrollregion_bottom, state->rows); if(SCROLLREGION_BOTTOM(state) <= state->scrollregion_top) { // Invalid state->scrollregion_top = 0; state->scrollregion_bottom = -1; } // Setting the scrolling region restores the cursor to the home position state->pos.row = 0; state->pos.col = 0; if(state->mode.origin) { state->pos.row += state->scrollregion_top; state->pos.col += SCROLLREGION_LEFT(state); } break; case 0x73: // DECSLRM - DEC custom // Always allow setting these margins, just they won't take effect without DECVSSM state->scrollregion_left = CSI_ARG_OR(args[0], 1) - 1; state->scrollregion_right = argcount < 2 || CSI_ARG_IS_MISSING(args[1]) ? -1 : CSI_ARG(args[1]); LBOUND(state->scrollregion_left, 0); UBOUND(state->scrollregion_left, state->cols); LBOUND(state->scrollregion_right, -1); if(state->scrollregion_left == 0 && state->scrollregion_right == state->cols) state->scrollregion_right = -1; else UBOUND(state->scrollregion_right, state->cols); if(state->scrollregion_right > -1 && state->scrollregion_right <= state->scrollregion_left) { // Invalid state->scrollregion_left = 0; state->scrollregion_right = -1; } // Setting the scrolling region restores the cursor to the home position state->pos.row = 0; state->pos.col = 0; if(state->mode.origin) { state->pos.row += state->scrollregion_top; state->pos.col += SCROLLREGION_LEFT(state); } break; case INTERMED('\'', 0x7D): // DECIC count = CSI_ARG_COUNT(args[0]); if(!is_cursor_in_scrollregion(state)) break; rect.start_row = state->scrollregion_top; rect.end_row = SCROLLREGION_BOTTOM(state); rect.start_col = state->pos.col; rect.end_col = SCROLLREGION_RIGHT(state); scroll(state, rect, 0, -count); break; case INTERMED('\'', 0x7E): // DECDC count = CSI_ARG_COUNT(args[0]); if(!is_cursor_in_scrollregion(state)) break; rect.start_row = state->scrollregion_top; rect.end_row = SCROLLREGION_BOTTOM(state); rect.start_col = state->pos.col; rect.end_col = SCROLLREGION_RIGHT(state); scroll(state, rect, 0, count); break; default: if(state->fallbacks && state->fallbacks->csi) if((*state->fallbacks->csi)(leader, args, argcount, intermed, command, state->fbdata)) return 1; return 0; } if(state->mode.origin) { LBOUND(state->pos.row, state->scrollregion_top); UBOUND(state->pos.row, SCROLLREGION_BOTTOM(state)-1); LBOUND(state->pos.col, SCROLLREGION_LEFT(state)); UBOUND(state->pos.col, SCROLLREGION_RIGHT(state)-1); } else { LBOUND(state->pos.row, 0); UBOUND(state->pos.row, state->rows-1); LBOUND(state->pos.col, 0); UBOUND(state->pos.col, THISROWWIDTH(state)-1); } updatecursor(state, &oldpos, cancel_phantom); #ifdef DEBUG if(state->pos.row < 0 || state->pos.row >= state->rows || state->pos.col < 0 || state->pos.col >= state->cols) { fprintf(stderr, "Position out of bounds after CSI %c: (%d,%d)\n", command, state->pos.row, state->pos.col); abort(); } if(SCROLLREGION_BOTTOM(state) <= state->scrollregion_top) { fprintf(stderr, "Scroll region height out of bounds after CSI %c: %d <= %d\n", command, SCROLLREGION_BOTTOM(state), state->scrollregion_top); abort(); } if(SCROLLREGION_RIGHT(state) <= SCROLLREGION_LEFT(state)) { fprintf(stderr, "Scroll region width out of bounds after CSI %c: %d <= %d\n", command, SCROLLREGION_RIGHT(state), SCROLLREGION_LEFT(state)); abort(); } #endif return 1; } static char base64_one(uint8_t b) { if(b < 26) return 'A' + b; else if(b < 52) return 'a' + b - 26; else if(b < 62) return '0' + b - 52; else if(b == 62) return '+'; else if(b == 63) return '/'; return 0; } static uint8_t unbase64one(char c) { if(c >= 'A' && c <= 'Z') return c - 'A'; else if(c >= 'a' && c <= 'z') return c - 'a' + 26; else if(c >= '0' && c <= '9') return c - '0' + 52; else if(c == '+') return 62; else if(c == '/') return 63; return 0xFF; } static void osc_selection(VTermState *state, VTermStringFragment frag) { if(frag.initial) { state->tmp.selection.mask = 0; state->tmp.selection.state = SELECTION_INITIAL; } while(!state->tmp.selection.state && frag.len) { /* Parse selection parameter */ switch(frag.str[0]) { case 'c': state->tmp.selection.mask |= VTERM_SELECTION_CLIPBOARD; break; case 'p': state->tmp.selection.mask |= VTERM_SELECTION_PRIMARY; break; case 'q': state->tmp.selection.mask |= VTERM_SELECTION_SECONDARY; break; case 's': state->tmp.selection.mask |= VTERM_SELECTION_SELECT; break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': state->tmp.selection.mask |= (VTERM_SELECTION_CUT0 << (frag.str[0] - '0')); break; case ';': state->tmp.selection.state = SELECTION_SELECTED; if(!state->tmp.selection.mask) state->tmp.selection.mask = VTERM_SELECTION_SELECT|VTERM_SELECTION_CUT0; break; } frag.str++; frag.len--; } if(!frag.len) return; if(state->tmp.selection.state == SELECTION_SELECTED) { if(frag.str[0] == '?') { state->tmp.selection.state = SELECTION_QUERY; } else { state->tmp.selection.state = SELECTION_SET_INITIAL; state->tmp.selection.recvpartial = 0; } } if(state->tmp.selection.state == SELECTION_QUERY) { if(state->selection.callbacks->query) (*state->selection.callbacks->query)(state->tmp.selection.mask, state->selection.user); return; } if(state->selection.callbacks->set) { size_t bufcur = 0; char *buffer = state->selection.buffer; uint32_t x = 0; /* Current decoding value */ int n = 0; /* Number of sextets consumed */ if(state->tmp.selection.recvpartial) { n = state->tmp.selection.recvpartial >> 24; x = state->tmp.selection.recvpartial & 0x03FFFF; /* could be up to 18 bits of state in here */ state->tmp.selection.recvpartial = 0; } while((state->selection.buflen - bufcur) >= 3 && frag.len) { if(frag.str[0] == '=') { if(n == 2) { buffer[0] = (x >> 4) & 0xFF; buffer += 1, bufcur += 1; } if(n == 3) { buffer[0] = (x >> 10) & 0xFF; buffer[1] = (x >> 2) & 0xFF; buffer += 2, bufcur += 2; } while(frag.len && frag.str[0] == '=') frag.str++, frag.len--; n = 0; } else { uint8_t b = unbase64one(frag.str[0]); if(b == 0xFF) { DEBUG_LOG("base64decode bad input %02X\n", (uint8_t)frag.str[0]); } else { x = (x << 6) | b; n++; } frag.str++, frag.len--; if(n == 4) { buffer[0] = (x >> 16) & 0xFF; buffer[1] = (x >> 8) & 0xFF; buffer[2] = (x >> 0) & 0xFF; buffer += 3, bufcur += 3; x = 0; n = 0; } } if(!frag.len || (state->selection.buflen - bufcur) < 3) { if(bufcur) { (*state->selection.callbacks->set)(state->tmp.selection.mask, (VTermStringFragment){ .str = state->selection.buffer, .len = bufcur, .initial = state->tmp.selection.state == SELECTION_SET_INITIAL, .final = frag.final, }, state->selection.user); state->tmp.selection.state = SELECTION_SET; } buffer = state->selection.buffer; bufcur = 0; } } if(n) state->tmp.selection.recvpartial = (n << 24) | x; } } static int on_osc(int command, VTermStringFragment frag, void *user) { VTermState *state = user; switch(command) { case 0: settermprop_string(state, VTERM_PROP_ICONNAME, frag); settermprop_string(state, VTERM_PROP_TITLE, frag); return 1; case 1: settermprop_string(state, VTERM_PROP_ICONNAME, frag); return 1; case 2: settermprop_string(state, VTERM_PROP_TITLE, frag); return 1; case 52: if(state->selection.callbacks) osc_selection(state, frag); return 1; default: if(state->fallbacks && state->fallbacks->osc) if((*state->fallbacks->osc)(command, frag, state->fbdata)) return 1; } return 0; } static void request_status_string(VTermState *state, VTermStringFragment frag) { VTerm *vt = state->vt; char *tmp = state->tmp.decrqss; if(frag.initial) tmp[0] = tmp[1] = tmp[2] = tmp[3] = 0; int i = 0; while(i < sizeof(state->tmp.decrqss)-1 && tmp[i]) i++; while(i < sizeof(state->tmp.decrqss)-1 && frag.len--) tmp[i++] = (frag.str++)[0]; tmp[i] = 0; if(!frag.final) return; switch(tmp[0] | tmp[1]<<8 | tmp[2]<<16) { case 'm': { // Query SGR long args[20]; int argc = vterm_state_getpen(state, args, sizeof(args)/sizeof(args[0])); size_t cur = 0; cur += snprintf(vt->tmpbuffer + cur, vt->tmpbuffer_len - cur, vt->mode.ctrl8bit ? "\x90" "1$r" : ESC_S "P" "1$r"); // DCS 1$r ... if(cur >= vt->tmpbuffer_len) return; for(int argi = 0; argi < argc; argi++) { cur += snprintf(vt->tmpbuffer + cur, vt->tmpbuffer_len - cur, argi == argc - 1 ? "%ld" : CSI_ARG_HAS_MORE(args[argi]) ? "%ld:" : "%ld;", CSI_ARG(args[argi])); if(cur >= vt->tmpbuffer_len) return; } cur += snprintf(vt->tmpbuffer + cur, vt->tmpbuffer_len - cur, vt->mode.ctrl8bit ? "m" "\x9C" : "m" ESC_S "\\"); // ... m ST if(cur >= vt->tmpbuffer_len) return; vterm_push_output_bytes(vt, vt->tmpbuffer, cur); return; } case 'r': // Query DECSTBM vterm_push_output_sprintf_str(vt, C1_DCS, true, "1$r%d;%dr", state->scrollregion_top+1, SCROLLREGION_BOTTOM(state)); return; case 's': // Query DECSLRM vterm_push_output_sprintf_str(vt, C1_DCS, true, "1$r%d;%ds", SCROLLREGION_LEFT(state)+1, SCROLLREGION_RIGHT(state)); return; case ' '|('q'<<8): { // Query DECSCUSR int reply; switch(state->mode.cursor_shape) { case VTERM_PROP_CURSORSHAPE_BLOCK: reply = 2; break; case VTERM_PROP_CURSORSHAPE_UNDERLINE: reply = 4; break; case VTERM_PROP_CURSORSHAPE_BAR_LEFT: reply = 6; break; } if(state->mode.cursor_blink) reply--; vterm_push_output_sprintf_str(vt, C1_DCS, true, "1$r%d q", reply); return; } case '\"'|('q'<<8): // Query DECSCA vterm_push_output_sprintf_str(vt, C1_DCS, true, "1$r%d\"q", state->protected_cell ? 1 : 2); return; } vterm_push_output_sprintf_str(state->vt, C1_DCS, true, "0$r%s", tmp); } static int on_dcs(const char *command, size_t commandlen, VTermStringFragment frag, void *user) { VTermState *state = user; if(commandlen == 2 && strneq(command, "$q", 2)) { request_status_string(state, frag); return 1; } else if(state->fallbacks && state->fallbacks->dcs) if((*state->fallbacks->dcs)(command, commandlen, frag, state->fbdata)) return 1; DEBUG_LOG("libvterm: Unhandled DCS %.*s\n", (int)commandlen, command); return 0; } static int on_apc(VTermStringFragment frag, void *user) { VTermState *state = user; if(state->fallbacks && state->fallbacks->apc) if((*state->fallbacks->apc)(frag, state->fbdata)) return 1; /* No DEBUG_LOG because all APCs are unhandled */ return 0; } static int on_pm(VTermStringFragment frag, void *user) { VTermState *state = user; if(state->fallbacks && state->fallbacks->pm) if((*state->fallbacks->pm)(frag, state->fbdata)) return 1; /* No DEBUG_LOG because all PMs are unhandled */ return 0; } static int on_sos(VTermStringFragment frag, void *user) { VTermState *state = user; if(state->fallbacks && state->fallbacks->sos) if((*state->fallbacks->sos)(frag, state->fbdata)) return 1; /* No DEBUG_LOG because all SOSs are unhandled */ return 0; } static int on_resize(int rows, int cols, void *user) { VTermState *state = user; VTermPos oldpos = state->pos; if(cols != state->cols) { unsigned char *newtabstops = vterm_allocator_malloc(state->vt, (cols + 7) / 8); /* TODO: This can all be done much more efficiently bytewise */ int col; for(col = 0; col < state->cols && col < cols; col++) { unsigned char mask = 1 << (col & 7); if(state->tabstops[col >> 3] & mask) newtabstops[col >> 3] |= mask; else newtabstops[col >> 3] &= ~mask; } for( ; col < cols; col++) { unsigned char mask = 1 << (col & 7); if(col % 8 == 0) newtabstops[col >> 3] |= mask; else newtabstops[col >> 3] &= ~mask; } vterm_allocator_free(state->vt, state->tabstops); state->tabstops = newtabstops; } if(rows != state->rows) { for(int bufidx = BUFIDX_PRIMARY; bufidx <= BUFIDX_ALTSCREEN; bufidx++) { VTermLineInfo *oldlineinfo = state->lineinfos[bufidx]; if(!oldlineinfo) continue; VTermLineInfo *newlineinfo = vterm_allocator_malloc(state->vt, rows * sizeof(VTermLineInfo)); int row; for(row = 0; row < state->rows && row < rows; row++) { newlineinfo[row] = oldlineinfo[row]; } for( ; row < rows; row++) { newlineinfo[row] = (VTermLineInfo){ .doublewidth = 0, }; } vterm_allocator_free(state->vt, state->lineinfos[bufidx]); state->lineinfos[bufidx] = newlineinfo; } state->lineinfo = state->lineinfos[state->mode.alt_screen ? BUFIDX_ALTSCREEN : BUFIDX_PRIMARY]; } state->rows = rows; state->cols = cols; if(state->scrollregion_bottom > -1) UBOUND(state->scrollregion_bottom, state->rows); if(state->scrollregion_right > -1) UBOUND(state->scrollregion_right, state->cols); VTermStateFields fields = { .pos = state->pos, }; if(state->callbacks && state->callbacks->resize) (*state->callbacks->resize)(rows, cols, &fields, state->cbdata); state->pos = fields.pos; if(state->at_phantom && state->pos.col < cols-1) { state->at_phantom = 0; state->pos.col++; } if(state->pos.row < 0) state->pos.row = 0; if(state->pos.row >= rows) state->pos.row = rows - 1; if(state->pos.col < 0) state->pos.col = 0; if(state->pos.col >= cols) state->pos.col = cols - 1; updatecursor(state, &oldpos, 1); return 1; } static const VTermParserCallbacks parser_callbacks = { .text = on_text, .control = on_control, .escape = on_escape, .csi = on_csi, .osc = on_osc, .dcs = on_dcs, .apc = on_apc, .pm = on_pm, .sos = on_sos, .resize = on_resize, }; VTermState *vterm_obtain_state(VTerm *vt) { if(vt->state) return vt->state; VTermState *state = vterm_state_new(vt); vt->state = state; vterm_parser_set_callbacks(vt, &parser_callbacks, state); return state; } void vterm_state_reset(VTermState *state, int hard) { state->scrollregion_top = 0; state->scrollregion_bottom = -1; state->scrollregion_left = 0; state->scrollregion_right = -1; state->mode.keypad = 0; state->mode.cursor = 0; state->mode.autowrap = 1; state->mode.insert = 0; state->mode.newline = 0; state->mode.alt_screen = 0; state->mode.origin = 0; state->mode.leftrightmargin = 0; state->mode.bracketpaste = 0; state->mode.report_focus = 0; state->mouse_flags = 0; state->vt->mode.ctrl8bit = 0; for(int col = 0; col < state->cols; col++) if(col % 8 == 0) set_col_tabstop(state, col); else clear_col_tabstop(state, col); for(int row = 0; row < state->rows; row++) set_lineinfo(state, row, FORCE, DWL_OFF, DHL_OFF); if(state->callbacks && state->callbacks->initpen) (*state->callbacks->initpen)(state->cbdata); vterm_state_resetpen(state); VTermEncoding *default_enc = state->vt->mode.utf8 ? vterm_lookup_encoding(ENC_UTF8, 'u') : vterm_lookup_encoding(ENC_SINGLE_94, 'B'); for(int i = 0; i < 4; i++) { state->encoding[i].enc = default_enc; if(default_enc->init) (*default_enc->init)(default_enc, state->encoding[i].data); } state->gl_set = 0; state->gr_set = 1; state->gsingle_set = 0; state->protected_cell = 0; // Initialise the props settermprop_bool(state, VTERM_PROP_CURSORVISIBLE, 1); settermprop_bool(state, VTERM_PROP_CURSORBLINK, 1); settermprop_int (state, VTERM_PROP_CURSORSHAPE, VTERM_PROP_CURSORSHAPE_BLOCK); if(hard) { state->pos.row = 0; state->pos.col = 0; state->at_phantom = 0; VTermRect rect = { 0, state->rows, 0, state->cols }; erase(state, rect, 0); } } void vterm_state_get_cursorpos(const VTermState *state, VTermPos *cursorpos) { *cursorpos = state->pos; } void vterm_state_set_callbacks(VTermState *state, const VTermStateCallbacks *callbacks, void *user) { if(callbacks) { state->callbacks = callbacks; state->cbdata = user; if(state->callbacks && state->callbacks->initpen) (*state->callbacks->initpen)(state->cbdata); } else { state->callbacks = NULL; state->cbdata = NULL; } } void *vterm_state_get_cbdata(VTermState *state) { return state->cbdata; } void vterm_state_set_unrecognised_fallbacks(VTermState *state, const VTermStateFallbacks *fallbacks, void *user) { if(fallbacks) { state->fallbacks = fallbacks; state->fbdata = user; } else { state->fallbacks = NULL; state->fbdata = NULL; } } void *vterm_state_get_unrecognised_fbdata(VTermState *state) { return state->fbdata; } int vterm_state_set_termprop(VTermState *state, VTermProp prop, VTermValue *val) { /* Only store the new value of the property if usercode said it was happy. * This is especially important for altscreen switching */ if(state->callbacks && state->callbacks->settermprop) if(!(*state->callbacks->settermprop)(prop, val, state->cbdata)) return 0; switch(prop) { case VTERM_PROP_TITLE: case VTERM_PROP_ICONNAME: // we don't store these, just transparently pass through return 1; case VTERM_PROP_CURSORVISIBLE: state->mode.cursor_visible = val->boolean; return 1; case VTERM_PROP_CURSORBLINK: state->mode.cursor_blink = val->boolean; return 1; case VTERM_PROP_CURSORSHAPE: state->mode.cursor_shape = val->number; return 1; case VTERM_PROP_REVERSE: state->mode.screen = val->boolean; return 1; case VTERM_PROP_ALTSCREEN: state->mode.alt_screen = val->boolean; state->lineinfo = state->lineinfos[state->mode.alt_screen ? BUFIDX_ALTSCREEN : BUFIDX_PRIMARY]; if(state->mode.alt_screen) { VTermRect rect = { .start_row = 0, .start_col = 0, .end_row = state->rows, .end_col = state->cols, }; erase(state, rect, 0); } return 1; case VTERM_PROP_MOUSE: state->mouse_flags = 0; if(val->number) state->mouse_flags |= MOUSE_WANT_CLICK; if(val->number == VTERM_PROP_MOUSE_DRAG) state->mouse_flags |= MOUSE_WANT_DRAG; if(val->number == VTERM_PROP_MOUSE_MOVE) state->mouse_flags |= MOUSE_WANT_MOVE; return 1; case VTERM_N_PROPS: return 0; } return 0; } void vterm_state_focus_in(VTermState *state) { if(state->mode.report_focus) vterm_push_output_sprintf_ctrl(state->vt, C1_CSI, "I"); } void vterm_state_focus_out(VTermState *state) { if(state->mode.report_focus) vterm_push_output_sprintf_ctrl(state->vt, C1_CSI, "O"); } const VTermLineInfo *vterm_state_get_lineinfo(const VTermState *state, int row) { return state->lineinfo + row; } void vterm_state_set_selection_callbacks(VTermState *state, const VTermSelectionCallbacks *callbacks, void *user, char *buffer, size_t buflen) { if(buflen && !buffer) buffer = vterm_allocator_malloc(state->vt, buflen); state->selection.callbacks = callbacks; state->selection.user = user; state->selection.buffer = buffer; state->selection.buflen = buflen; } void vterm_state_send_selection(VTermState *state, VTermSelectionMask mask, VTermStringFragment frag) { VTerm *vt = state->vt; if(frag.initial) { /* TODO: support sending more than one mask bit */ const static char selection_chars[] = "cpqs"; int idx; for(idx = 0; idx < 4; idx++) if(mask & (1 << idx)) break; vterm_push_output_sprintf_str(vt, C1_OSC, false, "52;%c;", selection_chars[idx]); state->tmp.selection.sendpartial = 0; } if(frag.len) { size_t bufcur = 0; char *buffer = state->selection.buffer; uint32_t x = 0; int n = 0; if(state->tmp.selection.sendpartial) { n = state->tmp.selection.sendpartial >> 24; x = state->tmp.selection.sendpartial & 0xFFFFFF; state->tmp.selection.sendpartial = 0; } while((state->selection.buflen - bufcur) >= 4 && frag.len) { x = (x << 8) | frag.str[0]; n++; frag.str++, frag.len--; if(n == 3) { buffer[0] = base64_one((x >> 18) & 0x3F); buffer[1] = base64_one((x >> 12) & 0x3F); buffer[2] = base64_one((x >> 6) & 0x3F); buffer[3] = base64_one((x >> 0) & 0x3F); buffer += 4, bufcur += 4; x = 0; n = 0; } if(!frag.len || (state->selection.buflen - bufcur) < 4) { if(bufcur) vterm_push_output_bytes(vt, state->selection.buffer, bufcur); buffer = state->selection.buffer; bufcur = 0; } } if(n) state->tmp.selection.sendpartial = (n << 24) | x; } if(frag.final) { if(state->tmp.selection.sendpartial) { int n = state->tmp.selection.sendpartial >> 24; uint32_t x = state->tmp.selection.sendpartial & 0xFFFFFF; char *buffer = state->selection.buffer; /* n is either 1 or 2 now */ x <<= (n == 1) ? 16 : 8; buffer[0] = base64_one((x >> 18) & 0x3F); buffer[1] = base64_one((x >> 12) & 0x3F); buffer[2] = (n == 1) ? '=' : base64_one((x >> 6) & 0x3F); buffer[3] = '='; vterm_push_output_sprintf_str(vt, 0, true, "%.*s", 4, buffer); } else vterm_push_output_sprintf_str(vt, 0, true, ""); } } cgdb-0.8.0/lib/vterm/utf8.h0000644000175000017500000000202014160506715012300 00000000000000/* The following functions copied and adapted from libtermkey * * http://www.leonerd.org.uk/code/libtermkey/ */ static inline unsigned int utf8_seqlen(long codepoint) { if(codepoint < 0x0000080) return 1; if(codepoint < 0x0000800) return 2; if(codepoint < 0x0010000) return 3; if(codepoint < 0x0200000) return 4; if(codepoint < 0x4000000) return 5; return 6; } /* Does NOT NUL-terminate the buffer */ static int fill_utf8(long codepoint, char *str) { int nbytes = utf8_seqlen(codepoint); // This is easier done backwards int b = nbytes; while(b > 1) { b--; str[b] = 0x80 | (codepoint & 0x3f); codepoint >>= 6; } switch(nbytes) { case 1: str[0] = (codepoint & 0x7f); break; case 2: str[0] = 0xc0 | (codepoint & 0x1f); break; case 3: str[0] = 0xe0 | (codepoint & 0x0f); break; case 4: str[0] = 0xf0 | (codepoint & 0x07); break; case 5: str[0] = 0xf8 | (codepoint & 0x03); break; case 6: str[0] = 0xfc | (codepoint & 0x01); break; } return nbytes; } /* end copy */ cgdb-0.8.0/lib/vterm/pen.c0000644000175000017500000004013314160506403012170 00000000000000#include "vterm_internal.h" #include /** * Structure used to store RGB triples without the additional metadata stored in * VTermColor. */ typedef struct { uint8_t red, green, blue; } VTermRGB; static const VTermRGB ansi_colors[] = { /* R G B */ { 0, 0, 0 }, // black { 224, 0, 0 }, // red { 0, 224, 0 }, // green { 224, 224, 0 }, // yellow { 0, 0, 224 }, // blue { 224, 0, 224 }, // magenta { 0, 224, 224 }, // cyan { 224, 224, 224 }, // white == light grey // high intensity { 128, 128, 128 }, // black { 255, 64, 64 }, // red { 64, 255, 64 }, // green { 255, 255, 64 }, // yellow { 64, 64, 255 }, // blue { 255, 64, 255 }, // magenta { 64, 255, 255 }, // cyan { 255, 255, 255 }, // white for real }; static int ramp6[] = { 0x00, 0x33, 0x66, 0x99, 0xCC, 0xFF, }; static int ramp24[] = { 0x00, 0x0B, 0x16, 0x21, 0x2C, 0x37, 0x42, 0x4D, 0x58, 0x63, 0x6E, 0x79, 0x85, 0x90, 0x9B, 0xA6, 0xB1, 0xBC, 0xC7, 0xD2, 0xDD, 0xE8, 0xF3, 0xFF, }; static void lookup_default_colour_ansi(long idx, VTermColor *col) { if (idx >= 0 && idx < 16) { vterm_color_rgb( col, ansi_colors[idx].red, ansi_colors[idx].green, ansi_colors[idx].blue); } } static bool lookup_colour_ansi(const VTermState *state, long index, VTermColor *col) { if(index >= 0 && index < 16) { *col = state->colors[index]; return true; } return false; } static bool lookup_colour_palette(const VTermState *state, long index, VTermColor *col) { if(index >= 0 && index < 16) { // Normal 8 colours or high intensity - parse as palette 0 return lookup_colour_ansi(state, index, col); } else if(index >= 16 && index < 232) { // 216-colour cube index -= 16; vterm_color_rgb(col, ramp6[index/6/6 % 6], ramp6[index/6 % 6], ramp6[index % 6]); return true; } else if(index >= 232 && index < 256) { // 24 greyscales index -= 232; vterm_color_rgb(col, ramp24[index], ramp24[index], ramp24[index]); return true; } return false; } static int lookup_colour(const VTermState *state, int palette, const long args[], int argcount, VTermColor *col) { switch(palette) { case 2: // RGB mode - 3 args contain colour values directly if(argcount < 3) return argcount; vterm_color_rgb(col, CSI_ARG(args[0]), CSI_ARG(args[1]), CSI_ARG(args[2])); return 3; case 5: // XTerm 256-colour mode if (!argcount || CSI_ARG_IS_MISSING(args[0])) { return argcount ? 1 : 0; } vterm_color_indexed(col, args[0]); return argcount ? 1 : 0; default: DEBUG_LOG("Unrecognised colour palette %d\n", palette); return 0; } } // Some conveniences static void setpenattr(VTermState *state, VTermAttr attr, VTermValueType type, VTermValue *val) { #ifdef DEBUG if(type != vterm_get_attr_type(attr)) { DEBUG_LOG("Cannot set attr %d as it has type %d, not type %d\n", attr, vterm_get_attr_type(attr), type); return; } #endif if(state->callbacks && state->callbacks->setpenattr) (*state->callbacks->setpenattr)(attr, val, state->cbdata); } static void setpenattr_bool(VTermState *state, VTermAttr attr, int boolean) { VTermValue val = { .boolean = boolean }; setpenattr(state, attr, VTERM_VALUETYPE_BOOL, &val); } static void setpenattr_int(VTermState *state, VTermAttr attr, int number) { VTermValue val = { .number = number }; setpenattr(state, attr, VTERM_VALUETYPE_INT, &val); } static void setpenattr_col(VTermState *state, VTermAttr attr, VTermColor color) { VTermValue val = { .color = color }; setpenattr(state, attr, VTERM_VALUETYPE_COLOR, &val); } static void set_pen_col_ansi(VTermState *state, VTermAttr attr, long col) { VTermColor *colp = (attr == VTERM_ATTR_BACKGROUND) ? &state->pen.bg : &state->pen.fg; vterm_color_indexed(colp, col); setpenattr_col(state, attr, *colp); } INTERNAL void vterm_state_newpen(VTermState *state) { // 90% grey so that pure white is brighter vterm_color_rgb(&state->default_fg, 240, 240, 240); vterm_color_rgb(&state->default_bg, 0, 0, 0); vterm_state_set_default_colors(state, &state->default_fg, &state->default_bg); for(int col = 0; col < 16; col++) lookup_default_colour_ansi(col, &state->colors[col]); } INTERNAL void vterm_state_resetpen(VTermState *state) { state->pen.bold = 0; setpenattr_bool(state, VTERM_ATTR_BOLD, 0); state->pen.underline = 0; setpenattr_int( state, VTERM_ATTR_UNDERLINE, 0); state->pen.italic = 0; setpenattr_bool(state, VTERM_ATTR_ITALIC, 0); state->pen.blink = 0; setpenattr_bool(state, VTERM_ATTR_BLINK, 0); state->pen.reverse = 0; setpenattr_bool(state, VTERM_ATTR_REVERSE, 0); state->pen.conceal = 0; setpenattr_bool(state, VTERM_ATTR_CONCEAL, 0); state->pen.strike = 0; setpenattr_bool(state, VTERM_ATTR_STRIKE, 0); state->pen.font = 0; setpenattr_int( state, VTERM_ATTR_FONT, 0); state->pen.fg = state->default_fg; setpenattr_col(state, VTERM_ATTR_FOREGROUND, state->default_fg); state->pen.bg = state->default_bg; setpenattr_col(state, VTERM_ATTR_BACKGROUND, state->default_bg); } INTERNAL void vterm_state_savepen(VTermState *state, int save) { if(save) { state->saved.pen = state->pen; } else { state->pen = state->saved.pen; setpenattr_bool(state, VTERM_ATTR_BOLD, state->pen.bold); setpenattr_int( state, VTERM_ATTR_UNDERLINE, state->pen.underline); setpenattr_bool(state, VTERM_ATTR_ITALIC, state->pen.italic); setpenattr_bool(state, VTERM_ATTR_BLINK, state->pen.blink); setpenattr_bool(state, VTERM_ATTR_REVERSE, state->pen.reverse); setpenattr_bool(state, VTERM_ATTR_CONCEAL, state->pen.conceal); setpenattr_bool(state, VTERM_ATTR_STRIKE, state->pen.strike); setpenattr_int( state, VTERM_ATTR_FONT, state->pen.font); setpenattr_col( state, VTERM_ATTR_FOREGROUND, state->pen.fg); setpenattr_col( state, VTERM_ATTR_BACKGROUND, state->pen.bg); } } int vterm_color_is_equal(const VTermColor *a, const VTermColor *b) { /* First make sure that the two colours are of the same type (RGB/Indexed) */ if (a->type != b->type) { return false; } /* Depending on the type inspect the corresponding members */ if (VTERM_COLOR_IS_INDEXED(a)) { return a->indexed.idx == b->indexed.idx; } else if (VTERM_COLOR_IS_RGB(a)) { return (a->rgb.red == b->rgb.red) && (a->rgb.green == b->rgb.green) && (a->rgb.blue == b->rgb.blue); } return 0; } void vterm_state_get_default_colors(const VTermState *state, VTermColor *default_fg, VTermColor *default_bg) { *default_fg = state->default_fg; *default_bg = state->default_bg; } void vterm_state_get_palette_color(const VTermState *state, int index, VTermColor *col) { lookup_colour_palette(state, index, col); } void vterm_state_set_default_colors(VTermState *state, const VTermColor *default_fg, const VTermColor *default_bg) { /* Copy the given colors */ state->default_fg = *default_fg; state->default_bg = *default_bg; /* Make sure the correct type flags are set */ state->default_fg.type = (state->default_fg.type & ~VTERM_COLOR_DEFAULT_MASK) | VTERM_COLOR_DEFAULT_FG; state->default_bg.type = (state->default_bg.type & ~VTERM_COLOR_DEFAULT_MASK) | VTERM_COLOR_DEFAULT_BG; } void vterm_state_set_palette_color(VTermState *state, int index, const VTermColor *col) { if(index >= 0 && index < 16) state->colors[index] = *col; } void vterm_state_convert_color_to_rgb(const VTermState *state, VTermColor *col) { if (VTERM_COLOR_IS_INDEXED(col)) { /* Convert indexed colors to RGB */ lookup_colour_palette(state, col->indexed.idx, col); } col->type &= VTERM_COLOR_TYPE_MASK; /* Reset any metadata but the type */ } void vterm_state_set_bold_highbright(VTermState *state, int bold_is_highbright) { state->bold_is_highbright = bold_is_highbright; } INTERNAL void vterm_state_setpen(VTermState *state, const long args[], int argcount) { // SGR - ECMA-48 8.3.117 int argi = 0; int value; while(argi < argcount) { // This logic is easier to do 'done' backwards; set it true, and make it // false again in the 'default' case int done = 1; long arg; switch(arg = CSI_ARG(args[argi])) { case CSI_ARG_MISSING: case 0: // Reset vterm_state_resetpen(state); break; case 1: { // Bold on const VTermColor *fg = &state->pen.fg; state->pen.bold = 1; setpenattr_bool(state, VTERM_ATTR_BOLD, 1); if(!VTERM_COLOR_IS_DEFAULT_FG(fg) && VTERM_COLOR_IS_INDEXED(fg) && fg->indexed.idx < 8 && state->bold_is_highbright) set_pen_col_ansi(state, VTERM_ATTR_FOREGROUND, fg->indexed.idx + (state->pen.bold ? 8 : 0)); break; } case 3: // Italic on state->pen.italic = 1; setpenattr_bool(state, VTERM_ATTR_ITALIC, 1); break; case 4: // Underline state->pen.underline = VTERM_UNDERLINE_SINGLE; if(CSI_ARG_HAS_MORE(args[argi])) { argi++; switch(CSI_ARG(args[argi])) { case 0: state->pen.underline = 0; break; case 1: state->pen.underline = VTERM_UNDERLINE_SINGLE; break; case 2: state->pen.underline = VTERM_UNDERLINE_DOUBLE; break; case 3: state->pen.underline = VTERM_UNDERLINE_CURLY; break; } } setpenattr_int(state, VTERM_ATTR_UNDERLINE, state->pen.underline); break; case 5: // Blink state->pen.blink = 1; setpenattr_bool(state, VTERM_ATTR_BLINK, 1); break; case 7: // Reverse on state->pen.reverse = 1; setpenattr_bool(state, VTERM_ATTR_REVERSE, 1); break; case 8: // Conceal on state->pen.conceal = 1; setpenattr_bool(state, VTERM_ATTR_CONCEAL, 1); break; case 9: // Strikethrough on state->pen.strike = 1; setpenattr_bool(state, VTERM_ATTR_STRIKE, 1); break; case 10: case 11: case 12: case 13: case 14: case 15: case 16: case 17: case 18: case 19: // Select font state->pen.font = CSI_ARG(args[argi]) - 10; setpenattr_int(state, VTERM_ATTR_FONT, state->pen.font); break; case 21: // Underline double state->pen.underline = VTERM_UNDERLINE_DOUBLE; setpenattr_int(state, VTERM_ATTR_UNDERLINE, state->pen.underline); break; case 22: // Bold off state->pen.bold = 0; setpenattr_bool(state, VTERM_ATTR_BOLD, 0); break; case 23: // Italic and Gothic (currently unsupported) off state->pen.italic = 0; setpenattr_bool(state, VTERM_ATTR_ITALIC, 0); break; case 24: // Underline off state->pen.underline = 0; setpenattr_int(state, VTERM_ATTR_UNDERLINE, 0); break; case 25: // Blink off state->pen.blink = 0; setpenattr_bool(state, VTERM_ATTR_BLINK, 0); break; case 27: // Reverse off state->pen.reverse = 0; setpenattr_bool(state, VTERM_ATTR_REVERSE, 0); break; case 28: // Conceal off (Reveal) state->pen.conceal = 0; setpenattr_bool(state, VTERM_ATTR_CONCEAL, 0); break; case 29: // Strikethrough off state->pen.strike = 0; setpenattr_bool(state, VTERM_ATTR_STRIKE, 0); break; case 30: case 31: case 32: case 33: case 34: case 35: case 36: case 37: // Foreground colour palette value = CSI_ARG(args[argi]) - 30; if(state->pen.bold && state->bold_is_highbright) value += 8; set_pen_col_ansi(state, VTERM_ATTR_FOREGROUND, value); break; case 38: // Foreground colour alternative palette if(argcount - argi < 1) return; argi += 1 + lookup_colour(state, CSI_ARG(args[argi+1]), args+argi+2, argcount-argi-2, &state->pen.fg); setpenattr_col(state, VTERM_ATTR_FOREGROUND, state->pen.fg); break; case 39: // Foreground colour default state->pen.fg = state->default_fg; setpenattr_col(state, VTERM_ATTR_FOREGROUND, state->pen.fg); break; case 40: case 41: case 42: case 43: case 44: case 45: case 46: case 47: // Background colour palette value = CSI_ARG(args[argi]) - 40; set_pen_col_ansi(state, VTERM_ATTR_BACKGROUND, value); break; case 48: // Background colour alternative palette if(argcount - argi < 1) return; argi += 1 + lookup_colour(state, CSI_ARG(args[argi+1]), args+argi+2, argcount-argi-2, &state->pen.bg); setpenattr_col(state, VTERM_ATTR_BACKGROUND, state->pen.bg); break; case 49: // Default background state->pen.bg = state->default_bg; setpenattr_col(state, VTERM_ATTR_BACKGROUND, state->pen.bg); break; case 90: case 91: case 92: case 93: case 94: case 95: case 96: case 97: // Foreground colour high-intensity palette value = CSI_ARG(args[argi]) - 90 + 8; set_pen_col_ansi(state, VTERM_ATTR_FOREGROUND, value); break; case 100: case 101: case 102: case 103: case 104: case 105: case 106: case 107: // Background colour high-intensity palette value = CSI_ARG(args[argi]) - 100 + 8; set_pen_col_ansi(state, VTERM_ATTR_BACKGROUND, value); break; default: done = 0; break; } if(!done) DEBUG_LOG("libvterm: Unhandled CSI SGR %ld\n", arg); while(CSI_ARG_HAS_MORE(args[argi++])); } } static int vterm_state_getpen_color(const VTermColor *col, int argi, long args[], int fg) { /* Do nothing if the given color is the default color */ if (( fg && VTERM_COLOR_IS_DEFAULT_FG(col)) || (!fg && VTERM_COLOR_IS_DEFAULT_BG(col))) { return argi; } /* Decide whether to send an indexed color or an RGB color */ if (VTERM_COLOR_IS_INDEXED(col)) { const uint8_t idx = col->indexed.idx; if (idx < 8) { args[argi++] = (idx + (fg ? 30 : 40)); } else if (idx < 16) { args[argi++] = (idx - 8 + (fg ? 90 : 100)); } else { args[argi++] = CSI_ARG_FLAG_MORE | (fg ? 38 : 48); args[argi++] = CSI_ARG_FLAG_MORE | 5; args[argi++] = idx; } } else if (VTERM_COLOR_IS_RGB(col)) { args[argi++] = CSI_ARG_FLAG_MORE | (fg ? 38 : 48); args[argi++] = CSI_ARG_FLAG_MORE | 2; args[argi++] = CSI_ARG_FLAG_MORE | col->rgb.red; args[argi++] = CSI_ARG_FLAG_MORE | col->rgb.green; args[argi++] = col->rgb.blue; } return argi; } INTERNAL int vterm_state_getpen(VTermState *state, long args[], int argcount) { int argi = 0; if(state->pen.bold) args[argi++] = 1; if(state->pen.italic) args[argi++] = 3; if(state->pen.underline == VTERM_UNDERLINE_SINGLE) args[argi++] = 4; if(state->pen.underline == VTERM_UNDERLINE_CURLY) args[argi++] = 4 | CSI_ARG_FLAG_MORE, args[argi++] = 3; if(state->pen.blink) args[argi++] = 5; if(state->pen.reverse) args[argi++] = 7; if(state->pen.conceal) args[argi++] = 8; if(state->pen.strike) args[argi++] = 9; if(state->pen.font) args[argi++] = 10 + state->pen.font; if(state->pen.underline == VTERM_UNDERLINE_DOUBLE) args[argi++] = 21; argi = vterm_state_getpen_color(&state->pen.fg, argi, args, true); argi = vterm_state_getpen_color(&state->pen.bg, argi, args, false); return argi; } int vterm_state_get_penattr(const VTermState *state, VTermAttr attr, VTermValue *val) { switch(attr) { case VTERM_ATTR_BOLD: val->boolean = state->pen.bold; return 1; case VTERM_ATTR_UNDERLINE: val->number = state->pen.underline; return 1; case VTERM_ATTR_ITALIC: val->boolean = state->pen.italic; return 1; case VTERM_ATTR_BLINK: val->boolean = state->pen.blink; return 1; case VTERM_ATTR_REVERSE: val->boolean = state->pen.reverse; return 1; case VTERM_ATTR_CONCEAL: val->boolean = state->pen.conceal; return 1; case VTERM_ATTR_STRIKE: val->boolean = state->pen.strike; return 1; case VTERM_ATTR_FONT: val->number = state->pen.font; return 1; case VTERM_ATTR_FOREGROUND: val->color = state->pen.fg; return 1; case VTERM_ATTR_BACKGROUND: val->color = state->pen.bg; return 1; case VTERM_N_ATTRS: return 0; } return 0; } cgdb-0.8.0/lib/vterm/vterm.c0000644000175000017500000002323514160506403012547 00000000000000#include "vterm_internal.h" #include #include #include #include /***************** * API functions * *****************/ static void *default_malloc(size_t size, void *allocdata) { void *ptr = malloc(size); if(ptr) memset(ptr, 0, size); return ptr; } static void default_free(void *ptr, void *allocdata) { free(ptr); } static VTermAllocatorFunctions default_allocator = { .malloc = &default_malloc, .free = &default_free, }; VTerm *vterm_new(int rows, int cols) { return vterm_new_with_allocator(rows, cols, &default_allocator, NULL); } VTerm *vterm_new_with_allocator(int rows, int cols, VTermAllocatorFunctions *funcs, void *allocdata) { /* Need to bootstrap using the allocator function directly */ VTerm *vt = (*funcs->malloc)(sizeof(VTerm), allocdata); vt->allocator = funcs; vt->allocdata = allocdata; vt->rows = rows; vt->cols = cols; vt->parser.state = NORMAL; vt->parser.callbacks = NULL; vt->parser.cbdata = NULL; vt->outfunc = NULL; vt->outdata = NULL; vt->outbuffer_len = 64; vt->outbuffer_cur = 0; vt->outbuffer = vterm_allocator_malloc(vt, vt->outbuffer_len); vt->tmpbuffer_len = 64; vt->tmpbuffer = vterm_allocator_malloc(vt, vt->tmpbuffer_len); return vt; } void vterm_free(VTerm *vt) { if(vt->screen) vterm_screen_free(vt->screen); if(vt->state) vterm_state_free(vt->state); vterm_allocator_free(vt, vt->outbuffer); vterm_allocator_free(vt, vt->tmpbuffer); vterm_allocator_free(vt, vt); } INTERNAL void *vterm_allocator_malloc(VTerm *vt, size_t size) { return (*vt->allocator->malloc)(size, vt->allocdata); } INTERNAL void vterm_allocator_free(VTerm *vt, void *ptr) { (*vt->allocator->free)(ptr, vt->allocdata); } void vterm_get_size(const VTerm *vt, int *rowsp, int *colsp) { if(rowsp) *rowsp = vt->rows; if(colsp) *colsp = vt->cols; } void vterm_set_size(VTerm *vt, int rows, int cols) { vt->rows = rows; vt->cols = cols; if(vt->parser.callbacks && vt->parser.callbacks->resize) (*vt->parser.callbacks->resize)(rows, cols, vt->parser.cbdata); } int vterm_get_utf8(const VTerm *vt) { return vt->mode.utf8; } void vterm_set_utf8(VTerm *vt, int is_utf8) { vt->mode.utf8 = is_utf8; } void vterm_output_set_callback(VTerm *vt, VTermOutputCallback *func, void *user) { vt->outfunc = func; vt->outdata = user; } INTERNAL void vterm_push_output_bytes(VTerm *vt, const char *bytes, size_t len) { if(vt->outfunc) { (vt->outfunc)(bytes, len, vt->outdata); return; } if(len > vt->outbuffer_len - vt->outbuffer_cur) return; memcpy(vt->outbuffer + vt->outbuffer_cur, bytes, len); vt->outbuffer_cur += len; } INTERNAL void vterm_push_output_vsprintf(VTerm *vt, const char *format, va_list args) { size_t len = vsnprintf(vt->tmpbuffer, vt->tmpbuffer_len, format, args); vterm_push_output_bytes(vt, vt->tmpbuffer, len); } INTERNAL void vterm_push_output_sprintf(VTerm *vt, const char *format, ...) { va_list args; va_start(args, format); vterm_push_output_vsprintf(vt, format, args); va_end(args); } INTERNAL void vterm_push_output_sprintf_ctrl(VTerm *vt, unsigned char ctrl, const char *fmt, ...) { size_t cur; if(ctrl >= 0x80 && !vt->mode.ctrl8bit) cur = snprintf(vt->tmpbuffer, vt->tmpbuffer_len, ESC_S "%c", ctrl - 0x40); else cur = snprintf(vt->tmpbuffer, vt->tmpbuffer_len, "%c", ctrl); if(cur >= vt->tmpbuffer_len) return; va_list args; va_start(args, fmt); cur += vsnprintf(vt->tmpbuffer + cur, vt->tmpbuffer_len - cur, fmt, args); va_end(args); if(cur >= vt->tmpbuffer_len) return; vterm_push_output_bytes(vt, vt->tmpbuffer, cur); } INTERNAL void vterm_push_output_sprintf_str(VTerm *vt, unsigned char ctrl, bool term, const char *fmt, ...) { size_t cur = 0; if(ctrl) { if(ctrl >= 0x80 && !vt->mode.ctrl8bit) cur = snprintf(vt->tmpbuffer, vt->tmpbuffer_len, ESC_S "%c", ctrl - 0x40); else cur = snprintf(vt->tmpbuffer, vt->tmpbuffer_len, "%c", ctrl); if(cur >= vt->tmpbuffer_len) return; } va_list args; va_start(args, fmt); cur += vsnprintf(vt->tmpbuffer + cur, vt->tmpbuffer_len - cur, fmt, args); va_end(args); if(cur >= vt->tmpbuffer_len) return; if(term) { cur += snprintf(vt->tmpbuffer + cur, vt->tmpbuffer_len - cur, vt->mode.ctrl8bit ? "\x9C" : ESC_S "\\"); // ST if(cur >= vt->tmpbuffer_len) return; } vterm_push_output_bytes(vt, vt->tmpbuffer, cur); } size_t vterm_output_get_buffer_size(const VTerm *vt) { return vt->outbuffer_len; } size_t vterm_output_get_buffer_current(const VTerm *vt) { return vt->outbuffer_cur; } size_t vterm_output_get_buffer_remaining(const VTerm *vt) { return vt->outbuffer_len - vt->outbuffer_cur; } size_t vterm_output_read(VTerm *vt, char *buffer, size_t len) { if(len > vt->outbuffer_cur) len = vt->outbuffer_cur; memcpy(buffer, vt->outbuffer, len); if(len < vt->outbuffer_cur) memmove(vt->outbuffer, vt->outbuffer + len, vt->outbuffer_cur - len); vt->outbuffer_cur -= len; return len; } VTermValueType vterm_get_attr_type(VTermAttr attr) { switch(attr) { case VTERM_ATTR_BOLD: return VTERM_VALUETYPE_BOOL; case VTERM_ATTR_UNDERLINE: return VTERM_VALUETYPE_INT; case VTERM_ATTR_ITALIC: return VTERM_VALUETYPE_BOOL; case VTERM_ATTR_BLINK: return VTERM_VALUETYPE_BOOL; case VTERM_ATTR_REVERSE: return VTERM_VALUETYPE_BOOL; case VTERM_ATTR_CONCEAL: return VTERM_VALUETYPE_BOOL; case VTERM_ATTR_STRIKE: return VTERM_VALUETYPE_BOOL; case VTERM_ATTR_FONT: return VTERM_VALUETYPE_INT; case VTERM_ATTR_FOREGROUND: return VTERM_VALUETYPE_COLOR; case VTERM_ATTR_BACKGROUND: return VTERM_VALUETYPE_COLOR; case VTERM_N_ATTRS: return 0; } return 0; /* UNREACHABLE */ } VTermValueType vterm_get_prop_type(VTermProp prop) { switch(prop) { case VTERM_PROP_CURSORVISIBLE: return VTERM_VALUETYPE_BOOL; case VTERM_PROP_CURSORBLINK: return VTERM_VALUETYPE_BOOL; case VTERM_PROP_ALTSCREEN: return VTERM_VALUETYPE_BOOL; case VTERM_PROP_TITLE: return VTERM_VALUETYPE_STRING; case VTERM_PROP_ICONNAME: return VTERM_VALUETYPE_STRING; case VTERM_PROP_REVERSE: return VTERM_VALUETYPE_BOOL; case VTERM_PROP_CURSORSHAPE: return VTERM_VALUETYPE_INT; case VTERM_PROP_MOUSE: return VTERM_VALUETYPE_INT; case VTERM_N_PROPS: return 0; } return 0; /* UNREACHABLE */ } void vterm_scroll_rect(VTermRect rect, int downward, int rightward, int (*moverect)(VTermRect src, VTermRect dest, void *user), int (*eraserect)(VTermRect rect, int selective, void *user), void *user) { VTermRect src; VTermRect dest; if(abs(downward) >= rect.end_row - rect.start_row || abs(rightward) >= rect.end_col - rect.start_col) { /* Scroll more than area; just erase the lot */ (*eraserect)(rect, 0, user); return; } if(rightward >= 0) { /* rect: [XXX................] * src: [----------------] * dest: [----------------] */ dest.start_col = rect.start_col; dest.end_col = rect.end_col - rightward; src.start_col = rect.start_col + rightward; src.end_col = rect.end_col; } else { /* rect: [................XXX] * src: [----------------] * dest: [----------------] */ int leftward = -rightward; dest.start_col = rect.start_col + leftward; dest.end_col = rect.end_col; src.start_col = rect.start_col; src.end_col = rect.end_col - leftward; } if(downward >= 0) { dest.start_row = rect.start_row; dest.end_row = rect.end_row - downward; src.start_row = rect.start_row + downward; src.end_row = rect.end_row; } else { int upward = -downward; dest.start_row = rect.start_row + upward; dest.end_row = rect.end_row; src.start_row = rect.start_row; src.end_row = rect.end_row - upward; } if(moverect) (*moverect)(dest, src, user); if(downward > 0) rect.start_row = rect.end_row - downward; else if(downward < 0) rect.end_row = rect.start_row - downward; if(rightward > 0) rect.start_col = rect.end_col - rightward; else if(rightward < 0) rect.end_col = rect.start_col - rightward; (*eraserect)(rect, 0, user); } void vterm_copy_cells(VTermRect dest, VTermRect src, void (*copycell)(VTermPos dest, VTermPos src, void *user), void *user) { int downward = src.start_row - dest.start_row; int rightward = src.start_col - dest.start_col; int init_row, test_row, init_col, test_col; int inc_row, inc_col; if(downward < 0) { init_row = dest.end_row - 1; test_row = dest.start_row - 1; inc_row = -1; } else /* downward >= 0 */ { init_row = dest.start_row; test_row = dest.end_row; inc_row = +1; } if(rightward < 0) { init_col = dest.end_col - 1; test_col = dest.start_col - 1; inc_col = -1; } else /* rightward >= 0 */ { init_col = dest.start_col; test_col = dest.end_col; inc_col = +1; } VTermPos pos; for(pos.row = init_row; pos.row != test_row; pos.row += inc_row) for(pos.col = init_col; pos.col != test_col; pos.col += inc_col) { VTermPos srcpos = { pos.row + downward, pos.col + rightward }; (*copycell)(pos, srcpos, user); } } void vterm_check_version(int major, int minor) { if(major != VTERM_VERSION_MAJOR) { fprintf(stderr, "libvterm major version mismatch; %d (wants) != %d (library)\n", major, VTERM_VERSION_MAJOR); exit(1); } if(minor > VTERM_VERSION_MINOR) { fprintf(stderr, "libvterm minor version mismatch; %d (wants) > %d (library)\n", minor, VTERM_VERSION_MINOR); exit(1); } // Happy } cgdb-0.8.0/lib/vterm/vterm_internal.h0000644000175000017500000001553614160506715014463 00000000000000#ifndef __VTERM_INTERNAL_H__ #define __VTERM_INTERNAL_H__ #include "vterm.h" #include #if defined(__GNUC__) # define INTERNAL __attribute__((visibility("internal"))) #else # define INTERNAL #endif #ifdef DEBUG # define DEBUG_LOG(...) fprintf(stderr, __VA_ARGS__) #else # define DEBUG_LOG(...) #endif #define ESC_S "\x1b" #define INTERMED_MAX 16 #define CSI_ARGS_MAX 16 #define CSI_LEADER_MAX 16 #define BUFIDX_PRIMARY 0 #define BUFIDX_ALTSCREEN 1 typedef struct VTermEncoding VTermEncoding; typedef struct { VTermEncoding *enc; // This size should be increased if required by other stateful encodings char data[4*sizeof(uint32_t)]; } VTermEncodingInstance; struct VTermPen { VTermColor fg; VTermColor bg; unsigned int bold:1; unsigned int underline:2; unsigned int italic:1; unsigned int blink:1; unsigned int reverse:1; unsigned int conceal:1; unsigned int strike:1; unsigned int font:4; /* To store 0-9 */ }; struct VTermState { VTerm *vt; const VTermStateCallbacks *callbacks; void *cbdata; const VTermStateFallbacks *fallbacks; void *fbdata; int rows; int cols; /* Current cursor position */ VTermPos pos; int at_phantom; /* True if we're on the "81st" phantom column to defer a wraparound */ int scrollregion_top; int scrollregion_bottom; /* -1 means unbounded */ #define SCROLLREGION_BOTTOM(state) ((state)->scrollregion_bottom > -1 ? (state)->scrollregion_bottom : (state)->rows) int scrollregion_left; #define SCROLLREGION_LEFT(state) ((state)->mode.leftrightmargin ? (state)->scrollregion_left : 0) int scrollregion_right; /* -1 means unbounded */ #define SCROLLREGION_RIGHT(state) ((state)->mode.leftrightmargin && (state)->scrollregion_right > -1 ? (state)->scrollregion_right : (state)->cols) /* Bitvector of tab stops */ unsigned char *tabstops; /* Primary and Altscreen; lineinfos[1] is lazily allocated as needed */ VTermLineInfo *lineinfos[2]; /* lineinfo will == lineinfos[0] or lineinfos[1], depending on altscreen */ VTermLineInfo *lineinfo; #define ROWWIDTH(state,row) ((state)->lineinfo[(row)].doublewidth ? ((state)->cols / 2) : (state)->cols) #define THISROWWIDTH(state) ROWWIDTH(state, (state)->pos.row) /* Mouse state */ int mouse_col, mouse_row; int mouse_buttons; int mouse_flags; #define MOUSE_WANT_CLICK 0x01 #define MOUSE_WANT_DRAG 0x02 #define MOUSE_WANT_MOVE 0x04 enum { MOUSE_X10, MOUSE_UTF8, MOUSE_SGR, MOUSE_RXVT } mouse_protocol; /* Last glyph output, for Unicode recombining purposes */ uint32_t *combine_chars; size_t combine_chars_size; // Number of ELEMENTS in the above int combine_width; // The width of the glyph above VTermPos combine_pos; // Position before movement struct { unsigned int keypad:1; unsigned int cursor:1; unsigned int autowrap:1; unsigned int insert:1; unsigned int newline:1; unsigned int cursor_visible:1; unsigned int cursor_blink:1; unsigned int cursor_shape:2; unsigned int alt_screen:1; unsigned int origin:1; unsigned int screen:1; unsigned int leftrightmargin:1; unsigned int bracketpaste:1; unsigned int report_focus:1; } mode; VTermEncodingInstance encoding[4], encoding_utf8; int gl_set, gr_set, gsingle_set; struct VTermPen pen; VTermColor default_fg; VTermColor default_bg; VTermColor colors[16]; // Store the 8 ANSI and the 8 ANSI high-brights only int bold_is_highbright; unsigned int protected_cell : 1; /* Saved state under DEC mode 1048/1049 */ struct { VTermPos pos; struct VTermPen pen; struct { unsigned int cursor_visible:1; unsigned int cursor_blink:1; unsigned int cursor_shape:2; } mode; } saved; /* Temporary state for DECRQSS parsing */ union { char decrqss[4]; struct { uint16_t mask; enum { SELECTION_INITIAL, SELECTION_SELECTED, SELECTION_QUERY, SELECTION_SET_INITIAL, SELECTION_SET, } state : 8; uint32_t recvpartial; uint32_t sendpartial; } selection; } tmp; struct { const VTermSelectionCallbacks *callbacks; void *user; char *buffer; size_t buflen; } selection; }; struct VTerm { VTermAllocatorFunctions *allocator; void *allocdata; int rows; int cols; struct { unsigned int utf8:1; unsigned int ctrl8bit:1; } mode; struct { enum VTermParserState { NORMAL, CSI_LEADER, CSI_ARGS, CSI_INTERMED, DCS_COMMAND, /* below here are the "string states" */ OSC_COMMAND, OSC, DCS, APC, PM, SOS, } state; bool in_esc : 1; int intermedlen; char intermed[INTERMED_MAX]; union { struct { int leaderlen; char leader[CSI_LEADER_MAX]; int argi; long args[CSI_ARGS_MAX]; } csi; struct { int command; } osc; struct { int commandlen; char command[CSI_LEADER_MAX]; } dcs; } v; const VTermParserCallbacks *callbacks; void *cbdata; bool string_initial; } parser; /* len == malloc()ed size; cur == number of valid bytes */ VTermOutputCallback *outfunc; void *outdata; char *outbuffer; size_t outbuffer_len; size_t outbuffer_cur; char *tmpbuffer; size_t tmpbuffer_len; VTermState *state; VTermScreen *screen; }; struct VTermEncoding { void (*init) (VTermEncoding *enc, void *data); void (*decode)(VTermEncoding *enc, void *data, uint32_t cp[], int *cpi, int cplen, const char bytes[], size_t *pos, size_t len); }; typedef enum { ENC_UTF8, ENC_SINGLE_94 } VTermEncodingType; void *vterm_allocator_malloc(VTerm *vt, size_t size); void vterm_allocator_free(VTerm *vt, void *ptr); void vterm_push_output_bytes(VTerm *vt, const char *bytes, size_t len); void vterm_push_output_vsprintf(VTerm *vt, const char *format, va_list args); void vterm_push_output_sprintf(VTerm *vt, const char *format, ...); void vterm_push_output_sprintf_ctrl(VTerm *vt, unsigned char ctrl, const char *fmt, ...); void vterm_push_output_sprintf_str(VTerm *vt, unsigned char ctrl, bool term, const char *fmt, ...); void vterm_state_free(VTermState *state); void vterm_state_newpen(VTermState *state); void vterm_state_resetpen(VTermState *state); void vterm_state_setpen(VTermState *state, const long args[], int argcount); int vterm_state_getpen(VTermState *state, long args[], int argcount); void vterm_state_savepen(VTermState *state, int save); enum { C1_SS3 = 0x8f, C1_DCS = 0x90, C1_CSI = 0x9b, C1_ST = 0x9c, C1_OSC = 0x9d, }; void vterm_state_push_output_sprintf_CSI(VTermState *vts, const char *format, ...); void vterm_screen_free(VTermScreen *screen); VTermEncoding *vterm_lookup_encoding(VTermEncodingType type, char designation); int vterm_unicode_width(uint32_t codepoint); int vterm_unicode_is_combining(uint32_t codepoint); #endif cgdb-0.8.0/lib/vterm/vterm_keycodes.h0000644000175000017500000000212214160506413014433 00000000000000#ifndef __VTERM_INPUT_H__ #define __VTERM_INPUT_H__ typedef enum { VTERM_MOD_NONE = 0x00, VTERM_MOD_SHIFT = 0x01, VTERM_MOD_ALT = 0x02, VTERM_MOD_CTRL = 0x04, VTERM_ALL_MODS_MASK = 0x07 } VTermModifier; typedef enum { VTERM_KEY_NONE, VTERM_KEY_ENTER, VTERM_KEY_TAB, VTERM_KEY_BACKSPACE, VTERM_KEY_ESCAPE, VTERM_KEY_UP, VTERM_KEY_DOWN, VTERM_KEY_LEFT, VTERM_KEY_RIGHT, VTERM_KEY_INS, VTERM_KEY_DEL, VTERM_KEY_HOME, VTERM_KEY_END, VTERM_KEY_PAGEUP, VTERM_KEY_PAGEDOWN, VTERM_KEY_FUNCTION_0 = 256, VTERM_KEY_FUNCTION_MAX = VTERM_KEY_FUNCTION_0 + 255, VTERM_KEY_KP_0, VTERM_KEY_KP_1, VTERM_KEY_KP_2, VTERM_KEY_KP_3, VTERM_KEY_KP_4, VTERM_KEY_KP_5, VTERM_KEY_KP_6, VTERM_KEY_KP_7, VTERM_KEY_KP_8, VTERM_KEY_KP_9, VTERM_KEY_KP_MULT, VTERM_KEY_KP_PLUS, VTERM_KEY_KP_COMMA, VTERM_KEY_KP_MINUS, VTERM_KEY_KP_PERIOD, VTERM_KEY_KP_DIVIDE, VTERM_KEY_KP_ENTER, VTERM_KEY_KP_EQUAL, VTERM_KEY_MAX, // Must be last VTERM_N_KEYS = VTERM_KEY_MAX } VTermKey; #define VTERM_KEY_FUNCTION(n) (VTERM_KEY_FUNCTION_0+(n)) #endif cgdb-0.8.0/lib/vterm/parser.c0000644000175000017500000002461314160506403012707 00000000000000#include "vterm_internal.h" #include #include #undef DEBUG_PARSER static bool is_intermed(unsigned char c) { return c >= 0x20 && c <= 0x2f; } static void do_control(VTerm *vt, unsigned char control) { if(vt->parser.callbacks && vt->parser.callbacks->control) if((*vt->parser.callbacks->control)(control, vt->parser.cbdata)) return; DEBUG_LOG("libvterm: Unhandled control 0x%02x\n", control); } static void do_csi(VTerm *vt, char command) { #ifdef DEBUG_PARSER printf("Parsed CSI args as:\n", arglen, args); printf(" leader: %s\n", vt->parser.v.csi.leader); for(int argi = 0; argi < vt->parser.v.csi.argi; argi++) { printf(" %lu", CSI_ARG(vt->parser.v.csi.args[argi])); if(!CSI_ARG_HAS_MORE(vt->parser.v.csi.args[argi])) printf("\n"); printf(" intermed: %s\n", vt->parser.intermed); } #endif if(vt->parser.callbacks && vt->parser.callbacks->csi) if((*vt->parser.callbacks->csi)( vt->parser.v.csi.leaderlen ? vt->parser.v.csi.leader : NULL, vt->parser.v.csi.args, vt->parser.v.csi.argi, vt->parser.intermedlen ? vt->parser.intermed : NULL, command, vt->parser.cbdata)) return; DEBUG_LOG("libvterm: Unhandled CSI %c\n", command); } static void do_escape(VTerm *vt, char command) { char seq[INTERMED_MAX+1]; size_t len = vt->parser.intermedlen; strncpy(seq, vt->parser.intermed, len); seq[len++] = command; seq[len] = 0; if(vt->parser.callbacks && vt->parser.callbacks->escape) if((*vt->parser.callbacks->escape)(seq, len, vt->parser.cbdata)) return; DEBUG_LOG("libvterm: Unhandled escape ESC 0x%02x\n", command); } static void string_fragment(VTerm *vt, const char *str, size_t len, bool final) { VTermStringFragment frag = { .str = str, .len = len, .initial = vt->parser.string_initial, .final = final, }; switch(vt->parser.state) { case OSC: if(vt->parser.callbacks && vt->parser.callbacks->osc) (*vt->parser.callbacks->osc)(vt->parser.v.osc.command, frag, vt->parser.cbdata); break; case DCS: if(vt->parser.callbacks && vt->parser.callbacks->dcs) (*vt->parser.callbacks->dcs)(vt->parser.v.dcs.command, vt->parser.v.dcs.commandlen, frag, vt->parser.cbdata); break; case APC: if(vt->parser.callbacks && vt->parser.callbacks->apc) (*vt->parser.callbacks->apc)(frag, vt->parser.cbdata); break; case PM: if(vt->parser.callbacks && vt->parser.callbacks->pm) (*vt->parser.callbacks->pm)(frag, vt->parser.cbdata); break; case SOS: if(vt->parser.callbacks && vt->parser.callbacks->sos) (*vt->parser.callbacks->sos)(frag, vt->parser.cbdata); break; case NORMAL: case CSI_LEADER: case CSI_ARGS: case CSI_INTERMED: case OSC_COMMAND: case DCS_COMMAND: break; } vt->parser.string_initial = false; } size_t vterm_input_write(VTerm *vt, const char *bytes, size_t len) { size_t pos = 0; const char *string_start; switch(vt->parser.state) { case NORMAL: case CSI_LEADER: case CSI_ARGS: case CSI_INTERMED: case OSC_COMMAND: case DCS_COMMAND: string_start = NULL; break; case OSC: case DCS: case APC: case PM: case SOS: string_start = bytes; break; } #define ENTER_STATE(st) do { vt->parser.state = st; string_start = NULL; } while(0) #define ENTER_NORMAL_STATE() ENTER_STATE(NORMAL) #define IS_STRING_STATE() (vt->parser.state >= OSC_COMMAND) for( ; pos < len; pos++) { unsigned char c = bytes[pos]; bool c1_allowed = !vt->mode.utf8; if(c == 0x00 || c == 0x7f) { // NUL, DEL if(IS_STRING_STATE()) { string_fragment(vt, string_start, bytes + pos - string_start, false); string_start = bytes + pos + 1; } continue; } if(c == 0x18 || c == 0x1a) { // CAN, SUB vt->parser.in_esc = false; ENTER_NORMAL_STATE(); continue; } else if(c == 0x1b) { // ESC vt->parser.intermedlen = 0; if(!IS_STRING_STATE()) vt->parser.state = NORMAL; vt->parser.in_esc = true; continue; } else if(c == 0x07 && // BEL, can stand for ST in OSC or DCS state IS_STRING_STATE()) { // fallthrough } else if(c < 0x20) { // other C0 if(vt->parser.state == SOS) continue; // All other C0s permitted in SOS if(IS_STRING_STATE()) string_fragment(vt, string_start, bytes + pos - string_start, false); do_control(vt, c); if(IS_STRING_STATE()) string_start = bytes + pos + 1; continue; } // else fallthrough size_t string_len = bytes + pos - string_start; if(vt->parser.in_esc) { // Hoist an ESC letter into a C1 if we're not in a string mode // Always accept ESC \ == ST even in string mode if(!vt->parser.intermedlen && c >= 0x40 && c < 0x60 && ((!IS_STRING_STATE() || c == 0x5c))) { c += 0x40; c1_allowed = true; if(string_len) string_len -= 1; vt->parser.in_esc = false; } else { string_start = NULL; vt->parser.state = NORMAL; } } switch(vt->parser.state) { case CSI_LEADER: /* Extract leader bytes 0x3c to 0x3f */ if(c >= 0x3c && c <= 0x3f) { if(vt->parser.v.csi.leaderlen < CSI_LEADER_MAX-1) vt->parser.v.csi.leader[vt->parser.v.csi.leaderlen++] = c; break; } /* else fallthrough */ vt->parser.v.csi.leader[vt->parser.v.csi.leaderlen] = 0; vt->parser.v.csi.argi = 0; vt->parser.v.csi.args[0] = CSI_ARG_MISSING; vt->parser.state = CSI_ARGS; /* fallthrough */ case CSI_ARGS: /* Numerical value of argument */ if(c >= '0' && c <= '9') { if(vt->parser.v.csi.args[vt->parser.v.csi.argi] == CSI_ARG_MISSING) vt->parser.v.csi.args[vt->parser.v.csi.argi] = 0; vt->parser.v.csi.args[vt->parser.v.csi.argi] *= 10; vt->parser.v.csi.args[vt->parser.v.csi.argi] += c - '0'; break; } if(c == ':') { vt->parser.v.csi.args[vt->parser.v.csi.argi] |= CSI_ARG_FLAG_MORE; c = ';'; } if(c == ';') { vt->parser.v.csi.argi++; vt->parser.v.csi.args[vt->parser.v.csi.argi] = CSI_ARG_MISSING; break; } /* else fallthrough */ vt->parser.v.csi.argi++; vt->parser.intermedlen = 0; vt->parser.state = CSI_INTERMED; case CSI_INTERMED: if(is_intermed(c)) { if(vt->parser.intermedlen < INTERMED_MAX-1) vt->parser.intermed[vt->parser.intermedlen++] = c; break; } else if(c == 0x1b) { /* ESC in CSI cancels */ } else if(c >= 0x40 && c <= 0x7e) { vt->parser.intermed[vt->parser.intermedlen] = 0; do_csi(vt, c); } /* else was invalid CSI */ ENTER_NORMAL_STATE(); break; case OSC_COMMAND: /* Numerical value of command */ if(c >= '0' && c <= '9') { if(vt->parser.v.osc.command == -1) vt->parser.v.osc.command = 0; else vt->parser.v.osc.command *= 10; vt->parser.v.osc.command += c - '0'; break; } if(c == ';') { vt->parser.state = OSC; string_start = bytes + pos + 1; break; } /* else fallthrough */ string_start = bytes + pos; string_len = 0; vt->parser.state = OSC; goto string_state; case DCS_COMMAND: if(vt->parser.v.dcs.commandlen < CSI_LEADER_MAX) vt->parser.v.dcs.command[vt->parser.v.dcs.commandlen++] = c; if(c >= 0x40 && c<= 0x7e) { string_start = bytes + pos + 1; vt->parser.state = DCS; } break; string_state: case OSC: case DCS: case APC: case PM: case SOS: if(c == 0x07 || (c1_allowed && c == 0x9c)) { string_fragment(vt, string_start, string_len, true); ENTER_NORMAL_STATE(); } break; case NORMAL: if(vt->parser.in_esc) { if(is_intermed(c)) { if(vt->parser.intermedlen < INTERMED_MAX-1) vt->parser.intermed[vt->parser.intermedlen++] = c; } else if(c >= 0x30 && c < 0x7f) { do_escape(vt, c); vt->parser.in_esc = 0; ENTER_NORMAL_STATE(); } else { DEBUG_LOG("TODO: Unhandled byte %02x in Escape\n", c); } break; } if(c1_allowed && c >= 0x80 && c < 0xa0) { switch(c) { case 0x90: // DCS vt->parser.string_initial = true; vt->parser.v.dcs.commandlen = 0; ENTER_STATE(DCS_COMMAND); break; case 0x98: // SOS vt->parser.string_initial = true; ENTER_STATE(SOS); string_start = bytes + pos + 1; string_len = 0; break; case 0x9b: // CSI vt->parser.v.csi.leaderlen = 0; ENTER_STATE(CSI_LEADER); break; case 0x9d: // OSC vt->parser.v.osc.command = -1; vt->parser.string_initial = true; string_start = bytes + pos + 1; ENTER_STATE(OSC_COMMAND); break; case 0x9e: // PM vt->parser.string_initial = true; ENTER_STATE(PM); string_start = bytes + pos + 1; string_len = 0; break; case 0x9f: // APC vt->parser.string_initial = true; ENTER_STATE(APC); string_start = bytes + pos + 1; string_len = 0; break; default: do_control(vt, c); break; } } else { size_t eaten = 0; if(vt->parser.callbacks && vt->parser.callbacks->text) eaten = (*vt->parser.callbacks->text)(bytes + pos, len - pos, vt->parser.cbdata); if(!eaten) { DEBUG_LOG("libvterm: Text callback did not consume any input\n"); /* force it to make progress */ eaten = 1; } pos += (eaten - 1); // we'll ++ it again in a moment } break; } } if(string_start) { size_t string_len = bytes + pos - string_start; if(vt->parser.in_esc) string_len -= 1; string_fragment(vt, string_start, string_len, false); } return len; } void vterm_parser_set_callbacks(VTerm *vt, const VTermParserCallbacks *callbacks, void *user) { vt->parser.callbacks = callbacks; vt->parser.cbdata = user; } void *vterm_parser_get_cbdata(VTerm *vt) { return vt->parser.cbdata; } cgdb-0.8.0/lib/vterm/unicode.c0000644000175000017500000003447714160506403013052 00000000000000#include "vterm_internal.h" // ### The following from http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c // With modifications: // made functions static // moved 'combining' table to file scope, so other functions can see it // ################################################################### /* * This is an implementation of wcwidth() and wcswidth() (defined in * IEEE Std 1002.1-2001) for Unicode. * * http://www.opengroup.org/onlinepubs/007904975/functions/wcwidth.html * http://www.opengroup.org/onlinepubs/007904975/functions/wcswidth.html * * In fixed-width output devices, Latin characters all occupy a single * "cell" position of equal width, whereas ideographic CJK characters * occupy two such cells. Interoperability between terminal-line * applications and (teletype-style) character terminals using the * UTF-8 encoding requires agreement on which character should advance * the cursor by how many cell positions. No established formal * standards exist at present on which Unicode character shall occupy * how many cell positions on character terminals. These routines are * a first attempt of defining such behavior based on simple rules * applied to data provided by the Unicode Consortium. * * For some graphical characters, the Unicode standard explicitly * defines a character-cell width via the definition of the East Asian * FullWidth (F), Wide (W), Half-width (H), and Narrow (Na) classes. * In all these cases, there is no ambiguity about which width a * terminal shall use. For characters in the East Asian Ambiguous (A) * class, the width choice depends purely on a preference of backward * compatibility with either historic CJK or Western practice. * Choosing single-width for these characters is easy to justify as * the appropriate long-term solution, as the CJK practice of * displaying these characters as double-width comes from historic * implementation simplicity (8-bit encoded characters were displayed * single-width and 16-bit ones double-width, even for Greek, * Cyrillic, etc.) and not any typographic considerations. * * Much less clear is the choice of width for the Not East Asian * (Neutral) class. Existing practice does not dictate a width for any * of these characters. It would nevertheless make sense * typographically to allocate two character cells to characters such * as for instance EM SPACE or VOLUME INTEGRAL, which cannot be * represented adequately with a single-width glyph. The following * routines at present merely assign a single-cell width to all * neutral characters, in the interest of simplicity. This is not * entirely satisfactory and should be reconsidered before * establishing a formal standard in this area. At the moment, the * decision which Not East Asian (Neutral) characters should be * represented by double-width glyphs cannot yet be answered by * applying a simple rule from the Unicode database content. Setting * up a proper standard for the behavior of UTF-8 character terminals * will require a careful analysis not only of each Unicode character, * but also of each presentation form, something the author of these * routines has avoided to do so far. * * http://www.unicode.org/unicode/reports/tr11/ * * Markus Kuhn -- 2007-05-26 (Unicode 5.0) * * Permission to use, copy, modify, and distribute this software * for any purpose and without fee is hereby granted. The author * disclaims all warranties with regard to this software. * * Latest version: http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c */ struct interval { int first; int last; }; /* sorted list of non-overlapping intervals of non-spacing characters */ /* generated by "uniset +cat=Me +cat=Mn +cat=Cf -00AD +1160-11FF +200B c" */ static const struct interval combining[] = { { 0x0300, 0x036F }, { 0x0483, 0x0486 }, { 0x0488, 0x0489 }, { 0x0591, 0x05BD }, { 0x05BF, 0x05BF }, { 0x05C1, 0x05C2 }, { 0x05C4, 0x05C5 }, { 0x05C7, 0x05C7 }, { 0x0600, 0x0603 }, { 0x0610, 0x0615 }, { 0x064B, 0x065E }, { 0x0670, 0x0670 }, { 0x06D6, 0x06E4 }, { 0x06E7, 0x06E8 }, { 0x06EA, 0x06ED }, { 0x070F, 0x070F }, { 0x0711, 0x0711 }, { 0x0730, 0x074A }, { 0x07A6, 0x07B0 }, { 0x07EB, 0x07F3 }, { 0x0901, 0x0902 }, { 0x093C, 0x093C }, { 0x0941, 0x0948 }, { 0x094D, 0x094D }, { 0x0951, 0x0954 }, { 0x0962, 0x0963 }, { 0x0981, 0x0981 }, { 0x09BC, 0x09BC }, { 0x09C1, 0x09C4 }, { 0x09CD, 0x09CD }, { 0x09E2, 0x09E3 }, { 0x0A01, 0x0A02 }, { 0x0A3C, 0x0A3C }, { 0x0A41, 0x0A42 }, { 0x0A47, 0x0A48 }, { 0x0A4B, 0x0A4D }, { 0x0A70, 0x0A71 }, { 0x0A81, 0x0A82 }, { 0x0ABC, 0x0ABC }, { 0x0AC1, 0x0AC5 }, { 0x0AC7, 0x0AC8 }, { 0x0ACD, 0x0ACD }, { 0x0AE2, 0x0AE3 }, { 0x0B01, 0x0B01 }, { 0x0B3C, 0x0B3C }, { 0x0B3F, 0x0B3F }, { 0x0B41, 0x0B43 }, { 0x0B4D, 0x0B4D }, { 0x0B56, 0x0B56 }, { 0x0B82, 0x0B82 }, { 0x0BC0, 0x0BC0 }, { 0x0BCD, 0x0BCD }, { 0x0C3E, 0x0C40 }, { 0x0C46, 0x0C48 }, { 0x0C4A, 0x0C4D }, { 0x0C55, 0x0C56 }, { 0x0CBC, 0x0CBC }, { 0x0CBF, 0x0CBF }, { 0x0CC6, 0x0CC6 }, { 0x0CCC, 0x0CCD }, { 0x0CE2, 0x0CE3 }, { 0x0D41, 0x0D43 }, { 0x0D4D, 0x0D4D }, { 0x0DCA, 0x0DCA }, { 0x0DD2, 0x0DD4 }, { 0x0DD6, 0x0DD6 }, { 0x0E31, 0x0E31 }, { 0x0E34, 0x0E3A }, { 0x0E47, 0x0E4E }, { 0x0EB1, 0x0EB1 }, { 0x0EB4, 0x0EB9 }, { 0x0EBB, 0x0EBC }, { 0x0EC8, 0x0ECD }, { 0x0F18, 0x0F19 }, { 0x0F35, 0x0F35 }, { 0x0F37, 0x0F37 }, { 0x0F39, 0x0F39 }, { 0x0F71, 0x0F7E }, { 0x0F80, 0x0F84 }, { 0x0F86, 0x0F87 }, { 0x0F90, 0x0F97 }, { 0x0F99, 0x0FBC }, { 0x0FC6, 0x0FC6 }, { 0x102D, 0x1030 }, { 0x1032, 0x1032 }, { 0x1036, 0x1037 }, { 0x1039, 0x1039 }, { 0x1058, 0x1059 }, { 0x1160, 0x11FF }, { 0x135F, 0x135F }, { 0x1712, 0x1714 }, { 0x1732, 0x1734 }, { 0x1752, 0x1753 }, { 0x1772, 0x1773 }, { 0x17B4, 0x17B5 }, { 0x17B7, 0x17BD }, { 0x17C6, 0x17C6 }, { 0x17C9, 0x17D3 }, { 0x17DD, 0x17DD }, { 0x180B, 0x180D }, { 0x18A9, 0x18A9 }, { 0x1920, 0x1922 }, { 0x1927, 0x1928 }, { 0x1932, 0x1932 }, { 0x1939, 0x193B }, { 0x1A17, 0x1A18 }, { 0x1B00, 0x1B03 }, { 0x1B34, 0x1B34 }, { 0x1B36, 0x1B3A }, { 0x1B3C, 0x1B3C }, { 0x1B42, 0x1B42 }, { 0x1B6B, 0x1B73 }, { 0x1DC0, 0x1DCA }, { 0x1DFE, 0x1DFF }, { 0x200B, 0x200F }, { 0x202A, 0x202E }, { 0x2060, 0x2063 }, { 0x206A, 0x206F }, { 0x20D0, 0x20EF }, { 0x302A, 0x302F }, { 0x3099, 0x309A }, { 0xA806, 0xA806 }, { 0xA80B, 0xA80B }, { 0xA825, 0xA826 }, { 0xFB1E, 0xFB1E }, { 0xFE00, 0xFE0F }, { 0xFE20, 0xFE23 }, { 0xFEFF, 0xFEFF }, { 0xFFF9, 0xFFFB }, { 0x10A01, 0x10A03 }, { 0x10A05, 0x10A06 }, { 0x10A0C, 0x10A0F }, { 0x10A38, 0x10A3A }, { 0x10A3F, 0x10A3F }, { 0x1D167, 0x1D169 }, { 0x1D173, 0x1D182 }, { 0x1D185, 0x1D18B }, { 0x1D1AA, 0x1D1AD }, { 0x1D242, 0x1D244 }, { 0xE0001, 0xE0001 }, { 0xE0020, 0xE007F }, { 0xE0100, 0xE01EF } }; /* auxiliary function for binary search in interval table */ static int bisearch(uint32_t ucs, const struct interval *table, int max) { int min = 0; int mid; if (ucs < table[0].first || ucs > table[max].last) return 0; while (max >= min) { mid = (min + max) / 2; if (ucs > table[mid].last) min = mid + 1; else if (ucs < table[mid].first) max = mid - 1; else return 1; } return 0; } /* The following two functions define the column width of an ISO 10646 * character as follows: * * - The null character (U+0000) has a column width of 0. * * - Other C0/C1 control characters and DEL will lead to a return * value of -1. * * - Non-spacing and enclosing combining characters (general * category code Mn or Me in the Unicode database) have a * column width of 0. * * - SOFT HYPHEN (U+00AD) has a column width of 1. * * - Other format characters (general category code Cf in the Unicode * database) and ZERO WIDTH SPACE (U+200B) have a column width of 0. * * - Hangul Jamo medial vowels and final consonants (U+1160-U+11FF) * have a column width of 0. * * - Spacing characters in the East Asian Wide (W) or East Asian * Full-width (F) category as defined in Unicode Technical * Report #11 have a column width of 2. * * - All remaining characters (including all printable * ISO 8859-1 and WGL4 characters, Unicode control characters, * etc.) have a column width of 1. * * This implementation assumes that uint32_t characters are encoded * in ISO 10646. */ static int mk_wcwidth(uint32_t ucs) { /* test for 8-bit control characters */ if (ucs == 0) return 0; if (ucs < 32 || (ucs >= 0x7f && ucs < 0xa0)) return -1; /* binary search in table of non-spacing characters */ if (bisearch(ucs, combining, sizeof(combining) / sizeof(struct interval) - 1)) return 0; /* if we arrive here, ucs is not a combining or C0/C1 control character */ return 1 + (ucs >= 0x1100 && (ucs <= 0x115f || /* Hangul Jamo init. consonants */ ucs == 0x2329 || ucs == 0x232a || (ucs >= 0x2e80 && ucs <= 0xa4cf && ucs != 0x303f) || /* CJK ... Yi */ (ucs >= 0xac00 && ucs <= 0xd7a3) || /* Hangul Syllables */ (ucs >= 0xf900 && ucs <= 0xfaff) || /* CJK Compatibility Ideographs */ (ucs >= 0xfe10 && ucs <= 0xfe19) || /* Vertical forms */ (ucs >= 0xfe30 && ucs <= 0xfe6f) || /* CJK Compatibility Forms */ (ucs >= 0xff00 && ucs <= 0xff60) || /* Fullwidth Forms */ (ucs >= 0xffe0 && ucs <= 0xffe6) || (ucs >= 0x20000 && ucs <= 0x2fffd) || (ucs >= 0x30000 && ucs <= 0x3fffd))); } static int mk_wcswidth(const uint32_t *pwcs, size_t n) { int w, width = 0; for (;*pwcs && n-- > 0; pwcs++) if ((w = mk_wcwidth(*pwcs)) < 0) return -1; else width += w; return width; } /* * The following functions are the same as mk_wcwidth() and * mk_wcswidth(), except that spacing characters in the East Asian * Ambiguous (A) category as defined in Unicode Technical Report #11 * have a column width of 2. This variant might be useful for users of * CJK legacy encodings who want to migrate to UCS without changing * the traditional terminal character-width behaviour. It is not * otherwise recommended for general use. */ static int mk_wcwidth_cjk(uint32_t ucs) { /* sorted list of non-overlapping intervals of East Asian Ambiguous * characters, generated by "uniset +WIDTH-A -cat=Me -cat=Mn -cat=Cf c" */ static const struct interval ambiguous[] = { { 0x00A1, 0x00A1 }, { 0x00A4, 0x00A4 }, { 0x00A7, 0x00A8 }, { 0x00AA, 0x00AA }, { 0x00AE, 0x00AE }, { 0x00B0, 0x00B4 }, { 0x00B6, 0x00BA }, { 0x00BC, 0x00BF }, { 0x00C6, 0x00C6 }, { 0x00D0, 0x00D0 }, { 0x00D7, 0x00D8 }, { 0x00DE, 0x00E1 }, { 0x00E6, 0x00E6 }, { 0x00E8, 0x00EA }, { 0x00EC, 0x00ED }, { 0x00F0, 0x00F0 }, { 0x00F2, 0x00F3 }, { 0x00F7, 0x00FA }, { 0x00FC, 0x00FC }, { 0x00FE, 0x00FE }, { 0x0101, 0x0101 }, { 0x0111, 0x0111 }, { 0x0113, 0x0113 }, { 0x011B, 0x011B }, { 0x0126, 0x0127 }, { 0x012B, 0x012B }, { 0x0131, 0x0133 }, { 0x0138, 0x0138 }, { 0x013F, 0x0142 }, { 0x0144, 0x0144 }, { 0x0148, 0x014B }, { 0x014D, 0x014D }, { 0x0152, 0x0153 }, { 0x0166, 0x0167 }, { 0x016B, 0x016B }, { 0x01CE, 0x01CE }, { 0x01D0, 0x01D0 }, { 0x01D2, 0x01D2 }, { 0x01D4, 0x01D4 }, { 0x01D6, 0x01D6 }, { 0x01D8, 0x01D8 }, { 0x01DA, 0x01DA }, { 0x01DC, 0x01DC }, { 0x0251, 0x0251 }, { 0x0261, 0x0261 }, { 0x02C4, 0x02C4 }, { 0x02C7, 0x02C7 }, { 0x02C9, 0x02CB }, { 0x02CD, 0x02CD }, { 0x02D0, 0x02D0 }, { 0x02D8, 0x02DB }, { 0x02DD, 0x02DD }, { 0x02DF, 0x02DF }, { 0x0391, 0x03A1 }, { 0x03A3, 0x03A9 }, { 0x03B1, 0x03C1 }, { 0x03C3, 0x03C9 }, { 0x0401, 0x0401 }, { 0x0410, 0x044F }, { 0x0451, 0x0451 }, { 0x2010, 0x2010 }, { 0x2013, 0x2016 }, { 0x2018, 0x2019 }, { 0x201C, 0x201D }, { 0x2020, 0x2022 }, { 0x2024, 0x2027 }, { 0x2030, 0x2030 }, { 0x2032, 0x2033 }, { 0x2035, 0x2035 }, { 0x203B, 0x203B }, { 0x203E, 0x203E }, { 0x2074, 0x2074 }, { 0x207F, 0x207F }, { 0x2081, 0x2084 }, { 0x20AC, 0x20AC }, { 0x2103, 0x2103 }, { 0x2105, 0x2105 }, { 0x2109, 0x2109 }, { 0x2113, 0x2113 }, { 0x2116, 0x2116 }, { 0x2121, 0x2122 }, { 0x2126, 0x2126 }, { 0x212B, 0x212B }, { 0x2153, 0x2154 }, { 0x215B, 0x215E }, { 0x2160, 0x216B }, { 0x2170, 0x2179 }, { 0x2190, 0x2199 }, { 0x21B8, 0x21B9 }, { 0x21D2, 0x21D2 }, { 0x21D4, 0x21D4 }, { 0x21E7, 0x21E7 }, { 0x2200, 0x2200 }, { 0x2202, 0x2203 }, { 0x2207, 0x2208 }, { 0x220B, 0x220B }, { 0x220F, 0x220F }, { 0x2211, 0x2211 }, { 0x2215, 0x2215 }, { 0x221A, 0x221A }, { 0x221D, 0x2220 }, { 0x2223, 0x2223 }, { 0x2225, 0x2225 }, { 0x2227, 0x222C }, { 0x222E, 0x222E }, { 0x2234, 0x2237 }, { 0x223C, 0x223D }, { 0x2248, 0x2248 }, { 0x224C, 0x224C }, { 0x2252, 0x2252 }, { 0x2260, 0x2261 }, { 0x2264, 0x2267 }, { 0x226A, 0x226B }, { 0x226E, 0x226F }, { 0x2282, 0x2283 }, { 0x2286, 0x2287 }, { 0x2295, 0x2295 }, { 0x2299, 0x2299 }, { 0x22A5, 0x22A5 }, { 0x22BF, 0x22BF }, { 0x2312, 0x2312 }, { 0x2460, 0x24E9 }, { 0x24EB, 0x254B }, { 0x2550, 0x2573 }, { 0x2580, 0x258F }, { 0x2592, 0x2595 }, { 0x25A0, 0x25A1 }, { 0x25A3, 0x25A9 }, { 0x25B2, 0x25B3 }, { 0x25B6, 0x25B7 }, { 0x25BC, 0x25BD }, { 0x25C0, 0x25C1 }, { 0x25C6, 0x25C8 }, { 0x25CB, 0x25CB }, { 0x25CE, 0x25D1 }, { 0x25E2, 0x25E5 }, { 0x25EF, 0x25EF }, { 0x2605, 0x2606 }, { 0x2609, 0x2609 }, { 0x260E, 0x260F }, { 0x2614, 0x2615 }, { 0x261C, 0x261C }, { 0x261E, 0x261E }, { 0x2640, 0x2640 }, { 0x2642, 0x2642 }, { 0x2660, 0x2661 }, { 0x2663, 0x2665 }, { 0x2667, 0x266A }, { 0x266C, 0x266D }, { 0x266F, 0x266F }, { 0x273D, 0x273D }, { 0x2776, 0x277F }, { 0xE000, 0xF8FF }, { 0xFFFD, 0xFFFD }, { 0xF0000, 0xFFFFD }, { 0x100000, 0x10FFFD } }; /* binary search in table of non-spacing characters */ if (bisearch(ucs, ambiguous, sizeof(ambiguous) / sizeof(struct interval) - 1)) return 2; return mk_wcwidth(ucs); } static int mk_wcswidth_cjk(const uint32_t *pwcs, size_t n) { int w, width = 0; for (;*pwcs && n-- > 0; pwcs++) if ((w = mk_wcwidth_cjk(*pwcs)) < 0) return -1; else width += w; return width; } // ################################ // ### The rest added by Paul Evans static const struct interval fullwidth[] = { #include "fullwidth.inc" }; INTERNAL int vterm_unicode_width(uint32_t codepoint) { if(bisearch(codepoint, fullwidth, sizeof(fullwidth) / sizeof(fullwidth[0]) - 1)) return 2; return mk_wcwidth(codepoint); } INTERNAL int vterm_unicode_is_combining(uint32_t codepoint) { return bisearch(codepoint, combining, sizeof(combining) / sizeof(struct interval) - 1); } cgdb-0.8.0/lib/vterm/screen.c0000644000175000017500000006463714160506403012704 00000000000000#include "vterm_internal.h" #include #include #include "rect.h" #include "utf8.h" #define UNICODE_SPACE 0x20 #define UNICODE_LINEFEED 0x0a /* State of the pen at some moment in time, also used in a cell */ typedef struct { /* After the bitfield */ VTermColor fg, bg; unsigned int bold : 1; unsigned int underline : 2; unsigned int italic : 1; unsigned int blink : 1; unsigned int reverse : 1; unsigned int conceal : 1; unsigned int strike : 1; unsigned int font : 4; /* 0 to 9 */ /* Extra state storage that isn't strictly pen-related */ unsigned int protected_cell : 1; unsigned int dwl : 1; /* on a DECDWL or DECDHL line */ unsigned int dhl : 2; /* on a DECDHL line (1=top 2=bottom) */ } ScreenPen; /* Internal representation of a screen cell */ typedef struct { uint32_t chars[VTERM_MAX_CHARS_PER_CELL]; ScreenPen pen; } ScreenCell; struct VTermScreen { VTerm *vt; VTermState *state; const VTermScreenCallbacks *callbacks; void *cbdata; VTermDamageSize damage_merge; /* start_row == -1 => no damage */ VTermRect damaged; VTermRect pending_scrollrect; int pending_scroll_downward, pending_scroll_rightward; int rows; int cols; int global_reverse; /* Primary and Altscreen. buffers[1] is lazily allocated as needed */ ScreenCell *buffers[2]; /* buffer will == buffers[0] or buffers[1], depending on altscreen */ ScreenCell *buffer; /* buffer for a single screen row used in scrollback storage callbacks */ VTermScreenCell *sb_buffer; ScreenPen pen; }; static inline void clearcell(const VTermScreen *screen, ScreenCell *cell) { cell->chars[0] = 0; cell->pen = screen->pen; } static inline ScreenCell *getcell(const VTermScreen *screen, int row, int col) { if(row < 0 || row >= screen->rows) return NULL; if(col < 0 || col >= screen->cols) return NULL; return screen->buffer + (screen->cols * row) + col; } static ScreenCell *alloc_buffer(VTermScreen *screen, int rows, int cols) { ScreenCell *new_buffer = vterm_allocator_malloc(screen->vt, sizeof(ScreenCell) * rows * cols); for(int row = 0; row < rows; row++) { for(int col = 0; col < cols; col++) { clearcell(screen, &new_buffer[row * cols + col]); } } return new_buffer; } static void damagerect(VTermScreen *screen, VTermRect rect) { VTermRect emit; switch(screen->damage_merge) { case VTERM_DAMAGE_CELL: /* Always emit damage event */ emit = rect; break; case VTERM_DAMAGE_ROW: /* Emit damage longer than one row. Try to merge with existing damage in * the same row */ if(rect.end_row > rect.start_row + 1) { // Bigger than 1 line - flush existing, emit this vterm_screen_flush_damage(screen); emit = rect; } else if(screen->damaged.start_row == -1) { // None stored yet screen->damaged = rect; return; } else if(rect.start_row == screen->damaged.start_row) { // Merge with the stored line if(screen->damaged.start_col > rect.start_col) screen->damaged.start_col = rect.start_col; if(screen->damaged.end_col < rect.end_col) screen->damaged.end_col = rect.end_col; return; } else { // Emit the currently stored line, store a new one emit = screen->damaged; screen->damaged = rect; } break; case VTERM_DAMAGE_SCREEN: case VTERM_DAMAGE_SCROLL: /* Never emit damage event */ if(screen->damaged.start_row == -1) screen->damaged = rect; else { rect_expand(&screen->damaged, &rect); } return; default: DEBUG_LOG("TODO: Maybe merge damage for level %d\n", screen->damage_merge); return; } if(screen->callbacks && screen->callbacks->damage) (*screen->callbacks->damage)(emit, screen->cbdata); } static void damagescreen(VTermScreen *screen) { VTermRect rect = { .start_row = 0, .end_row = screen->rows, .start_col = 0, .end_col = screen->cols, }; damagerect(screen, rect); } static int putglyph(VTermGlyphInfo *info, VTermPos pos, void *user) { VTermScreen *screen = user; ScreenCell *cell = getcell(screen, pos.row, pos.col); if(!cell) return 0; int i; for(i = 0; i < VTERM_MAX_CHARS_PER_CELL && info->chars[i]; i++) { cell->chars[i] = info->chars[i]; cell->pen = screen->pen; } if(i < VTERM_MAX_CHARS_PER_CELL) cell->chars[i] = 0; for(int col = 1; col < info->width; col++) getcell(screen, pos.row, pos.col + col)->chars[0] = (uint32_t)-1; VTermRect rect = { .start_row = pos.row, .end_row = pos.row+1, .start_col = pos.col, .end_col = pos.col+info->width, }; cell->pen.protected_cell = info->protected_cell; cell->pen.dwl = info->dwl; cell->pen.dhl = info->dhl; damagerect(screen, rect); return 1; } static void sb_pushline_from_row(VTermScreen *screen, int row) { VTermPos pos = { .row = row }; for(pos.col = 0; pos.col < screen->cols; pos.col++) vterm_screen_get_cell(screen, pos, screen->sb_buffer + pos.col); (screen->callbacks->sb_pushline)(screen->cols, screen->sb_buffer, screen->cbdata); } static int moverect_internal(VTermRect dest, VTermRect src, void *user) { VTermScreen *screen = user; if(screen->callbacks && screen->callbacks->sb_pushline && dest.start_row == 0 && dest.start_col == 0 && // starts top-left corner dest.end_col == screen->cols && // full width screen->buffer == screen->buffers[BUFIDX_PRIMARY]) { // not altscreen for(int row = 0; row < src.start_row; row++) sb_pushline_from_row(screen, row); } int cols = src.end_col - src.start_col; int downward = src.start_row - dest.start_row; int init_row, test_row, inc_row; if(downward < 0) { init_row = dest.end_row - 1; test_row = dest.start_row - 1; inc_row = -1; } else { init_row = dest.start_row; test_row = dest.end_row; inc_row = +1; } for(int row = init_row; row != test_row; row += inc_row) memmove(getcell(screen, row, dest.start_col), getcell(screen, row + downward, src.start_col), cols * sizeof(ScreenCell)); return 1; } static int moverect_user(VTermRect dest, VTermRect src, void *user) { VTermScreen *screen = user; if(screen->callbacks && screen->callbacks->moverect) { if(screen->damage_merge != VTERM_DAMAGE_SCROLL) // Avoid an infinite loop vterm_screen_flush_damage(screen); if((*screen->callbacks->moverect)(dest, src, screen->cbdata)) return 1; } damagerect(screen, dest); return 1; } static int erase_internal(VTermRect rect, int selective, void *user) { VTermScreen *screen = user; for(int row = rect.start_row; row < screen->state->rows && row < rect.end_row; row++) { const VTermLineInfo *info = vterm_state_get_lineinfo(screen->state, row); for(int col = rect.start_col; col < rect.end_col; col++) { ScreenCell *cell = getcell(screen, row, col); if(selective && cell->pen.protected_cell) continue; cell->chars[0] = 0; cell->pen = screen->pen; cell->pen.dwl = info->doublewidth; cell->pen.dhl = info->doubleheight; } } return 1; } static int erase_user(VTermRect rect, int selective, void *user) { VTermScreen *screen = user; damagerect(screen, rect); return 1; } static int erase(VTermRect rect, int selective, void *user) { erase_internal(rect, selective, user); return erase_user(rect, 0, user); } static int scrollrect(VTermRect rect, int downward, int rightward, void *user) { VTermScreen *screen = user; if(screen->damage_merge != VTERM_DAMAGE_SCROLL) { vterm_scroll_rect(rect, downward, rightward, moverect_internal, erase_internal, screen); vterm_screen_flush_damage(screen); vterm_scroll_rect(rect, downward, rightward, moverect_user, erase_user, screen); return 1; } if(screen->damaged.start_row != -1 && !rect_intersects(&rect, &screen->damaged)) { vterm_screen_flush_damage(screen); } if(screen->pending_scrollrect.start_row == -1) { screen->pending_scrollrect = rect; screen->pending_scroll_downward = downward; screen->pending_scroll_rightward = rightward; } else if(rect_equal(&screen->pending_scrollrect, &rect) && ((screen->pending_scroll_downward == 0 && downward == 0) || (screen->pending_scroll_rightward == 0 && rightward == 0))) { screen->pending_scroll_downward += downward; screen->pending_scroll_rightward += rightward; } else { vterm_screen_flush_damage(screen); screen->pending_scrollrect = rect; screen->pending_scroll_downward = downward; screen->pending_scroll_rightward = rightward; } vterm_scroll_rect(rect, downward, rightward, moverect_internal, erase_internal, screen); if(screen->damaged.start_row == -1) return 1; if(rect_contains(&rect, &screen->damaged)) { /* Scroll region entirely contains the damage; just move it */ vterm_rect_move(&screen->damaged, -downward, -rightward); rect_clip(&screen->damaged, &rect); } /* There are a number of possible cases here, but lets restrict this to only * the common case where we might actually gain some performance by * optimising it. Namely, a vertical scroll that neatly cuts the damage * region in half. */ else if(rect.start_col <= screen->damaged.start_col && rect.end_col >= screen->damaged.end_col && rightward == 0) { if(screen->damaged.start_row >= rect.start_row && screen->damaged.start_row < rect.end_row) { screen->damaged.start_row -= downward; if(screen->damaged.start_row < rect.start_row) screen->damaged.start_row = rect.start_row; if(screen->damaged.start_row > rect.end_row) screen->damaged.start_row = rect.end_row; } if(screen->damaged.end_row >= rect.start_row && screen->damaged.end_row < rect.end_row) { screen->damaged.end_row -= downward; if(screen->damaged.end_row < rect.start_row) screen->damaged.end_row = rect.start_row; if(screen->damaged.end_row > rect.end_row) screen->damaged.end_row = rect.end_row; } } else { DEBUG_LOG("TODO: Just flush and redo damaged=" STRFrect " rect=" STRFrect "\n", ARGSrect(screen->damaged), ARGSrect(rect)); } return 1; } static int movecursor(VTermPos pos, VTermPos oldpos, int visible, void *user) { VTermScreen *screen = user; if(screen->callbacks && screen->callbacks->movecursor) return (*screen->callbacks->movecursor)(pos, oldpos, visible, screen->cbdata); return 0; } static int setpenattr(VTermAttr attr, VTermValue *val, void *user) { VTermScreen *screen = user; switch(attr) { case VTERM_ATTR_BOLD: screen->pen.bold = val->boolean; return 1; case VTERM_ATTR_UNDERLINE: screen->pen.underline = val->number; return 1; case VTERM_ATTR_ITALIC: screen->pen.italic = val->boolean; return 1; case VTERM_ATTR_BLINK: screen->pen.blink = val->boolean; return 1; case VTERM_ATTR_REVERSE: screen->pen.reverse = val->boolean; return 1; case VTERM_ATTR_CONCEAL: screen->pen.conceal = val->boolean; return 1; case VTERM_ATTR_STRIKE: screen->pen.strike = val->boolean; return 1; case VTERM_ATTR_FONT: screen->pen.font = val->number; return 1; case VTERM_ATTR_FOREGROUND: screen->pen.fg = val->color; return 1; case VTERM_ATTR_BACKGROUND: screen->pen.bg = val->color; return 1; case VTERM_N_ATTRS: return 0; } return 0; } static int settermprop(VTermProp prop, VTermValue *val, void *user) { VTermScreen *screen = user; switch(prop) { case VTERM_PROP_ALTSCREEN: if(val->boolean && !screen->buffers[BUFIDX_ALTSCREEN]) return 0; screen->buffer = val->boolean ? screen->buffers[BUFIDX_ALTSCREEN] : screen->buffers[BUFIDX_PRIMARY]; /* only send a damage event on disable; because during enable there's an * erase that sends a damage anyway */ if(!val->boolean) damagescreen(screen); break; case VTERM_PROP_REVERSE: screen->global_reverse = val->boolean; damagescreen(screen); break; default: ; /* ignore */ } if(screen->callbacks && screen->callbacks->settermprop) return (*screen->callbacks->settermprop)(prop, val, screen->cbdata); return 1; } static int bell(void *user) { VTermScreen *screen = user; if(screen->callbacks && screen->callbacks->bell) return (*screen->callbacks->bell)(screen->cbdata); return 0; } static void resize_buffer(VTermScreen *screen, int bufidx, int new_rows, int new_cols, bool active, VTermStateFields *statefields) { int old_rows = screen->rows; int old_cols = screen->cols; ScreenCell *old_buffer = screen->buffers[bufidx]; ScreenCell *new_buffer = vterm_allocator_malloc(screen->vt, sizeof(ScreenCell) * new_rows * new_cols); int old_row = old_rows - 1; int new_row = new_rows - 1; while(new_row >= 0 && old_row >= 0) { int col; for(col = 0; col < old_cols && col < new_cols; col++) new_buffer[new_row * new_cols + col] = old_buffer[old_row * old_cols + col]; for( ; col < new_cols; col++) clearcell(screen, &new_buffer[new_row * new_cols + col]); old_row--; new_row--; if(new_row < 0 && old_row >= 0 && new_buffer[(new_rows - 1) * new_cols].chars[0] == 0 && (!active || statefields->pos.row < (new_rows - 1))) { int moverows = new_rows - 1; memmove(&new_buffer[1 * new_cols], &new_buffer[0], moverows * new_cols * sizeof(ScreenCell)); new_row++; } } if(old_row >= 0 && bufidx == BUFIDX_PRIMARY) { /* Push spare lines to scrollback buffer */ for(int row = 0; row <= old_row; row++) sb_pushline_from_row(screen, row); if(active) statefields->pos.row -= (old_row + 1); } if(new_row >= 0 && bufidx == BUFIDX_PRIMARY && screen->callbacks && screen->callbacks->sb_popline) { /* Try to backfill rows by popping scrollback buffer */ while(new_row >= 0) { if(!(screen->callbacks->sb_popline(old_cols, screen->sb_buffer, screen->cbdata))) break; VTermPos pos = { .row = new_row }; for(pos.col = 0; pos.col < old_cols && pos.col < new_cols; pos.col += screen->sb_buffer[pos.col].width) { VTermScreenCell *src = &screen->sb_buffer[pos.col]; ScreenCell *dst = &new_buffer[pos.row * new_cols + pos.col]; for(int i = 0; i < VTERM_MAX_CHARS_PER_CELL; i++) { dst->chars[i] = src->chars[i]; if(!src->chars[i]) break; } dst->pen.bold = src->attrs.bold; dst->pen.underline = src->attrs.underline; dst->pen.italic = src->attrs.italic; dst->pen.blink = src->attrs.blink; dst->pen.reverse = src->attrs.reverse ^ screen->global_reverse; dst->pen.conceal = src->attrs.conceal; dst->pen.strike = src->attrs.strike; dst->pen.font = src->attrs.font; dst->pen.fg = src->fg; dst->pen.bg = src->bg; if(src->width == 2 && pos.col < (new_cols-1)) (dst + 1)->chars[0] = (uint32_t) -1; } for( ; pos.col < new_cols; pos.col++) clearcell(screen, &new_buffer[pos.row * new_cols + pos.col]); new_row--; if(active) statefields->pos.row++; } } if(new_row >= 0) { /* Scroll new rows back up to the top and fill in blanks at the bottom */ int moverows = new_rows - new_row - 1; memmove(&new_buffer[0], &new_buffer[(new_row + 1) * new_cols], moverows * new_cols * sizeof(ScreenCell)); for(new_row = moverows; new_row < new_rows; new_row++) for(int col = 0; col < new_cols; col++) clearcell(screen, &new_buffer[new_row * new_cols + col]); } vterm_allocator_free(screen->vt, old_buffer); screen->buffers[bufidx] = new_buffer; return; /* REFLOW TODO: * Handle delta. Probably needs to be a full cursorpos that we edit */ } static int resize(int new_rows, int new_cols, VTermStateFields *fields, void *user) { VTermScreen *screen = user; int altscreen_active = (screen->buffers[BUFIDX_ALTSCREEN] && screen->buffer == screen->buffers[BUFIDX_ALTSCREEN]); int old_cols = screen->cols; if(new_cols > old_cols) { /* Ensure that ->sb_buffer is large enough for a new or and old row */ if(screen->sb_buffer) vterm_allocator_free(screen->vt, screen->sb_buffer); screen->sb_buffer = vterm_allocator_malloc(screen->vt, sizeof(VTermScreenCell) * new_cols); } resize_buffer(screen, 0, new_rows, new_cols, !altscreen_active, fields); if(screen->buffers[BUFIDX_ALTSCREEN]) resize_buffer(screen, 1, new_rows, new_cols, altscreen_active, fields); screen->buffer = altscreen_active ? screen->buffers[BUFIDX_ALTSCREEN] : screen->buffers[BUFIDX_PRIMARY]; screen->rows = new_rows; screen->cols = new_cols; if(new_cols <= old_cols) { if(screen->sb_buffer) vterm_allocator_free(screen->vt, screen->sb_buffer); screen->sb_buffer = vterm_allocator_malloc(screen->vt, sizeof(VTermScreenCell) * new_cols); } /* TODO: Maaaaybe we can optimise this if there's no reflow happening */ damagescreen(screen); if(screen->callbacks && screen->callbacks->resize) return (*screen->callbacks->resize)(new_rows, new_cols, screen->cbdata); return 1; } static int setlineinfo(int row, const VTermLineInfo *newinfo, const VTermLineInfo *oldinfo, void *user) { VTermScreen *screen = user; if(newinfo->doublewidth != oldinfo->doublewidth || newinfo->doubleheight != oldinfo->doubleheight) { for(int col = 0; col < screen->cols; col++) { ScreenCell *cell = getcell(screen, row, col); cell->pen.dwl = newinfo->doublewidth; cell->pen.dhl = newinfo->doubleheight; } VTermRect rect = { .start_row = row, .end_row = row + 1, .start_col = 0, .end_col = newinfo->doublewidth ? screen->cols / 2 : screen->cols, }; damagerect(screen, rect); if(newinfo->doublewidth) { rect.start_col = screen->cols / 2; rect.end_col = screen->cols; erase_internal(rect, 0, user); } } return 1; } static VTermStateCallbacks state_cbs = { .putglyph = &putglyph, .movecursor = &movecursor, .scrollrect = &scrollrect, .erase = &erase, .setpenattr = &setpenattr, .settermprop = &settermprop, .bell = &bell, .resize = &resize, .setlineinfo = &setlineinfo, }; static VTermScreen *screen_new(VTerm *vt) { VTermState *state = vterm_obtain_state(vt); if(!state) return NULL; VTermScreen *screen = vterm_allocator_malloc(vt, sizeof(VTermScreen)); int rows, cols; vterm_get_size(vt, &rows, &cols); screen->vt = vt; screen->state = state; screen->damage_merge = VTERM_DAMAGE_CELL; screen->damaged.start_row = -1; screen->pending_scrollrect.start_row = -1; screen->rows = rows; screen->cols = cols; screen->callbacks = NULL; screen->cbdata = NULL; screen->buffers[BUFIDX_PRIMARY] = alloc_buffer(screen, rows, cols); screen->buffer = screen->buffers[BUFIDX_PRIMARY]; screen->sb_buffer = vterm_allocator_malloc(screen->vt, sizeof(VTermScreenCell) * cols); vterm_state_set_callbacks(screen->state, &state_cbs, screen); return screen; } INTERNAL void vterm_screen_free(VTermScreen *screen) { vterm_allocator_free(screen->vt, screen->buffers[BUFIDX_PRIMARY]); if(screen->buffers[BUFIDX_ALTSCREEN]) vterm_allocator_free(screen->vt, screen->buffers[BUFIDX_ALTSCREEN]); vterm_allocator_free(screen->vt, screen->sb_buffer); vterm_allocator_free(screen->vt, screen); } void vterm_screen_reset(VTermScreen *screen, int hard) { screen->damaged.start_row = -1; screen->pending_scrollrect.start_row = -1; vterm_state_reset(screen->state, hard); vterm_screen_flush_damage(screen); } static size_t _get_chars(const VTermScreen *screen, const int utf8, void *buffer, size_t len, const VTermRect rect) { size_t outpos = 0; int padding = 0; #define PUT(c) \ if(utf8) { \ size_t thislen = utf8_seqlen(c); \ if(buffer && outpos + thislen <= len) \ outpos += fill_utf8((c), (char *)buffer + outpos); \ else \ outpos += thislen; \ } \ else { \ if(buffer && outpos + 1 <= len) \ ((uint32_t*)buffer)[outpos++] = (c); \ else \ outpos++; \ } for(int row = rect.start_row; row < rect.end_row; row++) { for(int col = rect.start_col; col < rect.end_col; col++) { ScreenCell *cell = getcell(screen, row, col); if(cell->chars[0] == 0) // Erased cell, might need a space padding++; else if(cell->chars[0] == (uint32_t)-1) // Gap behind a double-width char, do nothing ; else { while(padding) { PUT(UNICODE_SPACE); padding--; } for(int i = 0; i < VTERM_MAX_CHARS_PER_CELL && cell->chars[i]; i++) { PUT(cell->chars[i]); } } } if(row < rect.end_row - 1) { PUT(UNICODE_LINEFEED); padding = 0; } } return outpos; } size_t vterm_screen_get_chars(const VTermScreen *screen, uint32_t *chars, size_t len, const VTermRect rect) { return _get_chars(screen, 0, chars, len, rect); } size_t vterm_screen_get_text(const VTermScreen *screen, char *str, size_t len, const VTermRect rect) { return _get_chars(screen, 1, str, len, rect); } /* Copy internal to external representation of a screen cell */ int vterm_screen_get_cell(const VTermScreen *screen, VTermPos pos, VTermScreenCell *cell) { ScreenCell *intcell = getcell(screen, pos.row, pos.col); if(!intcell) return 0; for(int i = 0; i < VTERM_MAX_CHARS_PER_CELL; i++) { cell->chars[i] = intcell->chars[i]; if(!intcell->chars[i]) break; } cell->attrs.bold = intcell->pen.bold; cell->attrs.underline = intcell->pen.underline; cell->attrs.italic = intcell->pen.italic; cell->attrs.blink = intcell->pen.blink; cell->attrs.reverse = intcell->pen.reverse ^ screen->global_reverse; cell->attrs.conceal = intcell->pen.conceal; cell->attrs.strike = intcell->pen.strike; cell->attrs.font = intcell->pen.font; cell->attrs.dwl = intcell->pen.dwl; cell->attrs.dhl = intcell->pen.dhl; cell->fg = intcell->pen.fg; cell->bg = intcell->pen.bg; if(pos.col < (screen->cols - 1) && getcell(screen, pos.row, pos.col + 1)->chars[0] == (uint32_t)-1) cell->width = 2; else cell->width = 1; return 1; } int vterm_screen_is_eol(const VTermScreen *screen, VTermPos pos) { /* This cell is EOL if this and every cell to the right is black */ for(; pos.col < screen->cols; pos.col++) { ScreenCell *cell = getcell(screen, pos.row, pos.col); if(cell->chars[0] != 0) return 0; } return 1; } VTermScreen *vterm_obtain_screen(VTerm *vt) { if(vt->screen) return vt->screen; VTermScreen *screen = screen_new(vt); vt->screen = screen; return screen; } void vterm_screen_enable_altscreen(VTermScreen *screen, int altscreen) { if(!screen->buffers[BUFIDX_ALTSCREEN] && altscreen) { int rows, cols; vterm_get_size(screen->vt, &rows, &cols); screen->buffers[BUFIDX_ALTSCREEN] = alloc_buffer(screen, rows, cols); } } void vterm_screen_set_callbacks(VTermScreen *screen, const VTermScreenCallbacks *callbacks, void *user) { screen->callbacks = callbacks; screen->cbdata = user; } void *vterm_screen_get_cbdata(VTermScreen *screen) { return screen->cbdata; } void vterm_screen_set_unrecognised_fallbacks(VTermScreen *screen, const VTermStateFallbacks *fallbacks, void *user) { vterm_state_set_unrecognised_fallbacks(screen->state, fallbacks, user); } void *vterm_screen_get_unrecognised_fbdata(VTermScreen *screen) { return vterm_state_get_unrecognised_fbdata(screen->state); } void vterm_screen_flush_damage(VTermScreen *screen) { if(screen->pending_scrollrect.start_row != -1) { vterm_scroll_rect(screen->pending_scrollrect, screen->pending_scroll_downward, screen->pending_scroll_rightward, moverect_user, erase_user, screen); screen->pending_scrollrect.start_row = -1; } if(screen->damaged.start_row != -1) { if(screen->callbacks && screen->callbacks->damage) (*screen->callbacks->damage)(screen->damaged, screen->cbdata); screen->damaged.start_row = -1; } } void vterm_screen_set_damage_merge(VTermScreen *screen, VTermDamageSize size) { vterm_screen_flush_damage(screen); screen->damage_merge = size; } static int attrs_differ(VTermAttrMask attrs, ScreenCell *a, ScreenCell *b) { if((attrs & VTERM_ATTR_BOLD_MASK) && (a->pen.bold != b->pen.bold)) return 1; if((attrs & VTERM_ATTR_UNDERLINE_MASK) && (a->pen.underline != b->pen.underline)) return 1; if((attrs & VTERM_ATTR_ITALIC_MASK) && (a->pen.italic != b->pen.italic)) return 1; if((attrs & VTERM_ATTR_BLINK_MASK) && (a->pen.blink != b->pen.blink)) return 1; if((attrs & VTERM_ATTR_REVERSE_MASK) && (a->pen.reverse != b->pen.reverse)) return 1; if((attrs & VTERM_ATTR_CONCEAL_MASK) && (a->pen.conceal != b->pen.conceal)) return 1; if((attrs & VTERM_ATTR_STRIKE_MASK) && (a->pen.strike != b->pen.strike)) return 1; if((attrs & VTERM_ATTR_FONT_MASK) && (a->pen.font != b->pen.font)) return 1; if((attrs & VTERM_ATTR_FOREGROUND_MASK) && !vterm_color_is_equal(&a->pen.fg, &b->pen.fg)) return 1; if((attrs & VTERM_ATTR_BACKGROUND_MASK) && !vterm_color_is_equal(&a->pen.bg, &b->pen.bg)) return 1; return 0; } int vterm_screen_get_attrs_extent(const VTermScreen *screen, VTermRect *extent, VTermPos pos, VTermAttrMask attrs) { ScreenCell *target = getcell(screen, pos.row, pos.col); // TODO: bounds check extent->start_row = pos.row; extent->end_row = pos.row + 1; if(extent->start_col < 0) extent->start_col = 0; if(extent->end_col < 0) extent->end_col = screen->cols; int col; for(col = pos.col - 1; col >= extent->start_col; col--) if(attrs_differ(attrs, target, getcell(screen, pos.row, col))) break; extent->start_col = col + 1; for(col = pos.col + 1; col < extent->end_col; col++) if(attrs_differ(attrs, target, getcell(screen, pos.row, col))) break; extent->end_col = col - 1; return 1; } void vterm_screen_convert_color_to_rgb(const VTermScreen *screen, VTermColor *col) { vterm_state_convert_color_to_rgb(screen->state, col); } cgdb-0.8.0/lib/vterm/fullwidth.inc0000644000175000017500000000476014160506535013753 00000000000000 { 0x1100, 0x115f }, { 0x231a, 0x231b }, { 0x2329, 0x232a }, { 0x23e9, 0x23ec }, { 0x23f0, 0x23f0 }, { 0x23f3, 0x23f3 }, { 0x25fd, 0x25fe }, { 0x2614, 0x2615 }, { 0x2648, 0x2653 }, { 0x267f, 0x267f }, { 0x2693, 0x2693 }, { 0x26a1, 0x26a1 }, { 0x26aa, 0x26ab }, { 0x26bd, 0x26be }, { 0x26c4, 0x26c5 }, { 0x26ce, 0x26ce }, { 0x26d4, 0x26d4 }, { 0x26ea, 0x26ea }, { 0x26f2, 0x26f3 }, { 0x26f5, 0x26f5 }, { 0x26fa, 0x26fa }, { 0x26fd, 0x26fd }, { 0x2705, 0x2705 }, { 0x270a, 0x270b }, { 0x2728, 0x2728 }, { 0x274c, 0x274c }, { 0x274e, 0x274e }, { 0x2753, 0x2755 }, { 0x2757, 0x2757 }, { 0x2795, 0x2797 }, { 0x27b0, 0x27b0 }, { 0x27bf, 0x27bf }, { 0x2b1b, 0x2b1c }, { 0x2b50, 0x2b50 }, { 0x2b55, 0x2b55 }, { 0x2e80, 0x2e99 }, { 0x2e9b, 0x2ef3 }, { 0x2f00, 0x2fd5 }, { 0x2ff0, 0x2ffb }, { 0x3000, 0x303e }, { 0x3041, 0x3096 }, { 0x3099, 0x30ff }, { 0x3105, 0x312f }, { 0x3131, 0x318e }, { 0x3190, 0x31ba }, { 0x31c0, 0x31e3 }, { 0x31f0, 0x321e }, { 0x3220, 0x3247 }, { 0x3250, 0x4dbf }, { 0x4e00, 0xa48c }, { 0xa490, 0xa4c6 }, { 0xa960, 0xa97c }, { 0xac00, 0xd7a3 }, { 0xf900, 0xfaff }, { 0xfe10, 0xfe19 }, { 0xfe30, 0xfe52 }, { 0xfe54, 0xfe66 }, { 0xfe68, 0xfe6b }, { 0xff01, 0xff60 }, { 0xffe0, 0xffe6 }, { 0x16fe0, 0x16fe3 }, { 0x17000, 0x187f7 }, { 0x18800, 0x18af2 }, { 0x1b000, 0x1b11e }, { 0x1b150, 0x1b152 }, { 0x1b164, 0x1b167 }, { 0x1b170, 0x1b2fb }, { 0x1f004, 0x1f004 }, { 0x1f0cf, 0x1f0cf }, { 0x1f18e, 0x1f18e }, { 0x1f191, 0x1f19a }, { 0x1f200, 0x1f202 }, { 0x1f210, 0x1f23b }, { 0x1f240, 0x1f248 }, { 0x1f250, 0x1f251 }, { 0x1f260, 0x1f265 }, { 0x1f300, 0x1f320 }, { 0x1f32d, 0x1f335 }, { 0x1f337, 0x1f37c }, { 0x1f37e, 0x1f393 }, { 0x1f3a0, 0x1f3ca }, { 0x1f3cf, 0x1f3d3 }, { 0x1f3e0, 0x1f3f0 }, { 0x1f3f4, 0x1f3f4 }, { 0x1f3f8, 0x1f43e }, { 0x1f440, 0x1f440 }, { 0x1f442, 0x1f4fc }, { 0x1f4ff, 0x1f53d }, { 0x1f54b, 0x1f54e }, { 0x1f550, 0x1f567 }, { 0x1f57a, 0x1f57a }, { 0x1f595, 0x1f596 }, { 0x1f5a4, 0x1f5a4 }, { 0x1f5fb, 0x1f64f }, { 0x1f680, 0x1f6c5 }, { 0x1f6cc, 0x1f6cc }, { 0x1f6d0, 0x1f6d2 }, { 0x1f6d5, 0x1f6d5 }, { 0x1f6eb, 0x1f6ec }, { 0x1f6f4, 0x1f6fa }, { 0x1f7e0, 0x1f7eb }, { 0x1f90d, 0x1f971 }, { 0x1f973, 0x1f976 }, { 0x1f97a, 0x1f9a2 }, { 0x1f9a5, 0x1f9aa }, { 0x1f9ae, 0x1f9ca }, { 0x1f9cd, 0x1f9ff }, { 0x1fa70, 0x1fa73 }, { 0x1fa78, 0x1fa7a }, { 0x1fa80, 0x1fa82 }, { 0x1fa90, 0x1fa95 }, cgdb-0.8.0/lib/vterm/Makefile.in0000664000175000017500000004147014171036450013320 00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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/vterm ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/config/readline_check_version.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) 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 = libcgdbvterm_a_AR = $(AR) $(ARFLAGS) libcgdbvterm_a_LIBADD = am_libcgdbvterm_a_OBJECTS = encoding.$(OBJEXT) keyboard.$(OBJEXT) \ mouse.$(OBJEXT) parser.$(OBJEXT) pen.$(OBJEXT) \ screen.$(OBJEXT) state.$(OBJEXT) unicode.$(OBJEXT) \ vterm.$(OBJEXT) libcgdbvterm_a_OBJECTS = $(am_libcgdbvterm_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 = $(libcgdbvterm_a_SOURCES) DIST_SOURCES = $(libcgdbvterm_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 am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/config/depcomp 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@ CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ 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@ HAS_MAKEINFO = @HAS_MAKEINFO@ 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@ ac_ct_CXX = @ac_ct_CXX@ 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@ runstatedir = @runstatedir@ 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 = libcgdbvterm.a libcgdbvterm_a_SOURCES = \ vterm.h \ vterm_keycodes.h \ DECdrawing.inc \ encoding.c \ fullwidth.inc \ keyboard.c \ mouse.c \ parser.c \ pen.c \ rect.h \ screen.c \ state.c \ uk.inc \ unicode.c \ utf8.h \ vterm.c \ vterm_internal.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) --foreign lib/vterm/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign lib/vterm/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) libcgdbvterm.a: $(libcgdbvterm_a_OBJECTS) $(libcgdbvterm_a_DEPENDENCIES) $(EXTRA_libcgdbvterm_a_DEPENDENCIES) $(AM_V_at)-rm -f libcgdbvterm.a $(AM_V_AR)$(libcgdbvterm_a_AR) libcgdbvterm.a $(libcgdbvterm_a_OBJECTS) $(libcgdbvterm_a_LIBADD) $(AM_V_at)$(RANLIB) libcgdbvterm.a mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/encoding.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/keyboard.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mouse.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parser.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pen.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/screen.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/state.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unicode.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vterm.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 -o $@ $< .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 -o $@ `$(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 .PRECIOUS: Makefile # 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.8.0/lib/vterm/Makefile.am0000664000175000017500000000043314160506327013304 00000000000000noinst_LIBRARIES = libcgdbvterm.a libcgdbvterm_a_SOURCES = \ vterm.h \ vterm_keycodes.h \ DECdrawing.inc \ encoding.c \ fullwidth.inc \ keyboard.c \ mouse.c \ parser.c \ pen.c \ rect.h \ screen.c \ state.c \ uk.inc \ unicode.c \ utf8.h \ vterm.c \ vterm_internal.h cgdb-0.8.0/lib/vterm/DECdrawing.inc0000664000175000017500000000136514160506467013724 00000000000000static const struct StaticTableEncoding encoding_DECdrawing = { { .decode = &decode_table }, { [0x60] = 0x25C6, [0x61] = 0x2592, [0x62] = 0x2409, [0x63] = 0x240C, [0x64] = 0x240D, [0x65] = 0x240A, [0x66] = 0x00B0, [0x67] = 0x00B1, [0x68] = 0x2424, [0x69] = 0x240B, [0x6a] = 0x2518, [0x6b] = 0x2510, [0x6c] = 0x250C, [0x6d] = 0x2514, [0x6e] = 0x253C, [0x6f] = 0x23BA, [0x70] = 0x23BB, [0x71] = 0x2500, [0x72] = 0x23BC, [0x73] = 0x23BD, [0x74] = 0x251C, [0x75] = 0x2524, [0x76] = 0x2534, [0x77] = 0x252C, [0x78] = 0x2502, [0x79] = 0x2A7D, [0x7a] = 0x2A7E, [0x7b] = 0x03C0, [0x7c] = 0x2260, [0x7d] = 0x00A3, [0x7e] = 0x00B7, } }; cgdb-0.8.0/lib/vterm/encoding.c0000644000175000017500000001314614160506512013201 00000000000000#include "vterm_internal.h" #define UNICODE_INVALID 0xFFFD #if defined(DEBUG) && DEBUG > 1 # define DEBUG_PRINT_UTF8 #endif struct UTF8DecoderData { // number of bytes remaining in this codepoint int bytes_remaining; // number of bytes total in this codepoint once it's finished // (for detecting overlongs) int bytes_total; int this_cp; }; static void init_utf8(VTermEncoding *enc, void *data_) { struct UTF8DecoderData *data = data_; data->bytes_remaining = 0; data->bytes_total = 0; } static void decode_utf8(VTermEncoding *enc, void *data_, uint32_t cp[], int *cpi, int cplen, const char bytes[], size_t *pos, size_t bytelen) { struct UTF8DecoderData *data = data_; #ifdef DEBUG_PRINT_UTF8 printf("BEGIN UTF-8\n"); #endif for(; *pos < bytelen && *cpi < cplen; (*pos)++) { unsigned char c = bytes[*pos]; #ifdef DEBUG_PRINT_UTF8 printf(" pos=%zd c=%02x rem=%d\n", *pos, c, data->bytes_remaining); #endif if(c < 0x20) // C0 return; else if(c >= 0x20 && c < 0x7f) { if(data->bytes_remaining) cp[(*cpi)++] = UNICODE_INVALID; cp[(*cpi)++] = c; #ifdef DEBUG_PRINT_UTF8 printf(" UTF-8 char: U+%04x\n", c); #endif data->bytes_remaining = 0; } else if(c == 0x7f) // DEL return; else if(c >= 0x80 && c < 0xc0) { if(!data->bytes_remaining) { cp[(*cpi)++] = UNICODE_INVALID; continue; } data->this_cp <<= 6; data->this_cp |= c & 0x3f; data->bytes_remaining--; if(!data->bytes_remaining) { #ifdef DEBUG_PRINT_UTF8 printf(" UTF-8 raw char U+%04x bytelen=%d ", data->this_cp, data->bytes_total); #endif // Check for overlong sequences switch(data->bytes_total) { case 2: if(data->this_cp < 0x0080) data->this_cp = UNICODE_INVALID; break; case 3: if(data->this_cp < 0x0800) data->this_cp = UNICODE_INVALID; break; case 4: if(data->this_cp < 0x10000) data->this_cp = UNICODE_INVALID; break; case 5: if(data->this_cp < 0x200000) data->this_cp = UNICODE_INVALID; break; case 6: if(data->this_cp < 0x4000000) data->this_cp = UNICODE_INVALID; break; } // Now look for plain invalid ones if((data->this_cp >= 0xD800 && data->this_cp <= 0xDFFF) || data->this_cp == 0xFFFE || data->this_cp == 0xFFFF) data->this_cp = UNICODE_INVALID; #ifdef DEBUG_PRINT_UTF8 printf(" char: U+%04x\n", data->this_cp); #endif cp[(*cpi)++] = data->this_cp; } } else if(c >= 0xc0 && c < 0xe0) { if(data->bytes_remaining) cp[(*cpi)++] = UNICODE_INVALID; data->this_cp = c & 0x1f; data->bytes_total = 2; data->bytes_remaining = 1; } else if(c >= 0xe0 && c < 0xf0) { if(data->bytes_remaining) cp[(*cpi)++] = UNICODE_INVALID; data->this_cp = c & 0x0f; data->bytes_total = 3; data->bytes_remaining = 2; } else if(c >= 0xf0 && c < 0xf8) { if(data->bytes_remaining) cp[(*cpi)++] = UNICODE_INVALID; data->this_cp = c & 0x07; data->bytes_total = 4; data->bytes_remaining = 3; } else if(c >= 0xf8 && c < 0xfc) { if(data->bytes_remaining) cp[(*cpi)++] = UNICODE_INVALID; data->this_cp = c & 0x03; data->bytes_total = 5; data->bytes_remaining = 4; } else if(c >= 0xfc && c < 0xfe) { if(data->bytes_remaining) cp[(*cpi)++] = UNICODE_INVALID; data->this_cp = c & 0x01; data->bytes_total = 6; data->bytes_remaining = 5; } else { cp[(*cpi)++] = UNICODE_INVALID; } } } static VTermEncoding encoding_utf8 = { .init = &init_utf8, .decode = &decode_utf8, }; static void decode_usascii(VTermEncoding *enc, void *data, uint32_t cp[], int *cpi, int cplen, const char bytes[], size_t *pos, size_t bytelen) { int is_gr = bytes[*pos] & 0x80; for(; *pos < bytelen && *cpi < cplen; (*pos)++) { unsigned char c = bytes[*pos] ^ is_gr; if(c < 0x20 || c == 0x7f || c >= 0x80) return; cp[(*cpi)++] = c; } } static VTermEncoding encoding_usascii = { .decode = &decode_usascii, }; struct StaticTableEncoding { const VTermEncoding enc; const uint32_t chars[128]; }; static void decode_table(VTermEncoding *enc, void *data, uint32_t cp[], int *cpi, int cplen, const char bytes[], size_t *pos, size_t bytelen) { struct StaticTableEncoding *table = (struct StaticTableEncoding *)enc; int is_gr = bytes[*pos] & 0x80; for(; *pos < bytelen && *cpi < cplen; (*pos)++) { unsigned char c = bytes[*pos] ^ is_gr; if(c < 0x20 || c == 0x7f || c >= 0x80) return; if(table->chars[c]) cp[(*cpi)++] = table->chars[c]; else cp[(*cpi)++] = c; } } #include "DECdrawing.inc" #include "uk.inc" static struct { VTermEncodingType type; char designation; VTermEncoding *enc; } encodings[] = { { ENC_UTF8, 'u', &encoding_utf8 }, { ENC_SINGLE_94, '0', (VTermEncoding*)&encoding_DECdrawing }, { ENC_SINGLE_94, 'A', (VTermEncoding*)&encoding_uk }, { ENC_SINGLE_94, 'B', &encoding_usascii }, { 0 }, }; /* This ought to be INTERNAL but isn't because it's used by unit testing */ VTermEncoding *vterm_lookup_encoding(VTermEncodingType type, char designation) { for(int i = 0; encodings[i].designation; i++) if(encodings[i].type == type && encodings[i].designation == designation) return encodings[i].enc; return NULL; } cgdb-0.8.0/lib/vterm/vterm.h0000644000175000017500000004564014160506413012561 00000000000000#ifndef __VTERM_H__ #define __VTERM_H__ #ifdef __cplusplus extern "C" { #endif #include #include #include #include "vterm_keycodes.h" #define VTERM_VERSION_MAJOR 0 #define VTERM_VERSION_MINOR 2 #define VTERM_CHECK_VERSION \ vterm_check_version(VTERM_VERSION_MAJOR, VTERM_VERSION_MINOR) typedef struct VTerm VTerm; typedef struct VTermState VTermState; typedef struct VTermScreen VTermScreen; typedef struct { int row; int col; } VTermPos; /* some small utility functions; we can just keep these static here */ /* order points by on-screen flow order */ static inline int vterm_pos_cmp(VTermPos a, VTermPos b) { return (a.row == b.row) ? a.col - b.col : a.row - b.row; } typedef struct { int start_row; int end_row; int start_col; int end_col; } VTermRect; /* true if the rect contains the point */ static inline int vterm_rect_contains(VTermRect r, VTermPos p) { return p.row >= r.start_row && p.row < r.end_row && p.col >= r.start_col && p.col < r.end_col; } /* move a rect */ static inline void vterm_rect_move(VTermRect *rect, int row_delta, int col_delta) { rect->start_row += row_delta; rect->end_row += row_delta; rect->start_col += col_delta; rect->end_col += col_delta; } /** * Bit-field describing the content of the tagged union `VTermColor`. */ typedef enum { /** * If the lower bit of `type` is not set, the colour is 24-bit RGB. */ VTERM_COLOR_RGB = 0x00, /** * The colour is an index into a palette of 256 colours. */ VTERM_COLOR_INDEXED = 0x01, /** * Mask that can be used to extract the RGB/Indexed bit. */ VTERM_COLOR_TYPE_MASK = 0x01, /** * If set, indicates that this colour should be the default foreground * color, i.e. there was no SGR request for another colour. When * rendering this colour it is possible to ignore "idx" and just use a * colour that is not in the palette. */ VTERM_COLOR_DEFAULT_FG = 0x02, /** * If set, indicates that this colour should be the default background * color, i.e. there was no SGR request for another colour. A common * option when rendering this colour is to not render a background at * all, for example by rendering the window transparently at this spot. */ VTERM_COLOR_DEFAULT_BG = 0x04, /** * Mask that can be used to extract the default foreground/background bit. */ VTERM_COLOR_DEFAULT_MASK = 0x06 } VTermColorType; /** * Returns true if the VTERM_COLOR_RGB `type` flag is set, indicating that the * given VTermColor instance is an indexed colour. */ #define VTERM_COLOR_IS_INDEXED(col) \ (((col)->type & VTERM_COLOR_TYPE_MASK) == VTERM_COLOR_INDEXED) /** * Returns true if the VTERM_COLOR_INDEXED `type` flag is set, indicating that * the given VTermColor instance is an rgb colour. */ #define VTERM_COLOR_IS_RGB(col) \ (((col)->type & VTERM_COLOR_TYPE_MASK) == VTERM_COLOR_RGB) /** * Returns true if the VTERM_COLOR_DEFAULT_FG `type` flag is set, indicating * that the given VTermColor instance corresponds to the default foreground * color. */ #define VTERM_COLOR_IS_DEFAULT_FG(col) \ (!!((col)->type & VTERM_COLOR_DEFAULT_FG)) /** * Returns true if the VTERM_COLOR_DEFAULT_BG `type` flag is set, indicating * that the given VTermColor instance corresponds to the default background * color. */ #define VTERM_COLOR_IS_DEFAULT_BG(col) \ (!!((col)->type & VTERM_COLOR_DEFAULT_BG)) /** * Tagged union storing either an RGB color or an index into a colour palette. * In order to convert indexed colours to RGB, you may use the * vterm_state_convert_color_to_rgb() or vterm_screen_convert_color_to_rgb() * functions which lookup the RGB colour from the palette maintained by a * VTermState or VTermScreen instance. */ typedef union { /** * Tag indicating which union member is actually valid. This variable * coincides with the `type` member of the `rgb` and the `indexed` struct * in memory. Please use the `VTERM_COLOR_IS_*` test macros to check whether * a particular type flag is set. */ uint8_t type; /** * Valid if `VTERM_COLOR_IS_RGB(type)` is true. Holds the RGB colour values. */ struct { /** * Same as the top-level `type` member stored in VTermColor. */ uint8_t type; /** * The actual 8-bit red, green, blue colour values. */ uint8_t red, green, blue; } rgb; /** * If `VTERM_COLOR_IS_INDEXED(type)` is true, this member holds the index into * the colour palette. */ struct { /** * Same as the top-level `type` member stored in VTermColor. */ uint8_t type; /** * Index into the colour map. */ uint8_t idx; } indexed; } VTermColor; /** * Constructs a new VTermColor instance representing the given RGB values. */ static inline void vterm_color_rgb(VTermColor *col, uint8_t red, uint8_t green, uint8_t blue) { col->type = VTERM_COLOR_RGB; col->rgb.red = red; col->rgb.green = green; col->rgb.blue = blue; } /** * Construct a new VTermColor instance representing an indexed color with the * given index. */ static inline void vterm_color_indexed(VTermColor *col, uint8_t idx) { col->type = VTERM_COLOR_INDEXED; col->indexed.idx = idx; } /** * Compares two colours. Returns true if the colors are equal, false otherwise. */ int vterm_color_is_equal(const VTermColor *a, const VTermColor *b); typedef enum { /* VTERM_VALUETYPE_NONE = 0 */ VTERM_VALUETYPE_BOOL = 1, VTERM_VALUETYPE_INT, VTERM_VALUETYPE_STRING, VTERM_VALUETYPE_COLOR, VTERM_N_VALUETYPES } VTermValueType; typedef struct { const char *str; size_t len : 30; bool initial : 1; bool final : 1; } VTermStringFragment; typedef union { int boolean; int number; VTermStringFragment string; VTermColor color; } VTermValue; typedef enum { /* VTERM_ATTR_NONE = 0 */ VTERM_ATTR_BOLD = 1, // bool: 1, 22 VTERM_ATTR_UNDERLINE, // number: 4, 21, 24 VTERM_ATTR_ITALIC, // bool: 3, 23 VTERM_ATTR_BLINK, // bool: 5, 25 VTERM_ATTR_REVERSE, // bool: 7, 27 VTERM_ATTR_CONCEAL, // bool: 8, 28 VTERM_ATTR_STRIKE, // bool: 9, 29 VTERM_ATTR_FONT, // number: 10-19 VTERM_ATTR_FOREGROUND, // color: 30-39 90-97 VTERM_ATTR_BACKGROUND, // color: 40-49 100-107 VTERM_N_ATTRS } VTermAttr; typedef enum { /* VTERM_PROP_NONE = 0 */ VTERM_PROP_CURSORVISIBLE = 1, // bool VTERM_PROP_CURSORBLINK, // bool VTERM_PROP_ALTSCREEN, // bool VTERM_PROP_TITLE, // string VTERM_PROP_ICONNAME, // string VTERM_PROP_REVERSE, // bool VTERM_PROP_CURSORSHAPE, // number VTERM_PROP_MOUSE, // number VTERM_N_PROPS } VTermProp; enum { VTERM_PROP_CURSORSHAPE_BLOCK = 1, VTERM_PROP_CURSORSHAPE_UNDERLINE, VTERM_PROP_CURSORSHAPE_BAR_LEFT, VTERM_N_PROP_CURSORSHAPES }; enum { VTERM_PROP_MOUSE_NONE = 0, VTERM_PROP_MOUSE_CLICK, VTERM_PROP_MOUSE_DRAG, VTERM_PROP_MOUSE_MOVE, VTERM_N_PROP_MOUSES }; typedef enum { VTERM_SELECTION_CLIPBOARD = (1<<0), VTERM_SELECTION_PRIMARY = (1<<1), VTERM_SELECTION_SECONDARY = (1<<2), VTERM_SELECTION_SELECT = (1<<3), VTERM_SELECTION_CUT0 = (1<<4), /* also CUT1 .. CUT7 by bitshifting */ } VTermSelectionMask; typedef struct { const uint32_t *chars; int width; unsigned int protected_cell:1; /* DECSCA-protected against DECSEL/DECSED */ unsigned int dwl:1; /* DECDWL or DECDHL double-width line */ unsigned int dhl:2; /* DECDHL double-height line (1=top 2=bottom) */ } VTermGlyphInfo; typedef struct { unsigned int doublewidth:1; /* DECDWL or DECDHL line */ unsigned int doubleheight:2; /* DECDHL line (1=top 2=bottom) */ unsigned int continuation:1; /* Line is a flow continuation of the previous */ } VTermLineInfo; /* Copies of VTermState fields that the 'resize' callback might have reason to * edit. 'resize' callback gets total control of these fields and may * free-and-reallocate them if required. They will be copied back from the * struct after the callback has returned. */ typedef struct { VTermPos pos; /* current cursor position */ } VTermStateFields; typedef struct { /* libvterm relies on this memory to be zeroed out before it is returned * by the allocator. */ void *(*malloc)(size_t size, void *allocdata); void (*free)(void *ptr, void *allocdata); } VTermAllocatorFunctions; void vterm_check_version(int major, int minor); VTerm *vterm_new(int rows, int cols); VTerm *vterm_new_with_allocator(int rows, int cols, VTermAllocatorFunctions *funcs, void *allocdata); void vterm_free(VTerm* vt); void vterm_get_size(const VTerm *vt, int *rowsp, int *colsp); void vterm_set_size(VTerm *vt, int rows, int cols); int vterm_get_utf8(const VTerm *vt); void vterm_set_utf8(VTerm *vt, int is_utf8); size_t vterm_input_write(VTerm *vt, const char *bytes, size_t len); /* Setting output callback will override the buffer logic */ typedef void VTermOutputCallback(const char *s, size_t len, void *user); void vterm_output_set_callback(VTerm *vt, VTermOutputCallback *func, void *user); /* These buffer functions only work if output callback is NOT set * These are deprecated and will be removed in a later version */ size_t vterm_output_get_buffer_size(const VTerm *vt); size_t vterm_output_get_buffer_current(const VTerm *vt); size_t vterm_output_get_buffer_remaining(const VTerm *vt); /* This too */ size_t vterm_output_read(VTerm *vt, char *buffer, size_t len); void vterm_keyboard_unichar(VTerm *vt, uint32_t c, VTermModifier mod); void vterm_keyboard_key(VTerm *vt, VTermKey key, VTermModifier mod); void vterm_keyboard_start_paste(VTerm *vt); void vterm_keyboard_end_paste(VTerm *vt); void vterm_mouse_move(VTerm *vt, int row, int col, VTermModifier mod); void vterm_mouse_button(VTerm *vt, int button, bool pressed, VTermModifier mod); // ------------ // Parser layer // ------------ /* Flag to indicate non-final subparameters in a single CSI parameter. * Consider * CSI 1;2:3:4;5a * 1 4 and 5 are final. * 2 and 3 are non-final and will have this bit set * * Don't confuse this with the final byte of the CSI escape; 'a' in this case. */ #define CSI_ARG_FLAG_MORE (1U<<31) #define CSI_ARG_MASK (~(1U<<31)) #define CSI_ARG_HAS_MORE(a) ((a) & CSI_ARG_FLAG_MORE) #define CSI_ARG(a) ((a) & CSI_ARG_MASK) /* Can't use -1 to indicate a missing argument; use this instead */ #define CSI_ARG_MISSING ((1UL<<31)-1) #define CSI_ARG_IS_MISSING(a) (CSI_ARG(a) == CSI_ARG_MISSING) #define CSI_ARG_OR(a,def) (CSI_ARG(a) == CSI_ARG_MISSING ? (def) : CSI_ARG(a)) #define CSI_ARG_COUNT(a) (CSI_ARG(a) == CSI_ARG_MISSING || CSI_ARG(a) == 0 ? 1 : CSI_ARG(a)) typedef struct { int (*text)(const char *bytes, size_t len, void *user); int (*control)(unsigned char control, void *user); int (*escape)(const char *bytes, size_t len, void *user); int (*csi)(const char *leader, const long args[], int argcount, const char *intermed, char command, void *user); int (*osc)(int command, VTermStringFragment frag, void *user); int (*dcs)(const char *command, size_t commandlen, VTermStringFragment frag, void *user); int (*apc)(VTermStringFragment frag, void *user); int (*pm)(VTermStringFragment frag, void *user); int (*sos)(VTermStringFragment frag, void *user); int (*resize)(int rows, int cols, void *user); } VTermParserCallbacks; void vterm_parser_set_callbacks(VTerm *vt, const VTermParserCallbacks *callbacks, void *user); void *vterm_parser_get_cbdata(VTerm *vt); // ----------- // State layer // ----------- typedef struct { int (*putglyph)(VTermGlyphInfo *info, VTermPos pos, void *user); int (*movecursor)(VTermPos pos, VTermPos oldpos, int visible, void *user); int (*scrollrect)(VTermRect rect, int downward, int rightward, void *user); int (*moverect)(VTermRect dest, VTermRect src, void *user); int (*erase)(VTermRect rect, int selective, void *user); int (*initpen)(void *user); int (*setpenattr)(VTermAttr attr, VTermValue *val, void *user); int (*settermprop)(VTermProp prop, VTermValue *val, void *user); int (*bell)(void *user); int (*resize)(int rows, int cols, VTermStateFields *fields, void *user); int (*setlineinfo)(int row, const VTermLineInfo *newinfo, const VTermLineInfo *oldinfo, void *user); } VTermStateCallbacks; typedef struct { int (*control)(unsigned char control, void *user); int (*csi)(const char *leader, const long args[], int argcount, const char *intermed, char command, void *user); int (*osc)(int command, VTermStringFragment frag, void *user); int (*dcs)(const char *command, size_t commandlen, VTermStringFragment frag, void *user); int (*apc)(VTermStringFragment frag, void *user); int (*pm)(VTermStringFragment frag, void *user); int (*sos)(VTermStringFragment frag, void *user); } VTermStateFallbacks; typedef struct { int (*set)(VTermSelectionMask mask, VTermStringFragment frag, void *user); int (*query)(VTermSelectionMask mask, void *user); } VTermSelectionCallbacks; VTermState *vterm_obtain_state(VTerm *vt); void vterm_state_set_callbacks(VTermState *state, const VTermStateCallbacks *callbacks, void *user); void *vterm_state_get_cbdata(VTermState *state); void vterm_state_set_unrecognised_fallbacks(VTermState *state, const VTermStateFallbacks *fallbacks, void *user); void *vterm_state_get_unrecognised_fbdata(VTermState *state); void vterm_state_reset(VTermState *state, int hard); void vterm_state_get_cursorpos(const VTermState *state, VTermPos *cursorpos); void vterm_state_get_default_colors(const VTermState *state, VTermColor *default_fg, VTermColor *default_bg); void vterm_state_get_palette_color(const VTermState *state, int index, VTermColor *col); void vterm_state_set_default_colors(VTermState *state, const VTermColor *default_fg, const VTermColor *default_bg); void vterm_state_set_palette_color(VTermState *state, int index, const VTermColor *col); void vterm_state_set_bold_highbright(VTermState *state, int bold_is_highbright); int vterm_state_get_penattr(const VTermState *state, VTermAttr attr, VTermValue *val); int vterm_state_set_termprop(VTermState *state, VTermProp prop, VTermValue *val); void vterm_state_focus_in(VTermState *state); void vterm_state_focus_out(VTermState *state); const VTermLineInfo *vterm_state_get_lineinfo(const VTermState *state, int row); /** * Makes sure that the given color `col` is indeed an RGB colour. After this * function returns, VTERM_COLOR_IS_RGB(col) will return true, while all other * flags stored in `col->type` will have been reset. * * @param state is the VTermState instance from which the colour palette should * be extracted. * @param col is a pointer at the VTermColor instance that should be converted * to an RGB colour. */ void vterm_state_convert_color_to_rgb(const VTermState *state, VTermColor *col); void vterm_state_set_selection_callbacks(VTermState *state, const VTermSelectionCallbacks *callbacks, void *user, char *buffer, size_t buflen); void vterm_state_send_selection(VTermState *state, VTermSelectionMask mask, VTermStringFragment frag); // ------------ // Screen layer // ------------ typedef struct { unsigned int bold : 1; unsigned int underline : 2; unsigned int italic : 1; unsigned int blink : 1; unsigned int reverse : 1; unsigned int conceal : 1; unsigned int strike : 1; unsigned int font : 4; /* 0 to 9 */ unsigned int dwl : 1; /* On a DECDWL or DECDHL line */ unsigned int dhl : 2; /* On a DECDHL line (1=top 2=bottom) */ } VTermScreenCellAttrs; enum { VTERM_UNDERLINE_OFF, VTERM_UNDERLINE_SINGLE, VTERM_UNDERLINE_DOUBLE, VTERM_UNDERLINE_CURLY, }; typedef struct { #define VTERM_MAX_CHARS_PER_CELL 6 uint32_t chars[VTERM_MAX_CHARS_PER_CELL]; char width; VTermScreenCellAttrs attrs; VTermColor fg, bg; } VTermScreenCell; typedef struct { int (*damage)(VTermRect rect, void *user); int (*moverect)(VTermRect dest, VTermRect src, void *user); int (*movecursor)(VTermPos pos, VTermPos oldpos, int visible, void *user); int (*settermprop)(VTermProp prop, VTermValue *val, void *user); int (*bell)(void *user); int (*resize)(int rows, int cols, void *user); int (*sb_pushline)(int cols, const VTermScreenCell *cells, void *user); int (*sb_popline)(int cols, VTermScreenCell *cells, void *user); } VTermScreenCallbacks; VTermScreen *vterm_obtain_screen(VTerm *vt); void vterm_screen_set_callbacks(VTermScreen *screen, const VTermScreenCallbacks *callbacks, void *user); void *vterm_screen_get_cbdata(VTermScreen *screen); void vterm_screen_set_unrecognised_fallbacks(VTermScreen *screen, const VTermStateFallbacks *fallbacks, void *user); void *vterm_screen_get_unrecognised_fbdata(VTermScreen *screen); void vterm_screen_enable_altscreen(VTermScreen *screen, int altscreen); typedef enum { VTERM_DAMAGE_CELL, /* every cell */ VTERM_DAMAGE_ROW, /* entire rows */ VTERM_DAMAGE_SCREEN, /* entire screen */ VTERM_DAMAGE_SCROLL, /* entire screen + scrollrect */ VTERM_N_DAMAGES } VTermDamageSize; void vterm_screen_flush_damage(VTermScreen *screen); void vterm_screen_set_damage_merge(VTermScreen *screen, VTermDamageSize size); void vterm_screen_reset(VTermScreen *screen, int hard); /* Neither of these functions NUL-terminate the buffer */ size_t vterm_screen_get_chars(const VTermScreen *screen, uint32_t *chars, size_t len, const VTermRect rect); size_t vterm_screen_get_text(const VTermScreen *screen, char *str, size_t len, const VTermRect rect); typedef enum { VTERM_ATTR_BOLD_MASK = 1 << 0, VTERM_ATTR_UNDERLINE_MASK = 1 << 1, VTERM_ATTR_ITALIC_MASK = 1 << 2, VTERM_ATTR_BLINK_MASK = 1 << 3, VTERM_ATTR_REVERSE_MASK = 1 << 4, VTERM_ATTR_STRIKE_MASK = 1 << 5, VTERM_ATTR_FONT_MASK = 1 << 6, VTERM_ATTR_FOREGROUND_MASK = 1 << 7, VTERM_ATTR_BACKGROUND_MASK = 1 << 8, VTERM_ATTR_CONCEAL_MASK = 1 << 9, VTERM_ALL_ATTRS_MASK = (1 << 10) - 1 } VTermAttrMask; int vterm_screen_get_attrs_extent(const VTermScreen *screen, VTermRect *extent, VTermPos pos, VTermAttrMask attrs); int vterm_screen_get_cell(const VTermScreen *screen, VTermPos pos, VTermScreenCell *cell); int vterm_screen_is_eol(const VTermScreen *screen, VTermPos pos); /** * Same as vterm_state_convert_color_to_rgb(), but takes a `screen` instead of a `state` * instance. */ void vterm_screen_convert_color_to_rgb(const VTermScreen *screen, VTermColor *col); // --------- // Utilities // --------- VTermValueType vterm_get_attr_type(VTermAttr attr); VTermValueType vterm_get_prop_type(VTermProp prop); void vterm_scroll_rect(VTermRect rect, int downward, int rightward, int (*moverect)(VTermRect src, VTermRect dest, void *user), int (*eraserect)(VTermRect rect, int selective, void *user), void *user); void vterm_copy_cells(VTermRect dest, VTermRect src, void (*copycell)(VTermPos dest, VTermPos src, void *user), void *user); #ifdef __cplusplus } #endif #endif cgdb-0.8.0/lib/vterm/keyboard.c0000644000175000017500000001401714160506403013210 00000000000000#include "vterm_internal.h" #include #include "utf8.h" void vterm_keyboard_unichar(VTerm *vt, uint32_t c, VTermModifier mod) { /* The shift modifier is never important for Unicode characters * apart from Space */ if(c != ' ') mod &= ~VTERM_MOD_SHIFT; if(mod == 0) { // Normal text - ignore just shift char str[6]; int seqlen = fill_utf8(c, str); vterm_push_output_bytes(vt, str, seqlen); return; } int needs_CSIu; switch(c) { /* Special Ctrl- letters that can't be represented elsewise */ case 'i': case 'j': case 'm': case '[': needs_CSIu = 1; break; /* Ctrl-\ ] ^ _ don't need CSUu */ case '\\': case ']': case '^': case '_': needs_CSIu = 0; break; /* Shift-space needs CSIu */ case ' ': needs_CSIu = !!(mod & VTERM_MOD_SHIFT); break; /* All other characters needs CSIu except for letters a-z */ default: needs_CSIu = (c < 'a' || c > 'z'); } /* ALT we can just prefix with ESC; anything else requires CSI u */ if(needs_CSIu && (mod & ~VTERM_MOD_ALT)) { vterm_push_output_sprintf_ctrl(vt, C1_CSI, "%d;%du", c, mod+1); return; } if(mod & VTERM_MOD_CTRL) c &= 0x1f; vterm_push_output_sprintf(vt, "%s%c", mod & VTERM_MOD_ALT ? ESC_S : "", c); } typedef struct { enum { KEYCODE_NONE, KEYCODE_LITERAL, KEYCODE_TAB, KEYCODE_ENTER, KEYCODE_SS3, KEYCODE_CSI, KEYCODE_CSI_CURSOR, KEYCODE_CSINUM, KEYCODE_KEYPAD, } type; char literal; int csinum; } keycodes_s; static keycodes_s keycodes[] = { { KEYCODE_NONE }, // NONE { KEYCODE_ENTER, '\r' }, // ENTER { KEYCODE_TAB, '\t' }, // TAB { KEYCODE_LITERAL, '\x7f' }, // BACKSPACE == ASCII DEL { KEYCODE_LITERAL, '\x1b' }, // ESCAPE { KEYCODE_CSI_CURSOR, 'A' }, // UP { KEYCODE_CSI_CURSOR, 'B' }, // DOWN { KEYCODE_CSI_CURSOR, 'D' }, // LEFT { KEYCODE_CSI_CURSOR, 'C' }, // RIGHT { KEYCODE_CSINUM, '~', 2 }, // INS { KEYCODE_CSINUM, '~', 3 }, // DEL { KEYCODE_CSI_CURSOR, 'H' }, // HOME { KEYCODE_CSI_CURSOR, 'F' }, // END { KEYCODE_CSINUM, '~', 5 }, // PAGEUP { KEYCODE_CSINUM, '~', 6 }, // PAGEDOWN }; static keycodes_s keycodes_fn[] = { { KEYCODE_NONE }, // F0 - shouldn't happen { KEYCODE_SS3, 'P' }, // F1 { KEYCODE_SS3, 'Q' }, // F2 { KEYCODE_SS3, 'R' }, // F3 { KEYCODE_SS3, 'S' }, // F4 { KEYCODE_CSINUM, '~', 15 }, // F5 { KEYCODE_CSINUM, '~', 17 }, // F6 { KEYCODE_CSINUM, '~', 18 }, // F7 { KEYCODE_CSINUM, '~', 19 }, // F8 { KEYCODE_CSINUM, '~', 20 }, // F9 { KEYCODE_CSINUM, '~', 21 }, // F10 { KEYCODE_CSINUM, '~', 23 }, // F11 { KEYCODE_CSINUM, '~', 24 }, // F12 }; static keycodes_s keycodes_kp[] = { { KEYCODE_KEYPAD, '0', 'p' }, // KP_0 { KEYCODE_KEYPAD, '1', 'q' }, // KP_1 { KEYCODE_KEYPAD, '2', 'r' }, // KP_2 { KEYCODE_KEYPAD, '3', 's' }, // KP_3 { KEYCODE_KEYPAD, '4', 't' }, // KP_4 { KEYCODE_KEYPAD, '5', 'u' }, // KP_5 { KEYCODE_KEYPAD, '6', 'v' }, // KP_6 { KEYCODE_KEYPAD, '7', 'w' }, // KP_7 { KEYCODE_KEYPAD, '8', 'x' }, // KP_8 { KEYCODE_KEYPAD, '9', 'y' }, // KP_9 { KEYCODE_KEYPAD, '*', 'j' }, // KP_MULT { KEYCODE_KEYPAD, '+', 'k' }, // KP_PLUS { KEYCODE_KEYPAD, ',', 'l' }, // KP_COMMA { KEYCODE_KEYPAD, '-', 'm' }, // KP_MINUS { KEYCODE_KEYPAD, '.', 'n' }, // KP_PERIOD { KEYCODE_KEYPAD, '/', 'o' }, // KP_DIVIDE { KEYCODE_KEYPAD, '\n', 'M' }, // KP_ENTER { KEYCODE_KEYPAD, '=', 'X' }, // KP_EQUAL }; void vterm_keyboard_key(VTerm *vt, VTermKey key, VTermModifier mod) { if(key == VTERM_KEY_NONE) return; keycodes_s k; if(key < VTERM_KEY_FUNCTION_0) { if(key >= sizeof(keycodes)/sizeof(keycodes[0])) return; k = keycodes[key]; } else if(key >= VTERM_KEY_FUNCTION_0 && key <= VTERM_KEY_FUNCTION_MAX) { if((key - VTERM_KEY_FUNCTION_0) >= sizeof(keycodes_fn)/sizeof(keycodes_fn[0])) return; k = keycodes_fn[key - VTERM_KEY_FUNCTION_0]; } else if(key >= VTERM_KEY_KP_0) { if((key - VTERM_KEY_KP_0) >= sizeof(keycodes_kp)/sizeof(keycodes_kp[0])) return; k = keycodes_kp[key - VTERM_KEY_KP_0]; } switch(k.type) { case KEYCODE_NONE: break; case KEYCODE_TAB: /* Shift-Tab is CSI Z but plain Tab is 0x09 */ if(mod == VTERM_MOD_SHIFT) vterm_push_output_sprintf_ctrl(vt, C1_CSI, "Z"); else if(mod & VTERM_MOD_SHIFT) vterm_push_output_sprintf_ctrl(vt, C1_CSI, "1;%dZ", mod+1); else goto case_LITERAL; break; case KEYCODE_ENTER: /* Enter is CRLF in newline mode, but just LF in linefeed */ if(vt->state->mode.newline) vterm_push_output_sprintf(vt, "\r\n"); else goto case_LITERAL; break; case KEYCODE_LITERAL: case_LITERAL: if(mod & (VTERM_MOD_SHIFT|VTERM_MOD_CTRL)) vterm_push_output_sprintf_ctrl(vt, C1_CSI, "%d;%du", k.literal, mod+1); else vterm_push_output_sprintf(vt, mod & VTERM_MOD_ALT ? ESC_S "%c" : "%c", k.literal); break; case KEYCODE_SS3: case_SS3: if(mod == 0) vterm_push_output_sprintf_ctrl(vt, C1_SS3, "%c", k.literal); else goto case_CSI; break; case KEYCODE_CSI: case_CSI: if(mod == 0) vterm_push_output_sprintf_ctrl(vt, C1_CSI, "%c", k.literal); else vterm_push_output_sprintf_ctrl(vt, C1_CSI, "1;%d%c", mod + 1, k.literal); break; case KEYCODE_CSINUM: if(mod == 0) vterm_push_output_sprintf_ctrl(vt, C1_CSI, "%d%c", k.csinum, k.literal); else vterm_push_output_sprintf_ctrl(vt, C1_CSI, "%d;%d%c", k.csinum, mod + 1, k.literal); break; case KEYCODE_CSI_CURSOR: if(vt->state->mode.cursor) goto case_SS3; else goto case_CSI; case KEYCODE_KEYPAD: if(vt->state->mode.keypad) { k.literal = k.csinum; goto case_SS3; } else goto case_LITERAL; } } void vterm_keyboard_start_paste(VTerm *vt) { if(vt->state->mode.bracketpaste) vterm_push_output_sprintf_ctrl(vt, C1_CSI, "200~"); } void vterm_keyboard_end_paste(VTerm *vt) { if(vt->state->mode.bracketpaste) vterm_push_output_sprintf_ctrl(vt, C1_CSI, "201~"); } cgdb-0.8.0/lib/vterm/uk.inc0000664000175000017500000000016714160506473012370 00000000000000static const struct StaticTableEncoding encoding_uk = { { .decode = &decode_table }, { [0x23] = 0x00a3, } }; cgdb-0.8.0/lib/vterm/mouse.c0000644000175000017500000000471314160506403012542 00000000000000#include "vterm_internal.h" #include "utf8.h" static void output_mouse(VTermState *state, int code, int pressed, int modifiers, int col, int row) { modifiers <<= 2; switch(state->mouse_protocol) { case MOUSE_X10: if(col + 0x21 > 0xff) col = 0xff - 0x21; if(row + 0x21 > 0xff) row = 0xff - 0x21; if(!pressed) code = 3; vterm_push_output_sprintf_ctrl(state->vt, C1_CSI, "M%c%c%c", (code | modifiers) + 0x20, col + 0x21, row + 0x21); break; case MOUSE_UTF8: { char utf8[18]; size_t len = 0; if(!pressed) code = 3; len += fill_utf8((code | modifiers) + 0x20, utf8 + len); len += fill_utf8(col + 0x21, utf8 + len); len += fill_utf8(row + 0x21, utf8 + len); utf8[len] = 0; vterm_push_output_sprintf_ctrl(state->vt, C1_CSI, "M%s", utf8); } break; case MOUSE_SGR: vterm_push_output_sprintf_ctrl(state->vt, C1_CSI, "<%d;%d;%d%c", code | modifiers, col + 1, row + 1, pressed ? 'M' : 'm'); break; case MOUSE_RXVT: if(!pressed) code = 3; vterm_push_output_sprintf_ctrl(state->vt, C1_CSI, "%d;%d;%dM", code | modifiers, col + 1, row + 1); break; } } void vterm_mouse_move(VTerm *vt, int row, int col, VTermModifier mod) { VTermState *state = vt->state; if(col == state->mouse_col && row == state->mouse_row) return; state->mouse_col = col; state->mouse_row = row; if((state->mouse_flags & MOUSE_WANT_DRAG && state->mouse_buttons) || (state->mouse_flags & MOUSE_WANT_MOVE)) { int button = state->mouse_buttons & 0x01 ? 1 : state->mouse_buttons & 0x02 ? 2 : state->mouse_buttons & 0x04 ? 3 : 4; output_mouse(state, button-1 + 0x20, 1, mod, col, row); } } void vterm_mouse_button(VTerm *vt, int button, bool pressed, VTermModifier mod) { VTermState *state = vt->state; int old_buttons = state->mouse_buttons; if(button > 0 && button <= 3) { if(pressed) state->mouse_buttons |= (1 << (button-1)); else state->mouse_buttons &= ~(1 << (button-1)); } /* Most of the time we don't get button releases from 4/5 */ if(state->mouse_buttons == old_buttons && button < 4) return; if(!state->mouse_flags) return; if(button < 4) { output_mouse(state, button-1, pressed, mod, state->mouse_col, state->mouse_row); } else if(button < 6) { output_mouse(state, button-4 + 0x40, pressed, mod, state->mouse_col, state->mouse_row); } } cgdb-0.8.0/COPYING0000644000175000017500000004311012303175461010373 00000000000000 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.8.0/aclocal.m40000664000175000017500000012340414134377073011216 00000000000000# generated automatically by aclocal 1.15 -*- Autoconf -*- # Copyright (C) 1996-2014 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-2014 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.15' 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.15], [], [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.15])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-2014 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], [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997-2014 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-2014 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-2014 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-2014 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. dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O. m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC]) [_AM_PROG_CC_C_O ]) # 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 (and possibly the TAP driver). 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 # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile # recipes. So use an aggressive probe to check that the usage we want is # actually supported "in the wild" to an acceptable degree. # See automake bug#10828. # To make any issue more visible, cause the running configure to be aborted # by default if the 'rm' program in use doesn't match our expectations; the # user can still override this though. if rm -f && rm -fr && rm -rf; then : OK; else cat >&2 <<'END' Oops! Your 'rm' program seems unable to run without file operands specified on the command line, even when the '-f' option is present. This is contrary to the behaviour of most rm programs out there, and not conforming with the upcoming POSIX standard: Please tell bug-automake@gnu.org about your system, including the value of your $PATH and any error possibly output before this message. This can help us improve future automake versions. END if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then echo 'Configuration will proceed anyway, since you have set the' >&2 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 echo >&2 else cat >&2 <<'END' Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM to "yes", and re-run configure. END AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) fi fi dnl The trailing newline in this macro's definition is deliberate, for dnl backward compatibility and to allow trailing 'dnl'-style comments dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841. ]) 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-2014 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+set}" != 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-2014 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-2014 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-2014 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 ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997-2014 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-2014 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])]) # Copyright (C) 1999-2014 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. We rewrite AC_PROG_CC # to automatically call this. AC_DEFUN([_AM_PROG_CC_C_O], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([compile])dnl AC_LANG_PUSH([C])dnl AC_CACHE_CHECK( [whether $CC understands -c and -o together], [am_cv_prog_cc_c_o], [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])]) # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i]) if test "$am_cv_prog_cc_c_o" != 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 AC_LANG_POP([C])]) # For backward compatibility. AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) # Copyright (C) 2001-2014 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_RUN_LOG(COMMAND) # ------------------- # Run COMMAND, save the exit status in ac_status, and log it. # (This has been adapted from Autoconf's _AC_RUN_LOG macro.) AC_DEFUN([AM_RUN_LOG], [{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD (exit $ac_status); }]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996-2014 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-2014 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-2014 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-2014 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-2014 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}']) # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' m4_if([$1], [v7], [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], [m4_case([$1], [ustar], [# The POSIX 1988 'ustar' format is defined with fixed-size fields. # There is notably a 21 bits limit for the UID and the GID. In fact, # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 # and bug#13588). am_max_uid=2097151 # 2^21 - 1 am_max_gid=$am_max_uid # The $UID and $GID variables are not portable, so we need to resort # to the POSIX-mandated id(1) utility. Errors in the 'id' calls # below are definitely unexpected, so allow the users to see them # (that is, avoid stderr redirection). am_uid=`id -u || echo unknown` am_gid=`id -g || echo unknown` AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) if test $am_uid -le $am_max_uid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) if test $am_gid -le $am_max_gid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi], [pax], [], [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Go ahead even if we have the value already cached. We do so because we # need to set the values for the 'am__tar' and 'am__untar' variables. _am_tools=${am_cv_prog_tar_$1-$_am_tools} 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.8.0/Makefile.am0000664000175000017500000000043713355214337011407 00000000000000# 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 AUTOMAKE_OPTIONS = -Wportability foreign SUBDIRS=lib cgdb doc test DIST_SUBDIRS=lib cgdb doc test cgdb-0.8.0/ChangeLog0000644000175000017500000000000012303175461011101 00000000000000cgdb-0.8.0/INSTALL0000664000175000017500000001734513046230117010401 00000000000000Basic 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: NOTE if building from a git checkout, `sh autogen.sh` needs to be ran first. 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.8.0/configure0000775000175000017500000071422214171036447011267 00000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69 for cgdb 0.8.0. # # # 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.8.0' PACKAGE_STRING='cgdb 0.8.0' 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 HAS_MAKEINFO 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__fastdepCXX_FALSE am__fastdepCXX_TRUE CXXDEPMODE ac_ct_CXX CXXFLAGS CXX 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 runstatedir 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 CXX CXXFLAGS CCC 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' runstatedir='${localstatedir}/run' 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 ;; -runstatedir | --runstatedir | --runstatedi | --runstated \ | --runstate | --runstat | --runsta | --runst | --runs \ | --run | --ru | --r) ac_prev=runstatedir ;; -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ | --run=* | --ru=* | --r=*) runstatedir=$ac_optarg ;; -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 runstatedir 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.8.0 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] --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --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.8.0:";; 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 CXX C++ compiler command CXXFLAGS C++ compiler flags 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.8.0 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_cxx_try_compile LINENO # ---------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_cxx_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_cxx_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_cxx_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.8.0, 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.15' # 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+set}" != 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.8.0' 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 (and possibly the TAP driver). 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}' # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar pax cpio none' am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile # recipes. So use an aggressive probe to check that the usage we want is # actually supported "in the wild" to an acceptable degree. # See automake bug#10828. # To make any issue more visible, cause the running configure to be aborted # by default if the 'rm' program in use doesn't match our expectations; the # user can still override this though. if rm -f && rm -fr && rm -rf; then : OK; else cat >&2 <<'END' Oops! Your 'rm' program seems unable to run without file operands specified on the command line, even when the '-f' option is present. This is contrary to the behaviour of most rm programs out there, and not conforming with the upcoming POSIX standard: Please tell bug-automake@gnu.org about your system, including the value of your $PATH and any error possibly output before this message. This can help us improve future automake versions. END if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then echo 'Configuration will proceed anyway, since you have set the' >&2 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 echo >&2 else cat >&2 <<'END' Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM to "yes", and re-run configure. END as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 fi 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 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 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 whether $CC understands -c and -o together" >&5 $as_echo_n "checking whether $CC understands -c and -o together... " >&6; } if ${am_cv_prog_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. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 $as_echo "$am_cv_prog_cc_c_o" >&6; } if test "$am_cv_prog_cc_c_o" != 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 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 ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test -z "$CXX"; then if test -n "$CCC"; then CXX=$CCC else if test -n "$ac_tool_prefix"; then for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC 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_CXX+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # 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_CXX="$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 CXX=$ac_cv_prog_CXX if test -n "$CXX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 $as_echo "$CXX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CXX" && break done fi if test -z "$CXX"; then ac_ct_CXX=$CXX for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC 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_CXX+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CXX"; then ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # 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_CXX="$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_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 $as_echo "$ac_ct_CXX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CXX" && break done if test "x$ac_ct_CXX" = x; then CXX="g++" 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 CXX=$ac_ct_CXX fi fi fi fi # 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 { $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_cxx_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_cxx_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_cxx_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 $as_echo "$ac_cv_cxx_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GXX=yes else GXX= fi ac_test_CXXFLAGS=${CXXFLAGS+set} ac_save_CXXFLAGS=$CXXFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 $as_echo_n "checking whether $CXX accepts -g... " >&6; } if ${ac_cv_prog_cxx_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_cxx_werror_flag=$ac_cxx_werror_flag ac_cxx_werror_flag=yes ac_cv_prog_cxx_g=no CXXFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_cv_prog_cxx_g=yes else CXXFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : else ac_cxx_werror_flag=$ac_save_cxx_werror_flag CXXFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_cv_prog_cxx_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_cxx_werror_flag=$ac_save_cxx_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 $as_echo "$ac_cv_prog_cxx_g" >&6; } if test "$ac_test_CXXFLAGS" = set; then CXXFLAGS=$ac_save_CXXFLAGS elif test $ac_cv_prog_cxx_g = yes; then if test "$GXX" = yes; then CXXFLAGS="-g -O2" else CXXFLAGS="-g" fi else if test "$GXX" = yes; then CXXFLAGS="-O2" else CXXFLAGS= fi 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 depcc="$CXX" 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_CXX_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_CXX_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_CXX_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CXX_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5 $as_echo "$am_cv_CXX_dependencies_compiler_type" >&6; } CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then am__fastdepCXX_TRUE= am__fastdepCXX_FALSE='#' else am__fastdepCXX_TRUE='#' am__fastdepCXX_FALSE= 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 /proc/self/status" >&5 $as_echo_n "checking for /proc/self/status... " >&6; } if ${ac_cv_file__proc_self_status+:} 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 "/proc/self/status"; then ac_cv_file__proc_self_status=yes else ac_cv_file__proc_self_status=no fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_file__proc_self_status" >&5 $as_echo "$ac_cv_file__proc_self_status" >&6; } if test "x$ac_cv_file__proc_self_status" = xyes; then : $as_echo "#define HAVE_PROC_SELF_STATUS_FILE 1" >>confdefs.h fi for ac_header in pty.h do : ac_fn_c_check_header_mongrel "$LINENO" "pty.h" "ac_cv_header_pty_h" "$ac_includes_default" if test "x$ac_cv_header_pty_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_PTY_H 1 _ACEOF $as_echo "#define HAVE_PTY_H 1" >>confdefs.h fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for openpty in -lutil" >&5 $as_echo_n "checking for openpty in -lutil... " >&6; } if ${ac_cv_lib_util_openpty+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lutil $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 openpty (); int main () { return openpty (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_util_openpty=yes else ac_cv_lib_util_openpty=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_util_openpty" >&5 $as_echo "$ac_cv_lib_util_openpty" >&6; } if test "x$ac_cv_lib_util_openpty" = xyes; then : $as_echo "#define HAVE_OPENPTY 1" >>confdefs.h LIBS="$LIBS -lutil" 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 { $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" "ttyname_r" "ac_cv_func_ttyname_r" if test "x$ac_cv_func_ttyname_r" = xyes; then : $as_echo "#define HAVE_TTYNAME_R 1" >>confdefs.h fi cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #include int main () { char buf[10]; ptsname_r(0, buf, sizeof(buf)); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : $as_echo "#define HAVE_PTSNAME_R 1" >>confdefs.h fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext # Extract the first word of "makeinfo", so it can be a program name with args. set dummy makeinfo; 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_HAS_MAKEINFO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$HAS_MAKEINFO"; then ac_cv_prog_HAS_MAKEINFO="$HAS_MAKEINFO" # 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_HAS_MAKEINFO="yes" $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 test -z "$ac_cv_prog_HAS_MAKEINFO" && ac_cv_prog_HAS_MAKEINFO="no" fi fi HAS_MAKEINFO=$ac_cv_prog_HAS_MAKEINFO if test -n "$HAS_MAKEINFO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HAS_MAKEINFO" >&5 $as_echo "$HAS_MAKEINFO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } 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 if test "$LEX" != "flex" -a "$LEX" != "lex"; then as_fn_error $? "Please install flex before installing" "$LINENO" 5 fi if test "$HAS_MAKEINFO" != "yes" ; then as_fn_error $? "Please install makeinfo before installing" "$LINENO" 5 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 \"yes\"" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for initscr in -lncursesw" >&5 $as_echo_n "checking for initscr in -lncursesw... " >&6; } if ${ac_cv_lib_ncursesw_initscr+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lncursesw $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_ncursesw_initscr=yes else ac_cv_lib_ncursesw_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_ncursesw_initscr" >&5 $as_echo "$ac_cv_lib_ncursesw_initscr" >&6; } if test "x$ac_cv_lib_ncursesw_initscr" = xyes; then : $as_echo "#define HAVE_NCURSES \"yes\"" >>confdefs.h fi if test "$ac_cv_lib_ncursesw_initscr" = "yes"; then curses_lib_name="ncursesw" elif test "$ac_cv_lib_ncurses_initscr" = "yes"; then curses_lib_name="ncurses" 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 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking Checking attribute printf support" >&5 $as_echo_n "checking Checking attribute printf support... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include static void test(const char *fmt, ...) __attribute__((format(__printf__, 1, 2))); static void test(const char *fmt, ...) { (void)fmt; } int main () { test("foobar"); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } $as_echo "#define HAVE_ATTRIBUTE_PRINTF 1" >>confdefs.h else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext 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 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 if test "$curses_lib_name" = "ncursesw"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tgetent in -lncursesw" >&5 $as_echo_n "checking for tgetent in -lncursesw... " >&6; } if ${ac_cv_lib_ncursesw_tgetent+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lncursesw $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_ncursesw_tgetent=yes else ac_cv_lib_ncursesw_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_ncursesw_tgetent" >&5 $as_echo "$ac_cv_lib_ncursesw_tgetent" >&6; } if test "x$ac_cv_lib_ncursesw_tgetent" = xyes; then : bash_cv_termcap_lib=libncursesw else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tgetent in -ltinfow" >&5 $as_echo_n "checking for tgetent in -ltinfow... " >&6; } if ${ac_cv_lib_tinfow_tgetent+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ltinfow $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_tinfow_tgetent=yes else ac_cv_lib_tinfow_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_tinfow_tgetent" >&5 $as_echo "$ac_cv_lib_tinfow_tgetent" >&6; } if test "x$ac_cv_lib_tinfow_tgetent" = xyes; then : bash_cv_termcap_lib=libtinfow fi fi elif test "$curses_lib_name" = "ncurses"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tgetent in -lncurses" >&5 $as_echo_n "checking for tgetent in -lncurses... " >&6; } if ${ac_cv_lib_ncurses_tgetent+:} 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 tgetent (); int main () { return tgetent (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_ncurses_tgetent=yes else ac_cv_lib_ncurses_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_ncurses_tgetent" >&5 $as_echo "$ac_cv_lib_ncurses_tgetent" >&6; } if test "x$ac_cv_lib_ncurses_tgetent" = xyes; then : bash_cv_termcap_lib=libncurses 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 fi fi elif test "$curses_lib_name" = "curses"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tgetent in -lcurses" >&5 $as_echo_n "checking for tgetent in -lcurses... " >&6; } if ${ac_cv_lib_curses_tgetent+:} 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 tgetent (); int main () { return tgetent (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_curses_tgetent=yes else ac_cv_lib_curses_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_curses_tgetent" >&5 $as_echo "$ac_cv_lib_curses_tgetent" >&6; } if test "x$ac_cv_lib_curses_tgetent" = xyes; then : bash_cv_termcap_lib=libcurses fi else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tgetent in -ltermcap" >&5 $as_echo_n "checking for tgetent in -ltermcap... " >&6; } if ${ac_cv_lib_termcap_tgetent+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ltermcap $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_termcap_tgetent=yes else ac_cv_lib_termcap_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_termcap_tgetent" >&5 $as_echo "$ac_cv_lib_termcap_tgetent" >&6; } if test "x$ac_cv_lib_termcap_tgetent" = xyes; then : bash_cv_termcap_lib=libtermcap 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 = libtinfow; then TERMCAP_LIB=-ltinfow TERMCAP_DEP= 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 #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 cgdb_custom_config.h Makefile lib/Makefile lib/kui/Makefile lib/rline/Makefile lib/tgdb/Makefile lib/tokenizer/Makefile lib/util/Makefile lib/vterm/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 if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCXX\" 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.8.0, 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.8.0 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" ;; "cgdb_custom_config.h") CONFIG_FILES="$CONFIG_FILES cgdb_custom_config.h" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "lib/Makefile") CONFIG_FILES="$CONFIG_FILES lib/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/tokenizer/Makefile") CONFIG_FILES="$CONFIG_FILES lib/tokenizer/Makefile" ;; "lib/util/Makefile") CONFIG_FILES="$CONFIG_FILES lib/util/Makefile" ;; "lib/vterm/Makefile") CONFIG_FILES="$CONFIG_FILES lib/vterm/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.8.0/test/0000775000175000017500000000000014171036467010411 500000000000000cgdb-0.8.0/test/config/0000755000175000017500000000000014007074105011641 500000000000000cgdb-0.8.0/test/config/unix.exp0000644000175000017500000000173512303175461013274 00000000000000# 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.8.0/test/Makefile.in0000664000175000017500000003232614171036450012374 00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/config/readline_check_version.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) 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 am__DIST_COMMON = $(srcdir)/Makefile.in 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@ CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ 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@ HAS_MAKEINFO = @HAS_MAKEINFO@ 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@ ac_ct_CXX = @ac_ct_CXX@ 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@ runstatedir = @runstatedir@ 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) --foreign test/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign test/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 .PRECIOUS: Makefile # 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.8.0/test/Makefile.am0000644000175000017500000000011412303175461012350 00000000000000AUTOMAKE_OPTIONS = dejagnu EXTRA_DIST = kui.base config DEJATOOL = kui.base cgdb-0.8.0/test/kui.base/0000755000175000017500000000000013344617171012106 500000000000000cgdb-0.8.0/test/kui.base/basic.exp0000664000175000017500000004052013257311731013624 00000000000000# 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" # Testing maps that are subsets of each other puts $mapping_output "map unmap_example1 a" puts $mapping_output "map unmap_example2_subset b" puts $mapping_output "unmap unmap_example1" # Testing maps that are subsets of each other puts $mapping_output "map unmap_example2 a" puts $mapping_output "map unmap_example2_subset b" puts $mapping_output "unmap unmap_example2_subset" 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" } } set test "backward-word key" send "\033b" expect { -re "CGDB_KEY_BACKWARD_WORD\\\[27\\\]\\\[98\\\]$kui_prompt$" { pass "$test"} timeout { fail "timeout $test" } } set test "forward-word key" send "\033f" expect { -re "CGDB_KEY_FORWARD_WORD\\\[27\\\]\\\[102\\\]$kui_prompt$" { pass "$test"} timeout { fail "timeout $test" } } set test "backward-kill-word key" send "\033\b" expect { -re "CGDB_KEY_BACKWARD_KILL_WORD\\\[27\\\]\\\[8\\\]$kui_prompt$" { pass "$test"} timeout { fail "timeout $test" } } set test "forward-kill-word key" send "\033d" expect { -re "CGDB_KEY_FORWARD_KILL_WORD\\\[27\\\]\\\[100\\\]$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" } } # If 2 maps exist and our subsets of each other, # map unmap_example1 a # map unmap_example1_subset b # and then you delete the parent map, the child should still match. # unmap unmap_example1 set test "parent map deleted, child map still matches" send "unmap_example1_subset" expect { -re "b${kui_prompt}$" { pass "$test"} timeout { fail "timeout $test" } } # If 2 maps exist and our subsets of each other, # map unmap_example2 a # map unmap_example2_subset b # and then you delete the child map, the parent should still match. # unmap unmap_example2_subset set test "child map deleted, parent map still matches" send "unmap_example2" expect { -re "a${kui_prompt}$" { pass "$test"} timeout { fail "timeout $test" } } cgdb-0.8.0/cgdb_custom_config.h.in0000664000175000017500000000033013015143602013724 00000000000000#ifndef CGDB_CUSTOM_H #define CGDB_CUSTOM_H #if HAVE_ATTRIBUTE_PRINTF #define ATTRIBUTE_PRINTF( _x, _y ) __attribute__( ( __format__( __printf__, _x, _y ) ) ) #else #define ATTRIBUTE_PRINTF( _x, _y ) #endif #endif cgdb-0.8.0/config.h.in0000664000175000017500000001256714134377103011402 00000000000000/* config.h.in. Generated from configure.ac by autoheader. */ /* Define to 1 if compiler supports attribute format printf */ #undef HAVE_ATTRIBUTE_PRINTF /* 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 /* 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 /* ncursesw 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 /* have /proc/self/status file */ #undef HAVE_PROC_SELF_STATUS_FILE /* Define to 1 if you have a re-entrant version of ptsname */ #undef HAVE_PTSNAME_R /* have pty.h */ #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 ttyname_r function */ #undef HAVE_TTYNAME_R /* 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 /* 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 #include