unixcw-3.0.2/ 0000755 0001750 0001750 00000000000 11767714362 012671 5 ustar acerion acerion unixcw-3.0.2/icon_unixcw.svg 0000644 0001750 0001750 00000014261 11663010242 015720 0 ustar acerion acerion
unixcw-3.0.2/configure 0000755 0001750 0001750 00000561100 11702306002 014554 0 ustar acerion acerion #! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.68 for UnixCW 3.0.1.
#
# Report bugs to .
#
#
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 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
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"
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 :
# 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
export CONFIG_SHELL
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+"$@"}
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 and acerion@wp.pl
$0: about your system, including any error possibly output
$0: before this message. Then install a modern shell, or
$0: manually run the script under such a shell if you do
$0: 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_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; }
# 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 -p'.
ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
as_ln_s='cp -p'
elif ln conf$$.file conf$$ 2>/dev/null; then
as_ln_s=ln
else
as_ln_s='cp -p'
fi
else
as_ln_s='cp -p'
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
if test -x / >/dev/null 2>&1; then
as_test_x='test -x'
else
if ls -dL / >/dev/null 2>&1; then
as_ls_L_option=L
else
as_ls_L_option=
fi
as_test_x='
eval sh -c '\''
if test -d "$1"; then
test -d "$1/.";
else
case $1 in #(
-*)set "./$1";;
esac;
case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
???[sx]*):;;*)false;;esac;fi
'\'' sh
'
fi
as_executable_p=$as_test_x
# 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='UnixCW'
PACKAGE_TARNAME='unixcw'
PACKAGE_VERSION='3.0.1'
PACKAGE_STRING='UnixCW 3.0.1'
PACKAGE_BUGREPORT='acerion@wp.pl'
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='LTLIBOBJS
LD_LINKS_SO
LD
CC_LINKS_SO
CFLAG_PIC
SUBDIRS
QT4INC
QT4MOC_2
QT4MOC
LIBOBJS
EGREP
GREP
CPP
LDCONFIG
GZIP
LN_S
SET_MAKE
INSTALL_DATA
INSTALL_SCRIPT
INSTALL_PROGRAM
RANLIB
AWK
ac_ct_CXX
CXXFLAGS
CXX
OBJEXT
EXEEXT
ac_ct_CC
CPPFLAGS
LDFLAGS
CFLAGS
CC
target_alias
host_alias
build_alias
LIBS
ECHO_T
ECHO_N
ECHO_C
DEFS
mandir
localedir
libdir
psdir
pdfdir
dvidir
htmldir
infodir
docdir
oldincludedir
includedir
localstatedir
sharedstatedir
sysconfdir
datadir
datarootdir
libexecdir
sbindir
bindir
program_transform_name
prefix
exec_prefix
PACKAGE_URL
PACKAGE_BUGREPORT
PACKAGE_STRING
PACKAGE_VERSION
PACKAGE_TARNAME
PACKAGE_NAME
PATH_SEPARATOR
SHELL'
ac_subst_files=''
ac_user_opts='
enable_option_checking
'
ac_precious_vars='build_alias
host_alias
target_alias
CC
CFLAGS
LDFLAGS
LIBS
CPPFLAGS
CXX
CXXFLAGS
CCC
CPP'
# Initialize some variables set by options.
ac_init_help=
ac_init_version=false
ac_unrecognized_opts=
ac_unrecognized_sep=
# The variables have the same names as the options, with
# dashes changed to underlines.
cache_file=/dev/null
exec_prefix=NONE
no_create=
no_recursion=
prefix=NONE
program_prefix=NONE
program_suffix=NONE
program_transform_name=s,x,x,
silent=
site=
srcdir=
verbose=
x_includes=NONE
x_libraries=NONE
# Installation directory options.
# These are left unexpanded so users can "make install exec_prefix=/foo"
# and all the variables that are supposed to be based on exec_prefix
# by default will actually change.
# Use braces instead of parens because sh, perl, etc. also accept them.
# (The list follows the same order as the GNU Coding Standards.)
bindir='${exec_prefix}/bin'
sbindir='${exec_prefix}/sbin'
libexecdir='${exec_prefix}/libexec'
datarootdir='${prefix}/share'
datadir='${datarootdir}'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
includedir='${prefix}/include'
oldincludedir='/usr/include'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
infodir='${datarootdir}/info'
htmldir='${docdir}'
dvidir='${docdir}'
pdfdir='${docdir}'
psdir='${docdir}'
libdir='${exec_prefix}/lib'
localedir='${datarootdir}/locale'
mandir='${datarootdir}/man'
ac_prev=
ac_dashdash=
for ac_option
do
# If the previous option needs an argument, assign it.
if test -n "$ac_prev"; then
eval $ac_prev=\$ac_option
ac_prev=
continue
fi
case $ac_option in
*=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
*=) ac_optarg= ;;
*) ac_optarg=yes ;;
esac
# Accept the important Cygnus configure options, so we can diagnose typos.
case $ac_dashdash$ac_option in
--)
ac_dashdash=yes ;;
-bindir | --bindir | --bindi | --bind | --bin | --bi)
ac_prev=bindir ;;
-bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
bindir=$ac_optarg ;;
-build | --build | --buil | --bui | --bu)
ac_prev=build_alias ;;
-build=* | --build=* | --buil=* | --bui=* | --bu=*)
build_alias=$ac_optarg ;;
-cache-file | --cache-file | --cache-fil | --cache-fi \
| --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
ac_prev=cache_file ;;
-cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
| --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
cache_file=$ac_optarg ;;
--config-cache | -C)
cache_file=config.cache ;;
-datadir | --datadir | --datadi | --datad)
ac_prev=datadir ;;
-datadir=* | --datadir=* | --datadi=* | --datad=*)
datadir=$ac_optarg ;;
-datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
| --dataroo | --dataro | --datar)
ac_prev=datarootdir ;;
-datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
| --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
datarootdir=$ac_optarg ;;
-disable-* | --disable-*)
ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
as_fn_error $? "invalid feature name: $ac_useropt"
ac_useropt_orig=$ac_useropt
ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
case $ac_user_opts in
*"
"enable_$ac_useropt"
"*) ;;
*) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
ac_unrecognized_sep=', ';;
esac
eval enable_$ac_useropt=no ;;
-docdir | --docdir | --docdi | --doc | --do)
ac_prev=docdir ;;
-docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
docdir=$ac_optarg ;;
-dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
ac_prev=dvidir ;;
-dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
dvidir=$ac_optarg ;;
-enable-* | --enable-*)
ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
as_fn_error $? "invalid feature name: $ac_useropt"
ac_useropt_orig=$ac_useropt
ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
case $ac_user_opts in
*"
"enable_$ac_useropt"
"*) ;;
*) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
ac_unrecognized_sep=', ';;
esac
eval enable_$ac_useropt=\$ac_optarg ;;
-exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
| --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
| --exec | --exe | --ex)
ac_prev=exec_prefix ;;
-exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
| --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
| --exec=* | --exe=* | --ex=*)
exec_prefix=$ac_optarg ;;
-gas | --gas | --ga | --g)
# Obsolete; use --with-gas.
with_gas=yes ;;
-help | --help | --hel | --he | -h)
ac_init_help=long ;;
-help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
ac_init_help=recursive ;;
-help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
ac_init_help=short ;;
-host | --host | --hos | --ho)
ac_prev=host_alias ;;
-host=* | --host=* | --hos=* | --ho=*)
host_alias=$ac_optarg ;;
-htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
ac_prev=htmldir ;;
-htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
| --ht=*)
htmldir=$ac_optarg ;;
-includedir | --includedir | --includedi | --included | --include \
| --includ | --inclu | --incl | --inc)
ac_prev=includedir ;;
-includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
| --includ=* | --inclu=* | --incl=* | --inc=*)
includedir=$ac_optarg ;;
-infodir | --infodir | --infodi | --infod | --info | --inf)
ac_prev=infodir ;;
-infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
infodir=$ac_optarg ;;
-libdir | --libdir | --libdi | --libd)
ac_prev=libdir ;;
-libdir=* | --libdir=* | --libdi=* | --libd=*)
libdir=$ac_optarg ;;
-libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
| --libexe | --libex | --libe)
ac_prev=libexecdir ;;
-libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
| --libexe=* | --libex=* | --libe=*)
libexecdir=$ac_optarg ;;
-localedir | --localedir | --localedi | --localed | --locale)
ac_prev=localedir ;;
-localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
localedir=$ac_optarg ;;
-localstatedir | --localstatedir | --localstatedi | --localstated \
| --localstate | --localstat | --localsta | --localst | --locals)
ac_prev=localstatedir ;;
-localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
| --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
localstatedir=$ac_optarg ;;
-mandir | --mandir | --mandi | --mand | --man | --ma | --m)
ac_prev=mandir ;;
-mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
mandir=$ac_optarg ;;
-nfp | --nfp | --nf)
# Obsolete; use --without-fp.
with_fp=no ;;
-no-create | --no-create | --no-creat | --no-crea | --no-cre \
| --no-cr | --no-c | -n)
no_create=yes ;;
-no-recursion | --no-recursion | --no-recursio | --no-recursi \
| --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
no_recursion=yes ;;
-oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
| --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
| --oldin | --oldi | --old | --ol | --o)
ac_prev=oldincludedir ;;
-oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
| --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
| --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
oldincludedir=$ac_optarg ;;
-prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
ac_prev=prefix ;;
-prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
prefix=$ac_optarg ;;
-program-prefix | --program-prefix | --program-prefi | --program-pref \
| --program-pre | --program-pr | --program-p)
ac_prev=program_prefix ;;
-program-prefix=* | --program-prefix=* | --program-prefi=* \
| --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
program_prefix=$ac_optarg ;;
-program-suffix | --program-suffix | --program-suffi | --program-suff \
| --program-suf | --program-su | --program-s)
ac_prev=program_suffix ;;
-program-suffix=* | --program-suffix=* | --program-suffi=* \
| --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
program_suffix=$ac_optarg ;;
-program-transform-name | --program-transform-name \
| --program-transform-nam | --program-transform-na \
| --program-transform-n | --program-transform- \
| --program-transform | --program-transfor \
| --program-transfo | --program-transf \
| --program-trans | --program-tran \
| --progr-tra | --program-tr | --program-t)
ac_prev=program_transform_name ;;
-program-transform-name=* | --program-transform-name=* \
| --program-transform-nam=* | --program-transform-na=* \
| --program-transform-n=* | --program-transform-=* \
| --program-transform=* | --program-transfor=* \
| --program-transfo=* | --program-transf=* \
| --program-trans=* | --program-tran=* \
| --progr-tra=* | --program-tr=* | --program-t=*)
program_transform_name=$ac_optarg ;;
-pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
ac_prev=pdfdir ;;
-pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
pdfdir=$ac_optarg ;;
-psdir | --psdir | --psdi | --psd | --ps)
ac_prev=psdir ;;
-psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
psdir=$ac_optarg ;;
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil)
silent=yes ;;
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
| --sbi=* | --sb=*)
sbindir=$ac_optarg ;;
-sharedstatedir | --sharedstatedir | --sharedstatedi \
| --sharedstated | --sharedstate | --sharedstat | --sharedsta \
| --sharedst | --shareds | --shared | --share | --shar \
| --sha | --sh)
ac_prev=sharedstatedir ;;
-sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
| --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
| --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
| --sha=* | --sh=*)
sharedstatedir=$ac_optarg ;;
-site | --site | --sit)
ac_prev=site ;;
-site=* | --site=* | --sit=*)
site=$ac_optarg ;;
-srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
ac_prev=srcdir ;;
-srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
srcdir=$ac_optarg ;;
-sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
| --syscon | --sysco | --sysc | --sys | --sy)
ac_prev=sysconfdir ;;
-sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
| --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
sysconfdir=$ac_optarg ;;
-target | --target | --targe | --targ | --tar | --ta | --t)
ac_prev=target_alias ;;
-target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
target_alias=$ac_optarg ;;
-v | -verbose | --verbose | --verbos | --verbo | --verb)
verbose=yes ;;
-version | --version | --versio | --versi | --vers | -V)
ac_init_version=: ;;
-with-* | --with-*)
ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
as_fn_error $? "invalid package name: $ac_useropt"
ac_useropt_orig=$ac_useropt
ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
case $ac_user_opts in
*"
"with_$ac_useropt"
"*) ;;
*) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
ac_unrecognized_sep=', ';;
esac
eval with_$ac_useropt=\$ac_optarg ;;
-without-* | --without-*)
ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
as_fn_error $? "invalid package name: $ac_useropt"
ac_useropt_orig=$ac_useropt
ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
case $ac_user_opts in
*"
"with_$ac_useropt"
"*) ;;
*) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
ac_unrecognized_sep=', ';;
esac
eval with_$ac_useropt=no ;;
--x)
# Obsolete; use --with-x.
with_x=yes ;;
-x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
| --x-incl | --x-inc | --x-in | --x-i)
ac_prev=x_includes ;;
-x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
| --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
x_includes=$ac_optarg ;;
-x-libraries | --x-libraries | --x-librarie | --x-librari \
| --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
ac_prev=x_libraries ;;
-x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
| --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
x_libraries=$ac_optarg ;;
-*) as_fn_error $? "unrecognized option: \`$ac_option'
Try \`$0 --help' for more information"
;;
*=*)
ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
# Reject names that are not valid shell variable names.
case $ac_envvar in #(
'' | [0-9]* | *[!_$as_cr_alnum]* )
as_fn_error $? "invalid variable name: \`$ac_envvar'" ;;
esac
eval $ac_envvar=\$ac_optarg
export $ac_envvar ;;
*)
# FIXME: should be removed in autoconf 3.0.
$as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
$as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
: "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}"
;;
esac
done
if test -n "$ac_prev"; then
ac_option=--`echo $ac_prev | sed 's/_/-/g'`
as_fn_error $? "missing argument to $ac_option"
fi
if test -n "$ac_unrecognized_opts"; then
case $enable_option_checking in
no) ;;
fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;
*) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
esac
fi
# Check all directory arguments for consistency.
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
datadir sysconfdir sharedstatedir localstatedir includedir \
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
libdir localedir mandir
do
eval ac_val=\$$ac_var
# Remove trailing slashes.
case $ac_val in
*/ )
ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
eval $ac_var=\$ac_val;;
esac
# Be sure to have absolute directory names.
case $ac_val in
[\\/$]* | ?:[\\/]* ) continue;;
NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
esac
as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"
done
# There might be people who depend on the old broken behavior: `$host'
# used to hold the argument of --host etc.
# FIXME: To remove some day.
build=$build_alias
host=$host_alias
target=$target_alias
# FIXME: To remove some day.
if test "x$host_alias" != x; then
if test "x$build_alias" = x; then
cross_compiling=maybe
$as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host.
If a cross compiler is detected then cross compile mode will be used" >&2
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 UnixCW 3.0.1 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE. See below for descriptions of some of the useful variables.
Defaults for the options are specified in brackets.
Configuration:
-h, --help display this help and exit
--help=short display options specific to this package
--help=recursive display the short help of all the included packages
-V, --version display version information and exit
-q, --quiet, --silent do not print \`checking ...' messages
--cache-file=FILE cache test results in FILE [disabled]
-C, --config-cache alias for \`--cache-file=config.cache'
-n, --no-create do not create output files
--srcdir=DIR find the sources in DIR [configure dir or \`..']
Installation directories:
--prefix=PREFIX install architecture-independent files in PREFIX
[$ac_default_prefix]
--exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
[PREFIX]
By default, \`make install' will install all the files in
\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
an installation prefix other than \`$ac_default_prefix' using \`--prefix',
for instance \`--prefix=\$HOME'.
For better control, use the options below.
Fine tuning of the installation directories:
--bindir=DIR user executables [EPREFIX/bin]
--sbindir=DIR system admin executables [EPREFIX/sbin]
--libexecdir=DIR program executables [EPREFIX/libexec]
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
--datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
--datadir=DIR read-only architecture-independent data [DATAROOTDIR]
--infodir=DIR info documentation [DATAROOTDIR/info]
--localedir=DIR locale-dependent data [DATAROOTDIR/locale]
--mandir=DIR man documentation [DATAROOTDIR/man]
--docdir=DIR documentation root [DATAROOTDIR/doc/unixcw]
--htmldir=DIR html documentation [DOCDIR]
--dvidir=DIR dvi documentation [DOCDIR]
--pdfdir=DIR pdf documentation [DOCDIR]
--psdir=DIR ps documentation [DOCDIR]
_ACEOF
cat <<\_ACEOF
_ACEOF
fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of UnixCW 3.0.1:";;
esac
cat <<\_ACEOF
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
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 .
_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
UnixCW configure 3.0.1
generated by GNU Autoconf 2.68
Copyright (C) 2010 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 ||
$as_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;}
( $as_echo "## ---------------------------- ##
## Report this to acerion@wp.pl ##
## ---------------------------- ##"
) | sed "s/^/$as_me: WARNING: /" >&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 UnixCW $as_me 3.0.1, which was
generated by GNU Autoconf 2.68. 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
# Specify a configuration header.
ac_config_headers="$ac_config_headers src/config.h"
# General checks for programs.
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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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
#include
#include
/* 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=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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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
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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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
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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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
ac_aux_dir=
for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; 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 \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$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.
# 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 { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$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 ${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
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5
$as_echo_n "checking whether ln -s works... " >&6; }
LN_S=$as_ln_s
if test "$LN_S" = "ln -s"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5
$as_echo "no, using $LN_S" >&6; }
fi
# Check specifically for gzip and ldconfig, and substitute the harmless ":"
# if absent.
# Extract the first word of "gzip", so it can be a program name with args.
set dummy gzip; 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_path_GZIP+:} false; then :
$as_echo_n "(cached) " >&6
else
case $GZIP in
[\\/]* | ?:[\\/]*)
ac_cv_path_GZIP="$GZIP" # Let the user override the test with a path.
;;
*)
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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_path_GZIP="$as_dir/$ac_word$ac_exec_ext"
$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
;;
esac
fi
GZIP=$ac_cv_path_GZIP
if test -n "$GZIP"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $GZIP" >&5
$as_echo "$GZIP" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
if test -z "$GZIP" ; then
GZIP=":"
fi
# Extract the first word of "ldconfig", so it can be a program name with args.
set dummy ldconfig; 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_path_LDCONFIG+:} false; then :
$as_echo_n "(cached) " >&6
else
case $LDCONFIG in
[\\/]* | ?:[\\/]*)
ac_cv_path_LDCONFIG="$LDCONFIG" # Let the user override the test with a path.
;;
*)
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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_path_LDCONFIG="$as_dir/$ac_word$ac_exec_ext"
$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
;;
esac
fi
LDCONFIG=$ac_cv_path_LDCONFIG
if test -n "$LDCONFIG"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $LDCONFIG" >&5
$as_echo "$LDCONFIG" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
if test -z "$LDCONFIG" ; then
LDCONFIG=":"
fi
# Checks for libraries.
{ $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 :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBCURSES 1
_ACEOF
LIBS="-lcurses $LIBS"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for snd_pcm_open in -lasound" >&5
$as_echo_n "checking for snd_pcm_open in -lasound... " >&6; }
if ${ac_cv_lib_asound_snd_pcm_open+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lasound $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 snd_pcm_open ();
int
main ()
{
return snd_pcm_open ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_asound_snd_pcm_open=yes
else
ac_cv_lib_asound_snd_pcm_open=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_asound_snd_pcm_open" >&5
$as_echo "$ac_cv_lib_asound_snd_pcm_open" >&6; }
if test "x$ac_cv_lib_asound_snd_pcm_open" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBASOUND 1
_ACEOF
LIBS="-lasound $LIBS"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5
$as_echo_n "checking for pthread_create in -lpthread... " >&6; }
if ${ac_cv_lib_pthread_pthread_create+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lpthread $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 pthread_create ();
int
main ()
{
return pthread_create ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_pthread_pthread_create=yes
else
ac_cv_lib_pthread_pthread_create=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_pthread_pthread_create" >&5
$as_echo "$ac_cv_lib_pthread_pthread_create" >&6; }
if test "x$ac_cv_lib_pthread_pthread_create" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBPTHREAD 1
_ACEOF
LIBS="-lpthread $LIBS"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for floor in -lm" >&5
$as_echo_n "checking for floor in -lm... " >&6; }
if ${ac_cv_lib_m_floor+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lm $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char floor ();
int
main ()
{
return floor ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_m_floor=yes
else
ac_cv_lib_m_floor=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_floor" >&5
$as_echo "$ac_cv_lib_m_floor" >&6; }
if test "x$ac_cv_lib_m_floor" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBM 1
_ACEOF
LIBS="-lm $LIBS"
fi
# Checks for header files, and refuse to go on if no KIOCSOUND is available.
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"
{ test -f "$ac_path_GREP" && $as_test_x "$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"
{ test -f "$ac_path_EGREP" && $as_test_x "$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
# 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 fcntl.h limits.h stdlib.h string.h strings.h sys/ioctl.h \
sys/param.h sys/time.h unistd.h locale.h libintl.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 sys/kd.h sys/vtkd.h sys/kbio.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
if test "$ac_cv_header_sys_kd_h" = 'no' \
&& test "$ac_cv_header_sys_vtkd_h" = 'no' \
&& test "$ac_cv_header_sys_kbio_h" = 'no' ; then
as_fn_error $? "Cannot find either sys/kd.h, sys/vtkd.h, or sys/kbio.h" "$LINENO" 5
fi
for ac_header in soundcard.h sys/soundcard.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
if test "$ac_cv_header_soundcard_h" = 'no' \
&& test "$ac_cv_header_sys_soundcard_h" = 'no' ; then
as_fn_error $? "Cannot find either soundcard.h or sys/soundcard.h" "$LINENO" 5
fi
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
fi
done
for ac_header in string.h strings.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
if test "$ac_cv_header_string_h" = 'no' \
&& test "$ac_cv_header_strings_h" = 'no' ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Cannot find either string.h or strings.h" >&5
$as_echo "$as_me: WARNING: Cannot find either string.h or strings.h" >&2;}
fi
# Checks for typedefs, structures, and compiler characteristics.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5
$as_echo_n "checking for stdbool.h that conforms to C99... " >&6; }
if ${ac_cv_header_stdbool_h+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
#ifndef bool
"error: bool is not defined"
#endif
#ifndef false
"error: false is not defined"
#endif
#if false
"error: false is not 0"
#endif
#ifndef true
"error: true is not defined"
#endif
#if true != 1
"error: true is not 1"
#endif
#ifndef __bool_true_false_are_defined
"error: __bool_true_false_are_defined is not defined"
#endif
struct s { _Bool s: 1; _Bool t; } s;
char a[true == 1 ? 1 : -1];
char b[false == 0 ? 1 : -1];
char c[__bool_true_false_are_defined == 1 ? 1 : -1];
char d[(bool) 0.5 == true ? 1 : -1];
/* See body of main program for 'e'. */
char f[(_Bool) 0.0 == false ? 1 : -1];
char g[true];
char h[sizeof (_Bool)];
char i[sizeof s.t];
enum { j = false, k = true, l = false * true, m = true * 256 };
/* The following fails for
HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */
_Bool n[m];
char o[sizeof n == m * sizeof n[0] ? 1 : -1];
char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
/* Catch a bug in an HP-UX C compiler. See
http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
*/
_Bool q = true;
_Bool *pq = &q;
int
main ()
{
bool e = &s;
*pq |= q;
*pq |= ! q;
/* Refer to every declared value, to avoid compiler optimizations. */
return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l
+ !m + !n + !o + !p + !q + !pq);
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_header_stdbool_h=yes
else
ac_cv_header_stdbool_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_stdbool_h" >&5
$as_echo "$ac_cv_header_stdbool_h" >&6; }
ac_fn_c_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" "$ac_includes_default"
if test "x$ac_cv_type__Bool" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE__BOOL 1
_ACEOF
fi
if test $ac_cv_header_stdbool_h = yes; then
$as_echo "#define HAVE_STDBOOL_H 1" >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5
$as_echo_n "checking for an ANSI C-conforming const... " >&6; }
if ${ac_cv_c_const+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
/* FIXME: Include the comments suggested by Paul. */
#ifndef __cplusplus
/* Ultrix mips cc rejects this. */
typedef int charset[2];
const charset cs;
/* 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. */
char *t;
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 saying
"k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
struct s { int j; const int *ap[3]; };
struct s *b; 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
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 time.h and sys/time.h may both be included" >&5
$as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; }
if ${ac_cv_header_time+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
#include
#include
int
main ()
{
if ((struct tm *) 0)
return 0;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_header_time=yes
else
ac_cv_header_time=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_time" >&5
$as_echo "$ac_cv_header_time" >&6; }
if test $ac_cv_header_time = yes; then
$as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working volatile" >&5
$as_echo_n "checking for working volatile... " >&6; }
if ${ac_cv_c_volatile+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
volatile int x;
int * volatile y = (int *) 0;
return !x && !y;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_c_volatile=yes
else
ac_cv_c_volatile=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_volatile" >&5
$as_echo "$ac_cv_c_volatile" >&6; }
if test $ac_cv_c_volatile = no; then
$as_echo "#define volatile /**/" >>confdefs.h
fi
# Checks for library functions.
if test $ac_cv_c_compiler_gnu = yes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC needs -traditional" >&5
$as_echo_n "checking whether $CC needs -traditional... " >&6; }
if ${ac_cv_prog_gcc_traditional+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_pattern="Autoconf.*'x'"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
Autoconf TIOCGETP
_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
$EGREP "$ac_pattern" >/dev/null 2>&1; then :
ac_cv_prog_gcc_traditional=yes
else
ac_cv_prog_gcc_traditional=no
fi
rm -f conftest*
if test $ac_cv_prog_gcc_traditional = no; then
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include
Autoconf TCGETA
_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
$EGREP "$ac_pattern" >/dev/null 2>&1; then :
ac_cv_prog_gcc_traditional=yes
fi
rm -f conftest*
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_gcc_traditional" >&5
$as_echo "$ac_cv_prog_gcc_traditional" >&6; }
if test $ac_cv_prog_gcc_traditional = yes; then
CC="$CC -traditional"
fi
fi
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
fi
done
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible malloc" >&5
$as_echo_n "checking for GNU libc compatible malloc... " >&6; }
if ${ac_cv_func_malloc_0_nonnull+:} false; then :
$as_echo_n "(cached) " >&6
else
if test "$cross_compiling" = yes; then :
ac_cv_func_malloc_0_nonnull=no
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#if defined STDC_HEADERS || defined HAVE_STDLIB_H
# include
#else
char *malloc ();
#endif
int
main ()
{
return ! malloc (0);
;
return 0;
}
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
ac_cv_func_malloc_0_nonnull=yes
else
ac_cv_func_malloc_0_nonnull=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
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_malloc_0_nonnull" >&5
$as_echo "$ac_cv_func_malloc_0_nonnull" >&6; }
if test $ac_cv_func_malloc_0_nonnull = yes; then :
$as_echo "#define HAVE_MALLOC 1" >>confdefs.h
else
$as_echo "#define HAVE_MALLOC 0" >>confdefs.h
case " $LIBOBJS " in
*" malloc.$ac_objext "* ) ;;
*) LIBOBJS="$LIBOBJS malloc.$ac_objext"
;;
esac
$as_echo "#define malloc rpl_malloc" >>confdefs.h
fi
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
fi
done
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible realloc" >&5
$as_echo_n "checking for GNU libc compatible realloc... " >&6; }
if ${ac_cv_func_realloc_0_nonnull+:} false; then :
$as_echo_n "(cached) " >&6
else
if test "$cross_compiling" = yes; then :
ac_cv_func_realloc_0_nonnull=no
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#if defined STDC_HEADERS || defined HAVE_STDLIB_H
# include
#else
char *realloc ();
#endif
int
main ()
{
return ! realloc (0, 0);
;
return 0;
}
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
ac_cv_func_realloc_0_nonnull=yes
else
ac_cv_func_realloc_0_nonnull=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
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_realloc_0_nonnull" >&5
$as_echo "$ac_cv_func_realloc_0_nonnull" >&6; }
if test $ac_cv_func_realloc_0_nonnull = yes; then :
$as_echo "#define HAVE_REALLOC 1" >>confdefs.h
else
$as_echo "#define HAVE_REALLOC 0" >>confdefs.h
case " $LIBOBJS " in
*" realloc.$ac_objext "* ) ;;
*) LIBOBJS="$LIBOBJS realloc.$ac_objext"
;;
esac
$as_echo "#define realloc rpl_realloc" >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working strcoll" >&5
$as_echo_n "checking for working strcoll... " >&6; }
if ${ac_cv_func_strcoll_works+:} false; then :
$as_echo_n "(cached) " >&6
else
if test "$cross_compiling" = yes; then :
ac_cv_func_strcoll_works=no
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$ac_includes_default
int
main ()
{
return (strcoll ("abc", "def") >= 0 ||
strcoll ("ABC", "DEF") >= 0 ||
strcoll ("123", "456") >= 0)
;
return 0;
}
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
ac_cv_func_strcoll_works=yes
else
ac_cv_func_strcoll_works=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
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_strcoll_works" >&5
$as_echo "$ac_cv_func_strcoll_works" >&6; }
if test $ac_cv_func_strcoll_works = yes; then
$as_echo "#define HAVE_STRCOLL 1" >>confdefs.h
fi
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
for ac_func in floor gettimeofday memset sqrt strchr strdup strrchr \
strtoul getopt_long setlocale memmove select strerror strspn
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
fi
done
for ac_header in sys/select.h sys/socket.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
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking types of arguments for select" >&5
$as_echo_n "checking types of arguments for select... " >&6; }
if ${ac_cv_func_select_args+:} false; then :
$as_echo_n "(cached) " >&6
else
for ac_arg234 in 'fd_set *' 'int *' 'void *'; do
for ac_arg1 in 'int' 'size_t' 'unsigned long int' 'unsigned int'; do
for ac_arg5 in 'struct timeval *' 'const struct timeval *'; do
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$ac_includes_default
#ifdef HAVE_SYS_SELECT_H
# include
#endif
#ifdef HAVE_SYS_SOCKET_H
# include
#endif
int
main ()
{
extern int select ($ac_arg1,
$ac_arg234, $ac_arg234, $ac_arg234,
$ac_arg5);
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_func_select_args="$ac_arg1,$ac_arg234,$ac_arg5"; break 3
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
done
done
done
# Provide a safe default value.
: "${ac_cv_func_select_args=int,int *,struct timeval *}"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_select_args" >&5
$as_echo "$ac_cv_func_select_args" >&6; }
ac_save_IFS=$IFS; IFS=','
set dummy `echo "$ac_cv_func_select_args" | sed 's/\*/\*/g'`
IFS=$ac_save_IFS
shift
cat >>confdefs.h <<_ACEOF
#define SELECT_TYPE_ARG1 $1
_ACEOF
cat >>confdefs.h <<_ACEOF
#define SELECT_TYPE_ARG234 ($2)
_ACEOF
cat >>confdefs.h <<_ACEOF
#define SELECT_TYPE_ARG5 ($3)
_ACEOF
rm -f conftest*
# Check for certain routines which are missing from liboss-salsa-dev
# (kfreebsd's libasound implementation):
for ac_func in \
snd_pcm_hw_params_test_rate \
snd_pcm_hw_params_test_periods \
snd_pcm_hw_params_test_buffer_size \
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
fi
done
# Decide on which subdirectories to build; substitute into SUBDIRS. Build
# cwcp if curses is available, and xcwcp if Qt is available.
SUBDIRS="libcw cwutils cw cwgen"
# Simple test for curses based on prior library check.
if test $ac_cv_lib_curses_initscr = 'yes' ; then
SUBDIRS="$SUBDIRS cwcp"
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Cannot find libcurses - unable to build cwcp" >&5
$as_echo "$as_me: WARNING: Cannot find libcurses - unable to build cwcp" >&2;}
fi
# autodetection of QT4 dependencies
MOC_MAJOR_EARLIEST=4
# possible locations of Qt4 headers
QT4HEADER_DIRS="/usr/include/qt4 \ # Debian
/usr/include" # Arch (?)
# possible locations of Qt4 moc (a.k.a. moc-qt4)
QT4BIN_DIRS=$PATH # pretty standard
# QT4DIR="" # for testing purposes
QT4INC="" # full path to directory with QT4 QtCore + QtGui subdirs and include files, e.g. /usr/include/qt4/
QT4MOC="" # full path to QT4 moc executable
if [[ $QT4DIR = "" ]] ; then
# look for QT4 include directories
for dir in $QT4HEADER_DIRS; do
if test -d "$dir/QtGui" && test -d "$dir/QtCore" ; then
QT4INC=$dir;
fi
done
# look for QT4 moc binary
# Extract the first word of "moc-qt4", so it can be a program name with args.
set dummy moc-qt4; 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_path_QT4MOC+:} false; then :
$as_echo_n "(cached) " >&6
else
case $QT4MOC in
[\\/]* | ?:[\\/]*)
ac_cv_path_QT4MOC="$QT4MOC" # Let the user override the test with a path.
;;
*)
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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_path_QT4MOC="$as_dir/$ac_word$ac_exec_ext"
$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
;;
esac
fi
QT4MOC=$ac_cv_path_QT4MOC
if test -n "$QT4MOC"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $QT4MOC" >&5
$as_echo "$QT4MOC" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
if test -n "$QT4MOC" ; then
MOC_MAJOR="`$QT4MOC -v 2>&1 | sed -e 's;.\+ (Qt \([0-9]\).\+;\1;g'`"
if [[ $MOC_MAJOR != $MOC_MAJOR_EARLIEST ]] ; then
QT4MOC=""
fi
fi
if [[ "$QT4MOC" = "" ]] ; then
QT4MOC_2=""
# Extract the first word of "moc", so it can be a program name with args.
set dummy moc; 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_path_QT4MOC_2+:} false; then :
$as_echo_n "(cached) " >&6
else
case $QT4MOC_2 in
[\\/]* | ?:[\\/]*)
ac_cv_path_QT4MOC_2="$QT4MOC_2" # Let the user override the test with a path.
;;
*)
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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_path_QT4MOC_2="$as_dir/$ac_word$ac_exec_ext"
$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
;;
esac
fi
QT4MOC_2=$ac_cv_path_QT4MOC_2
if test -n "$QT4MOC_2"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $QT4MOC_2" >&5
$as_echo "$QT4MOC_2" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
if test -n "$QT4MOC_2" ; then
MOC_MAJOR="`$QT4MOC_2 -v 2>&1 | sed -e 's;.\+ (Qt \([0-9]\).\+;\1;g'`"
if [[ $MOC_MAJOR = $MOC_MAJOR_EARLIEST ]] ; then
QT4MOC=$QT4MOC_2
fi
fi
fi
if [[ $QT4INC != "" && $QT4MOC != "" ]] ; then
# we have moc4 and path to QT4 include files,
# so we can build xcwcp
SUBDIRS="$SUBDIRS xcwcp"
else
if [[ $QT4INC = "" ]] ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Can't find directory with QT4 header files - unable to build xcwcp" >&5
$as_echo "$as_me: WARNING: Can't find directory with QT4 header files - unable to build xcwcp" >&2;}
fi
if [[ $QT4MOC = "" ]] ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Can't find QT moc version == $MOC_MAJOR_EARLIEST - unable to build xcwcp" >&5
$as_echo "$as_me: WARNING: Can't find QT moc version == $MOC_MAJOR_EARLIEST - unable to build xcwcp" >&2;}
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Hint: try setting QT4DIR env variable per instructions in unixcw/INSTALLATION" >&5
$as_echo "$as_me: WARNING: Hint: try setting QT4DIR env variable per instructions in unixcw/INSTALLATION" >&2;}
QT4INC=""
QT4MOC=""
fi
else
# Look for $QT4DIR. If found, then look for moc, either on $PATH, or
# in $QT4DIR/bin.
# Extract the first word of "moc", so it can be a program name with args.
set dummy moc; 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_path_QT4MOC+:} false; then :
$as_echo_n "(cached) " >&6
else
case $QT4MOC in
[\\/]* | ?:[\\/]*)
ac_cv_path_QT4MOC="$QT4MOC" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
as_dummy="$QT4DIR/bin:$PATH"
for as_dir in $as_dummy
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_path_QT4MOC="$as_dir/$ac_word$ac_exec_ext"
$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
;;
esac
fi
QT4MOC=$ac_cv_path_QT4MOC
if test -n "$QT4MOC"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $QT4MOC" >&5
$as_echo "$QT4MOC" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
if test -n "$QT4MOC" ; then
MOC_VERSION="`$QT4MOC -v 2>&1 | sed -e 's;.*(Qt ;;' -e 's;).*;;'`"
if test -n "$MOC_VERSION" ; then
MOC_MAJOR="`echo $MOC_VERSION | sed -e 's;\..*;;'`"
expr "$MOC_MAJOR" + 0 >/dev/null 2>/dev/null
status=$?
if test -n "$MOC_MAJOR" -a $status -eq 0 ; then
if test "$MOC_MAJOR" -ge $MOC_MAJOR_EARLIEST ; then
SUBDIRS="$SUBDIRS xcwcp"
QT4INC="$QT4DIR/include"
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Found 'moc' $MOC_VERSION - unable to build xcwcp" >&5
$as_echo "$as_me: WARNING: Found 'moc' $MOC_VERSION - unable to build xcwcp" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Hint: xcwcp requires 'moc' version >= $MOC_MAJOR_EARLIEST" >&5
$as_echo "$as_me: WARNING: Hint: xcwcp requires 'moc' version >= $MOC_MAJOR_EARLIEST" >&2;}
fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Cannot find 'moc' version - unable to build xcwcp" >&5
$as_echo "$as_me: WARNING: Cannot find 'moc' version - unable to build xcwcp" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Hint: ensure 'moc' is in QT4DIR/bin on your PATH" >&5
$as_echo "$as_me: WARNING: Hint: ensure 'moc' is in QT4DIR/bin on your PATH" >&2;}
fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Cannot find 'moc' version - unable to build xcwcp" >&5
$as_echo "$as_me: WARNING: Cannot find 'moc' version - unable to build xcwcp" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Hint: ensure 'moc' is in QT4DIR/bin on your PATH" >&5
$as_echo "$as_me: WARNING: Hint: ensure 'moc' is in QT4DIR/bin on your PATH" >&2;}
fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Cannot find 'moc' - unable to build xcwcp" >&5
$as_echo "$as_me: WARNING: Cannot find 'moc' - unable to build xcwcp" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Hint: ensure 'moc' is in QT4DIR/bin on your PATH" >&5
$as_echo "$as_me: WARNING: Hint: ensure 'moc' is in QT4DIR/bin on your PATH" >&2;}
fi
fi
if [[ $QT4INC != "" && $QT4MOC != "" ]] ; then
echo "QT4 headers dir is $QT4INC"
echo "QT4 moc is $QT4MOC"
fi
# Add -Wall, -W, -pedantic, and other paranoia to gcc command flags, and -Wall
# to with a few suppressions to icc command flags, then similarly, though less
# so, for g++ and icpc.
if test "`basename $CC`" = "gcc" ; then
CFLAGS="$CFLAGS -Wall -W -pedantic -Wfloat-equal -Wpointer-arith -std=gnu99"
CFLAGS="$CFLAGS -Wcast-qual -Wwrite-strings -Wmissing-prototypes"
CFLAGS="$CFLAGS -Wstrict-prototypes -Wmissing-declarations -Wredundant-decls"
else
if test "`basename $CC`" = "icc" ; then
CFLAGS="$CFLAGS -Wall -wd181,188,279,383,593,810,981,1469"
fi
fi
if test "`basename $CXX`" = "g++" ; then
CXXFLAGS="$CXXFLAGS -Wall -W -pedantic -Wno-long-long"
else
if test "`basename $CXX`" = "icpc" ; then
CXXFLAGS="$CXXFLAGS -Wall -wd181,188,279,383,593,810,981,1469"
fi
fi
# Determine if -fPIC or -KPIC is available for building .so libraries.
# Because gcc complains about invalid flags, but then continues, we have to
# check by searching the compile stdout and stderr for any output.
if test -z "$CFLAG_PIC" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -KPIC or -fPIC compiler options" >&5
$as_echo_n "checking for -KPIC or -fPIC compiler options... " >&6; }
cat >conftest.c <<-EOF
int so_test() { return 0; }
EOF
if $CC -fPIC -c conftest.c 2>&1 | egrep -q '.' ; then
if $CC -KPIC -c conftest.c 2>&1 | egrep -q '.' ; then
CFLAG_PIC=""
else
CFLAG_PIC="-KPIC"
fi
else
CFLAG_PIC="-fPIC"
fi
rm -f conftest.c conftest.o
if test -n "$CFLAG_PIC" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CFLAG_PIC" >&5
$as_echo "$CFLAG_PIC" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
fi
# Determine if the C compiler builds DSO files, by testing with -shared.
CC_LINKS_SO="no"
if test -n "$CC" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether cc builds .so files with -shared" >&5
$as_echo_n "checking whether cc builds .so files with -shared... " >&6; }
cat >conftest.c <<-EOF
int so_test() { return 0; }
EOF
$CC -c conftest.c >/dev/null 2>/dev/null
$CC -shared -o conftest.so conftest.o >/dev/null 2>/dev/null
rm -f conftest.c conftest.o
if test -f conftest.so ; then
nm conftest.so | grep -q so_test
if test $? -eq 0 ; then
CC_LINKS_SO="yes"
fi
fi
rm -f conftest.so
if test $CC_LINKS_SO = "yes" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
fi
# A linker might also build DSO files with -G, but we'll prefer to use the
# compiler if it will cooperate.
LD_LINKS_SO="no"
# Extract the first word of "ld", so it can be a program name with args.
set dummy ld; 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_path_LD+:} false; then :
$as_echo_n "(cached) " >&6
else
case $LD in
[\\/]* | ?:[\\/]*)
ac_cv_path_LD="$LD" # Let the user override the test with a path.
;;
*)
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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_path_LD="$as_dir/$ac_word$ac_exec_ext"
$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
;;
esac
fi
LD=$ac_cv_path_LD
if test -n "$LD"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5
$as_echo "$LD" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
if test -n "$LD" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ld builds .so files with -G" >&5
$as_echo_n "checking whether ld builds .so files with -G... " >&6; }
cat >conftest.c <<-EOF
int so_test() { return 0; }
EOF
$CC -c conftest.c >/dev/null 2>/dev/null
$LD -G -o conftest.so conftest.o >/dev/null 2>/dev/null
rm -f conftest.c conftest.o
if test -f conftest.so ; then
nm conftest.so | grep -q so_test
if test $? -eq 0 ; then
LD_LINKS_SO="yes"
fi
fi
rm -f conftest.so
if test $LD_LINKS_SO = "yes" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
else
LD=":"
fi
# Write out configuration information to output files.
ac_config_files="$ac_config_files Makefile.inc"
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
: "${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 -p'.
ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
as_ln_s='cp -p'
elif ln conf$$.file conf$$ 2>/dev/null; then
as_ln_s=ln
else
as_ln_s='cp -p'
fi
else
as_ln_s='cp -p'
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
if test -x / >/dev/null 2>&1; then
as_test_x='test -x'
else
if ls -dL / >/dev/null 2>&1; then
as_ls_L_option=L
else
as_ls_L_option=
fi
as_test_x='
eval sh -c '\''
if test -d "$1"; then
test -d "$1/.";
else
case $1 in #(
-*)set "./$1";;
esac;
case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
???[sx]*):;;*)false;;esac;fi
'\'' sh
'
fi
as_executable_p=$as_test_x
# 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 UnixCW $as_me 3.0.1, which was
generated by GNU Autoconf 2.68. 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"
_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
Report bugs to ."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
UnixCW config.status 3.0.1
configured by $0, generated by GNU Autoconf 2.68,
with options \\"\$ac_cs_config\\"
Copyright (C) 2010 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'
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
_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
"src/config.h") CONFIG_HEADERS="$CONFIG_HEADERS src/config.h" ;;
"Makefile.inc") CONFIG_FILES="$CONFIG_FILES Makefile.inc" ;;
*) 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
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 "
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
_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
$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
;;
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
unixcw-3.0.2/autogen.sh 0000755 0001750 0001750 00000002024 11665750175 014667 0 ustar acerion acerion #!/bin/sh
#
# Copyright (C) 2001-2006 Simon Baldwin (simon_baldwin@yahoo.com)
# Copyright (C) 2011 Kamil Ignacak (acerion@wp.pl)
#
# 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.
#
autoheader
touch NEWS README AUTHORS ChangeLog
touch stamp-h
aclocal
autoconf
mkdir -p po
find src \( -name '*.c' -o -name '*.cc' -o -name '*.h' \) -print \
| xargs xgettext -k_ -kN_ -p po -d UnixCW
unixcw-3.0.2/Makefile 0000644 0001750 0001750 00000003544 11702303671 014321 0 ustar acerion acerion # Copyright (C) 2001-2006 Simon Baldwin (simon_baldwin@yahoo.com)
# Copyright (C) 2011-2012 Kamil Ignacak (acerion@wp.pl)
#
# 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
#
#
-include Makefile.inc
SHELL = /bin/sh
SUBDIRS = src
DIST = unixcw-3.0.1
# Top level makefile - descends into subdirectories and executes the make in
# these one at a time.
# Macro to support descending into selected subdirectories.
DESCEND = for subdir in $(SUBDIRS); do \
( cd $$subdir; $(MAKE) $@ ); \
done
# Targets that do nothing other than descend.
all install install-strip uninstall TAGS info dvi check:
$(DESCEND)
clean:
$(DESCEND)
rm -f Makefile.inc
# Targets that do just a little more than this.
distclean mostlyclean:
$(DESCEND)
rm -f $(DIST).tar $(DIST).tar.gz $(DIST).tgz
rm -f Makefile.inc src/config.h src/config.h.in~
rm -f config.status config.cache config.log
rm -rf autom4te.cache
maintainer-clean: distclean
rm -f configure src/config.h.in aclocal.m4 configure.scan autoscan.log
rm -f po/UnixCW.po
-rmdir po
dist: distclean
rm -f $(DIST).tar $(DIST).tar.gz $(DIST).tgz
rm -f $(DIST); ln -s . $(DIST)
FILES="`ls -d $(DIST)/* | grep -v '^$(DIST)/$(DIST)$$'`"; \
tar zcvf $(DIST).tgz $$FILES
rm $(DIST)
unixcw-3.0.2/INSTALLING 0000644 0001750 0001750 00000005501 11662167310 014246 0 ustar acerion acerion
The source code for UnixCW version 3.0 comes with a 'configure' file. Its job
is to try and decide which features your system offers, and then configure
UnixCW the best way it can for these features.
At minimum, you will need a set of sound card definitions (usually in the file
soundcard.h) and perhaps also a KIOCSOUND console sound ioctl available on your
system; these are used to build the CW library. Note that it's not necessary
for the system doing the build to actually have a sound card, nor for that
matter, a working console speaker, but you will need the definitions from
various header files. Of course, you will need a sound card or console speaker
if you want to run any of the programs once they are built.
cwcp:
If you have a Curses (ncurses) library, UnixCW will build 'cwcp'.
xcwcp:
If you have a Qt library, version 4.0 or later, and a C++ compiler, UnixCW
will build 'xcwcp'. 'configure' script will try to resolve all dependencies
needed to build QT4 application without using QT-specific build tools.
If the script fails at detecting 'moc' executable or include files for QT4,
you may have to set the environment variable QT4DIR (if not already set)
to indicate the Qt library directory on your system. On Debian it would be:
export QT4DIR=/usr/share/qt4
The configure script will then look for the Qt4 'moc' utility on either your
current $PATH or in $QT4DIR/bin.
UnixCW may port to other platforms, but the primary target systems on which it
should "just build", perhaps with a bit of tweaking as shown above with
environment variables, are:
o Linux
o FreeBSD
To build the CW library and the UnixCW applications, you should be able to type
the following commands in the directory where you unpacked the source code:
./configure
make all
'configure' will tell you of any problems with missing features on your system.
If you lack a Qt library, it will omit building 'xcwcp'. If you lack a Curses
library, it will omit building 'cwcp'. The other components should still
build, however.
Assuming the 'make all' succeeded, you can now install the programs with
make install
By default, this will install everything under /usr/local. You would probably
want to be 'root' to do this, otherwise you may not have the permissions to
write files to the installation directory.
Note that it is not necessary to install the programs in order to run them.
You should be able to run any of them in the directories in which they built
themselves.
To uninstall the programs, use
make uninstall
with the same user/permissions as you used for installing. To clean out the
directory for a rebuild, use
make distclean
If you have autoconf and the other auto* tools installed on your system, you
can regenerate the configure file, if you like, from configure.in, with
make maintainer-clean
sh autogen.sh
unixcw-3.0.2/_build_debian~ 0000755 0001750 0001750 00000001747 11767330774 015567 0 ustar acerion acerion #!/bin/bash
PACKAGE="unixcw"
VERSION="3.0.1"
# setup
REPO=`pwd`
cd ../../build
BUILD=`pwd`
echo "REPO = " $REPO
echo "BUILD = " $BUILD
if [ "$REPO" == x"" ]; then
echo "REPO is empty"
exit
elif [ "$REPO" == x"/" ]; then
echo "REPO is root directory"
exit
fi
if [ "$BUILD" == x"" ]; then
echo "BUILD is empty"
exit
elif [ "$BUILD" == x"/" ]; then
echo "BUILD is root directory"
exit
fi
# clean up old files, prepare brand new, empty dir
rm -rf $BUILD/*
# prepare $PACKAGE_X.Y.Z.debian.tar.gz
cd $REPO
cp -rp debian $BUILD/
cd $BUILD
tar cvfz $PACKAGE\_$VERSION.debian.tar.gz debian
rm -rf debian
cd $REPO
cp -rp ../$PACKAGE $BUILD
cd $BUILD/$PACKAGE/
./_clean_up distclean
rm -rf _build_debian _clean_up
rm -rf .git
cd $BUILD
mv $PACKAGE $PACKAGE-$VERSION
tar cvfz $PACKAGE\_$VERSION.orig.tar.gz $PACKAGE-$VERSION --exclude=debian
# go to final build dir and start building Debian package
cd $PACKAGE-$VERSION
echo ""
echo `pwd`
debuild -us -uc
unixcw-3.0.2/stamp-h 0000644 0001750 0001750 00000000000 10455365565 014153 0 ustar acerion acerion unixcw-3.0.2/AUTHORS 0000644 0001750 0001750 00000000062 10455365565 013737 0 ustar acerion acerion
See README for authorship and acknowledgements.
unixcw-3.0.2/NEWS 0000644 0001750 0001750 00000011361 11767714356 013375 0 ustar acerion acerion version 3.0.2 / 2012.06.18
New version. You won't find it in git repo, but only in SourceForge download
area and on Debian webpage.
This is a special release with two goals related to Debian packaging:
debian/:
- fixing Debian's FTBFS bug #676752
- removing debian/ from unixcw_X.Y.Z.orig.tar.gz. Contents of debian/ can be
found in separately provided unixcw_X.Y.Z-W.debian.tar.gz
Thanks to Kamal Mostafa for patiently explaining to me some details of
Debian/Ubuntu packaging.
----------------------------------------------------------------------------
version 3.0.1 / 2012.01.08
Thanks to Kamal Mostafa for providing patches that are the reason
for 3.0.1 release.
Content of upstream package unixcw-3.0.1 is approximately the same as of
Debian source package unixcw_3.0-5.
debian/:
- added proper "Section" field in control file;
- fixed library dependencies in control file;
- fixed "Replaces:"/"Conflicts:" fields in control file;
- fixed Debian bug #653411: changes in *.preinst files to remove
dangling symlinks left by old packaging (suggested by Bob Proulx);
general:
- fixed library dependencies in "configure" script;
- fixed library dependencies provided by libcw.pc file;
libcw:
- proper detection of capabilities of liboss-salsa-dev
(kfreebsd's libasound implementation); libcw now can be built
properly on Debian/kFreeBSD;
- fixing awk scripts producing man pages: the awk scripts now
work with mawk too;
cwcp:
- fixed list of libraries in Makefile;
----------------------------------------------------------------------------
version 3.0 / 2011.12.13
Thanks to Simon Baldwin for creating this software in the
first place, and to Kamal Mostafa for helping me with packaging
unixcw 3.0 for Debian.
unixcw:
- Changed major version of unixcw package to '3'. Changes listed
below probably justify this.
- New main developer: Kamil Ignacak
- New website: http://unixcw.sourceforge.net
- Scripts building Debian packages now build 'libcw3' package
instead of 'unixcw' package, and 'libcw3-dev' Debian package instead
of 'unixcw-dev' Debian package.
libcw:
- Renamed 'cwlib' part of unixcw package to 'libcw'.
- Renamed library's header file from cwlib.h to libcw.h.
- Changed library's soname from 0 to 3 (/usr/lib/libcw.so.3.0.0
/ libcw.so.3).
- Added support for ALSA. OSS is still the default backend.
- As a consequence, libasound2 is a new dependency. There is no
possibility (yet) to disable or reconfigure this at build time.
It is possible to select sound backend in applications that use
libcw.
- Added implicit dependency on pthread library (which is a part
of libc library, so it should be available on target system by
default). Main routine generating sine wave operates as a separate
thread.
- Added actual slopes to dot and dash sounds produced by the
library. This should result in less of (or even none) audible
pops. Unfortunately current implementation makes dots and dashes
a tiny bit longer than they would be without the slopes. The
difference is not significant, but I plan to re-implement it
in the future to make this feature 100% correct.
The slopes are linear.
- Rewritten management of sound volume so that the library doesn't
use OSS mixer. This should resolve Debian bug #567394
(http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=567394).
Code that controls volume level is common for OSS and ALSA.
- Since libcw doesn't touch the mixer device anymore, then Debian
bug #567392 should be resolved as well
(http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=567392).
- Added code that attempts to discover proper audio buffer size
for both OSS and ALSA. This should resolve Debian bug #567395
(http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=567395).
- Fix of Debian bug #567395 should also solve Debian bug #567397
(http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=567397).
- Changed library's API. There will be more API changes in 3.1, so
consider current API to be unstable.
- Changed volume change step from 5% to 1%.
- Changed frequency change step from 100Hz to 20Hz.
- The library no longer can produce sound on console buzzer and on
sound card at the same time.
- The library knows default names of OSS, ALSA and console buzzer
devices. The names are used to open sound devices if no other
names are provided explicitly as function arguments.
- Introduced symbolic names of int values returned by most of
library's function: CW_FAILURE / CW_SUCCESS.
xcwcp:
- Ported xcwcp to QT4. This should resolve Debian bug #604386
(http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=604386).
- Added auto-detection of QT4 headers and QT4 moc by build files.
unixcw-3.0.2/unixcw-2.3.spec 0000644 0001750 0001750 00000004577 11665754531 015376 0 ustar acerion acerion #
# Copyright (C) 2001-2006 Simon Baldwin (simon_baldwin@yahoo.com)
#
# 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.
#
# Normal descriptive preamble.
Summary: UnixCW Morse Code Utilities
Name: unixcw
Version: 2.3
Release: 2
Group: Applications/Hamradio
Copyright: GPL
Packager: Simon Baldwin
URL: http://www.geocities.com/simon_baldwin/
Source: ftp://metalab.unc.edu/pub/Linux/apps/ham/morse/unixcw-2.3.tgz
BuildRoot: /tmp/unixcw-2.3
%description
The UnixCW utilities add a general purpose CW library to your system, and
a small set of applications based around this library. These applications
form a Morse code tutor suite, useful for Amateur and Marine radio operators.
# Straightforward preparation for building.
%prep
%setup
# To build, first configure, then make. Here we set "prefix" to the build
# root, suffixed with "/usr". So, unlike our natural locations under
# "/usr/local", we build and install the RPM packaged version in "/usr",
# leaving "/usr/local" free for, well, the usual "/usr/local" stuff.
%build
./configure
make prefix="$RPM_BUILD_ROOT/usr"
# Install with "prefix" tweaked in the same way.
%install
make prefix="$RPM_BUILD_ROOT/usr" install
# Clean up our build root.
%clean
rm -rf $RPM_BUILD_ROOT
# Postinstall and postuninstall.
%post
/sbin/ldconfig
%postun
/sbin/ldconfig
# List of packaged files.
%files
/usr/bin/cw
/usr/bin/cwcp
/usr/bin/cwgen
/usr/bin/xcwcp
/usr/include/libcw.h
/usr/lib/libcw.a
/usr/lib/libcw.so
/usr/lib/libcw.so.0
/usr/lib/libcw.so.0.0.0
/usr/man/man1/cw.1.gz
/usr/man/man1/cwcp.1.gz
/usr/man/man1/cwgen.1.gz
/usr/man/man1/xcwcp.1.gz
/usr/man/man3/libcw.3.gz
/usr/man/man7/CW.7.gz
/usr/man/man7/cw.7.gz
/usr/lib/pkgconfig/libcw.pc
%doc COPYING
%doc README
%doc INSTALLING
unixcw-3.0.2/README 0000644 0001750 0001750 00000016742 11702276624 013554 0 ustar acerion acerion
The original UnixCW package, version 1, grew out of a desire to have a program
available under Linux that was very similar to the one I was used to under DOS.
While several Linux Morse Tutors were, in fact, still are, available, I never
quite found one that did the stuff I wanted.
From the original UnixCW package came version 2. This was almost a total
rewrite, although it included the same basic binaries as were in version 1.
The two major changes for this version were the addition of an extensive,
general purpose CW library, and also an X Window-based CW tutor program.
With version 2.1, finally, came full sound card support, built into the CW
library itself. All three main user level programs that use the library were
enhanced to allow control over the sound card tone volume. Console speaker
sound is still there, if needed, but sound card tones became the default mode.
Version 2.2 was a bug-fixed version of 2.1. It seems that some sound card
drivers (some later OSS drivers) couldn't handle the volume control ioctls that
the CW library uses, and this meant sound card tones would not work for these
systems. To solve this, version 2.2 uses the /dev/mixer device to control
volumes if it finds that it cannot do this with the main sound card device.
Version 2.3 is a thorough overhaul, cleanup, and refactoring of version 2.2.
All the code has been reformatted for correct Gnu style, and programs now take
a lot more care over what they do, and don't do, in signal handler context.
cwcp and xcwcp now offer fully configurable modes and dictionaries through a
configuration file option, and xcwcp has been rewritten in proper C++ style.
Version 3.0 has been prepared and released by new maintainer, Kamil Ignacak.
The takeover of unixcw has been discussed with and approved by Simon Baldwin.
Main changes in 3.0 are:
o rewriting parts of libcw so that using OSS is less probable to cause
problems (this should solve at least one Debian bug)
o adding support for ALSA to libcw; libcw uses OSS as default audio system,
but there are no differences in support of OSS and ALSA in terms of
functionality
o porting xcwcp to Qt4
The fact that there is a new maintainer should take some burden off of
shoulders of Kamal Mostafa, who was responsible for (among other things)
patching unixcw.
Version 3.0 introduces some changes in API, and there should be some
more API changes in 3.1. Hopefully things will be more stable in 3.2.
Version 3.0.1 contains small fixes that don't influence core capabilities
of any application, but are still important. Patches for this release were
provided mainly by Kamal Mostafa (thanks Kamal!).
The heart of the package is 'libcw'. This is a library which, when built,
offers the following basic CW services to a caller program:
o Morse code character translation tables, and lookup functions
o Morse code low-level timing calculations
o A 'sidetone' generation and queueing system, using either the system sound
card or the console speaker
o Optional keying control for an external device, say a transmitter, or an
oscillator
o CW character and string send routines, tied in with the character lookup
o CW receive routines, also tied in to the character lookup
o Adaptive speed tracking of received CW
o An iambic keyer, with both Curtis 8044 types A and B timing
o Straight key emulation
The library uses signals and threads to create a background task in which to do
the majority of its work, leaving the main program free to handle other tasks.
For example, the simplest CW sending program that uses the library looks like:
#include
int main ()
{
/* Library initialization */
cw_generator_new(CW_AUDIO_ALSA, NULL);
cw_generator_start();
/* Start the string sending in the background. */
cw_send_string ("Hello, world");
/* Wait for the string send to complete. */
cw_wait_for_tone_queue();
/* Library cleanup */
cw_generator_stop();
cw_generator_delete();
return;
}
Instead of the cw_tone_queue_wait() call, this program could instead handle any
other work it has to do, asynchronously from the CW library's sending.
As well as the handful of applications included in UnixCW 3.0, the following
sorts of programs might also use 'libcw' as their core:
o A fully graphical CW send and receive station
o A 'CWbiff' that announces incoming email sender in CW
o An offline CW reader program, capable of decoding CW from MP3 or other
audio file formats
o A simple Iambic keyer for an external transmitter, using the mouse buttons
as the keyer paddles
o A more comprehensive CW tutor program
o An automated Morse Code testing application
'libcw' is written in C for easy portability and use.
The package comes with four basic applications:
o cw A CW sending 'engine' that reads characters from stdin, sounds them
on either the sound card, the console speaker, or both, and echoes
them to stdout.
o cwgen A simple random character generator that can be used as a feed for
cw. For example:
cwgen | cw
o cwcp A curses-based program that generates groups of characters from
selected sets, words, and CW abbreviations randomly, and sounds
them using 'libcw'. It owes much to CP222.EXE, by VU2ZAP.
o xcwcp A CW tutor program for X Window environment. It offers the same
random and keyboard sending as 'cwcp', and in addition can read
CW that sent to it using the keyboard or mouse as a keyer, making
it useful for sending as well as receiving practice.
'libcw', 'cw', and 'cwgen' require a C compiler. 'cwcp' requires a C compiler
and a Curses library. 'xcwcp' requires a C++ compiler and a copy of the
Qt library (version 4). This library is fairly standard on Linux systems, as
it is the basis of KDE, so relying on this should not be too much of a problem.
See INSTALLING for details on how to build UnixCW version 3.0 from the
distributed sources.
UnixCW is distributed under the GNU GPL 2 (or later). See COPYING for details.
Thanks to...
Kamal Mostafa, KA6MAL, for reviewing the libcw API, showing me the errors of my
ways with 64-bit integers, and hounding me to add the adaptive receive speed
tracking...
Joop Stakenborg, PG4I, for being a willing "guinea pig" with various snapshots
of unfinished versions of the package, for help in isolating various sound card
problems, and for his continued enthusiasm and interest in maintaining UnixCW
as a Debian Linux package...
Paolo Cravero, IK1ZYW, for very kindly making the first sound card patch
available for UnixCW 2. His tone generation code is now fully embedded inside
the CW library, and it's no exaggeration to say that without his help, there
would still be no sound card support in UnixCW...
Michael D. Ivey, for identifying a problem with CW sending rhythm when sending
in 'Farnsworth' mode, and for taking the time and trouble to test the patches
I sent him...
Wolf-Ruediger Juergens, for ideas on implementing CW weighting...
Diane Bruce and Jason L. Wright, for adding support for assorted BSD flavors...
Dan Jacobson, for making improvement suggestions above and beyond the call of
duty...
And finally, everyone else who has sent feedback about UnixCW. If not for your
interest, and fairly frequent requests for a version that works with a sound
card, the package would not have progressed at all.
Simon Baldwin, G0FRD
-------------------------
Kamil Ignacak
unixcw-3.0.2/missing 0000755 0001750 0001750 00000024037 11665745441 014275 0 ustar acerion acerion #! /bin/sh
# Common stub for a few missing GNU programs while installing.
# Copyright (C) 1996, 1997, 1999, 2000, 2002 Free Software Foundation, Inc.
# Originally by Fran,cois Pinard , 1996.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
if test $# -eq 0; then
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
fi
run=:
# In the cases where this matters, `missing' is being run in the
# srcdir already.
if test -f configure.ac; then
configure_ac=configure.ac
else
configure_ac=configure.in
fi
case "$1" in
--run)
# Try to run requested program, and just exit if it succeeds.
run=
shift
"$@" && exit 0
;;
esac
# If it does not exist, or fails to run (possibly an outdated version),
# try to emulate it.
case "$1" in
-h|--h|--he|--hel|--help)
echo "\
$0 [OPTION]... PROGRAM [ARGUMENT]...
Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
error status if there is no known handling for PROGRAM.
Options:
-h, --help display this help and exit
-v, --version output version information and exit
--run try to run the given command, and emulate it if it fails
Supported PROGRAM values:
aclocal touch file \`aclocal.m4'
autoconf touch file \`configure'
autoheader touch file \`config.h.in'
automake touch all \`Makefile.in' files
bison create \`y.tab.[ch]', if possible, from existing .[ch]
flex create \`lex.yy.c', if possible, from existing .c
help2man touch the output file
lex create \`lex.yy.c', if possible, from existing .c
makeinfo touch the output file
tar try tar, gnutar, gtar, then tar without non-portable flags
yacc create \`y.tab.[ch]', if possible, from existing .[ch]"
;;
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
echo "missing 0.4 - GNU automake"
;;
-*)
echo 1>&2 "$0: Unknown \`$1' option"
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
;;
aclocal*)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified \`acinclude.m4' or \`${configure_ac}'. You might want
to install the \`Automake' and \`Perl' packages. Grab them from
any GNU archive site."
touch aclocal.m4
;;
autoconf)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified \`${configure_ac}'. You might want to install the
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
archive site."
touch configure
;;
autoheader)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified \`acconfig.h' or \`${configure_ac}'. You might want
to install the \`Autoconf' and \`GNU m4' packages. Grab them
from any GNU archive site."
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
test -z "$files" && files="config.h"
touch_files=
for f in $files; do
case "$f" in
*:*) touch_files="$touch_files "`echo "$f" |
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
*) touch_files="$touch_files $f.in";;
esac
done
touch $touch_files
;;
automake*)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
You might want to install the \`Automake' and \`Perl' packages.
Grab them from any GNU archive site."
find . -type f -name Makefile.am -print |
sed 's/\.am$/.in/' |
while read f; do touch "$f"; done
;;
autom4te)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is needed, and you do not seem to have it handy on your
system. You might have modified some files without having the
proper tools for further handling them.
You can get \`$1Help2man' as part of \`Autoconf' from any GNU
archive site."
file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
if test -f "$file"; then
touch $file
else
test -z "$file" || exec >$file
echo "#! /bin/sh"
echo "# Created by GNU Automake missing as a replacement of"
echo "# $ $@"
echo "exit 0"
chmod +x $file
exit 1
fi
;;
bison|yacc)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified a \`.y' file. You may need the \`Bison' package
in order for those modifications to take effect. You can get
\`Bison' from any GNU archive site."
rm -f y.tab.c y.tab.h
if [ $# -ne 1 ]; then
eval LASTARG="\${$#}"
case "$LASTARG" in
*.y)
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" y.tab.c
fi
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" y.tab.h
fi
;;
esac
fi
if [ ! -f y.tab.h ]; then
echo >y.tab.h
fi
if [ ! -f y.tab.c ]; then
echo 'main() { return 0; }' >y.tab.c
fi
;;
lex|flex)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified a \`.l' file. You may need the \`Flex' package
in order for those modifications to take effect. You can get
\`Flex' from any GNU archive site."
rm -f lex.yy.c
if [ $# -ne 1 ]; then
eval LASTARG="\${$#}"
case "$LASTARG" in
*.l)
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" lex.yy.c
fi
;;
esac
fi
if [ ! -f lex.yy.c ]; then
echo 'main() { return 0; }' >lex.yy.c
fi
;;
help2man)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified a dependency of a manual page. You may need the
\`Help2man' package in order for those modifications to take
effect. You can get \`Help2man' from any GNU archive site."
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
if test -z "$file"; then
file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
fi
if [ -f "$file" ]; then
touch $file
else
test -z "$file" || exec >$file
echo ".ab help2man is required to generate this page"
exit 1
fi
;;
makeinfo)
if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then
# We have makeinfo, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified a \`.texi' or \`.texinfo' file, or any other file
indirectly affecting the aspect of the manual. The spurious
call might also be the consequence of using a buggy \`make' (AIX,
DU, IRIX). You might want to install the \`Texinfo' package or
the \`GNU make' package. Grab either from any GNU archive site."
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
if test -z "$file"; then
file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
fi
touch $file
;;
tar)
shift
if test -n "$run"; then
echo 1>&2 "ERROR: \`tar' requires --run"
exit 1
fi
# We have already tried tar in the generic part.
# Look for gnutar/gtar before invocation to avoid ugly error
# messages.
if (gnutar --version > /dev/null 2>&1); then
gnutar "$@" && exit 0
fi
if (gtar --version > /dev/null 2>&1); then
gtar "$@" && exit 0
fi
firstarg="$1"
if shift; then
case "$firstarg" in
*o*)
firstarg=`echo "$firstarg" | sed s/o//`
tar "$firstarg" "$@" && exit 0
;;
esac
case "$firstarg" in
*h*)
firstarg=`echo "$firstarg" | sed s/h//`
tar "$firstarg" "$@" && exit 0
;;
esac
fi
echo 1>&2 "\
WARNING: I can't seem to be able to run \`tar' with the given arguments.
You may want to install GNU tar or Free paxutils, or check the
command line arguments."
exit 1
;;
*)
echo 1>&2 "\
WARNING: \`$1' is needed, and you do not seem to have it handy on your
system. You might have modified some files without having the
proper tools for further handling them. Check the \`README' file,
it often tells you about the needed prerequirements for installing
this package. You may also peek at any GNU archive site, in case
some other package would contain this missing \`$1' program."
exit 1
;;
esac
exit 0
unixcw-3.0.2/icon_unixcw.xpm 0000644 0001750 0001750 00002350343 11663010407 015736 0 ustar acerion acerion /* XPM */
static char * unixcw_xpm[] = {
"800 800 3 1",
" c None",
". c #FF0000",
"+ c #000000",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ...................................................................................................................................................... ...................................................................................................................................................... ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ",
" +++++++++++++++++++++++++++++++++++++++ ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" "};
unixcw-3.0.2/build_debs 0000644 0001750 0001750 00000000026 11666727633 014711 0 ustar acerion acerion debuild -i -us -uc -b
unixcw-3.0.2/po/ 0000755 0001750 0001750 00000000000 10455365575 013310 5 ustar acerion acerion unixcw-3.0.2/po/UnixCW.po 0000644 0001750 0001750 00000066557 10455365575 015050 0 ustar acerion acerion # SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR , YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2006-07-12 23:43-0700\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME \n"
"Language-Team: LANGUAGE \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: src/cw/cw.c:234
#, c-format
msgid "%d HZ "
msgstr ""
#: src/cw/cw.c:238 src/cw/cw.c:250
#, c-format
msgid "%d PERCENT "
msgstr ""
#: src/cw/cw.c:242
#, c-format
msgid "%d WPM "
msgstr ""
#: src/cw/cw.c:246
#, c-format
msgid "%d DOTS "
msgstr ""
#: src/cw/cw.c:254
#, c-format
msgid "ECHO %s "
msgstr ""
#: src/cw/cw.c:258
#, c-format
msgid "ERRORS %s "
msgstr ""
#: src/cw/cw.c:262
#, c-format
msgid "COMMANDS %s "
msgstr ""
#: src/cw/cw.c:266
#, c-format
msgid "COMBINATIONS %s "
msgstr ""
#: src/cw/cw.c:270
#, c-format
msgid "COMMENTS %s "
msgstr ""
#: src/cw/cw.c:288
msgid "ON"
msgstr ""
#: src/cw/cw.c:288
msgid "OFF"
msgstr ""
#: src/cw/cw.c:572 src/cwcp/cwcp.c:1261 src/cwgen/cwgen.c:159
#, c-format
msgid "Try '%s --help' for more information.\n"
msgstr ""
#: src/cw/cw.c:573 src/cwcp/cwcp.c:1262 src/cwgen/cwgen.c:160
#, c-format
msgid "Try '%s -h' for more information.\n"
msgstr ""
#: src/cw/cw.c:599
#, c-format
msgid ""
"Usage: %s [options...]\n"
"\n"
" -s, --sound=SOURCE generate sound on SOURCE [default 'soundcard']\n"
" one of 's[oundcard]', 'c[onsole]', or 'b[oth]'\n"
" -x, --sdevice=SDEVICE use SDEVICE for soundcard [default %s]\n"
" -y, --mdevice=MDEVICE use MDEVICE for sound mixer [default %s]\n"
" -d, --cdevice=CDEVICE use CDEVICE for sound ioctl [default %s]\n"
" -f, --file=FILE read from FILE [default stdin]\n"
msgstr ""
#: src/cw/cw.c:608
#, c-format
msgid ""
"Usage: %s [options...]\n"
"\n"
" -s SOURCE generate sound on SOURCE [default 'console']\n"
" one of 'c[onsole]', 's[oundcard]', or 'b[oth]'\n"
" -x SDEVICE use SDEVICE for soundcard [default %s]\n"
" -y MDEVICE use MDEVICE for sound mixer [default %s]\n"
" -d CDEVICE use CDEVICE for sound ioctl [default %s]\n"
" -f FILE read from FILE [default stdin]\n"
msgstr ""
#: src/cw/cw.c:622
#, c-format
msgid ""
" -w, --wpm=WPM set initial words per minute [default %d]\n"
" valid WPM values are between %d and %d\n"
" -t, --hz,--tone=HZ set initial tone to HZ [default %d]\n"
" valid HZ values are between %d and %d\n"
" -v, --volume=PERCENT set initial volume to PERCENT [default %d]\n"
" valid PERCENT values are between %d and %d\n"
msgstr ""
#: src/cw/cw.c:628
#, c-format
msgid ""
" -w WPM set initial words per minute [default %d]\n"
" valid WPM values are between %d and %d\n"
" -t HZ set initial tone to HZ [default %d]\n"
" valid HZ values are between %d and %d\n"
" -v PERCENT set initial volume to PERCENT [default %d]\n"
" valid PERCENT values are between %d and %d\n"
msgstr ""
#: src/cw/cw.c:641
#, c-format
msgid ""
" -g, --gap=GAP set extra gap between letters [default %d]\n"
" valid GAP values are between %d and %d\n"
" -k, --weighting=WEIGHT set weighting to WEIGHT [default %d]\n"
" valid WEIGHT values are between %d and %d\n"
" -e, --noecho don't echo sending to stdout [default echo]\n"
" -m, --nomessages don't write messages to stderr [default messages]\n"
msgstr ""
#: src/cw/cw.c:648
#, c-format
msgid ""
" -g GAP set extra gap between letters [default %d]\n"
" valid GAP values are between %d and %d\n"
" -k WEIGHT set weighting to WEIGHT [default %d]\n"
" valid WEIGHT values are between %d and %d\n"
" -e don't echo sending to stdout [default echo]\n"
" -m don't write messages to stderr [default messages]\n"
msgstr ""
#: src/cw/cw.c:660
msgid ""
" -c, --nocommands don't execute embedded commands [default commands]\n"
" -o, --nocombinations don't allow [...] combinations [default combos]\n"
" -p, --nocomments don't allow {...} comments [default comments]\n"
" -h, --help print this message\n"
" -V, --version output version information and exit\n"
"\n"
msgstr ""
#: src/cw/cw.c:667
msgid ""
" -c don't execute embedded commands [default commands]\n"
" -o don't allow [...] combinations [default combinations]\n"
" -p don't allow {...} comments [default comments]\n"
" -h print this message\n"
" -V output version information and exit\n"
"\n"
msgstr ""
#: src/cw/cw.c:696
msgid ""
"s:|sound,d:|cdevice,x:|sdevice,y:|mdevice,f:|file,t:|tone,t:|hz,v:|volume,w:|"
"wpm,g:|gap,k:|weighting,e|noecho,m|nomessages,c|nocommands,o|nocombinations,"
"p|nocomments,h|help,V|version"
msgstr ""
#: src/cw/cw.c:707 src/cwcp/cwcp.c:1391 src/xcwcp/main.cc:208
msgid "console"
msgstr ""
#: src/cw/cw.c:708 src/cwcp/cwcp.c:1392 src/xcwcp/main.cc:208
msgid "c"
msgstr ""
#: src/cw/cw.c:713 src/cwcp/cwcp.c:1397 src/xcwcp/main.cc:213
msgid "soundcard"
msgstr ""
#: src/cw/cw.c:714 src/cwcp/cwcp.c:1398 src/xcwcp/main.cc:132
#: src/xcwcp/main.cc:213
msgid "s"
msgstr ""
#: src/cw/cw.c:719 src/cwcp/cwcp.c:1403 src/xcwcp/main.cc:218
msgid "both"
msgstr ""
#: src/cw/cw.c:720 src/cwcp/cwcp.c:1404 src/xcwcp/main.cc:218
msgid "b"
msgstr ""
#: src/cw/cw.c:727 src/cwcp/cwcp.c:1411
#, c-format
msgid "%s: invalid sound source\n"
msgstr ""
#: src/cw/cw.c:747
#, c-format
msgid "%s: error opening input file\n"
msgstr ""
#: src/cw/cw.c:757 src/cwcp/cwcp.c:1448
#, c-format
msgid "%s: invalid tone value\n"
msgstr ""
#: src/cw/cw.c:766 src/cwcp/cwcp.c:1457
#, c-format
msgid "%s: invalid volume value\n"
msgstr ""
#: src/cw/cw.c:775 src/cwcp/cwcp.c:1466
#, c-format
msgid "%s: invalid wpm value\n"
msgstr ""
#: src/cw/cw.c:784 src/cwcp/cwcp.c:1475
#, c-format
msgid "%s: invalid gap value\n"
msgstr ""
#: src/cw/cw.c:793
#, c-format
msgid "%s: invalid weighting value\n"
msgstr ""
#: src/cw/cw.c:822 src/cwcp/cwcp.c:1511 src/cwgen/cwgen.c:304
#, c-format
msgid "%s version %s, %s\n"
msgstr ""
#: src/cw/cw.c:830
#, c-format
msgid "%s: getopts returned '%c'\n"
msgstr ""
#: src/cw/cw.c:840 src/cwcp/cwcp.c:1530
#, c-format
msgid "%s: no console sound: -d invalid\n"
msgstr ""
#: src/cw/cw.c:847 src/cwcp/cwcp.c:1535
#, c-format
msgid "%s: no soundcard sound: -x invalid\n"
msgstr ""
#: src/cw/cw.c:852 src/cwcp/cwcp.c:1540
#, c-format
msgid "%s: no soundcard sound: -y invalid\n"
msgstr ""
#: src/cw/cw.c:864 src/cwcp/cwcp.c:1551
#, c-format
msgid "%s: cannot set up soundcard sound\n"
msgstr ""
#: src/cw/cw.c:880 src/cwcp/cwcp.c:1567
#, c-format
msgid "%s: cannot set up console sound\n"
msgstr ""
#: src/cw/cw.c:906
msgid "CW_OPTIONS"
msgstr ""
#: src/cwcp/cwcp.c:454
msgid "Keyboard"
msgstr ""
#: src/cwcp/cwcp.c:458
msgid "Exit (F12)"
msgstr ""
#: src/cwcp/cwcp.c:556
msgid "Sending(F9 or Esc to exit)"
msgstr ""
#: src/cwcp/cwcp.c:589 src/cwcp/cwcp.c:902
msgid "Start(F9)"
msgstr ""
#: src/cwcp/cwcp.c:691
msgid ""
"\n"
"UNIX/Linux Morse Tutor v2.3, (C) 1997-2006 Simon Baldwin\n"
"--------------------------------------------------------\n"
"\n"
"Cwcp is an interactive Morse code tutor program, designed\n"
"both for learning Morse code for the first time, and for\n"
"experienced Morse users who want, or need, to improve\n"
"their receiving speed.\n"
"\n"
msgstr ""
#: src/cwcp/cwcp.c:698
msgid ""
"\n"
"To use the program, select a mode from those listed on\n"
"the left, and begin sending by pressing Return or F9.\n"
"\n"
"You can vary the speed, tone, volume, and spacing of the\n"
"Morse code at any time using the appropriate keys.\n"
"\n"
"To stop sending, press F9. To stop the program, select\n"
"Exit from the Mode menu, or use F12 or ^C.\n"
msgstr ""
#: src/cwcp/cwcp.c:889
msgid "Mode(F10v,F11^)"
msgstr ""
#: src/cwcp/cwcp.c:917 src/cwcp/cwcp.c:1044
#, c-format
msgid "%2d WPM"
msgstr ""
#: src/cwcp/cwcp.c:918
msgid "Speed(F1-,F2+)"
msgstr ""
#: src/cwcp/cwcp.c:921 src/cwcp/cwcp.c:1065
#, c-format
msgid "%4d Hz"
msgstr ""
#: src/cwcp/cwcp.c:922
msgid "Tone(F3-,F4+)"
msgstr ""
#: src/cwcp/cwcp.c:925 src/cwcp/cwcp.c:1084
#, c-format
msgid "%3d %%"
msgstr ""
#: src/cwcp/cwcp.c:926
msgid "Vol(F5-,F6+)"
msgstr ""
#: src/cwcp/cwcp.c:930 src/cwcp/cwcp.c:1104
#, c-format
msgid "%2d dot "
msgstr ""
#: src/cwcp/cwcp.c:930 src/cwcp/cwcp.c:1104
#, c-format
msgid "%2d dots"
msgstr ""
#: src/cwcp/cwcp.c:931
msgid "Gap(F7-,F8+)"
msgstr ""
#: src/cwcp/cwcp.c:935
#, c-format
msgid " 0/%2d min "
msgstr ""
#: src/cwcp/cwcp.c:935
#, c-format
msgid " 0/%2d mins"
msgstr ""
#: src/cwcp/cwcp.c:936
msgid "Time(Dn-,Up+)"
msgstr ""
#: src/cwcp/cwcp.c:1124
#, c-format
msgid "%2d min "
msgstr ""
#: src/cwcp/cwcp.c:1124
#, c-format
msgid "%2d mins"
msgstr ""
#: src/cwcp/cwcp.c:1288
#, c-format
msgid ""
"Usage: %s [options...]\n"
"\n"
" -s, --sound=SOURCE generate sound on SOURCE [default 'soundcard']\n"
" one of 's[oundcard]', 'c[onsole]', or 'b[oth]'\n"
" -x, --sdevice=SDEVICE use SDEVICE for soundcard [default %s]\n"
" -y, --mdevice=MDEVICE use MDEVICE for sound mixer [default %s]\n"
" -d, --cdevice=CDEVICE use CDEVICE for sound ioctl [default %s]\n"
msgstr ""
#: src/cwcp/cwcp.c:1296
#, c-format
msgid ""
"Usage: %s [options...]\n"
"\n"
" -s SOURCE generate sound on SOURCE [default 'soundcard']\n"
" one of 's[oundcard]', 'c[onsole]', or 'b[oth]'\n"
" -x SDEVICE use SDEVICE for soundcard [default %s]\n"
" -y MDEVICE use MDEVICE for sound mixer [default %s]\n"
" -d CDEVICE use CDEVICE for sound ioctl [default %s]\n"
msgstr ""
#: src/cwcp/cwcp.c:1309
#, c-format
msgid ""
" -i, --inifile=INIFILE load practice words from INIFILE\n"
" -w, --wpm=WPM set initial words per minute [default %d]\n"
" valid WPM values are between %d and %d\n"
" -t, --hz,--tone=HZ set initial tone to HZ [default %d]\n"
" valid HZ values are between %d and %d\n"
" -v, --volume=PERCENT set initial volume to PERCENT [default %d]\n"
" valid PERCENT values are between %d and %d\n"
msgstr ""
#: src/cwcp/cwcp.c:1317
#, c-format
msgid ""
" -i INIFILE load practice words from INIFILE\n"
" -w WPM set initial words per minute [default %d]\n"
" valid WPM values are between %d and %d\n"
" -t HZ set initial tone to HZ [default %d]\n"
" valid HZ values are between %d and %d\n"
" -v PERCENT set initial volume to PERCENT [default %d]\n"
" valid PERCENT values are between %d and %d\n"
msgstr ""
#: src/cwcp/cwcp.c:1331
#, c-format
msgid ""
" -g, --gap=GAP set extra gap between letters [default %d]\n"
" valid GAP values are between %d and %d\n"
" -p, --time=TIME set initial practice time [default %d mins]\n"
" valid TIME values are between %d and %d\n"
" -c, --colo[u]rs=CSET set initial display colors where available\n"
" [default %d,%d,%d,%d]\n"
msgstr ""
#: src/cwcp/cwcp.c:1337
#, c-format
msgid ""
" -g GAP set extra gap between letters [default %d]\n"
" valid GAP values are between %d and %d\n"
" -p TIME set initial practice time [default %d mins]\n"
" valid TIME values are between %d and %d\n"
" -c CSET set initial display colors where available\n"
" [default %d,%d,%d,%d]\n"
msgstr ""
#: src/cwcp/cwcp.c:1351
msgid ""
" -m, --mono specify no colors [default colors]\n"
" -h, --help print this message\n"
" -V, --version output version information and exit\n"
"\n"
msgstr ""
#: src/cwcp/cwcp.c:1354
msgid ""
" -m specify no colors [default colors]\n"
" -h print this message\n"
" -V output version information and exit\n"
"\n"
msgstr ""
#: src/cwcp/cwcp.c:1381
msgid ""
"s:|sound,d:|cdevice,x:|sdevice,y:|mdevice,i:|inifile,t:|tone,t:|hz,v:|volume,"
"w:|wpm,g:|gap,p:|time,c:|colours,c:|colors,m|mono,h|help,V|version,#:|#"
msgstr ""
#: src/cwcp/cwcp.c:1431
#, c-format
msgid "%s: error loading practice words\n"
msgstr ""
#: src/cwcp/cwcp.c:1439
#, c-format
msgid "%s: error writing practice words\n"
msgstr ""
#: src/cwcp/cwcp.c:1484
#, c-format
msgid "%s: invalid time value\n"
msgstr ""
#: src/cwcp/cwcp.c:1498
#, c-format
msgid "%s: invalid colors value\n"
msgstr ""
#: src/cwcp/cwcp.c:1519 src/cwgen/cwgen.c:312
#, c-format
msgid "%s: getopts returned %c\n"
msgstr ""
#: src/cwcp/cwcp.c:1629
#, c-format
msgid ""
"\n"
"Caught signal %d, exiting...\n"
msgstr ""
#: src/cwcp/cwcp.c:1652
msgid "CWCP_OPTIONS"
msgstr ""
#: src/cwgen/cwgen.c:178
#, c-format
msgid ""
"Usage: %s [options...]\n"
"\n"
" -g, --groups=GROUPS send GROUPS groups of chars [default %d]\n"
" GROUPS values may not be lower than %d\n"
" -n, --groupsize=GS make groups GS chars [default %d]\n"
" GS values may not be lower than %d, or\n"
" -n, --groupsize=GL-GH make groups between GL and GH chars\n"
" valid GL, GH values are as for GS above\n"
msgstr ""
#: src/cwgen/cwgen.c:185
#, c-format
msgid ""
"Usage: %s [options...]\n"
"\n"
" -g GROUPS send GROUPS groups of chars [default %d]\n"
" GROUPS values may not be lower than %d\n"
" -n GS make groups GS chars [default %d]\n"
" GS values may not be lower than %d, or\n"
" -n GL-GH make groups between GL and GH chars\n"
" valid GL, GH values are as for GS above\n"
msgstr ""
#: src/cwgen/cwgen.c:198
#, c-format
msgid ""
" -r, --repeat=COUNT repeat each group COUNT times [default %d]\n"
" COUNT values may not be lower than %d\n"
" -c, --charset=CHARSET select chars to send from this set\n"
" [default %s]\n"
" -x, --limit=LIMIT stop after LIMIT characters [default %d]\n"
" a LIMIT of zero indicates no set limit\n"
" -h, --help print this message\n"
" -v, --version output version information and exit\n"
"\n"
msgstr ""
#: src/cwgen/cwgen.c:206
#, c-format
msgid ""
" -r COUNT repeat each group COUNT times [default %d]\n"
" COUNT values may not be lower than %d\n"
" -c CHARSET select chars to send from this set\n"
" [default %s]\n"
" -x LIMIT stop after LIMIT characters [default %d]\n"
" a LIMIT of zero indicates no set limit\n"
" -h print this message\n"
" -v output version information and exit\n"
"\n"
msgstr ""
#: src/cwgen/cwgen.c:237
msgid "g:|groups,n:|groupsize,r:|repeat,x:|limit,c:|charset,h|help,v|version"
msgstr ""
#: src/cwgen/cwgen.c:247
#, c-format
msgid "%s: invalid groups value\n"
msgstr ""
#: src/cwgen/cwgen.c:258
#, c-format
msgid "%s: invalid groupsize range\n"
msgstr ""
#: src/cwgen/cwgen.c:266
#, c-format
msgid "%s: invalid groupsize value\n"
msgstr ""
#: src/cwgen/cwgen.c:277
#, c-format
msgid "%s: invalid repeat value\n"
msgstr ""
#: src/cwgen/cwgen.c:286
#, c-format
msgid "%s: invalid limit value\n"
msgstr ""
#: src/cwgen/cwgen.c:294
#, c-format
msgid "%s: charset cannot be empty\n"
msgstr ""
#: src/cwgen/cwgen.c:336
msgid "CWGEN_OPTIONS"
msgstr ""
#: src/cwutils/dictionary.c:435
msgid "Letter Groups"
msgstr ""
#: src/cwutils/dictionary.c:436
msgid "Number Groups"
msgstr ""
#: src/cwutils/dictionary.c:437
msgid "Alphanum Groups"
msgstr ""
#: src/cwutils/dictionary.c:438
msgid "All Char Groups"
msgstr ""
#: src/cwutils/dictionary.c:439
msgid "English Words"
msgstr ""
#: src/cwutils/dictionary.c:440
msgid "CW Words"
msgstr ""
#: src/cwutils/dictionary.c:441
msgid "PARIS Calibrate"
msgstr ""
#: src/cwutils/dictionary.c:442
msgid "EISH5 Groups"
msgstr ""
#: src/cwutils/dictionary.c:443
msgid "TMO0 Groups"
msgstr ""
#: src/cwutils/dictionary.c:444
msgid "AUV4 Groups"
msgstr ""
#: src/cwutils/dictionary.c:445
msgid "NDB6 Groups"
msgstr ""
#: src/cwutils/dictionary.c:446
msgid "KX=-RP Groups"
msgstr ""
#: src/cwutils/dictionary.c:447
msgid "FLYQC Groups"
msgstr ""
#: src/cwutils/dictionary.c:448
msgid "WJ1GZ Groups"
msgstr ""
#: src/cwutils/dictionary.c:449
msgid "23789 Groups"
msgstr ""
#: src/cwutils/dictionary.c:450
msgid ",?.;)/ Groups"
msgstr ""
#: src/cwutils/dictionary.c:451
msgid "\"'$(+:_ Groups"
msgstr ""
#: src/cwutils/copyright.h:28
msgid ""
"Copyright (C) 2001-2006 Simon Baldwin\n"
"\n"
"This program comes with ABSOLUTELY NO WARRANTY; for details please see\n"
"the file 'COPYING' supplied with the source code. This is free software,\n"
"and you are welcome to redistribute it under certain conditions; again,\n"
"see 'COPYING' for details. This program is released under the GNU General\n"
"Public License.\n"
msgstr ""
#: src/xcwcp/main.cc:60
msgid "Try '"
msgstr ""
#: src/xcwcp/main.cc:61
msgid "--help"
msgstr ""
#: src/xcwcp/main.cc:61
msgid "-h"
msgstr ""
#: src/xcwcp/main.cc:62
msgid "' for more information."
msgstr ""
#: src/xcwcp/main.cc:100 src/xcwcp/main.cc:107
msgid " [default "
msgstr ""
#: src/xcwcp/main.cc:117
msgid "valid "
msgstr ""
#: src/xcwcp/main.cc:117
msgid " values are between "
msgstr ""
#: src/xcwcp/main.cc:118
msgid " and "
msgstr ""
#: src/xcwcp/main.cc:131
msgid "Usage: "
msgstr ""
#: src/xcwcp/main.cc:131
msgid " [options...]"
msgstr ""
#: src/xcwcp/main.cc:132
msgid "sound"
msgstr ""
#: src/xcwcp/main.cc:132
msgid "SOURCE"
msgstr ""
#: src/xcwcp/main.cc:133
msgid "generate sound on SOURCE"
msgstr ""
#: src/xcwcp/main.cc:133
msgid "'soundcard'"
msgstr ""
#: src/xcwcp/main.cc:135
msgid "one of 's[oundcard]', 'c[onsole]', or 'b[oth]'"
msgstr ""
#: src/xcwcp/main.cc:136
msgid "x"
msgstr ""
#: src/xcwcp/main.cc:136
msgid "sdevice"
msgstr ""
#: src/xcwcp/main.cc:136
msgid "SDEVICE"
msgstr ""
#: src/xcwcp/main.cc:138
msgid "use SDEVICE for soundcard"
msgstr ""
#: src/xcwcp/main.cc:139
msgid "y"
msgstr ""
#: src/xcwcp/main.cc:139
msgid "mdevice"
msgstr ""
#: src/xcwcp/main.cc:139
msgid "MDEVICE"
msgstr ""
#: src/xcwcp/main.cc:141
msgid "use MDEVICE for sound mixer"
msgstr ""
#: src/xcwcp/main.cc:143
msgid "d"
msgstr ""
#: src/xcwcp/main.cc:143
msgid "cdevice"
msgstr ""
#: src/xcwcp/main.cc:143
msgid "CDEVICE"
msgstr ""
#: src/xcwcp/main.cc:145
msgid "use CDEVICE for sound ioctl"
msgstr ""
#: src/xcwcp/main.cc:146
msgid "i"
msgstr ""
#: src/xcwcp/main.cc:146
msgid "inifile"
msgstr ""
#: src/xcwcp/main.cc:146
msgid "INIFILE"
msgstr ""
#: src/xcwcp/main.cc:147
msgid "load practice words from INIFILE"
msgstr ""
#: src/xcwcp/main.cc:151
msgid "w"
msgstr ""
#: src/xcwcp/main.cc:151
msgid "wpm"
msgstr ""
#: src/xcwcp/main.cc:151 src/xcwcp/main.cc:155
msgid "WPM"
msgstr ""
#: src/xcwcp/main.cc:153
msgid "set initial words per minute"
msgstr ""
#: src/xcwcp/main.cc:157
msgid "t"
msgstr ""
#: src/xcwcp/main.cc:157
msgid "hz,--tone"
msgstr ""
#: src/xcwcp/main.cc:157 src/xcwcp/main.cc:160
msgid "HZ"
msgstr ""
#: src/xcwcp/main.cc:158
msgid "set initial tone to HZ"
msgstr ""
#: src/xcwcp/main.cc:162
msgid "v"
msgstr ""
#: src/xcwcp/main.cc:162
msgid "volume"
msgstr ""
#: src/xcwcp/main.cc:162 src/xcwcp/main.cc:165
msgid "PERCENT"
msgstr ""
#: src/xcwcp/main.cc:163
msgid "set initial volume to PERCENT"
msgstr ""
#: src/xcwcp/main.cc:167
msgid "g"
msgstr ""
#: src/xcwcp/main.cc:167
msgid "gap"
msgstr ""
#: src/xcwcp/main.cc:167 src/xcwcp/main.cc:170
msgid "GAP"
msgstr ""
#: src/xcwcp/main.cc:168
msgid "set extra gap between letters"
msgstr ""
#: src/xcwcp/main.cc:172
msgid "h"
msgstr ""
#: src/xcwcp/main.cc:172
msgid "help"
msgstr ""
#: src/xcwcp/main.cc:173
msgid "print this message"
msgstr ""
#: src/xcwcp/main.cc:174
msgid "V"
msgstr ""
#: src/xcwcp/main.cc:174
msgid "version"
msgstr ""
#: src/xcwcp/main.cc:175
msgid "output version information and exit"
msgstr ""
#: src/xcwcp/main.cc:196
msgid ""
"s:|sound,d:|cdevice,x:|sdevice,y:|mdevice,i:|inifile,t:|tone,t:|hz,v:|volume,"
"w:|wpm,g:|gap,h|help,V|version,#:|#"
msgstr ""
#: src/xcwcp/main.cc:225
msgid ": invalid sound source"
msgstr ""
#: src/xcwcp/main.cc:246
msgid ": error loading words list"
msgstr ""
#: src/xcwcp/main.cc:255
msgid ": error writing words list"
msgstr ""
#: src/xcwcp/main.cc:264
msgid ": invalid tone value"
msgstr ""
#: src/xcwcp/main.cc:273
msgid ": invalid volume value"
msgstr ""
#: src/xcwcp/main.cc:282
msgid ": invalid wpm value"
msgstr ""
#: src/xcwcp/main.cc:291
msgid ": invalid gap value"
msgstr ""
#: src/xcwcp/main.cc:300
msgid " version "
msgstr ""
#: src/xcwcp/main.cc:308
msgid ": getopts returned "
msgstr ""
#: src/xcwcp/main.cc:319
msgid ": no console sound: -d invalid"
msgstr ""
#: src/xcwcp/main.cc:324
msgid ": no soundcard sound: -x invalid"
msgstr ""
#: src/xcwcp/main.cc:329
msgid ": no soundcard sound: -y invalid"
msgstr ""
#: src/xcwcp/main.cc:341
msgid ": cannot set up soundcard sound"
msgstr ""
#: src/xcwcp/main.cc:358
msgid ": cannot set up console sound"
msgstr ""
#: src/xcwcp/main.cc:373
msgid "Caught signal "
msgstr ""
#: src/xcwcp/main.cc:374
msgid ", exiting..."
msgstr ""
#: src/xcwcp/main.cc:403
msgid "XCWCP_OPTIONS"
msgstr ""
#: src/xcwcp/main.cc:423 src/xcwcp/application.cc:147
#: src/xcwcp/application.cc:384 src/xcwcp/application.cc:419
#: src/xcwcp/application.cc:518
msgid "Xcwcp"
msgstr ""
#: src/xcwcp/application.cc:75 src/xcwcp/application.cc:78
msgid "Xcwcp version "
msgstr ""
#: src/xcwcp/application.cc:83
msgid ""
"When this button shows , click it to begin sending or "
"receiving. Only one window may send at a time.
When the button shows "
", click it to finish sending or receiving.\n"
"\n"
msgstr ""
#: src/xcwcp/application.cc:89
msgid ""
"This allows you to change what Xcwcp does. Most of the available selections "
"will probably generate random CW characters of one form or another."
"
The exceptions are Send Keyboard CW, which sends the characters that "
"you type at the keyboard, and Receive Keyed CW, which will decode CW that "
"you key in using the mouse or keyboard.
To key CW into Xcwcp for "
"receive mode, use either the mouse or the keyboard. On the mouse, the left "
"and right buttons form an Iambic keyer, and the middle mouse button works as "
"a straight key.
On the keyboard, use the Left and Right cursor keys "
"for Iambic keyer control, and the Up or Down cursor keys, or the Space, "
"Enter, or Return keys, as a straight key."
msgstr ""
#: src/xcwcp/application.cc:103
msgid ""
"This controls the CW sending speed. If you deselect adaptive receive speed, "
"it also controls the CW receiving speed."
msgstr ""
#: src/xcwcp/application.cc:107
msgid ""
"This sets the frequency of the CW tone on the system sound card or console."
"
It affects both sent CW and receive sidetone."
msgstr ""
#: src/xcwcp/application.cc:112
msgid ""
"This sets the volume of the CW tone on the system sound card. It is not "
"possible to control console sound volume, so in this case, all values other "
"than zero produce tones.
The volume control affects both sent CW and "
"receive sidetone."
msgstr ""
#: src/xcwcp/application.cc:118
msgid ""
"This sets the \"Farnsworth\" gap used in sending CW. This gap is an extra "
"number of dit-length silences between CW characters."
msgstr ""
#: src/xcwcp/application.cc:122
msgid ""
"This is the main display for Xcwcp. The random CW characters that Xcwcp "
"generates, any keyboard input you type, and the CW that you key into Xcwcp "
"all appear here.
You can clear the display contents from the File "
"menu.
The status bar shows the current character being sent, any "
"character received, and other general error and Xcwcp status information."
msgstr ""
#: src/xcwcp/application.cc:151 src/xcwcp/application.cc:152
msgid "Xcwcp Operations"
msgstr ""
#: src/xcwcp/application.cc:162 src/xcwcp/application.cc:164
msgid "Start/Stop"
msgstr ""
#: src/xcwcp/application.cc:165
msgid "Start/stop"
msgstr ""
#: src/xcwcp/application.cc:174 src/xcwcp/application.cc:175
msgid "Mode"
msgstr ""
#: src/xcwcp/application.cc:193
msgid "Speed:"
msgstr ""
#: src/xcwcp/application.cc:193
msgid "Speed Label"
msgstr ""
#: src/xcwcp/application.cc:195 src/xcwcp/application.cc:196
msgid "Speed"
msgstr ""
#: src/xcwcp/application.cc:197 src/xcwcp/receiver.cc:290
#: src/xcwcp/receiver.cc:309 src/xcwcp/sender.cc:144
msgid " WPM"
msgstr ""
#: src/xcwcp/application.cc:202
msgid "Tone:"
msgstr ""
#: src/xcwcp/application.cc:202
msgid "Frequency Label"
msgstr ""
#: src/xcwcp/application.cc:205 src/xcwcp/application.cc:206
msgid "Frequency"
msgstr ""
#: src/xcwcp/application.cc:207
msgid " Hz"
msgstr ""
#: src/xcwcp/application.cc:213
msgid "Volume:"
msgstr ""
#: src/xcwcp/application.cc:213
msgid "Volume Label"
msgstr ""
#: src/xcwcp/application.cc:215 src/xcwcp/application.cc:216
msgid "Volume"
msgstr ""
#: src/xcwcp/application.cc:217
msgid " %"
msgstr ""
#: src/xcwcp/application.cc:222
msgid "Gap:"
msgstr ""
#: src/xcwcp/application.cc:222
msgid "Gap Label"
msgstr ""
#: src/xcwcp/application.cc:224
msgid "Gap"
msgstr ""
#: src/xcwcp/application.cc:225
msgid "Farnsworth gap"
msgstr ""
#: src/xcwcp/application.cc:226
msgid " dot(s)"
msgstr ""
#: src/xcwcp/application.cc:233
msgid "start"
msgstr ""
#: src/xcwcp/application.cc:234
msgid "stop"
msgstr ""
#: src/xcwcp/application.cc:244
msgid "File"
msgstr ""
#: src/xcwcp/application.cc:245
msgid "&File"
msgstr ""
#: src/xcwcp/application.cc:247
msgid "&New Window"
msgstr ""
#: src/xcwcp/application.cc:250
msgid "Clear &Display"
msgstr ""
#: src/xcwcp/application.cc:252
msgid "Synchronize S&peed"
msgstr ""
#: src/xcwcp/application.cc:256
msgid "&Start"
msgstr ""
#: src/xcwcp/application.cc:259
msgid "S&top"
msgstr ""
#: src/xcwcp/application.cc:263
msgid "&Close"
msgstr ""
#: src/xcwcp/application.cc:265
msgid "&Quit"
msgstr ""
#: src/xcwcp/application.cc:275
msgid "Settings"
msgstr ""
#: src/xcwcp/application.cc:276
msgid "&Settings"
msgstr ""
#: src/xcwcp/application.cc:278 src/xcwcp/application.cc:279
msgid "Reverse Paddles"
msgstr ""
#: src/xcwcp/application.cc:281 src/xcwcp/application.cc:282
msgid "Curtis Mode B Timing"
msgstr ""
#: src/xcwcp/application.cc:286 src/xcwcp/application.cc:287
msgid "Adaptive CW Receive Speed"
msgstr ""
#: src/xcwcp/application.cc:293
msgid "&Font Settings..."
msgstr ""
#: src/xcwcp/application.cc:294
msgid "&Color Settings..."
msgstr ""
#: src/xcwcp/application.cc:297
msgid "Help"
msgstr ""
#: src/xcwcp/application.cc:299
msgid "&Help"
msgstr ""
#: src/xcwcp/application.cc:301
msgid "&About"
msgstr ""
#: src/xcwcp/application.cc:309 src/xcwcp/application.cc:506
msgid "Ready"
msgstr ""
#: src/xcwcp/application.cc:320
msgid "PollTimer"
msgstr ""
#: src/xcwcp/application.cc:385
msgid "Busy - are you sure?"
msgstr ""
#: src/xcwcp/application.cc:386
msgid "&Exit"
msgstr ""
#: src/xcwcp/application.cc:386 src/xcwcp/application.cc:421
msgid "&Cancel"
msgstr ""
#: src/xcwcp/application.cc:420
msgid "Another Xcwcp window is busy."
msgstr ""
#: src/xcwcp/application.cc:421
msgid "&Stop Other"
msgstr ""
#: src/xcwcp/display.cc:80
msgid "Display"
msgstr ""
#: src/xcwcp/receiver.cc:267
msgid "Badly formed CW element"
msgstr ""
#: src/xcwcp/receiver.cc:268
msgid "Receive buffer overrun"
msgstr ""
#: src/xcwcp/receiver.cc:289
msgid "Received '"
msgstr ""
#: src/xcwcp/receiver.cc:290 src/xcwcp/sender.cc:144
msgid "' at "
msgstr ""
#: src/xcwcp/receiver.cc:308
msgid "Unknown character received at "
msgstr ""
#: src/xcwcp/sender.cc:143
msgid "Sending '"
msgstr ""
unixcw-3.0.2/NEWS~ 0000644 0001750 0001750 00000011325 11767713422 013564 0 ustar acerion acerion version 3.0.2 / 2012.06.18
New version. You won't find it in git repo nor in SourceForge download area.
This is a special release with two goals related to Debian packaging:
debian/:
- fixing Debian's FTBFS bug #676752
- removing debian/ from unixcw_X.Y.Z.orig.tar.gz. Contents of debian/ can be
found in separately provided unixcw_X.Y.Z-W.debian.tar.gz
Thanks to Kamal Mostafa for patiently explaining to me some details of
Debian/Ubuntu packaging.
----------------------------------------------------------------------------
version 3.0.1 / 2012.01.08
Thanks to Kamal Mostafa for providing patches that are the reason
for 3.0.1 release.
Content of upstream package unixcw-3.0.1 is approximately the same as of
Debian source package unixcw_3.0-5.
debian/:
- added proper "Section" field in control file;
- fixed library dependencies in control file;
- fixed "Replaces:"/"Conflicts:" fields in control file;
- fixed Debian bug #653411: changes in *.preinst files to remove
dangling symlinks left by old packaging (suggested by Bob Proulx);
general:
- fixed library dependencies in "configure" script;
- fixed library dependencies provided by libcw.pc file;
libcw:
- proper detection of capabilities of liboss-salsa-dev
(kfreebsd's libasound implementation); libcw now can be built
properly on Debian/kFreeBSD;
- fixing awk scripts producing man pages: the awk scripts now
work with mawk too;
cwcp:
- fixed list of libraries in Makefile;
----------------------------------------------------------------------------
version 3.0 / 2011.12.13
Thanks to Simon Baldwin for creating this software in the
first place, and to Kamal Mostafa for helping me with packaging
unixcw 3.0 for Debian.
unixcw:
- Changed major version of unixcw package to '3'. Changes listed
below probably justify this.
- New main developer: Kamil Ignacak
- New website: http://unixcw.sourceforge.net
- Scripts building Debian packages now build 'libcw3' package
instead of 'unixcw' package, and 'libcw3-dev' Debian package instead
of 'unixcw-dev' Debian package.
libcw:
- Renamed 'cwlib' part of unixcw package to 'libcw'.
- Renamed library's header file from cwlib.h to libcw.h.
- Changed library's soname from 0 to 3 (/usr/lib/libcw.so.3.0.0
/ libcw.so.3).
- Added support for ALSA. OSS is still the default backend.
- As a consequence, libasound2 is a new dependency. There is no
possibility (yet) to disable or reconfigure this at build time.
It is possible to select sound backend in applications that use
libcw.
- Added implicit dependency on pthread library (which is a part
of libc library, so it should be available on target system by
default). Main routine generating sine wave operates as a separate
thread.
- Added actual slopes to dot and dash sounds produced by the
library. This should result in less of (or even none) audible
pops. Unfortunately current implementation makes dots and dashes
a tiny bit longer than they would be without the slopes. The
difference is not significant, but I plan to re-implement it
in the future to make this feature 100% correct.
The slopes are linear.
- Rewritten management of sound volume so that the library doesn't
use OSS mixer. This should resolve Debian bug #567394
(http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=567394).
Code that controls volume level is common for OSS and ALSA.
- Since libcw doesn't touch the mixer device anymore, then Debian
bug #567392 should be resolved as well
(http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=567392).
- Added code that attempts to discover proper audio buffer size
for both OSS and ALSA. This should resolve Debian bug #567395
(http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=567395).
- Fix of Debian bug #567395 should also solve Debian bug #567397
(http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=567397).
- Changed library's API. There will be more API changes in 3.1, so
consider current API to be unstable.
- Changed volume change step from 5% to 1%.
- Changed frequency change step from 100Hz to 20Hz.
- The library no longer can produce sound on console buzzer and on
sound card at the same time.
- The library knows default names of OSS, ALSA and console buzzer
devices. The names are used to open sound devices if no other
names are provided explicitly as function arguments.
- Introduced symbolic names of int values returned by most of
library's function: CW_FAILURE / CW_SUCCESS.
xcwcp:
- Ported xcwcp to QT4. This should resolve Debian bug #604386
(http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=604386).
- Added auto-detection of QT4 headers and QT4 moc by build files.
unixcw-3.0.2/ChangeLog 0000644 0001750 0001750 00000000000 10455365565 014431 0 ustar acerion acerion unixcw-3.0.2/Makefile.inc.in 0000644 0001750 0001750 00000003135 11702276741 015501 0 ustar acerion acerion # Copyright (C) 2001-2006 Simon Baldwin (simon_baldwin@yahoo.com)
# Copyright (C) 2011-2012 Kamil Ignacak (acerion@wp.pl)
#
# 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.
#
# Autoconfigure definitions.
AC_CC = @CC@
AC_CFLAGS = @CFLAGS@
AC_CXX = @CXX@
AC_CXXFLAGS = @CXXFLAGS@
AC_DEFS = @DEFS@
AC_GZIP = @GZIP@
AC_LDCONFIG = @LDCONFIG@
AC_LIBS = @LIBS@
AC_AWK = @AWK@
AC_RANLIB = @RANLIB@
# AC_QTDIR = @QTDIR@
# AC_QTMOC = @QTMOC@
AC_QT4INC = @QT4INC@
AC_QT4MOC = @QT4MOC@
AC_CFLAG_PIC = @CFLAG_PIC@
AC_SUBDIRS = @SUBDIRS@
AC_CC_LINKS_SO = @CC_LINKS_SO@
AC_LD_LINKS_SO = @LD_LINKS_SO@
AC_LD = @LD@
AC_LN_S = @LN_S@
# Portability values.
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
prefix = @prefix@
exec_prefix = @exec_prefix@
includedir = @includedir@
bindir = @bindir@
mandir = @mandir@
libdir = @libdir@
# http://www.gnu.org/s/hello/manual/autoconf/Changed-Directory-Variables.html
datarootdir = @datarootdir@
unixcw-3.0.2/configure.ac 0000644 0001750 0001750 00000023063 11702276410 015145 0 ustar acerion acerion # Copyright (C) 2001-2006 Simon Baldwin (simon_baldwin@yahoo.com)
# Copyright (C) 2011-2012 Kamil Ignacak (acerion@wp.pl)
#
# 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.
#
# General initializations.
AC_PREREQ(2.57)
AC_INIT([UnixCW], 3.0.1, [acerion@wp.pl])
# Specify a configuration header.
AC_CONFIG_HEADERS(src/config.h)
# General checks for programs.
AC_PROG_CC
AC_PROG_CXX
AC_PROG_AWK
AC_PROG_RANLIB
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AC_PROG_LN_S
# Check specifically for gzip and ldconfig, and substitute the harmless ":"
# if absent.
AC_PATH_PROG(GZIP, gzip, ,)
if test -z "$GZIP" ; then
GZIP=":"
fi
AC_PATH_PROG(LDCONFIG, ldconfig, ,)
if test -z "$LDCONFIG" ; then
LDCONFIG=":"
fi
AC_SUBST(GZIP)
AC_SUBST(LDCONFIG)
# Checks for libraries.
AC_CHECK_LIB(curses, initscr)
AC_CHECK_LIB(asound, snd_pcm_open)
AC_CHECK_LIB(pthread, pthread_create)
AC_CHECK_LIB(m, floor)
# Checks for header files, and refuse to go on if no KIOCSOUND is available.
AC_HEADER_STDC
AC_CHECK_HEADERS([fcntl.h limits.h stdlib.h string.h strings.h sys/ioctl.h \
sys/param.h sys/time.h unistd.h locale.h libintl.h])
AC_CHECK_HEADERS([sys/kd.h sys/vtkd.h sys/kbio.h])
if test "$ac_cv_header_sys_kd_h" = 'no' \
&& test "$ac_cv_header_sys_vtkd_h" = 'no' \
&& test "$ac_cv_header_sys_kbio_h" = 'no' ; then
AC_MSG_ERROR([Cannot find either sys/kd.h, sys/vtkd.h, or sys/kbio.h])
fi
AC_CHECK_HEADERS([soundcard.h sys/soundcard.h])
if test "$ac_cv_header_soundcard_h" = 'no' \
&& test "$ac_cv_header_sys_soundcard_h" = 'no' ; then
AC_MSG_ERROR([Cannot find either soundcard.h or sys/soundcard.h])
fi
AC_CHECK_HEADERS([getopt.h])
AC_CHECK_HEADERS([string.h strings.h])
if test "$ac_cv_header_string_h" = 'no' \
&& test "$ac_cv_header_strings_h" = 'no' ; then
AC_MSG_WARN([Cannot find either string.h or strings.h])
fi
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_CONST
AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_C_VOLATILE
# Checks for library functions.
AC_PROG_GCC_TRADITIONAL
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_FUNC_STRCOLL
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([floor gettimeofday memset sqrt strchr strdup strrchr \
strtoul getopt_long setlocale memmove select strerror strspn])
AC_FUNC_SELECT_ARGTYPES
# Check for certain routines which are missing from liboss-salsa-dev
# (kfreebsd's libasound implementation):
AC_CHECK_FUNCS([ \
snd_pcm_hw_params_test_rate \
snd_pcm_hw_params_test_periods \
snd_pcm_hw_params_test_buffer_size \
])
# Decide on which subdirectories to build; substitute into SUBDIRS. Build
# cwcp if curses is available, and xcwcp if Qt is available.
SUBDIRS="libcw cwutils cw cwgen"
# Simple test for curses based on prior library check.
if test $ac_cv_lib_curses_initscr = 'yes' ; then
SUBDIRS="$SUBDIRS cwcp"
else
AC_MSG_WARN([Cannot find libcurses - unable to build cwcp])
fi
# autodetection of QT4 dependencies
MOC_MAJOR_EARLIEST=4
# possible locations of Qt4 headers
QT4HEADER_DIRS="/usr/include/qt4 \ # Debian
/usr/include" # Arch (?)
# possible locations of Qt4 moc (a.k.a. moc-qt4)
QT4BIN_DIRS=$PATH # pretty standard
# QT4DIR="" # for testing purposes
QT4INC="" # full path to directory with QT4 QtCore + QtGui subdirs and include files, e.g. /usr/include/qt4/
QT4MOC="" # full path to QT4 moc executable
if [[[ $QT4DIR = "" ]]] ; then
# look for QT4 include directories
for dir in $QT4HEADER_DIRS; do
if test -d "$dir/QtGui" && test -d "$dir/QtCore" ; then
QT4INC=$dir;
fi
done
# look for QT4 moc binary
AC_PATH_PROG(QT4MOC, moc-qt4, , $PATH)
if test -n "$QT4MOC" ; then
MOC_MAJOR="`$QT4MOC -v 2>&1 | sed -e 's;.\+ (Qt \([[0-9]]\).\+;\1;g'`"
if [[[ $MOC_MAJOR != $MOC_MAJOR_EARLIEST ]]] ; then
QT4MOC=""
fi
fi
if [[[ "$QT4MOC" = "" ]]] ; then
QT4MOC_2=""
AC_PATH_PROG(QT4MOC_2, moc, , $PATH)
if test -n "$QT4MOC_2" ; then
MOC_MAJOR="`$QT4MOC_2 -v 2>&1 | sed -e 's;.\+ (Qt \([[0-9]]\).\+;\1;g'`"
if [[[ $MOC_MAJOR = $MOC_MAJOR_EARLIEST ]]] ; then
QT4MOC=$QT4MOC_2
fi
fi
fi
if [[[ $QT4INC != "" && $QT4MOC != "" ]]] ; then
# we have moc4 and path to QT4 include files,
# so we can build xcwcp
SUBDIRS="$SUBDIRS xcwcp"
AC_SUBST(QT4INC)
AC_SUBST(QT4MOC)
else
if [[[ $QT4INC = "" ]]] ; then
AC_MSG_WARN([Can't find directory with QT4 header files - unable to build xcwcp])
fi
if [[[ $QT4MOC = "" ]]] ; then
AC_MSG_WARN([Can't find QT moc version == $MOC_MAJOR_EARLIEST - unable to build xcwcp])
fi
AC_MSG_WARN([Hint: try setting QT4DIR env variable per instructions in unixcw/INSTALLATION])
QT4INC=""
QT4MOC=""
fi
else
# Look for $QT4DIR. If found, then look for moc, either on $PATH, or
# in $QT4DIR/bin.
AC_PATH_PROG(QT4MOC, moc, , $QT4DIR/bin:$PATH)
if test -n "$QT4MOC" ; then
MOC_VERSION="`$QT4MOC -v 2>&1 | sed -e 's;.*(Qt ;;' -e 's;).*;;'`"
if test -n "$MOC_VERSION" ; then
MOC_MAJOR="`echo $MOC_VERSION | sed -e 's;\..*;;'`"
expr "$MOC_MAJOR" + 0 >/dev/null 2>/dev/null
status=$?
if test -n "$MOC_MAJOR" -a $status -eq 0 ; then
if test "$MOC_MAJOR" -ge $MOC_MAJOR_EARLIEST ; then
SUBDIRS="$SUBDIRS xcwcp"
QT4INC="$QT4DIR/include"
AC_SUBST(QT4INC)
AC_SUBST(QT4MOC)
else
AC_MSG_WARN([Found 'moc' $MOC_VERSION - unable to build xcwcp])
AC_MSG_WARN([Hint: xcwcp requires 'moc' version >= $MOC_MAJOR_EARLIEST])
fi
else
AC_MSG_WARN([Cannot find 'moc' version - unable to build xcwcp])
AC_MSG_WARN([Hint: ensure 'moc' is in QT4DIR/bin on your PATH])
fi
else
AC_MSG_WARN([Cannot find 'moc' version - unable to build xcwcp])
AC_MSG_WARN([Hint: ensure 'moc' is in QT4DIR/bin on your PATH])
fi
else
AC_MSG_WARN([Cannot find 'moc' - unable to build xcwcp])
AC_MSG_WARN([Hint: ensure 'moc' is in QT4DIR/bin on your PATH])
fi
fi
AC_SUBST(SUBDIRS)
if [[[ $QT4INC != "" && $QT4MOC != "" ]]] ; then
echo "QT4 headers dir is $QT4INC"
echo "QT4 moc is $QT4MOC"
fi
# Add -Wall, -W, -pedantic, and other paranoia to gcc command flags, and -Wall
# to with a few suppressions to icc command flags, then similarly, though less
# so, for g++ and icpc.
if test "`basename $CC`" = "gcc" ; then
CFLAGS="$CFLAGS -Wall -W -pedantic -Wfloat-equal -Wpointer-arith -std=gnu99"
CFLAGS="$CFLAGS -Wcast-qual -Wwrite-strings -Wmissing-prototypes"
CFLAGS="$CFLAGS -Wstrict-prototypes -Wmissing-declarations -Wredundant-decls"
else
if test "`basename $CC`" = "icc" ; then
CFLAGS="$CFLAGS -Wall -wd181,188,279,383,593,810,981,1469"
fi
fi
if test "`basename $CXX`" = "g++" ; then
CXXFLAGS="$CXXFLAGS -Wall -W -pedantic -Wno-long-long"
else
if test "`basename $CXX`" = "icpc" ; then
CXXFLAGS="$CXXFLAGS -Wall -wd181,188,279,383,593,810,981,1469"
fi
fi
# Determine if -fPIC or -KPIC is available for building .so libraries.
# Because gcc complains about invalid flags, but then continues, we have to
# check by searching the compile stdout and stderr for any output.
if test -z "$CFLAG_PIC" ; then
AC_MSG_CHECKING([for -KPIC or -fPIC compiler options])
cat >conftest.c <<-EOF
int so_test() { return 0; }
EOF
if $CC -fPIC -c conftest.c 2>&1 | egrep -q '.' ; then
if $CC -KPIC -c conftest.c 2>&1 | egrep -q '.' ; then
CFLAG_PIC=""
else
CFLAG_PIC="-KPIC"
fi
else
CFLAG_PIC="-fPIC"
fi
rm -f conftest.c conftest.o
if test -n "$CFLAG_PIC" ; then
AC_MSG_RESULT($CFLAG_PIC)
else
AC_MSG_RESULT(no)
fi
fi
AC_SUBST(CFLAG_PIC)
# Determine if the C compiler builds DSO files, by testing with -shared.
CC_LINKS_SO="no"
if test -n "$CC" ; then
AC_MSG_CHECKING(whether cc builds .so files with -shared)
cat >conftest.c <<-EOF
int so_test() { return 0; }
EOF
$CC -c conftest.c >/dev/null 2>/dev/null
$CC -shared -o conftest.so conftest.o >/dev/null 2>/dev/null
rm -f conftest.c conftest.o
if test -f conftest.so ; then
nm conftest.so | grep -q so_test
if test $? -eq 0 ; then
CC_LINKS_SO="yes"
fi
fi
rm -f conftest.so
if test $CC_LINKS_SO = "yes" ; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
fi
AC_SUBST(CC_LINKS_SO)
# A linker might also build DSO files with -G, but we'll prefer to use the
# compiler if it will cooperate.
LD_LINKS_SO="no"
AC_PATH_PROG(LD, ld, , )
if test -n "$LD" ; then
AC_MSG_CHECKING(whether ld builds .so files with -G)
cat >conftest.c <<-EOF
int so_test() { return 0; }
EOF
$CC -c conftest.c >/dev/null 2>/dev/null
$LD -G -o conftest.so conftest.o >/dev/null 2>/dev/null
rm -f conftest.c conftest.o
if test -f conftest.so ; then
nm conftest.so | grep -q so_test
if test $? -eq 0 ; then
LD_LINKS_SO="yes"
fi
fi
rm -f conftest.so
if test $LD_LINKS_SO = "yes" ; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
else
LD=":"
fi
AC_SUBST(LD)
AC_SUBST(LD_LINKS_SO)
# Write out configuration information to output files.
AC_CONFIG_FILES([Makefile.inc])
AC_OUTPUT
unixcw-3.0.2/install-sh 0000755 0001750 0001750 00000012736 07301357142 014672 0 ustar acerion acerion #!/bin/sh
#
# install - install a program, script, or datafile
# This comes from X11R5 (mit/util/scripts/install.sh).
#
# Copyright 1991 by the Massachusetts Institute of Technology
#
# Permission to use, copy, modify, distribute, and sell this software and its
# documentation for any purpose is hereby granted without fee, provided that
# the above copyright notice appear in all copies and that both that
# copyright notice and this permission notice appear in supporting
# documentation, and that the name of M.I.T. not be used in advertising or
# publicity pertaining to distribution of the software without specific,
# written prior permission. M.I.T. makes no representations about the
# suitability of this software for any purpose. It is provided "as is"
# without express or implied warranty.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch. It can only install one file at a time, a restriction
# shared with many OS's install programs.
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"
# put in absolute paths if you don't have them in your path; or use env. vars.
mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
transformbasename=""
transform_arg=""
instcmd="$mvprog"
chmodcmd="$chmodprog 0755"
chowncmd=""
chgrpcmd=""
stripcmd=""
rmcmd="$rmprog -f"
mvcmd="$mvprog"
src=""
dst=""
dir_arg=""
while [ x"$1" != x ]; do
case $1 in
-c) instcmd="$cpprog"
shift
continue;;
-d) dir_arg=true
shift
continue;;
-m) chmodcmd="$chmodprog $2"
shift
shift
continue;;
-o) chowncmd="$chownprog $2"
shift
shift
continue;;
-g) chgrpcmd="$chgrpprog $2"
shift
shift
continue;;
-s) stripcmd="$stripprog"
shift
continue;;
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
shift
continue;;
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
shift
continue;;
*) if [ x"$src" = x ]
then
src=$1
else
# this colon is to work around a 386BSD /bin/sh bug
:
dst=$1
fi
shift
continue;;
esac
done
if [ x"$src" = x ]
then
echo "install: no input file specified"
exit 1
else
true
fi
if [ x"$dir_arg" != x ]; then
dst=$src
src=""
if [ -d $dst ]; then
instcmd=:
chmodcmd=""
else
instcmd=mkdir
fi
else
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if [ -f $src -o -d $src ]
then
true
else
echo "install: $src does not exist"
exit 1
fi
if [ x"$dst" = x ]
then
echo "install: no destination specified"
exit 1
else
true
fi
# If destination is a directory, append the input filename; if your system
# does not like double slashes in filenames, you may need to add some logic
if [ -d $dst ]
then
dst="$dst"/`basename $src`
else
true
fi
fi
## this sed command emulates the dirname command
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
# Make sure that the destination directory exists.
# this part is taken from Noah Friedman's mkinstalldirs script
# Skip lots of stat calls in the usual case.
if [ ! -d "$dstdir" ]; then
defaultIFS='
'
IFS="${IFS-${defaultIFS}}"
oIFS="${IFS}"
# Some sh's can't handle IFS=/ for some reason.
IFS='%'
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
IFS="${oIFS}"
pathcomp=''
while [ $# -ne 0 ] ; do
pathcomp="${pathcomp}${1}"
shift
if [ ! -d "${pathcomp}" ] ;
then
$mkdirprog "${pathcomp}"
else
true
fi
pathcomp="${pathcomp}/"
done
fi
if [ x"$dir_arg" != x ]
then
$doit $instcmd $dst &&
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
else
# If we're going to rename the final executable, determine the name now.
if [ x"$transformarg" = x ]
then
dstfile=`basename $dst`
else
dstfile=`basename $dst $transformbasename |
sed $transformarg`$transformbasename
fi
# don't allow the sed command to completely eliminate the filename
if [ x"$dstfile" = x ]
then
dstfile=`basename $dst`
else
true
fi
# Make a temp file name in the proper directory.
dsttmp=$dstdir/#inst.$$#
# Move or copy the file name to the temp name
$doit $instcmd $src $dsttmp &&
trap "rm -f ${dsttmp}" 0 &&
# and set any options; do chmod last to preserve setuid bits
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $instcmd $src $dsttmp" command.
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
# Now rename the file to the real destination.
$doit $rmcmd -f $dstdir/$dstfile &&
$doit $mvcmd $dsttmp $dstdir/$dstfile
fi &&
exit 0
unixcw-3.0.2/COPYING 0000644 0001750 0001750 00000043254 11665750012 013721 0 ustar acerion acerion GNU GENERAL PUBLIC LICENSE
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.
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.,
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.
, 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.
unixcw-3.0.2/unixcw-3.0.1.lsm 0000644 0001750 0001750 00000002405 11702276355 015353 0 ustar acerion acerion Begin4
Title: UnixCW
Version: 3.0.1
Entered-date: 2012-01-08
Description: UnixCW is a package of UNIX-based programs that fit together
to form a CW tutor program similar to CP222 by VU2ZAP. The
core of the package is libcw, a general-purpose CW functions
library. There are four programs in the package built around
this library: a simple Morse code sounding program; a small
random character generator; a curses-based Morse code tutor;
and a Qt4-based (X Window) Morse code tutor. The Qt4-based
tutor program offers send practice as well as receive. The
package includes complete man pages.
Keywords: CW Morse amateur radio ham tutor
Author: simon_baldwin@yahoo.com (Simon Baldwin, G0FRD)
acerion@wp.pl (Kamil Ignacak)
Maintained-by: acerion@wp.pl (Kamil Ignacak)
Primary-site: http://unixcw.sourceforge.net
Alternate-site: none
Original-site: none
Platforms: unixcw/libcw requires libasound2 library;
unixcw/cwcp requires Ncurses library;
unixcw/xcwcp requires QT4 library;
GNU/Linux; may work on OpenBSD, FreeBSD;
Copying-policy: GPL 2.0
End
unixcw-3.0.2/src/ 0000755 0001750 0001750 00000000000 11702312014 013431 5 ustar acerion acerion unixcw-3.0.2/src/cwgen/ 0000755 0001750 0001750 00000000000 11767330213 014550 5 ustar acerion acerion unixcw-3.0.2/src/cwgen/Makefile 0000644 0001750 0001750 00000003316 11767330213 016213 0 ustar acerion acerion # Copyright (C) 2001-2006 Simon Baldwin (simon_baldwin@yahoo.com)
# Copyright (C) 2011-2012 Kamil Ignacak (acerion@wp.pl)
#
# 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.
#
include ../../Makefile.inc
CC = $(AC_CC)
CFLAGS = $(AC_CFLAGS) $(AC_DEFS) -I../cwutils
GZIP = $(AC_GZIP)
SHELL = /bin/sh
default: all
# Build the cwgen binary.
all: cwgen
cwgen.o: cwgen.c
cwgen: cwgen.o
$(CC) $(LDFLAGS) -o $@ cwgen.o ../cwutils/i18n.o ../cwutils/cmdline.o \
../cwutils/memory.o
# Install targets.
install: all
$(INSTALL) -d $(bindir) $(mandir)/man1
$(INSTALL_PROGRAM) cwgen $(bindir)/cwgen
$(INSTALL_DATA) cwgen.1 $(mandir)/man1/cwgen.1
$(GZIP) -f -9 $(mandir)/man1/cwgen.1
install-strip:
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install
uninstall:
rm -f $(bindir)/cwgen
rm -f $(mandir)/man1/cwgen.1 $(mandir)/man1/cwgen.1.gz
# Cleanup targets.
clean:
rm -f cwgen *.s *.o
rm -f core core.*
distclean: clean
rm -f Makefile.port
mostlyclean: clean
maintainer-clean: distclean
# Test targets.
check: all
-./cwgen
# Unimplemented targets.
TAGS:
info:
dvi:
dist:
unixcw-3.0.2/src/cwgen/cwgen.1 0000644 0001750 0001750 00000007150 11702304016 015727 0 ustar acerion acerion .\"
.\" UnixCW CW Tutor Package - CWGEN
.\" Copyright (C) 2001-2006 Simon Baldwin (simon_baldwin@yahoo.com)
.\" Copyright (C) 2011-2012 Kamil Ignacak (acerion@wp.pl)
.\"
.\" 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.
.\"
.\"
.TH CWGEN 1 "CW Tutor Package" "cwgen ver. 3.0.1" \" -*- nroff -*-
.SH NAME
.\"
cwgen \- generate groups of random characters for Morse code practice
.\"
.\"
.\"
.SH SYNOPSIS
.\"
.B cwgen
[\-g\ \-\-groups=\fIgroups\fP]
[\-n\ \-\-groupsize=\fIgroupsize\fP]
[\-n\ \-\-groupsize=\fIgroup_min-group_max\fP]
[\-r\ \-\-repeat=\fIrepeat\fP]
[\-x\ \-\-limit=\fIlimit\fP]
[\-c\ \-\-charset=\fIcharset\fP]
.BR
[\-h\ \-\-help]
[\-V\ \-\-version]
.PP
\fBcwgen\fP installed on GNU/Linux systems understands both short form
and long form command line options. \fBcwgen\fP installed on other
operating systems may understand only the short form options.
.PP
Options may be predefined in the environment variable \fBCWGEN_OPTIONS\fP.
If defined, these options are used first; command line options take
precedence.
.PP
.\"
.\"
.\"
.SH DESCRIPTION
.\"
.PP
.B cwgen
provides a simple method to generate groups of random characters for
use as input into \fBcw\fP. Command line options control the group
size, number of groups, and character set from which the random
characters are selected.
.PP
.\"
.\"
.\"
.SS COMMAND LINE OPTIONS
.\"
.B cwgen
understands the following command line options. The long form options
may not be available in non-LINUX versions.
.TP
.I "\-g, \-\-groups"
Specifies the number of groups of random characters to generate. The
default value is 128.
.TP
.I "\-n, \-\-groupsize"
Specifies either the number of random characters in each group, if a
single value is given, or a range for the number of random characters
in each group if a dash-separated pair of values is given. If a range
is given, \fBcwgen\fP generates groups sized randomly between 'group_min'
and 'group_max'. The default value is 5.
.TP
.I "\-r, \-\-repeat"
Specifies the number of times to repeat each group. The default value
is 0, indicating that each group is printed just once.
.TP
.I "\-x, \-\-limit"
Specifies an upper limit on the number of characters printed. This option
is useful when using random group sizes, to ensure a given amount of
practice text. The default value is 0, indicating no upper limit on the
number of characters printed.
.TP
.I "\-c, \-\-charset"
Defines the character set from which the random characters are
selected. The default value is 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'.
.PP
.\"
.\"
.\"
.SH EXAMPLES
.\"
Generate 20 groups of 10 characters from the set EISH5, and sound
them as Morse code. Both short-form and long-form option examples
are shown:
.IP
cwgen \-g 20 \-n 10 \-c "EISH5" | cw \-w 25 \-t 850
.IP
cwgen \-\-groups=20 \-\-groupsize=10 \-\-charset="EISH5" |
cw \-\-wpm=25 \-\-tone=850
.PP
.\"
.\"
.\"
.SH SEE ALSO
.\"
Man pages for \fBcw\fP(7,LOCAL), \fBlibcw\fP(3,LOCAL), \fBcw\fP(1,LOCAL),
\fBcwcp\fP(1,LOCAL), and \fBxcwcp\fP(1,LOCAL).
.\"
unixcw-3.0.2/src/cwgen/cwgen.c 0000644 0001750 0001750 00000025043 11702277324 016025 0 ustar acerion acerion /*
* Copyright (C) 2001-2006 Simon Baldwin (simon_baldwin@yahoo.com)
* Copyright (C) 2011-2012 Kamil Ignacak (acerion@wp.pl)
*
* 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.
*/
#include "../config.h"
#include
#include
#include
#include
#if defined(HAVE_STRING_H)
# include
#endif
#if defined(HAVE_STRINGS_H)
# include
#endif
#include "i18n.h"
#include "cmdline.h"
#include "copyright.h"
#include "memory.h"
/*---------------------------------------------------------------------*/
/* Module variables, miscellaneous other stuff */
/*---------------------------------------------------------------------*/
/* Assorted definitions and constants. */
enum { FALSE = 0, TRUE = !FALSE };
enum
{ MIN_GROUPS = 1, /* Lowest number of groups allowed */
INITIAL_GROUPS = 128, /* Default groups */
MIN_GROUP_SIZE = 1, /* Lowest group size allowed */
INITIAL_GROUP_SIZE = 5, /* Default group size */
INITIAL_REPEAT = 0, /* Default repeat count */
MIN_REPEAT = 0, /* Lowest repeat count allowed */
MIN_LIMIT = 0, /* Lowest character count limit allowed */
INITIAL_LIMIT = 0 /* Default character count limit */
};
static const char *const DEFAULT_CHARSET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"0123456789";
/* Global variables. */
static int groups = INITIAL_GROUPS,
group_min = INITIAL_GROUP_SIZE,
group_max = INITIAL_GROUP_SIZE,
repeat = INITIAL_REPEAT,
limit = INITIAL_LIMIT;
static const char *charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
/*---------------------------------------------------------------------*/
/* Character generation */
/*---------------------------------------------------------------------*/
/*
* generate_characters()
*
* Generate random characters on stdout, in groups as requested, and up
* to the requested number of groups. Characters are selected from the
* set given at random.
*/
static void
generate_characters (int groups, int repeat,
int group_min, int group_max, int limit,
const char *charset)
{
static int is_initialized = FALSE;
int charset_length, group, chars;
char *buffer;
/* On first (usually only) call, seed the random number generator. */
if (!is_initialized)
{
srand (time (NULL));
is_initialized = TRUE;
}
/* Allocate the buffer for repeating groups. */
buffer = safe_malloc (group_max);
/* Generate groups up to the number requested or to the character limit. */
charset_length = strlen (charset);
chars = 0;
for (group = 0;
group < groups && (limit == 0 || chars < limit); group++)
{
int size, index, count;
/* Randomize the group size between min and max inclusive. */
size = group_min + rand () % (group_max - group_min + 1);
/* Pick and buffer random characters from the set. */
for (index = 0; index < size; index++)
buffer[index] = charset[rand () % charset_length];
/*
* Repeatedly print the group as requested. It's always printed once,
* then repeated for the desired repeat count. Break altogether if we
* hit any set limit on printed characters.
*/
count = 0;
do
{
for (index = 0;
index < size && (limit == 0 || chars < limit);
index++, chars++)
{
/* Print with immediate buffer flush. */
putchar (buffer[index]);
fflush (stdout);
}
putchar (' ');
fflush (stdout);
}
while (count++ < repeat && (limit == 0 || chars < limit));
}
free (buffer);
}
/*---------------------------------------------------------------------*/
/* Command line mechanics */
/*---------------------------------------------------------------------*/
/*
* print_usage()
*
* Print out a brief message directing the user to the help function.
*/
static void
print_usage (const char *argv0)
{
const char *format;
format = has_longopts ()
? _("Try '%s --help' for more information.\n")
: _("Try '%s -h' for more information.\n");
fprintf (stderr, format, argv0);
exit (EXIT_FAILURE);
}
/*
* print_help()
*
* Print out a brief page of help information.
*/
static void
print_help (const char *argv0)
{
const char *format;
format = has_longopts ()
? _("Usage: %s [options...]\n\n"
" -g, --groups=GROUPS send GROUPS groups of chars [default %d]\n"
" GROUPS values may not be lower than %d\n"
" -n, --groupsize=GS make groups GS chars [default %d]\n"
" GS values may not be lower than %d, or\n"
" -n, --groupsize=GL-GH make groups between GL and GH chars\n"
" valid GL, GH values are as for GS above\n")
: _("Usage: %s [options...]\n\n"
" -g GROUPS send GROUPS groups of chars [default %d]\n"
" GROUPS values may not be lower than %d\n"
" -n GS make groups GS chars [default %d]\n"
" GS values may not be lower than %d, or\n"
" -n GL-GH make groups between GL and GH chars\n"
" valid GL, GH values are as for GS above\n");
printf (format, argv0,
INITIAL_GROUPS, MIN_GROUPS,
INITIAL_GROUP_SIZE, MIN_GROUP_SIZE);
format = has_longopts ()
? _(" -r, --repeat=COUNT repeat each group COUNT times [default %d]\n"
" COUNT values may not be lower than %d\n"
" -c, --charset=CHARSET select chars to send from this set\n"
" [default %s]\n"
" -x, --limit=LIMIT stop after LIMIT characters [default %d]\n"
" a LIMIT of zero indicates no set limit\n"
" -h, --help print this message\n"
" -v, --version output version information and exit\n\n")
: _(" -r COUNT repeat each group COUNT times [default %d]\n"
" COUNT values may not be lower than %d\n"
" -c CHARSET select chars to send from this set\n"
" [default %s]\n"
" -x LIMIT stop after LIMIT characters [default %d]\n"
" a LIMIT of zero indicates no set limit\n"
" -h print this message\n"
" -v output version information and exit\n\n");
printf (format,
INITIAL_REPEAT, MIN_REPEAT,
DEFAULT_CHARSET, INITIAL_LIMIT);
exit (EXIT_SUCCESS);
}
/*
* parse_command_line()
*
* Parse the command line options for initial values for the various
* global and flag definitions.
*/
static void
parse_command_line (int argc, char **argv)
{
const char *argv0;
int option;
char *argument;
argv0 = program_basename (argv[0]);
while (get_option (argc, argv,
_("g:|groups,n:|groupsize,r:|repeat,x:|limit,c:|charset,"
"h|help,v|version"),
&option, &argument))
{
switch (option)
{
case 'g':
if (sscanf (argument, "%d", &groups) != 1
|| groups < MIN_GROUPS)
{
fprintf (stderr, _("%s: invalid groups value\n"), argv0);
exit (EXIT_FAILURE);
}
break;
case 'n':
if (sscanf (argument, "%d-%d", &group_min, &group_max) == 2)
{
if (group_min < MIN_GROUP_SIZE || group_max < MIN_GROUP_SIZE
|| group_min > group_max)
{
fprintf (stderr, _("%s: invalid groupsize range\n"), argv0);
exit (EXIT_FAILURE);
}
}
else if (sscanf (argument, "%d", &group_min) == 1)
{
if (group_min < MIN_GROUP_SIZE)
{
fprintf (stderr, _("%s: invalid groupsize value\n"), argv0);
exit (EXIT_FAILURE);
}
group_max = group_min;
}
break;
case 'r':
if (sscanf (argument, "%d", &repeat) != 1
|| repeat < MIN_REPEAT)
{
fprintf (stderr, _("%s: invalid repeat value\n"), argv0);
exit (EXIT_FAILURE);
}
break;
case 'x':
if (sscanf (argument, "%d", &limit) != 1
|| limit < MIN_LIMIT)
{
fprintf (stderr, _("%s: invalid limit value\n"), argv0);
exit (EXIT_FAILURE);
}
break;
case 'c':
if (strlen (argument) == 0)
{
fprintf (stderr, _("%s: charset cannot be empty\n"), argv0);
exit (EXIT_FAILURE);
}
charset = argument;
break;
case 'h':
print_help (argv0);
case 'v':
printf (_("%s version %s\n%s\n"),
argv0, PACKAGE_VERSION, _(CW_COPYRIGHT));
exit (EXIT_SUCCESS);
case '?':
print_usage (argv0);
default:
fprintf (stderr, _("%s: getopts returned %c\n"), argv0, option);
exit (EXIT_FAILURE);
}
}
if (get_optind () != argc)
print_usage (argv0);
}
/*
* main()
*
* Parse the command line options, then generate the characters requested.
*/
int
main (int argc, char **argv)
{
int combined_argc;
char **combined_argv;
/* Set locale and message catalogs. */
i18n_initialize ();
/* Parse combined environment and command line arguments. */
combine_arguments (_("CWGEN_OPTIONS"),
argc, argv, &combined_argc, &combined_argv);
parse_command_line (combined_argc, combined_argv);
/* Generate the character groups as requested. */
generate_characters (groups, repeat, group_min, group_max, limit, charset);
putchar ('\n');
return EXIT_SUCCESS;
}
unixcw-3.0.2/src/cwgen/Makefile~ 0000644 0001750 0001750 00000003303 11702277276 016415 0 ustar acerion acerion # Copyright (C) 2001-2006 Simon Baldwin (simon_baldwin@yahoo.com)
# Copyright (C) 2011-2012 Kamil Ignacak (acerion@wp.pl)
#
# 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.
#
include ../../Makefile.inc
CC = $(AC_CC)
CFLAGS = $(AC_CFLAGS) $(AC_DEFS) -I../cwutils
GZIP = $(AC_GZIP)
SHELL = /bin/sh
default: all
# Build the cwgen binary.
all: cwgen
cwgen.o: cwgen.c
cwgen: cwgen.o
$(CC) -o $@ cwgen.o ../cwutils/i18n.o ../cwutils/cmdline.o \
../cwutils/memory.o
# Install targets.
install: all
$(INSTALL) -d $(bindir) $(mandir)/man1
$(INSTALL_PROGRAM) cwgen $(bindir)/cwgen
$(INSTALL_DATA) cwgen.1 $(mandir)/man1/cwgen.1
$(GZIP) -f -9 $(mandir)/man1/cwgen.1
install-strip:
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install
uninstall:
rm -f $(bindir)/cwgen
rm -f $(mandir)/man1/cwgen.1 $(mandir)/man1/cwgen.1.gz
# Cleanup targets.
clean:
rm -f cwgen *.s *.o
rm -f core core.*
distclean: clean
rm -f Makefile.port
mostlyclean: clean
maintainer-clean: distclean
# Test targets.
check: all
-./cwgen
# Unimplemented targets.
TAGS:
info:
dvi:
dist:
unixcw-3.0.2/src/cwgen/Makefile.port.in 0000644 0001750 0001750 00000002113 11702277305 017576 0 ustar acerion acerion # Copyright (C) 2001-2006 Simon Baldwin (simon_baldwin@yahoo.com)
# Copyright (C) 2011-2012 Kamil Ignacak (acerion@wp.pl)
#
# 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.
#
# Portability options.
CC = @CC@
CFLAGS = @CFLAGS@ @DEFS@ -I$(ROOT)/cwutils
GZIP = @GZIP@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
mandir = @mandir@
unixcw-3.0.2/src/Makefile 0000644 0001750 0001750 00000002452 11702300363 015100 0 ustar acerion acerion # Copyright (C) 2001-2006 Simon Baldwin (simon_baldwin@yahoo.com)
# Copyright (C) 2011-2012 Kamil Ignacak (acerion@wp.pl)
#
# 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.
#
-include ../Makefile.inc
SUBDIRS = $(AC_SUBDIRS)
SHELL = /bin/sh
# Top level makefile - descends into subdirectories and executes the make in
# these one at a time.
# Macro to support descending into selected subdirectories.
DESCEND = for subdir in $(SUBDIRS); do \
( cd $$subdir; $(MAKE) $@ ); \
done
# All targets do nothing other than descend.
all install install-strip uninstall clean TAGS info dvi check:
$(DESCEND)
distclean mostlyclean maintainer-clean:
$(DESCEND)
unixcw-3.0.2/src/cwcp/ 0000755 0001750 0001750 00000000000 11702312014 014365 5 ustar acerion acerion unixcw-3.0.2/src/cwcp/Makefile 0000644 0001750 0001750 00000004410 11702277244 016043 0 ustar acerion acerion # Copyright (C) 2001-2006 Simon Baldwin (simon_baldwin@yahoo.com)
# Copyright (C) 2011-2012 Kamil Ignacak (acerion@wp.pl)
#
# 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.
#
include ../../Makefile.inc
CC = $(AC_CC)
CFLAGS = $(AC_CFLAGS) $(AC_DEFS) -I../libcw -I../cwutils
GZIP = $(AC_GZIP)
LIBS = -lcurses -L../libcw -lcw
SHELL = /bin/sh
default: all
# Build the cwcp binary.
all: cwcp
cwcp.o: cwcp.c ../libcw/libcw.h
cwcp: cwcp.o
$(CC) $(LDFLAGS) -o $@ cwcp.o ../cwutils/i18n.o ../cwutils/cw_common.o ../cwutils/cmdline.o \
../cwutils/dictionary.o ../cwutils/memory.o $(LIBS)
# Install targets.
install: all
$(INSTALL) -d $(bindir) $(mandir)/man1
$(INSTALL_PROGRAM) -m 4755 cwcp $(bindir)/cwcp
$(INSTALL_DATA) cwcp.1 $(mandir)/man1/cwcp.1
$(GZIP) -f -9 $(mandir)/man1/cwcp.1
install-strip:
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install
uninstall:
rm -f $(bindir)/cwcp
rm -f $(mandir)/man1/cwcp.1 $(mandir)/man1/cwcp.1.gz
# Cleanup targets.
clean:
rm -f cwcp *.s *.o
rm -f core core.*
distclean: clean
rm -f Makefile.port
mostlyclean: clean
maintainer-clean: distclean
# Test targets.
# This test target will be invoked when creating deb package.
check:
# This test target can be invoked manually.
real_check: all
( echo "Trying with OSS audio output"; \
LD_LIBRARY_PATH=../libcw:$$LD_LIBRARY_PATH ./cwcp -so ) || \
( echo "Retrying with ALSA audio output"; \
LD_LIBRARY_PATH=../libcw:$$LD_LIBRARY_PATH ./cwcp -sa ) || \
( echo "Retrying with console audio output"; \
LIBCW_DEBUG=1 \
LD_LIBRARY_PATH=../libcw:$$LD_LIBRARY_PATH ./cwcp -sc )
# Unimplemented targets.
TAGS:
info:
dvi:
dist:
unixcw-3.0.2/src/cwcp/cwcp.c 0000644 0001750 0001750 00000110154 11702277550 015506 0 ustar acerion acerion /*
* Copyright (C) 2001-2006 Simon Baldwin (simon_baldwin@yahoo.com)
* Copyright (C) 2011-2012 Kamil Ignacak (acerion@wp.pl)
*
* 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.
*/
#include "../config.h"
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#if defined(HAVE_STRING_H)
# include
#endif
#if defined(HAVE_STRINGS_H)
# include
#endif
#include "libcw.h"
#include "i18n.h"
#include "cmdline.h"
#include "copyright.h"
#include "dictionary.h"
#include "memory.h"
/*---------------------------------------------------------------------*/
/* Module variables, miscellaneous other stuff */
/*---------------------------------------------------------------------*/
/* Flag set if colors are requested on the user interface. */
static int do_colors = TRUE;
/* Curses windows used globally. */
static WINDOW *text_box, *text_display, *timer_display;
static const char *all_options = "s:|system,d:|device,"
"w:|wpm,t:|tone,v:|volume,"
"g:|gap,k:|weighting,"
"f:|infile,F:|outfile,"
"T:|time,"
/* "c:|colours,c:|colors,m|mono," */
"h|help,V|version";
static cw_config_t *config;
/*---------------------------------------------------------------------*/
/* Circular character queue */
/*---------------------------------------------------------------------*/
/*
* Characters awaiting send are stored in a circular buffer, implemented as
* an array with tail and head indexes that wrap.
*/
enum { QUEUE_CAPACITY = 256 };
static volatile char queue_data[QUEUE_CAPACITY];
static volatile int queue_tail = 0,
queue_head = 0;
/*
* There are times where we have no data to send. For these cases, record
* as idle, so that we know when to wake the sender.
*/
static volatile int is_queue_idle = TRUE;
/* variables storing values of some command line arguments */
static const char *argv0 = NULL;
static int timer_get_practice_time(void);
static int timer_set_practice_time(int practice_time);
/*
static int is_console = FALSE;
static int is_soundcard = TRUE;
static int is_alsa = FALSE;
static char *console_device = NULL;
static char *soundcard_device = NULL;
static char *mixer_device = NULL;
*/
/*
* queue_get_length()
* queue_next_index()
* queue_prior_index()
*
* Return the count of characters currently held in the circular buffer, and
* advance/regress a tone queue index, including circular wrapping.
*/
static int
queue_get_length (void)
{
return queue_tail >= queue_head
? queue_tail - queue_head : queue_tail - queue_head + QUEUE_CAPACITY;
}
static int
queue_next_index (int index)
{
return (index + 1) % QUEUE_CAPACITY;
}
static int
queue_prior_index (int index)
{
return index == 0 ? QUEUE_CAPACITY - 1 : index - 1;
}
/*
* queue_display_add_character()
* queue_display_delete_character()
* queue_display_highlight_character()
*
* Add and delete a character to the text display when queueing, and
* highlight or un-highlight, a character in the text display when dequeueing.
*/
static void
queue_display_add_character (void)
{
/* Append the last queued character to the text display. */
if (queue_get_length () > 0)
{
waddch (text_display, toupper (queue_data[queue_tail]));
wrefresh (text_display);
}
}
static void
queue_display_delete_character (void)
{
int y, x, max_y, max_x;
/* Get the text display dimensions and current coordinates. */
getmaxyx (text_display, max_y, max_x);
getyx (text_display, y, x);
/* Back the cursor up one position. */
x--;
if (x < 0)
{
x += max_x;
y--;
}
/* If these coordinates are on screen, write a space and back up. */
if (y >= 0)
{
wmove (text_display, y, x);
waddch (text_display, ' ');
wmove (text_display, y, x);
wrefresh (text_display);
}
}
static void
queue_display_highlight_character (int is_highlight)
{
int y, x, max_y, max_x;
/* Get the text display dimensions and current coordinates. */
getmaxyx (text_display, max_y, max_x);
getyx (text_display, y, x);
/* Find the coordinates for the queue head character. */
x -= queue_get_length () + 1;
while (x < 0)
{
x += max_x;
y--;
}
/*
* If these coordinates are on screen, highlight or unhighlight, and then
* restore the cursor position so that it remains unchanged.
*/
if (y >= 0)
{
int saved_y, saved_x;
getyx (text_display, saved_y, saved_x);
wmove (text_display, y, x);
waddch (text_display,
is_highlight ? winch (text_display) | A_REVERSE
: winch (text_display) & ~A_REVERSE);
wmove (text_display, saved_y, saved_x);
wrefresh (text_display);
}
}
/*
* queue_discard_contents()
*
* Forcibly empty the queue, if not already idle.
*/
static void
queue_discard_contents (void)
{
if (!is_queue_idle)
{
queue_display_highlight_character (FALSE);
queue_head = queue_tail;
is_queue_idle = TRUE;
}
}
/*
* queue_dequeue_character()
*
* Called when the CW send buffer is empty. If the queue is not idle, take
* the next character from the queue and send it. If there are no more queued
* characters, set the queue to idle.
*/
static void
queue_dequeue_character (void)
{
if (!is_queue_idle)
{
/* Unhighlight any previous highlighting, and see if we can dequeue. */
queue_display_highlight_character (FALSE);
if (queue_get_length () > 0)
{
char c;
/*
* Take the next character off the queue, highlight, and send it.
* We don't expect sending to fail because only sendable characters
* are queued.
*/
queue_head = queue_next_index (queue_head);
c = queue_data[queue_head];
queue_display_highlight_character (TRUE);
if (!cw_send_character (c))
{
perror ("cw_send_character");
abort ();
}
}
else
is_queue_idle = TRUE;
}
}
/*
* queue_enqueue_string()
* queue_enqueue_character()
*
* Queues a string or character for sending by the CW sender. Rejects any
* unsendable character, and also any characters passed in where the character
* queue is already full. Rejection is silent.
*/
static void
queue_enqueue_string (const char *word)
{
int is_queue_notify, index;
is_queue_notify = FALSE;
for (index = 0; word[index] != '\0'; index++)
{
char c;
c = toupper (word[index]);
if (cw_check_character (c))
{
/*
* Calculate the new character queue tail. If the new value will
* not hit the current queue head, add the character to the queue.
*/
if (queue_next_index (queue_tail) != queue_head)
{
queue_tail = queue_next_index (queue_tail);
queue_data[queue_tail] = c;
queue_display_add_character ();
if (is_queue_idle)
is_queue_notify = TRUE;
}
}
}
/* If we queued any character, mark the queue as not idle. */
if (is_queue_notify)
is_queue_idle = FALSE;
}
static void
queue_enqueue_character (char c)
{
char buffer[2];
buffer[0] = c;
buffer[1] = '\0';
queue_enqueue_string (buffer);
}
/*
* queue_delete_character()
*
* Remove the most recently added character from the queue, provided that
* the dequeue hasn't yet reached it. If there's nothing available to
* delete, fail silently.
*/
static void
queue_delete_character (void)
{
/* If data is queued, regress tail and delete one display character. */
if (queue_get_length () > 0)
{
queue_tail = queue_prior_index (queue_tail);
queue_display_delete_character ();
}
}
/*---------------------------------------------------------------------*/
/* Practice timer */
/*---------------------------------------------------------------------*/
/* Practice timer limits, timer, and time() value on practice start. */
static const int TIMER_MIN_TIME = 1, TIMER_MAX_TIME = 99;
static int timer_practice_time = 15,
timer_practice_start = 0;
/*
* timer_get_practice_time()
* timer_set_practice_time()
* timer_get_practice_time_limits()
*
* Accessor, mutator, and limit function for mode practice timer.
*/
static int
timer_get_practice_time (void)
{
return timer_practice_time;
}
static int
timer_set_practice_time (int practice_time)
{
if (practice_time >= TIMER_MIN_TIME && practice_time <= TIMER_MAX_TIME)
{
timer_practice_time = practice_time;
return TRUE;
}
return FALSE;
}
/*
* timer_start()
*
* Set the timer practice start time to the current time.
*/
static void
timer_start (void)
{
timer_practice_start = time (NULL);
}
/*
* is_timer_expired()
*
* Update the practice timer, and return TRUE if the timer expires.
*/
static int
is_timer_expired (void)
{
char buffer[16];
int minutes;
/* Update the display of minutes practiced. */
minutes = (time (NULL) - timer_practice_start) / 60;
sprintf (buffer, "%2d", minutes);
mvwaddstr (timer_display, 0, 2, buffer);
wrefresh (timer_display);
/* Check the time, requesting stop if over practice time. */
return minutes >= timer_practice_time;
}
/*---------------------------------------------------------------------*/
/* General program state and mode control */
/*---------------------------------------------------------------------*/
/*
* Definition of an interface operating mode; its description, related
* dictionary, and data on how to send for the mode.
*/
typedef enum { M_DICTIONARY, M_KEYBOARD, M_EXIT } mode_type_t;
struct mode_s
{
const char *description; /* Text mode description */
mode_type_t type; /* Mode type; dictionary, keyboard... */
const dictionary *dict; /* Dictionary, if type is dictionary */
};
typedef struct mode_s *moderef_t;
/*
* Modes table, current program mode, and count of modes in the table.
* The program is always in one of these modes, indicated by current_mode.
*/
static moderef_t modes = NULL,
current_mode = NULL;
static int modes_count = 0;
/* Current sending state, active or idle. */
static int is_sending_active = FALSE;
/*
* mode_initialize()
*
* Build up the modes from the known dictionaries, then add non-dictionary
* modes.
*/
static void
mode_initialize (void)
{
int count;
const dictionary *dict;
/* Dispose of any pre-existing modes -- unlikely. */
free (modes);
modes = NULL;
/* Start the modes with the known dictionaries. */
count = 0;
for (dict = dictionary_iterate (NULL); dict; dict = dictionary_iterate (dict))
{
modes = safe_realloc (modes, sizeof (*modes) * (count + 1));
modes[count].description = get_dictionary_description (dict);
modes[count].type = M_DICTIONARY;
modes[count++].dict = dict;
}
/* Add keyboard, exit, and null sentinel. */
modes = safe_realloc (modes, sizeof (*modes) * (count + 3));
modes[count].description = _("Keyboard");
modes[count].type = M_KEYBOARD;
modes[count++].dict = NULL;
modes[count].description = _("Exit (F12)");
modes[count].type = M_EXIT;
modes[count++].dict = NULL;
memset (modes + count, 0, sizeof (*modes));
/* Initialize the current mode to be the first listed, and set count. */
current_mode = modes;
modes_count = count;
}
/*
* mode_get_count()
* mode_get_current()
* mode_get_description()
* mode_current_is_type()
*
* Get the count of modes, the index of the current mode, a description of the
* mode at a given index, and a type comparison for the current mode.
*/
static int
mode_get_count (void)
{
return modes_count;
}
static int
mode_get_current (void)
{
return current_mode - modes;
}
static const char *
mode_get_description (int index)
{
return modes[index].description;
}
static int
mode_current_is_type (mode_type_t type)
{
return current_mode->type == type;
}
/*
* mode_advance_current()
* mode_regress_current()
*
* Advance and regress the current node, returning FALSE if at the limits.
*/
static int
mode_advance_current (void)
{
current_mode++;
if (!current_mode->description)
{
current_mode--;
return FALSE;
}
else
return TRUE;
}
static int
mode_regress_current (void)
{
if (current_mode > modes)
{
current_mode--;
return TRUE;
}
else
return FALSE;
}
/*
* change_state_to_active()
*
* Change the state of the program from idle to actively sending.
*/
static void
change_state_to_active (void)
{
static moderef_t last_mode = NULL; /* Detect changes of mode */
if (!is_sending_active)
{
cw_start_beep();
/* Don't set sending_state until after the above warning has completed. */
is_sending_active = TRUE;
mvwaddstr (text_box, 0, 1, _("Sending(F9 or Esc to exit)"));
wnoutrefresh (text_box);
doupdate ();
if (current_mode != last_mode)
{
/* If the mode changed, clear the display window. */
werase (text_display);
wmove (text_display, 0, 0);
wrefresh (text_display);
/* And if we are starting something new, start the timer. */
timer_start ();
last_mode = current_mode;
}
}
}
/*
* change_state_to_idle()
*
* Change the state of the program from actively sending to idle.
*/
static void
change_state_to_idle (void)
{
if (is_sending_active)
{
is_sending_active = FALSE;
box (text_box, 0, 0);
mvwaddstr (text_box, 0, 1, _("Start(F9)"));
wnoutrefresh (text_box);
touchwin (text_display);
wnoutrefresh (text_display);
doupdate ();
/* Remove everything in the outgoing character queue. */
queue_discard_contents ();
cw_end_beep();
}
}
/*
* mode_buffer_random_text()
*
* Add a group of elements, based on the given mode, to the character queue.
*/
static void
mode_buffer_random_text (moderef_t mode)
{
const dictionary *dict;
int group, group_size;
dict = mode->dict;
group_size = get_dictionary_group_size (dict);
/* Select and buffer groupsize random wordlist elements. */
queue_enqueue_character (' ');
for (group = 0; group < group_size; group++)
queue_enqueue_string (get_dictionary_random_word (dict));
}
/*
* mode_libcw_poll_sender()
*
* Poll the CW library tone queue, and if it is getting low, arrange for
* more data to be passed in to the sender.
*/
static void
mode_libcw_poll_sender (void)
{
if (cw_get_tone_queue_length () <= 1)
{
/*
* If sending is active, arrange more data for libcw. The source for
* this data is dependent on the mode. If in dictionary modes, update
* and check the timer, then add more random data if the queue is empty.
* If in keyboard mode, just dequeue anything currently on the character
* queue.
*/
if (is_sending_active)
{
if (current_mode->type == M_DICTIONARY)
{
if (is_timer_expired ())
{
change_state_to_idle ();
return;
}
if (queue_get_length () == 0)
mode_buffer_random_text (current_mode);
}
if (current_mode->type == M_DICTIONARY
|| current_mode->type == M_KEYBOARD)
{
queue_dequeue_character ();
}
}
}
}
/*
* mode_is_sending_active()
*
* Return TRUE if currently sending, false otherwise.
*/
static int
mode_is_sending_active (void)
{
return is_sending_active;
}
/*---------------------------------------------------------------------*/
/* User interface initialization and event handling */
/*---------------------------------------------------------------------*/
/*
* User interface introduction strings, split in two to avoid the 509
* character limit imposed by ISO C89 on string literal lengths.
*/
static const char *const INTRODUCTION = N_(
"UNIX/Linux Morse Tutor v3.0.1\n"
"Copyright (C) 1997-2006 Simon Baldwin\n"
"Copyright (C) 2011-2012 Kamil Ignacak\n"
"---------------------------------------------------------\n"
"Cwcp is an interactive Morse code tutor program, designed\n"
"both for learning Morse code for the first time, and for\n"
"experienced Morse users who want, or need, to improve\n"
"their receiving speed.\n");
static const char *const INTRODUCTION_CONTINUED = N_(
"---------------------------------------------------------\n"
"Select mode: Up/Down arrow/F10/F11\n"
"Start sending selected mode: Enter/F9\n"
"Pause: F9/Esc\n"
"Resume: F9\n"
"Exit program: menu->Exit/F12/^C\n"
"Use keys specified below to adjust speed, tone, volume,\n"
"and spacing of the Morse code at any time.\n");
/* Alternative F-keys for folks without (some, or all) F-keys. */
enum
{ CTRL_OFFSET = 0100, /* Ctrl keys are 'X' - 0100 */
PSEUDO_KEYF1 = 'Q' - CTRL_OFFSET, /* Alternative FKEY1 */
PSEUDO_KEYF2 = 'W' - CTRL_OFFSET, /* Alternative FKEY2 */
PSEUDO_KEYF3 = 'E' - CTRL_OFFSET, /* Alternative FKEY3 */
PSEUDO_KEYF4 = 'R' - CTRL_OFFSET, /* Alternative FKEY4 */
PSEUDO_KEYF5 = 'T' - CTRL_OFFSET, /* Alternative FKEY5 */
PSEUDO_KEYF6 = 'Y' - CTRL_OFFSET, /* Alternative FKEY6 */
PSEUDO_KEYF7 = 'U' - CTRL_OFFSET, /* Alternative FKEY7 */
PSEUDO_KEYF8 = 'I' - CTRL_OFFSET, /* Alternative FKEY8 */
PSEUDO_KEYF9 = 'A' - CTRL_OFFSET, /* Alternative FKEY9 */
PSEUDO_KEYF10 = 'S' - CTRL_OFFSET, /* Alternative FKEY10 */
PSEUDO_KEYF11 = 'D' - CTRL_OFFSET, /* Alternative FKEY11 */
PSEUDO_KEYF12 = 'F' - CTRL_OFFSET, /* Alternative FKEY12 */
PSEUDO_KEYNPAGE = 'O' - CTRL_OFFSET, /* Alternative PageDown */
PSEUDO_KEYPPAGE = 'P' - CTRL_OFFSET /* Alternative PageUp */
};
/* User interface event loop running flag. */
static int is_running = TRUE;
/* Color definitions. */
static const short color_array[] = {
COLOR_BLACK, COLOR_RED, COLOR_GREEN, COLOR_YELLOW,
COLOR_BLUE, COLOR_MAGENTA, COLOR_CYAN, COLOR_WHITE
};
enum { COLORS_COUNT = sizeof (color_array) / sizeof (color_array[0]) };
enum
{ BOX_COLORS = 1, /* Normal color pair */
DISPLAY_COLORS = 2, /* Blue color pair */
DISPLAY_FOREGROUND = 7, /* White foreground */
DISPLAY_BACKGROUND = 4, /* Blue background */
BOX_FOREGROUND = 7, /* White foreground */
BOX_BACKGROUND = 0 /* Black background */
};
/* Color values as arrays into color_array. */
static int display_foreground = DISPLAY_FOREGROUND, /* White foreground */
display_background = DISPLAY_BACKGROUND, /* Blue background */
box_foreground = BOX_FOREGROUND, /* White foreground */
box_background = BOX_BACKGROUND; /* Black background */
/* Curses windows used by interface functions only. */
static WINDOW *screen = NULL,
*mode_display = NULL, *speed_display = NULL,
*tone_display = NULL, *volume_display = NULL,
*gap_display = NULL;
/*
* interface_init_screen()
* interface_init_box()
* interface_init_display()
* interface_init_panel()
*
* Helper functions for interface_init(), to build boxes and displays.
*/
static WINDOW*
interface_init_screen (void)
{
WINDOW *window;
/* Create the main window for the complete screen. */
window = initscr ();
wrefresh (window);
/* If using colors, set up a base color for the screen. */
if (do_colors && has_colors ())
{
int max_y, max_x;
WINDOW *base;
start_color ();
init_pair (BOX_COLORS,
color_array[box_foreground],
color_array[box_background]);
init_pair (DISPLAY_COLORS,
color_array[display_foreground],
color_array[display_background]);
getmaxyx (screen, max_y, max_x);
base = newwin (max_y + 1, max_x + 1, 0, 0);
wbkgdset (base, COLOR_PAIR (BOX_COLORS) | ' ');
werase (base);
wrefresh (base);
}
return window;
}
static WINDOW*
interface_init_box (int lines, int columns, int begin_y, int begin_x,
const char *legend)
{
WINDOW *window;
/* Create the window, and set up colors if possible and requested. */
window = newwin (lines, columns, begin_y, begin_x);
if (do_colors && has_colors ())
{
wbkgdset (window, COLOR_PAIR (BOX_COLORS) | ' ');
werase (window);
wattron (window, COLOR_PAIR (BOX_COLORS));
}
else
wattron (window, A_REVERSE);
box (window, 0, 0);
/* Add any initial legend to the box. */
if (legend)
mvwaddstr (window, 0, 1, legend);
wrefresh (window);
return window;
}
static WINDOW*
interface_init_display (int lines, int columns, int begin_y, int begin_x,
int indent, const char *text)
{
WINDOW *window;
/* Create the window, and set up colors if possible and requested. */
window = newwin (lines, columns, begin_y, begin_x);
if (do_colors && has_colors ())
{
wbkgdset (window, COLOR_PAIR (DISPLAY_COLORS) | ' ');
wattron (window, COLOR_PAIR (DISPLAY_COLORS));
werase (window);
}
/* Add any initial text to the box. */
if (text)
mvwaddstr (window, 0, indent, text);
wrefresh (window);
return window;
}
static void
interface_init_panel (int lines, int columns, int begin_y, int begin_x,
const char *box_legend,
int indent, const char *display_text,
WINDOW **box, WINDOW **display)
{
WINDOW *window;
/* Create and return, if required, a box for the control. */
window = interface_init_box (lines, columns, begin_y, begin_x, box_legend);
if (box)
*box = window;
/* Add a display within the frame of the box. */
*display = interface_init_display (lines - 2, columns - 2,
begin_y + 1, begin_x + 1,
indent, display_text);
}
/*
* interface_initialize()
*
* Initialize the user interface, boxes and windows.
*/
static void
interface_initialize (void)
{
static int is_initialized = FALSE;
char buffer[16];
int max_y, max_x, index, value;
/* Create the over-arching screen window. */
screen = interface_init_screen ();
getmaxyx (screen, max_y, max_x);
/* Create and box in the mode window. */
interface_init_panel (max_y - 3, 20, 0, 0, _("Mode(F10v,F11^)"),
0, NULL, NULL, &mode_display);
for (index = 0; index < mode_get_count (); index++)
{
if (index == mode_get_current ())
wattron (mode_display, A_REVERSE);
else
wattroff (mode_display, A_REVERSE);
mvwaddstr (mode_display, index, 0, mode_get_description (index));
}
wrefresh (mode_display);
/* Create the text display window; do the introduction only once. */
interface_init_panel (max_y - 3, max_x - 20, 0, 20, _("Start(F9)"),
0, NULL, &text_box, &text_display);
wmove (text_display, 0, 0);
if (!is_initialized)
{
waddstr (text_display, _(INTRODUCTION));
waddstr (text_display, _(INTRODUCTION_CONTINUED));
is_initialized = TRUE;
}
wrefresh (text_display);
idlok (text_display, TRUE);
immedok (text_display, TRUE);
scrollok (text_display, TRUE);
/* Create the control feedback boxes. */
sprintf (buffer, _("%2d WPM"), cw_get_send_speed ());
interface_init_panel (3, 16, max_y - 3, 0, _("Speed(F1-,F2+)"),
4, buffer, NULL, &speed_display);
sprintf (buffer, _("%4d Hz"), cw_get_frequency ());
interface_init_panel (3, 16, max_y - 3, 16, _("Tone(F3-,F4+)"),
3, buffer, NULL, &tone_display);
sprintf (buffer, _("%3d %%"), cw_get_volume ());
interface_init_panel (3, 16, max_y - 3, 32, _("Vol(F5-,F6+)"),
4, buffer, NULL, &volume_display);
value = cw_get_gap ();
sprintf (buffer, value == 1 ? _("%2d dot ") : _("%2d dots"), value);
interface_init_panel (3, 16, max_y - 3, 48, _("Gap(F7-,F8+)"),
3, buffer, NULL, &gap_display);
value = timer_get_practice_time ();
sprintf (buffer, value == 1 ? _(" 0/%2d min ") : _(" 0/%2d mins"), value);
interface_init_panel (3, 16, max_y - 3, 64, _("Time(Dn-,Up+)"),
2, buffer, NULL, &timer_display);
/* Set up curses input mode. */
keypad (screen, TRUE);
noecho ();
cbreak ();
curs_set (0);
raw ();
nodelay (screen, FALSE);
wrefresh (curscr);
}
/*
* interface_destroy()
*
* Dismantle the user interface, boxes and windows.
*/
static void
interface_destroy (void)
{
/* Clear the screen for neatness. */
werase (screen);
wrefresh (screen);
/* End curses processing. */
endwin ();
/* Reset user interface windows to initial values. */
screen = NULL;
mode_display = NULL;
speed_display = NULL;
tone_display = NULL;
volume_display = NULL;
gap_display = NULL;
}
/*
* interface_interpret()
*
* Assess a user command, and action it if valid. If the command turned out
* to be a valid user interface command, return TRUE, otherwise return FALSE.
*/
static int
interface_interpret (int c)
{
char buffer[16];
int previous_mode, value;
/* Interpret the command passed in */
switch (c)
{
default:
return FALSE;
case ']':
display_background = (display_background + 1) % COLORS_COUNT;
goto color_update;
case '[':
display_foreground = (display_foreground + 1) % COLORS_COUNT;
goto color_update;
case '{':
box_background = (box_background + 1) % COLORS_COUNT;
goto color_update;
case '}':
box_foreground = (box_foreground + 1) % COLORS_COUNT;
goto color_update;
color_update:
if (do_colors && has_colors ())
{
init_pair (BOX_COLORS,
color_array[box_foreground],
color_array[box_background]);
init_pair (DISPLAY_COLORS,
color_array[display_foreground],
color_array[display_background]);
wrefresh (curscr);
}
break;
case 'L' - CTRL_OFFSET:
wrefresh (curscr);
break;
case KEY_F (1):
case PSEUDO_KEYF1:
case KEY_LEFT:
if (cw_set_send_speed (cw_get_send_speed () - CW_SPEED_STEP))
goto speed_update;
break;
case KEY_F (2):
case PSEUDO_KEYF2:
case KEY_RIGHT:
if (cw_set_send_speed (cw_get_send_speed () + CW_SPEED_STEP))
goto speed_update;
break;
speed_update:
sprintf (buffer, _("%2d WPM"), cw_get_send_speed ());
mvwaddstr (speed_display, 0, 4, buffer);
wrefresh (speed_display);
break;
case KEY_F (3):
case PSEUDO_KEYF3:
case KEY_END:
if (cw_set_frequency (cw_get_frequency () - CW_FREQUENCY_STEP))
goto frequency_update;
break;
case KEY_F (4):
case PSEUDO_KEYF4:
case KEY_HOME:
if (cw_set_frequency (cw_get_frequency () + CW_FREQUENCY_STEP))
goto frequency_update;
break;
frequency_update:
sprintf (buffer, _("%4d Hz"), cw_get_frequency ());
mvwaddstr (tone_display, 0, 3, buffer);
wrefresh (tone_display);
break;
case KEY_F (5):
case PSEUDO_KEYF5:
if (cw_set_volume (cw_get_volume () - CW_VOLUME_STEP))
goto volume_update;
break;
case KEY_F (6):
case PSEUDO_KEYF6:
if (cw_set_volume (cw_get_volume () + CW_VOLUME_STEP))
goto volume_update;
break;
volume_update:
sprintf (buffer, _("%3d %%"), cw_get_volume ());
mvwaddstr (volume_display, 0, 4, buffer);
wrefresh (volume_display);
break;
case KEY_F (7):
case PSEUDO_KEYF7:
if (cw_set_gap (cw_get_gap () - CW_GAP_STEP))
goto gap_update;
break;
case KEY_F (8):
case PSEUDO_KEYF8:
if (cw_set_gap (cw_get_gap () + CW_GAP_STEP))
goto gap_update;
break;
gap_update:
value = cw_get_gap ();
sprintf (buffer, value == 1 ? _("%2d dot ") : _("%2d dots"), value);
mvwaddstr (gap_display, 0, 3, buffer);
wrefresh (gap_display);
break;
case KEY_NPAGE:
case PSEUDO_KEYNPAGE:
if (timer_set_practice_time (timer_get_practice_time () - CW_PRACTICE_TIME_STEP))
goto time_update;
break;
case KEY_PPAGE:
case PSEUDO_KEYPPAGE:
if (timer_set_practice_time (timer_get_practice_time () + CW_PRACTICE_TIME_STEP))
goto time_update;
break;
time_update:
value = cw_get_gap ();
sprintf (buffer, value == 1 ? _("%2d min ") : _("%2d mins"), value);
mvwaddstr (timer_display, 0, 5, buffer);
wrefresh (timer_display);
break;
case KEY_F (11):
case PSEUDO_KEYF11:
case KEY_UP:
change_state_to_idle ();
previous_mode = mode_get_current ();
if (mode_regress_current ())
goto mode_update;
break;
case KEY_F (10):
case PSEUDO_KEYF10:
case KEY_DOWN:
change_state_to_idle ();
previous_mode = mode_get_current ();
if (mode_advance_current ())
goto mode_update;
break;
mode_update:
wattroff (mode_display, A_REVERSE);
mvwaddstr (mode_display,
previous_mode, 0, mode_get_description (previous_mode));
wattron (mode_display, A_REVERSE);
mvwaddstr (mode_display,
mode_get_current (), 0,
mode_get_description (mode_get_current ()));
wrefresh (mode_display);
break;
case KEY_F (9):
case PSEUDO_KEYF9:
case '\n':
if (mode_current_is_type (M_EXIT))
is_running = FALSE;
else
{
if (!mode_is_sending_active ())
change_state_to_active ();
else
if (c != '\n')
change_state_to_idle ();
}
break;
case KEY_CLEAR:
case 'V' - CTRL_OFFSET:
if (!mode_is_sending_active ())
{
werase (text_display);
wmove (text_display, 0, 0);
wrefresh (text_display);
}
break;
case '[' - CTRL_OFFSET:
case 'Z' - CTRL_OFFSET:
change_state_to_idle ();
break;
case KEY_F (12):
case PSEUDO_KEYF12:
case 'C' - CTRL_OFFSET:
queue_discard_contents ();
cw_flush_tone_queue ();
is_running = FALSE;
break;
case KEY_RESIZE:
change_state_to_idle ();
interface_destroy ();
interface_initialize ();
break;
}
/* The command was a recognized interface key. */
return TRUE;
}
/*
* interface_handle_event()
*
* Handle an interface 'event', in this case simply a character from the
* keyboard via curses.
*/
static void
interface_handle_event (int c)
{
/* See if this character is a valid user interface command. */
if (interface_interpret (c))
return;
/*
* If the character is standard 8-bit ASCII or backspace, and the current
* sending mode is from the keyboard, then make an effort to either queue
* the character for sending, or delete the most recently queued.
*/
if (mode_is_sending_active () && mode_current_is_type (M_KEYBOARD))
{
if (c == KEY_BACKSPACE || c == KEY_DC)
{
queue_delete_character ();
return;
}
else if (c <= UCHAR_MAX)
{
queue_enqueue_character ((char) c);
return;
}
}
/* The 'event' is nothing at all of interest; drop it. */
}
/*
* poll_until_keypress_ready()
*
* Calls our sender polling function at regular intervals, and returns only
* when data is available to getch(), so that it will not block.
*/
static void
poll_until_keypress_ready (int fd, int usecs)
{
int fd_count;
/* Poll until the select indicates data on the file descriptor. */
do
{
fd_set read_set;
struct timeval timeout;
/* Set up a the file descriptor set and timeout information. */
FD_ZERO (&read_set);
FD_SET (fd, &read_set);
timeout.tv_sec = usecs / 1000000;
timeout.tv_usec = usecs % 1000000;
/*
* Wait until timeout, data, or a signal. If a signal interrupts
* select, we can just treat it as another timeout.
*/
fd_count = select (fd + 1, &read_set, NULL, NULL, &timeout);
if (fd_count == -1 && errno != EINTR)
{
perror ("select");
abort ();
}
/* Poll the sender on timeouts and on reads; it's just easier. */
mode_libcw_poll_sender ();
}
while (fd_count != 1);
}
/*
* signal_handler()
*
* Signal handler for signals, to clear up on kill.
*/
static void
signal_handler (int signal_number)
{
/* Attempt to wrestle the screen back from curses. */
interface_destroy ();
/* Show the signal caught, and exit. */
fprintf (stderr, _("\nCaught signal %d, exiting...\n"), signal_number);
exit (EXIT_SUCCESS);
}
/*
* main()
*
* Parse the command line, initialize a few things, then enter the main
* program event loop, from which there is no return.
*/
int main(int argc, char **argv)
{
argv0 = program_basename(argv[0]);
/* Set locale and message catalogs. */
i18n_initialize();
/* Parse combined environment and command line arguments. */
int combined_argc;
char **combined_argv;
/* Parse combined environment and command line arguments. */
combine_arguments(_("CWCP_OPTIONS"), argc, argv, &combined_argc, &combined_argv);
config = cw_config_new();
if (!config) {
return -1;
}
config->has_practice_time = 1;
config->has_outfile = 1;
if (!cw_process_argv(argc, argv, all_options, config)) {
fprintf(stderr, _("%s: failed to parse command line args\n"), argv0);
return EXIT_FAILURE;
}
if (!cw_config_is_valid(config)) {
fprintf(stderr, _("%s: inconsistent arguments\n"), argv0);
return EXIT_FAILURE;
}
if (config->input_file) {
if (!dictionary_load(config->input_file)) {
fprintf(stderr, _("%s: %s\n"), argv0, strerror(errno));
fprintf(stderr, _("%s: can't load dictionary from input file %s\n"), argv0, config->input_file);
return EXIT_FAILURE;
}
}
if (config->output_file) {
if (!dictionary_write(config->output_file)) {
fprintf(stderr, _("%s: %s\n"), argv0, strerror(errno));
fprintf(stderr, _("%s: can't save dictionary to output file %s\n"), argv0, config->input_file);
return EXIT_FAILURE;
}
}
if (!cw_generator_new_from_config(config, argv0)) {
fprintf(stderr, "%s: failed to create generator\n", argv0);
return EXIT_FAILURE;
}
timer_set_practice_time(config->practice_time);
int index;
static const int SIGNALS[] = { SIGHUP, SIGINT, SIGQUIT, SIGPIPE, SIGTERM, 0 };
/* Set up signal handlers to clear up and exit on a range of signals. */
for (index = 0; SIGNALS[index] != 0; index++) {
if (!cw_register_signal_handler(SIGNALS[index], signal_handler)) {
fprintf(stderr, _("%s: can't register signal: %s\n"), argv0, strerror(errno));
return EXIT_FAILURE;
}
}
/*
* Build our table of modes from dictionaries, augmented with keyboard
* and any other local modes.
*/
mode_initialize ();
/*
* Initialize the curses user interface, then catch and action every
* keypress we see. Before calling getch, wait until data is available on
* stdin, polling the libcw sender. At 60WPM, a dot is 20ms, so polling
* for the maximum library speed needs a 10ms (10,000usec) timeout.
*/
interface_initialize ();
cw_generator_start();
while (is_running) {
poll_until_keypress_ready(fileno(stdin), 10000);
interface_handle_event(getch());
}
/* Clean up and return. */
interface_destroy();
cw_wait_for_tone_queue();
cw_generator_stop();
/* Reset to ensure that the mixer volume gets restored. */
cw_complete_reset();
cw_generator_delete();
cw_config_delete(&config);
return EXIT_SUCCESS;
}
unixcw-3.0.2/src/cwcp/cwcp.1 0000644 0001750 0001750 00000046416 11702304041 015417 0 ustar acerion acerion .\"
.\" Unixcw CW Tutor Package - cwcp
.\" Copyright (C) 2001-2006 Simon Baldwin (simon_baldwin@yahoo.com)
.\" Copyright (C) 2011-2012 Kamil Ignacak (acerion@wp.pl)
.\"
.\" 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.
.\"
.\"
.TH CWCP 1 "CW Tutor Package" "cwcp ver. 3.0.1" \" -*- nroff -*-
.SH NAME
.\"
cwcp \- curses-based Morse tutor program
.\"
.\"
.\"
.SH SYNOPSIS
.\"
.B cwcp
[\-s\ \-\-system=\fISYSTEM\fP]
[\-d\ \-\-device=\fIDEVICE\fP]
[\-w\ \-\-wpm=\fIWPM\fP]
[\-t\ \-\-tone=\fIHZ\fP]
[\-v\ \-\-volume=\fIPERCENT\fP]
[\-g\ \-\-gap=\fIGAP\fP]
[\-T\ \-\-time=\fITIME\fP]
[\-f, \-\-infile=\fIFILE\fP]
[\-F, \-\-outifile=\fIFILE\fP]
.\"[\-c\ \-\-colours=\fICOLOURSET\fP]
.\".BR
.\"[\-m\ \-\-mono]
.BR
[\-h\ \-\-help]
[\-V\ \-\-version]
.PP
\fBcwcp\fP installed on GNU/Linux systems understands both short form
and long form command line options. \fBcwcp\fP installed on other
operating systems may understand only the short form options.
.PP
There are no mandatory options.
.PP
Options may be predefined in the environment variable \fBCWCP_OPTIONS\fP.
If defined, these options are used first; command line options take
precedence.
.PP
.\"
.\"
.\"
.SH DESCRIPTION
.\"
.PP
\fBcwcp\fP is a curses-based interactive Morse code tutor program.
It allows menu selection from a number of sending modes, and also permits
character sounding options, such as the tone pitch, and sending
speed, to be varied from the keyboard using a full-screen user
interface.
.PP
.\"
.\"
.\"
.SS COMMAND LINE OPTIONS
.\"
.B cwcp
understands the following command line options. The long form options
may not be available in non-LINUX versions.
.TP
.I "\-s, \-\-system=SYSTEM"
Specifies the way that \fBcwcp\fP generates tones. Valid values
are:
\fIconsole\fP for tones through the console speaker,
\fIalsa\fP for tones generated through the system sound card using ALSA
sound system,
\fIoss\fP for tones generated through system sound card using OSS sound
system,
\fIsoundcard\fP for tones generated through the system sound card, but
without explicit selection of sound system. These values can be
shortened to 'c', 'a', 'o', or 's', respectively. The default value
is 'oss'.
.TP
.I "\-d, \-\-device=DEVICE"
Specifies the device file to open for generating a sound.
\fBcwcp\fP will use default device if none is specified. The default
devices are:
\fI/dev/console\fP for sound produced through console,
\fIdefault\fP for ALSA sound system,
\fI/dev/audio\fP for OSS sound system.
See also \fINOTES ON USING A SOUND CARD\fP below.
.TP
.I "\-w, \-\-wpm=WPM"
Sets the initial sending speed in words per minute. The value must be
between 4 and 60. The default value is 12 WPM.
.TP
.I "\-t, \-\-tone=HZ"
Sets the initial sounder pitch in Hz. This value must be between 0
and 4,000. A value of 0 selects silent operation, and can be used for
timing checks or other testing. The default value is 800Hz,
.TP
.I "\-v, \-\-volume=PERCENT"
Sets the initial sending volume, as a percentage of full scale volume.
The value must be between 0 and 100. The default value is 70 %.
Sound volumes work fully for sound card tones, but \fBcwcp\fP cannot
control the volume of tones from the console speaker. In this case,
a volume of zero is silent, and all other volume values are simply sounded.
.TP
.I "\-g, \-\-gap=GAP"
Sets the initial extra gap, in dot lengths, between characters
(the 'Farnsworth' delay). It must be between 0 and 60. The default
is 0.
.TP
.I "\-T, \-\-time=TIME"
Sets the initial practice time, in minutes. \fBcwcp\fP stops after
generating random Morse code for this period. The value must be
between 1 and 99. The default is 15 minutes.
.TP
.I "\-f, \-\-infile=FILE"
Specifies a text file that \fBcwcp\fP can read to configure its practice
text. See \fICREATING CONFIGURATION FILES\fP below.
.TP
.I "\-F, \-\-outfile=FILE"
Specifies a text file to which \fBcwcp\fP should write its current practice
text.
.\".TP
.\".I "\-c, \-\-colours, \-\-colors"
.\"This option specifies an initial colour set for \fBcwcp\fP. The colour
.\"set is specified as four integers, in the range 0 to 7, separated by
.\".\"commas. These integers set the display foregrounds, the display
.\"backgrounds, the box foregrounds, and the box backgrounds. The
.\"available colours are, in order, black, red, green, yellow, blue,
.\"magenta, cyan, and white. The default colour set is "7,4,7,0".
.\"If \fI\-m\fP or \fI\-\-mono\fP is given, this option is ignored.
.\".TP
.\".I "\-m, \-\-mono"
.\"This option tells \fBcwcp\fP not to attempt to produce a colour
.\"display. Where colours are not possible, or monochrome
.\"requested, \fBcwcp\fP will use reverse video within its windows to
.\"create its interface. If this option is given, any \fI\-c\fP
.\"or \fI\-\-colours\fP is ignored.
.TP
.I "\-h, \-\-help"
Prints short help message.
.TP
.I "\-V, \-\-version"
Prints information about program's version, authors and license.
.PP
.\"
.\"
.\"
.SS USER INTERFACE
.\"
\fBcwcp\fP is a curses-based program that takes over the complete
operation of the terminal on which it is run. If colours are available
on the terminal, it will produce a colour interface.
.PP
The \fBcwcp\fP screen is divided into several distinct areas:
.TP
.I "The Menu Selection window"
The Menu Selection window shows the main modes that \fBcwcp\fP
offers. Use the \fIF10\fP and \fIF11\fP or \fIKEY_DOWN\fP and \fIKEY_UP\fP
keys to select the mode. \fIF9\fP or \fIReturn\fP start sending,
and \fIF9\fP again or \fIEsc\fP stop sending. Changing mode also
stops sending.
.TP
.I "The Morse Code Display window"
This window displays each Morse code character after it has been sent.
.TP
.I "The Speed Control window"
The Speed window shows the current Morse code sending speed in words per
minute. Pressing the \fIF2\fP or \fIKEY_RIGHT\fP keys increases the speed;
pressing the \fIF1\fP or \fIKEY_LEFT\fP keys decreases the speed.
.TP
.I "The Tone Control window"
This window shows the current Morse code tone pitch. Use the \fIF4\fP
or \fIKEY_HOME\fP key to increase the pitch, and the \fIF3\fP
or \fIKEY_END\fP key to decrease it. Values change in steps of 20Hz.
.TP
.I "The Volume Control window"
This window shows the current Morse code volume. Use the \fIF6\fP
key to increase the volume, and the \fIF5\fP key to decrease it.
Values change in steps of 1%. Note that \fBcwcp\fP cannot control
the volume of the console speaker, so the volume control only works
effectively for tones generated on the sound card.
.TP
.I "The Gap Control window"
This window shows the current additional 'Farnsworth' gaps to be
appended after each Morse code character is sounded. Use \fIF8\fP
to increase the gap, and \fIF7\fP to decrease it.
.TP
.I "The Time Control window"
This window shows the selected practice time. After generating Morse
code in a particular mode for this amount of time, \fBcwcp\fP stops
automatically. Use \fIKEY_NPAGE\fP to increase the time,
and \fIKEY_PPAGE\fP to decrease it. During sending, the value in this
window counts down to one, and after final minute of sending has
elapsed, \fBcwcp\fP stops sending. The timer operates like a microwave
or kitchen timer; it counts down on its own, but the time remaining can
also be altered manually while the timer operates.
.PP
The following keys vary the screen colours:
.TP
.I "{ key"
Changes the foreground colour of the window boxes.
.TP
.I "} key"
Changes the background colour of the window boxes.
.TP
.I "[ key"
Changes the foreground colour of the window contents.
.TP
.I "] key"
Changes the background colour of the window contents.
.PP
Eight screen colours are available for each: black, red, green,
yellow, blue, magenta, cyan, and white. Use a key to cycle round
these colours for the particular part of the display controlled by
that key. On a change of colours, the complete screen is repainted.
.PP
Use \fICtrl\-L\fP to repaint the complete screen, in case of screen
corruption. Use \fICtrl\-V\fP to clear the Morse Code Display Window.
This command is available only when \fBcwcp\fP is not sending.
.PP
To leave \fBcwcp\fP, press \fIF12\fP or \fICtrl-C\fP, or select \fIExit\fP
on the mode menu.
.PP
All of the above command keys may be used while random characters are
being sent, and when keyboard input is being sent.
.PP
If function keys are not available on the terminal, \fICtrl-\fP
combinations can be used. On the top row of letter keys on the
keyboard, the keys \fICtrl-Q\fP to \fICtrl-I\fP may be used as
alternatives for \fIF1\fP to \fIF8\fP, and on the second row of
letter keys, \fICtrl-A\fP to \fICtrl-F\fP as alternatives for \fIF9\fP
to \fIF12\fP. For \fIKEY_PPAGE\fP and \fIKEY_NPAGE\fP, use \fICtrl-O\fP
and \fICtrl-P\fP.
.PP
.\"
.\"
.\"
.SS RANDOM CHARACTERS AND WORDS
.\"
.B cwcp
sends random characters in groups of five, with a space between each
group. After a period of sending, set in
the \fITime Control window\fP, \fBcwcp\fP stops automatically. It can
also be stopped manually, before this time period expires.
.PP
When sending random words, \fBcwcp\fP sends the complete word, followed
by a space. Because short words are easier to copy without writing,
\fBcwcp\fP's default dictionary contains only three, four, and five-letter
words in its random words list.
.PP
.B cwcp
chooses at random from a list of around 3000 words in its default
dictionary. You can change this text using a configuration file, read
at startup. See \fICREATING CONFIGURATION FILES\fP below.
.PP
.\"
.\"
.\"
.SS NOTES ON USING A SOUND CARD
.\"
By default, \fBcwcp\fP tries to open OSS device "/dev/audio" to access
the system sound card. This is generally the correct device to use,
but for systems with special requirements, or those with multiple sound
cards, the option \fI-d\fP or \fI\-\-device\fP, combined with
\fI-s\fP or \fI\-\-system\fP can be used to specify the device
and audio system for sound card access. If the sound card device
cannot be set up, \fBcwcp\fP prints the error message
.IP
cannot set up soundcard sound
.PP
and exits.
.PP
Sound card devices, when opened through OSS sound system, are usually
single-access devices, so that when one process has opened the device,
other processes are prevented from using it. In such cases \fBcwcp\fP
will of course conflict with any other programs that expect exclusive
use of the system sound card (for example, MP3 players).
If \fBcwcp\fP finds that the sound card is already busy, it prints the
error message
.IP
open /dev/audio: Device or resource busy
.PP
and exits.
.PP
.\" The main sound card device will often allow \fBcwcp\fP to control tone
.\" volumes directly, but where this is not possible, \fBcwcp\fP uses the
.\" mixer device instead. By default, this is "/dev/mixer", but the device
.\" can be specified with the \fI-y\fP or \fI\-\-mdevice\fP options. In
.\" general, as with the main sound card device, the default mixer device
.\" is usually the correct one to use.
.\" .PP
.\" The mixer device is only used if the sound card does not allow volume
.\" control through the main sound card device.
.PP
The sound card device is not used if \fBcwcp\fP is only sending tones on
the console speaker.
.PP
.\"
.\"
.\"
.SS AUDIO OUTPUT \- DEFAULTS AND SELECTION
.\"
\fBcwcp\fP first tries to access sound card using OSS audio system
and default OSS audio device name ('/dev/audio'), unless user
specifies other audio device with option \fI-d\fP or \fI\-\-device\fP.
.PP
If opening soundcard through OSS fails, \fBcwcp\fP tries to access
the sound card using ALSA audio system, and default ALSA audio device
name ('default'), unless user specifies other audio device with option
\fI-d\fP or \fI\-\-device\fP.
.PP
If opening soundcard through ALSA also fails, \fBcwcp\fP tries to access
system console buzzer using default buzzer device '/dev/console',
unless user specifies other audio device with option \fI-d\fP or
\fI\-\-device\fP.
.PP
It is very common that in order to access the console buzzer device
user has to have root privileges. For that reason trying to open
console buzzer almost always fails. This is not a program's bug,
this is a result of operating system's restrictions.
Making \fBcwcp\fP an suid binary bypasses this restriction. The program
does not fork() or exec(), so making it suid should be relatively safe.
Note however that this practice is discouraged for security reasons.
.PP
As stated, user can tell \fBcwcp\fP which device to use, using
\fI-d\fP or \fI\-\-device\fP option. Which device files are suitable
will depend on which operating system is running, which system
user ID runs \fBcwcp\fP, and which user groups user belongs to.
.PP
.\"
.\"
.\"
.SS CREATING CONFIGURATION FILES
.\"
\fBcwcp\fP contains a default set of modes and practice text that should
be enough to begin with. It can however read in a file at startup that
reconfigures these to provide different character groupings, word sets,
and other practice data.
.PP
To read a configuration file, use the \fI-f\fP or \fI\-\-infile\fP command
line options. The file should introduce each \fBcwcp\fP mode with a
section header in '[' ... ']' characters, followed by the practice text
for that mode, with elements separated by whitespace. Lines starting with
a semicolon or hash are treated as comments. For example
.IP
; Simple example mode
.br
[ A to Z ]
.br
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
.PP
.B cwcp
will generate five character groups for modes whose elements are all single
characters, and treat other modes as having elements that are complete words.
As a starting point for customized modes, \fBcwcp\fP will write its default
configuration to a file if given the undocumented \fI-#\fP option, for
example "cwcp -# /tmp/cwcp.ini".
.\"
.\"
.\"
.SH NOTES
.\"
.B cwcp
owes its existence to the DOS Morse code tutor CP222C.EXE, by VU2ZAP.
CP222C.EXE seemed to offer the right range of facilities for learning
Morse code in a simple, easy-to-use, and compact package. \fBcwcp\fP
is very much modeled on that DOS program, and should prove useful
both for learning the code, and for experienced CW users who want, or
need, to improve their receiving speed.
.PP
Curses may impose a delay when recognizing the \fIEsc\fP key alone, as
this character is often the first of a sequence generated by a
function key. \fBcwcp\fP responds instantly to \fIF9\fP.
.PP
The characters echoed in the Morse Code Display window may be ASCII
representations of Morse procedural signals; see the \fBcw\fP(7,LOCAL)
man page for details.
.PP
.\"
.\"
.\"
.SS HINTS ON LEARNING MORSE CODE
.\"
Here are a few hints and tips that may help with the process of
learning Morse code.
.PP
Firstly, do \fBNOT\fP think of the elements as dots and dashes. Instead,
think of them as dits and dahs (so 'A' is di-dah). If you think of
them in this way, the process of translating sound into characters
will be learned much more easily.
.PP
Do not learn the characters from a table. Learn them by watching the
groups appear on the screen, and listening to the sounds produced as
each is sent. In the very initial stages, it may be beneficial if you
can find a person to take you through the first stages of recognizing
characters.
.PP
Do not waste your time learning Morse code at 5 WPM. Set the speed to
12 or 15 WPM, but use extra spacing (the Gap window) to reduce the
effective speed to much lower - around four or five WPM \fIeffective\fP
speed. This way, you will learn the rhythm of the characters as they
are sent, but still have plenty of time between characters. As you
practice, decrease the gap to zero.
.PP
Learn in stages. Start by learning the \fIEISH5\fP group, then progress
down through the menu as each group is mastered. The groups contain
characters which are in some way related, either by sound, or by type
of character.
.PP
.\" \[u0022] = ", otherwise emacs syntax highlighting is messed up;
Once you have completed all the groups \fIEISH5\fP to \fI\[u0022]'$(+:_\fP
(or \fI23789\fP if you do not want to learn procedural signals yet),
use the full character set options, and the words and CW words
options, to sharpen your skill. If you have difficulties with
particular characters, return to that group and practice again with a
smaller character set.
.PP
Resist the temptation to try to learn or improve your speed by copying
off-air. You will not know what speed you are working at, and much
hand-sent Morse is not perfectly formed. What you can gain off-air
though is a general 'resilience', a tolerance for Morse code where
the timing of individual elements, or spacing between characters and
words, is not 100% accurate.
.PP
If working to attain a particular speed for a test, always set the
speed slightly higher. For example, if aiming for 12 WPM, set the
tutor speed to 14 or 15 WPM. This way, when you drop back to 12 WPM
you will feel much more relaxed about copying. Be aware that \fBcwcp\fP
is not necessarily going to send at exactly the speed you set, due
to limitations in what can be done with UNIX timers. It often sends
at a slower speed than you set, so be very careful with this if you
have a target speed that you need to reach.
.PP
Use the program to make cassette tapes that you can take with you in a
walkman or in the car, for long journeys. You do not have to write
down everything you hear to practice Morse code. Simply listening to
the shapes of characters over a period will help to train your brain
into effortless recognition. In fact, slavishly writing everything
down becomes a barrier at speeds of 15-20 WPM and above, so if you can
begin to copy without writing each character down, you will find
progress much easier above these speeds. But do not over-use these
tapes, otherwise you will quickly memorize them. Re-record them with
new contents at very regular intervals.
.PP
Try to spend at least 15-30 minutes each day practicing. Much less
than this will make progress glacially slow. But significantly more
than an hour or so may just result in you becoming tired, but not
improving. Recognize when it is time to stop for the day.
.PP
Do not worry if you reach a speed 'plateau'. This is common, and you
will soon pass it with a little perseverance.
.PP
At higher speeds, CW operators tend to recognize the 'shape' of whole
words, rather than the individual characters within the words. The CW
words menu option can be used to help to practice and develop this
skill.
.PP
.\"
.\"
.\"
.SH ERRORS AND OMISSIONS
.\"
The calibration option is a bit ropy. It simply sends PARIS
repeatedly, and relies on you to time the sending and then work out if
any adjustment to the speed is really necessary. Automatic
calibration by making measurements over a given period would be a lot
better.
.PP
Generating random CW QSOs would be fun to do.
.PP
A facility to allow a user to key Morse into the system, and to have
it send code, and measure the accuracy of keying, would be nice.
.PP
.\"
.\"
.\"
.SH SEE ALSO
.\"
Man pages for \fBcw\fP(7,LOCAL), \fBlibcw\fP(3,LOCAL), \fBcw\fP(1,LOCAL),
\fBcwgen\fP(1,LOCAL), and \fBxcwcp\fP(1,LOCAL).
.\"
unixcw-3.0.2/src/cwutils/ 0000755 0001750 0001750 00000000000 11702312014 015123 5 ustar acerion acerion unixcw-3.0.2/src/cwutils/Makefile 0000644 0001750 0001750 00000002713 11702277527 016611 0 ustar acerion acerion # Copyright (C) 2001-2006 Simon Baldwin (simon_baldwin@yahoo.com)
# Copyright (C) 2011-2012 Kamil Ignacak (acerion@wp.pl)
#
# 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.
#
include ../../Makefile.inc
CC = $(AC_CC)
CFLAGS = $(AC_CFLAGS) $(AC_DEFS) -I../libcw
SHELL = /bin/sh
default: all
# Build everything.
all: cmdline.o dictionary.o i18n.o memory.o cw_common.o
cw_common.o: cw_common.c cw_common.h
cmdline.o: cmdline.c cmdline.h
dictionary.o: dictionary.c dictionary.h cwwords.h
i18n.o: i18n.c i18n.h
memory.o: memory.c memory.h
# Cleanup targets.
clean:
rm -f *.s *.o
distclean: clean
rm -f Makefile.port
mostlyclean: clean
maintainer-clean: distclean
# Test targets; no self-test, but make sure all is built.
check: all
# Unimplemented targets.
install:
install-strip:
uninstall:
TAGS:
info:
dvi:
dist:
unixcw-3.0.2/src/cwutils/dictionary.c 0000644 0001750 0001750 00000037036 11702277412 017461 0 ustar acerion acerion /*
* Copyright (C) 2001-2006 Simon Baldwin (simon_baldwin@yahoo.com)
* Copyright (C) 2011-2012 Kamil Ignacak (acerion@wp.pl)
*
* 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.
*/
#include "../config.h"
#include
#include
#include
#include
#include
#if defined(HAVE_STRING_H)
# include
#endif
#if defined(HAVE_STRINGS_H)
# include
#endif
#include "libcw.h"
#include "dictionary.h"
#include "cwwords.h"
#include "memory.h"
#include "i18n.h"
/*---------------------------------------------------------------------*/
/* Dictionary data */
/*---------------------------------------------------------------------*/
enum { FALSE = 0, TRUE = !FALSE };
enum { MAX_LINE = 8192 };
/* Aggregate dictionary data into a structure. */
struct dictionary_s
{
const char *description; /* Dictionary description */
const char *const *wordlist; /* Dictionary word list */
int wordlist_length; /* Length of word list */
int group_size; /* Size of a group */
void *mutable_description; /* Freeable (aliased) description string */
void *mutable_wordlist; /* Freeable (aliased) word list */
void *mutable_wordlist_data; /* Freeable bulk word list data */
dictionary *next; /* List pointer */
};
/* Current loaded dictionaries list head. */
static dictionary *dictionaries_head = NULL;
/*---------------------------------------------------------------------*/
/* Dictionary implementation */
/*---------------------------------------------------------------------*/
/*
* dictionary_new()
* dictionary_new_const()
* dictionary_new_mutable()
*
* Create a new dictionary, and add to any list tail passed in, returning
* the entry created (the new list tail). The main function adds the data,
* plus any mutable pointers that need to be freed on destroying the
* dictionary. The const and mutable variants are convenience interfaces.
*/
static dictionary *
dictionary_new (dictionary *tail,
const char *description, const char *const wordlist[],
void *mutable_description, void *mutable_wordlist,
void *mutable_wordlist_data)
{
dictionary *dict;
int words, is_multicharacter, word;
/* Count words in the wordlist, and look for multicharacter entries. */
words = 0;
is_multicharacter = FALSE;
for (word = 0; wordlist[word]; word++)
{
is_multicharacter |= strlen (wordlist[word]) > 1;
words++;
}
/*
* Create a new dictionary and fill in the main fields. Group size is
* set to one for multicharacter word lists, five otherwise.
*/
dict = safe_malloc (sizeof (*dict));
dict->description = description;
dict->wordlist = wordlist;
dict->wordlist_length = words;
dict->group_size = is_multicharacter ? 1 : 5;
dict->next = NULL;
/* Add mutable pointers passed in. */
dict->mutable_description = mutable_description;
dict->mutable_wordlist = mutable_wordlist;
dict->mutable_wordlist_data = mutable_wordlist_data;
/* Add to the list tail passed in, if any. */
if (tail)
tail->next = dict;
return dict;
}
static dictionary *
dictionary_new_const (dictionary *tail,
const char *description, const char *const wordlist[])
{
return dictionary_new (tail, description, wordlist, NULL, NULL, NULL);
}
static dictionary *
dictionary_new_mutable (dictionary *tail,
char *description, const char *wordlist[],
void *wordlist_data)
{
return dictionary_new (tail, description, wordlist,
description, wordlist, wordlist_data);
}
/*
* dictionary_unload()
*
* Free any allocations from the current dictionary, and return to the
* initial state.
*/
void
dictionary_unload (void)
{
dictionary *entry, *next;
/* Free each dictionary in the list. */
for (entry = dictionaries_head; entry; entry = next)
{
next = entry->next;
/* Free allocations held in the dictionary. */
free (entry->mutable_wordlist);
free (entry->mutable_description);
free (entry->mutable_wordlist_data);
/* Free the dictionary itself. */
free (entry);
}
dictionaries_head = NULL;
}
/*
* dictionary_getline()
*
* Helper function for dictionary_load(). Returns the next file line (or
* FALSE if no more lines), stripped of any trailing nl/cr.
*/
static int
dictionary_getline (FILE *stream, char *buffer, int length, int *line_number)
{
if (!feof (stream) && fgets (buffer, length, stream))
{
int bytes;
bytes = strlen (buffer);
while (bytes > 0 && strchr ("\r\n", buffer[bytes - 1]))
buffer[--bytes] = '\0';
*line_number += 1;
return TRUE;
}
return FALSE;
}
/*
* dictionary_is_parse_comment()
* dictionary_is_parse_section()
*
* Parse helpers, categorize lines and return allocated fields if matched.
*/
static int
dictionary_is_parse_comment (const char *line)
{
size_t index;
index = strspn (line, " \t");
return index == strlen (line) || strchr (";#", line[0]);
}
static int
dictionary_is_parse_section (const char *line, char **name_ptr)
{
char *name, dummy;
int count;
name = safe_malloc (strlen (line) + 1);
count = sscanf (line, " [ %[^]] ] %c", name, &dummy);
if (count == 1)
{
*name_ptr = safe_realloc (name, strlen (name) + 1);
return TRUE;
}
free (name);
return FALSE;
}
/*
* dictionary_build_wordlist()
*
* Build and return a wordlist from a string of space-separated words. The
* wordlist_data is changed by this function.
*/
static const char **
dictionary_build_wordlist (char *wordlist_data)
{
const char **wordlist, *word;
int size, allocation;
/* Split contents into a wordlist, and store each word retrieved. */
size = allocation = 0;
wordlist = NULL;
for (word = strtok (wordlist_data, " \t"); word; word = strtok (NULL, " \t"))
{
if (size == allocation)
{
allocation = allocation == 0 ? 1 : allocation << 1;
wordlist = safe_realloc (wordlist, sizeof (*wordlist) * allocation);
}
wordlist[size++] = word;
}
/* Add a null sentinel. */
if (size == allocation)
{
allocation++;
wordlist = safe_realloc (wordlist, sizeof (*wordlist) * allocation);
}
wordlist[size++] = NULL;
return wordlist;
}
/*
* dictionary_trim()
*
* Helper functions for dictionary_load(). Trims a line of all leading and
* trailing whitespace.
*/
static void
dictionary_trim (char *buffer)
{
int bytes, index;
bytes = strlen (buffer);
while (bytes > 0 && isspace (buffer[bytes - 1]))
buffer[--bytes] = '\0';
index = strspn (buffer, " \t");
if (index > 0)
memmove (buffer, buffer + index, bytes - index + 1);
}
/*
* dictionary_check_line()
*
* Check a line for unsendable characters. Returns an allocated string with
* '^' in error positions, and spaces otherwise, or NULL if no unsendable
* characters.
*/
static char *
dictionary_check_line (const char *line)
{
char *errors;
int count, index;
/* Allocate a string, and set a '^' marker for any unsendable characters. */
errors = safe_malloc (strlen (line) + 1);
count = 0;
for (index = 0; line[index] != '\0'; index++)
{
errors[index] = cw_check_character (line[index]) ? ' ' : '^';
if (errors[index] == '^')
count++;
}
errors[index] = '\0';
/* If not all sendable, return the string, otherwise return NULL. */
if (count > 0)
return errors;
free (errors);
return NULL;
}
/*
* dictionary_create_from_stream()
*
* Create a dictionary list from a stream. Returns the list head on success,
* NULL if loading fails. The file format is expected to be ini-style.
*/
static dictionary *
dictionary_create_from_stream (FILE *stream, const char *file)
{
int line_number;
char *line, *name, *content;
const char **wordlist;
dictionary *head, *tail;
/* Clear the variables used to accumulate stream data. */
line = safe_malloc (MAX_LINE);
line_number = 0;
name = content = NULL;
head = tail = NULL;
/* Parse input lines to create a new dictionary. */
while (dictionary_getline (stream, line, MAX_LINE, &line_number))
{
char *new_name;
if (dictionary_is_parse_comment (line))
continue;
else if (dictionary_is_parse_section (line, &new_name))
{
/*
* New section, so handle data accumulated so far. Or if no data
* accumulated, forget it.
*/
if (content)
{
wordlist = dictionary_build_wordlist (content);
tail = dictionary_new_mutable (tail, name, wordlist, content);
head = head ? head : tail;
}
else
free (name);
/* Start new accumulation of words. */
dictionary_trim (new_name);
name = new_name;
content = NULL;
}
else if (name)
{
char *errors;
/* Check the line for unsendable characters. */
errors = dictionary_check_line (line);
if (errors)
{
fprintf (stderr, "%s:%d: unsendable character found:\n",
file, line_number);
fprintf (stderr, "%s\n%s\n", line, errors);
free (errors);
}
/* Accumulate this line into the current content. */
dictionary_trim (line);
if (content)
{
content = safe_realloc (content,
strlen (content) + strlen (line) + 2);
strcat (content, " ");
strcat (content, line);
}
else
{
content = safe_malloc (strlen (line) + 1);
strcpy (content, line);
}
}
else
fprintf (stderr, "%s:%d: unrecognized line, expected [section]"
" or commentary\n", file, line_number);
}
/* Handle any final accumulated data. */
if (content)
{
wordlist = dictionary_build_wordlist (content);
tail = dictionary_new_mutable (tail, name, wordlist, content);
head = head ? head : tail;
}
if (!head)
fprintf (stderr, "%s:%d: no usable dictionary data found in"
" the file\n", file, line_number);
free (line);
return head;
}
/*
* dictionary_create_default()
*
* Create a dictionary list from internal data. Returns the list head.
*/
static dictionary *
dictionary_create_default (void)
{
dictionary *head, *tail;
head = dictionary_new_const (NULL, _("Letter Groups"), CW_ALPHABETIC);
tail = dictionary_new_const (head, _("Number Groups"), CW_NUMERIC);
tail = dictionary_new_const (tail, _("Alphanum Groups"), CW_ALPHANUMERIC);
tail = dictionary_new_const (tail, _("All Char Groups"), CW_ALL_CHARACTERS);
tail = dictionary_new_const (tail, _("English Words"), CW_SHORT_WORDS);
tail = dictionary_new_const (tail, _("CW Words"), CW_CW_WORDS);
tail = dictionary_new_const (tail, _("PARIS Calibrate"), CW_PARIS);
tail = dictionary_new_const (tail, _("EISH5 Groups"), CW_EISH5);
tail = dictionary_new_const (tail, _("TMO0 Groups"), CW_TMO0);
tail = dictionary_new_const (tail, _("AUV4 Groups"), CW_AUV4);
tail = dictionary_new_const (tail, _("NDB6 Groups"), CW_NDB6);
tail = dictionary_new_const (tail, _("KX=-RP Groups"), CW_KXffRP);
tail = dictionary_new_const (tail, _("FLYQC Groups"), CW_FLYQC);
tail = dictionary_new_const (tail, _("WJ1GZ Groups"), CW_WJ1GZ);
tail = dictionary_new_const (tail, _("23789 Groups"), CW_23789);
tail = dictionary_new_const (tail, _(",?.;)/ Groups"), CW_FIGURES_1);
tail = dictionary_new_const (tail, _("\"'$(+:_ Groups"), CW_FIGURES_2);
return head;
}
/*
* dictionary_load()
*
* Set the main dictionary list to data read from a file. Returns TRUE on
* success, FALSE if loading fails.
*/
int
dictionary_load (const char *file)
{
FILE *stream;
dictionary *head;
/* Open the input stream, or fail if unopenable. */
stream = fopen (file, "r");
if (!stream)
{
fprintf (stderr, "%s: open error: %s\n", file, strerror (errno));
return FALSE;
}
/*
* If we can generate a dictionary list, free any currently allocated one
* and store the details of what we loaded into module variables.
*/
head = dictionary_create_from_stream (stream, file);
if (head)
{
dictionary_unload ();
dictionaries_head = head;
}
/* Close stream and return TRUE if we loaded a dictionary. */
fclose (stream);
return head != NULL;
}
/*
* dictionary_iterate()
*
* Iterate known dictionaries. Returns the first if dictionary is NULL,
* otherwise the next, or NULL if no more.
*
* Because this is the only way dictionaries can be accessed by callers,
* this function sets up a default dictionary list if none loaded.
*/
const dictionary *
dictionary_iterate (const dictionary *current)
{
/* If no dictionary list has been loaded, supply a default one. */
if (!dictionaries_head)
dictionaries_head = dictionary_create_default ();
return current ? current->next : dictionaries_head;
}
/*
* dictionary_write()
*
* Write the currently loaded (or default) dictionary out to a given file.
* Returns TRUE on success, FALSE if write fails.
*/
int
dictionary_write (const char *file)
{
FILE *stream;
const dictionary *dict;
/* Open the output stream, or fail if unopenable. */
stream = fopen (file, "w");
if (!stream)
return FALSE;
/*
* If no dictionary list has been loaded, supply a default one, then
* print details of each.
*/
if (!dictionaries_head)
dictionaries_head = dictionary_create_default ();
for (dict = dictionaries_head; dict; dict = dict->next)
{
int index, chars;
fprintf (stream, "[ %s ]\n\n", dict->description);
chars = 0;
for (index = 0; index < dict->wordlist_length; index++)
{
fprintf (stream, " %s", dict->wordlist[index]);
chars += strlen (dict->wordlist[index]) + 1;
if (chars > 72)
{
fprintf (stream, "\n");
chars = 0;
}
}
fprintf (stream, chars > 0 ? "\n\n" : "\n");
}
fclose (stream);
return TRUE;
}
/*
* get_dictionary_description()
* get_dictionary_group_size()
*
* Return the text description and group size for a given dictionary.
*/
const char *
get_dictionary_description (const dictionary *dict)
{
return dict->description;
}
int get_dictionary_group_size (const dictionary *dict)
{
return dict->group_size;
}
/*
* get_dictionary_random_word()
*
* Return a random word from the given dictionary.
*/
const char *
get_dictionary_random_word (const dictionary *dict)
{
static int is_initialized = FALSE;
/* On the first call, seed the random number generator. */
if (!is_initialized)
{
srand (time (NULL));
is_initialized = TRUE;
}
return dict->wordlist[rand () % dict->wordlist_length];
}
unixcw-3.0.2/src/cwutils/i18n.h 0000644 0001750 0001750 00000002426 11702277372 016100 0 ustar acerion acerion /*
* Copyright (C) 2001-2006 Simon Baldwin (simon_baldwin@yahoo.com)
* Copyright (C) 2011-2012 Kamil Ignacak (acerion@wp.pl)
*
* 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.
*/
#ifndef _CWI18N_H
#define _CWI18N_H
#if defined(HAVE_LIBINTL_H)
# include
# define _(STR) i18n_gettext (STR)
# define gettext_noop(STR) (STR)
# define N_(STR) gettext_noop (STR)
#else
# define _(STR) (STR)
# define N_(STR) (STR)
#endif
#if defined(__cplusplus)
extern "C" {
#endif
extern void i18n_initialize (void);
extern const char *i18n_gettext (const char *msgid);
#if defined(__cplusplus)
}
#endif
#endif /* _CWI18N_H */
unixcw-3.0.2/src/cwutils/cmdline.c 0000644 0001750 0001750 00000040540 11702277517 016727 0 ustar acerion acerion /*
* Copyright (C) 2001-2006 Simon Baldwin (simon_baldwin@yahoo.com)
* Copyright (C) 2011-2012 Kamil Ignacak (acerion@wp.pl)
*
* 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.
*/
#include "../config.h"
#include
#include
#include
#if defined(HAVE_STRING_H)
# include
#endif
#if defined(HAVE_STRINGS_H)
# include
#endif
#if defined(HAVE_GETOPT_H)
# include
#endif
#include "libcw.h"
#include "cmdline.h"
#include "i18n.h"
#include "memory.h"
#include "copyright.h"
static int cw_process_option(int opt, const char *optarg, cw_config_t *config, const char *argv0);
static void cw_print_usage(const char *argv0);
/*---------------------------------------------------------------------*/
/* Command line helpers */
/*---------------------------------------------------------------------*/
/*
* program_basename()
*
* Return the program's base name from the given argv[0].
*/
const char *
program_basename (const char *argv0)
{
const char *base;
base = strrchr (argv0, '/');
return base ? base + 1 : argv0;
}
/*
* combine_arguments()
*
* Build a new argc and argv by combining command line and environment
* options.
*
* The new values are held in the heap, and the malloc'ed addresses are not
* retained, so do not call this function repeatedly, otherwise it will leak
* memory.
*/
void
combine_arguments (const char *env_variable,
int argc, char *const argv[],
int *new_argc, char **new_argv[])
{
int local_argc;
char **local_argv, *env_options;
int arg;
/* Begin with argv[0], which stays in place. */
local_argv = safe_malloc (sizeof (*local_argv));
local_argc = 0;
local_argv[local_argc++] = argv[0];
/* If options are given in an environment variable, add these next. */
env_options = getenv (env_variable);
if (env_options)
{
char *options, *option;
options = safe_strdup (env_options);
for (option = strtok (options, " \t"); option;
option = strtok (NULL, " \t"))
{
local_argv = safe_realloc (local_argv,
sizeof (*local_argv) * (local_argc + 1));
local_argv[local_argc++] = option;
}
}
/* Append the options given on the command line itself. */
for (arg = 1; arg < argc; arg++)
{
local_argv = safe_realloc (local_argv,
sizeof (*local_argv) * (local_argc + 1));
local_argv[local_argc++] = argv[arg];
}
/* Return the constructed argc/argv. */
*new_argc = local_argc;
*new_argv = local_argv;
}
/*---------------------------------------------------------------------*/
/* Option handling helpers */
/*---------------------------------------------------------------------*/
/**
\brief Check if target system supports long options
\return true the system supports long options,
\return false otherwise
*/
bool has_longopts(void)
{
#if defined(HAVE_GETOPT_LONG)
return true;
#else
return false;
#endif
}
/*
* get_option()
*
* Adapter wrapper round getopt() and getopt_long(). Descriptor strings are
* comma-separated groups of elements of the form "c[:]|longopt", giving the
* short form option ('c'), ':' if it requires an argument, and the long form
* option.
*/
int
get_option (int argc, char *const argv[],
const char *descriptor,
int *option, char **argument)
{
static char *option_string = NULL; /* Standard getopt() string */
#if defined(HAVE_GETOPT_LONG)
static struct option *long_options = NULL; /* getopt_long() structure */
static char **long_names = NULL; /* Allocated names array */
static int long_count = 0; /* Entries in long_options */
#endif
int opt;
/*
* If this is the first call, build a new option_string and a matching
* set of long options.
*/
if (!option_string)
{
char *options, *element;
/* Begin with an empty short options string. */
option_string = safe_strdup ("");
/* Break the descriptor into comma-separated elements. */
options = safe_strdup (descriptor);
for (element = strtok (options, ","); element;
element = strtok (NULL, ","))
{
int needs_arg;
/* Determine if this option requires an argument. */
needs_arg = element[1] == ':';
/*
* Append the short option character, and ':' if present, to the
* short options string. For simplicity in reallocating, assume
* that the ':' is always there.
*/
option_string = safe_realloc (option_string,
strlen (option_string) + 3);
strncat (option_string, element, needs_arg ? 2 : 1);
#if defined(HAVE_GETOPT_LONG)
/*
* Take a copy of the long name and add it to a retained array.
* Because struct option makes name a const char*, we can't just
* store it in there and then free later.
*/
long_names = safe_realloc (long_names,
sizeof (*long_names) * (long_count + 1));
long_names[long_count] = safe_strdup (element + (needs_arg ? 3 : 2));
/* Add a new entry to the long options array. */
long_options = safe_realloc (long_options,
sizeof (*long_options) * (long_count + 2));
long_options[long_count].name = long_names[long_count];
long_options[long_count].has_arg = needs_arg;
long_options[long_count].flag = NULL;
long_options[long_count].val = element[0];
long_count++;
/* Set the end sentry to all zeroes. */
memset (long_options + long_count, 0, sizeof (*long_options));
#endif
}
free (options);
}
/* Call the appropriate getopt function to get the first/next option. */
#if defined(HAVE_GETOPT_LONG)
opt = getopt_long (argc, argv, option_string, long_options, NULL);
#else
opt = getopt (argc, argv, option_string);
#endif
/* If no more options, clean up allocated memory before returning. */
if (opt == -1)
{
#if defined(HAVE_GETOPT_LONG)
int index;
/*
* Free each long option string created above, using the long_names
* growable array because the long_options[i].name aliased to it is
* a const char*. Then free long_names itself, and reset pointer.
*/
for (index = 0; index < long_count; index++)
free (long_names[index]);
free (long_names);
long_names = NULL;
/* Free the long options structure, and reset pointer and counter. */
free (long_options);
long_options = NULL;
long_count = 0;
#endif
/* Free and reset the retained short options string. */
free (option_string);
option_string = NULL;
}
/* Return the option and argument, with false if no more arguments. */
*option = opt;
*argument = optarg;
return !(opt == -1);
}
/*
* get_optind()
*
* Return the value of getopt()'s optind after get_options() calls complete.
*/
int
get_optind (void)
{
return optind;
}
void cw_print_help(const char *argv0, cw_config_t *config)
{
/* int format = has_longopts() */
fprintf(stderr, _("Usage: %s [options...]\n"), argv0);
if (!has_longopts()) {
fprintf(stderr, _("Long format of options is not supported on your system\n\n"));
}
fprintf(stderr, _("Audio system options:\n"));
fprintf(stderr, _(" -s, --system=SYSTEM\n"));
fprintf(stderr, _(" generate sound using SYSTEM audio system\n"));
fprintf(stderr, _(" SYSTEM: {console|oss|alsa|soundcard}\n"));
fprintf(stderr, _(" 'console': use system console/buzzer\n"));
fprintf(stderr, _(" this output may require root privileges\n"));
fprintf(stderr, _(" 'oss': use OSS output\n"));
fprintf(stderr, _(" 'alsa' use ALSA output\n"));
fprintf(stderr, _(" 'soundcard': use either OSS or ALSA\n"));
fprintf(stderr, _(" default sound system: 'oss'\n\n"));
fprintf(stderr, _(" -d, --device=DEVICE\n"));
fprintf(stderr, _(" use DEVICE as output device instead of default one;\n"));
fprintf(stderr, _(" optional for {console|alsa|oss};\n"));
fprintf(stderr, _(" default devices are:\n"));
fprintf(stderr, _(" 'console': \"%s\"\n"), CW_DEFAULT_CONSOLE_DEVICE);
fprintf(stderr, _(" 'oss': \"%s\"\n"), CW_DEFAULT_OSS_DEVICE);
fprintf(stderr, _(" 'alsa': \"%s\"\n\n"), CW_DEFAULT_ALSA_DEVICE);
fprintf(stderr, _("Sending options:\n"));
fprintf(stderr, _(" -w, --wpm=WPM set initial words per minute\n"));
fprintf(stderr, _(" valid values: %d - %d\n"), CW_SPEED_MIN, CW_SPEED_MAX);
fprintf(stderr, _(" default value: %d\n"), CW_SPEED_INITIAL);
fprintf(stderr, _(" -t, --tone=HZ set initial tone to HZ\n"));
fprintf(stderr, _(" valid values: %d - %d\n"), CW_FREQUENCY_MIN, CW_FREQUENCY_MAX);
fprintf(stderr, _(" default value: %d\n"), CW_FREQUENCY_INITIAL);
fprintf(stderr, _(" -v, --volume=PERCENT set initial volume to PERCENT\n"));
fprintf(stderr, _(" valid values: %d - %d\n"), CW_VOLUME_MIN, CW_VOLUME_MAX);
fprintf(stderr, _(" default value: %d\n"), CW_VOLUME_INITIAL);
fprintf(stderr, _("Dot/dash options:\n"));
fprintf(stderr, _(" -g, --gap=GAP set extra gap between letters\n"));
fprintf(stderr, _(" valid values: %d - %d\n"), CW_GAP_MIN, CW_GAP_MAX);
fprintf(stderr, _(" default value: %d\n"), CW_GAP_INITIAL);
fprintf(stderr, _(" -k, --weighting=WEIGHT set weighting to WEIGHT\n"));
fprintf(stderr, _(" valid values: %d - %d\n"), CW_WEIGHTING_MIN, CW_WEIGHTING_MAX);
fprintf(stderr, _(" default value: %d\n"), CW_WEIGHTING_INITIAL);
fprintf(stderr, _("Other options:\n"));
if (config->is_cw) {
fprintf(stderr, _(" -e, --noecho disable sending echo to stdout\n"));
fprintf(stderr, _(" -m, --nomessages disable writing messages to stderr\n"));
fprintf(stderr, _(" -c, --nocommands disable executing embedded commands\n"));
fprintf(stderr, _(" -o, --nocombinations disallow [...] combinations\n"));
fprintf(stderr, _(" -p, --nocomments disallow {...} comments\n"));
}
if (config->has_practice_time) {
fprintf(stderr, _(" -T, --time=TIME set initial practice time (in minutes)\n"));
fprintf(stderr, _(" valid values: %d - %d\n"), CW_PRACTICE_TIME_MIN, CW_PRACTICE_TIME_MAX);
fprintf(stderr, _(" default value: %d\n"), CW_PRACTICE_TIME_INITIAL);
}
if (config->has_infile) {
fprintf(stderr, _(" -f, --infile=FILE read practice words from FILE\n"));
}
if (config->has_outfile) {
fprintf(stderr, _(" -F, --outfile=FILE write current practice words to FILE\n"));
}
if (config->is_cw) {
fprintf(stderr, _(" default file: stdin\n"));
}
fprintf(stderr, "\n");
fprintf(stderr, _(" -h, --help print this message\n"));
fprintf(stderr, _(" -V, --version print version information\n\n"));
return;
}
int cw_process_argv(int argc, char *const argv[], const char *options, cw_config_t *config)
{
const char *argv0 = program_basename(argv[0]);
int option;
char *argument;
while (get_option(argc, argv, options, &option, &argument)) {
if (!cw_process_option(option, argument, config, argv0)) {
return CW_FAILURE;
}
}
if (get_optind() != argc) {
fprintf(stderr, "libcw: expected argument after options\n");
cw_print_usage(argv0);
return CW_FAILURE;
} else {
return CW_SUCCESS;
}
}
int cw_process_option(int opt, const char *optarg, cw_config_t *config, const char *argv0)
{
switch (opt) {
case 's':
if (!strcmp(optarg, "alsa")
|| !strcmp(optarg, "a")) {
config->audio_system = CW_AUDIO_ALSA;
} else if (!strcmp(optarg, "oss")
|| !strcmp(optarg, "o")) {
config->audio_system = CW_AUDIO_OSS;
} else if (!strcmp(optarg, "console")
|| !strcmp(optarg, "c")) {
config->audio_system = CW_AUDIO_CONSOLE;
} else if (!strcmp(optarg, "soundcard")
|| !strcmp(optarg, "s")) {
config->audio_system = CW_AUDIO_SOUNDCARD;
} else {
fprintf(stderr, "libcw: invalid audio system (option 's'): %s\n", optarg);
return CW_FAILURE;
}
break;
case 'd':
// fprintf(stderr, "libcw: d:%s\n", optarg);
if (optarg && strlen(optarg)) {
config->audio_device = strdup(optarg);
} else {
fprintf(stderr, "libcw: no device specified for option -d\n");
return CW_FAILURE;
}
break;
case 'w':
{
// fprintf(stderr, "libcw: w:%s\n", optarg);
int speed = atoi(optarg);
if (speed < CW_SPEED_MIN || speed > CW_SPEED_MAX) {
fprintf(stderr, "libcw: speed out of range: %d\n", speed);
return CW_FAILURE;
} else {
config->send_speed = speed;
}
break;
}
case 't':
{
// fprintf(stderr, "libcw: t:%s\n", optarg);
int frequency = atoi(optarg);
if (frequency < CW_FREQUENCY_MIN || frequency > CW_FREQUENCY_MAX) {
fprintf(stderr, "libcw: frequency out of range: %d\n", frequency);
return CW_FAILURE;
} else {
config->frequency = frequency;
}
break;
}
case 'v':
{
// fprintf(stderr, "libcw: v:%s\n", optarg);
int volume = atoi(optarg);
if (volume < CW_VOLUME_MIN || volume > CW_VOLUME_MAX) {
fprintf(stderr, "libcw: volume level out of range: %d\n", volume);
return CW_FAILURE;
} else {
config->volume = volume;
}
break;
}
case 'g':
{
// fprintf(stderr, "libcw: g:%s\n", optarg);
int gap = atoi(optarg);
if (gap < CW_GAP_MIN || gap > CW_GAP_MAX) {
fprintf(stderr, "libcw: gap out of range: %d\n", gap);
return CW_FAILURE;
} else {
config->gap = gap;
}
break;
}
case 'k':
{
// fprintf(stderr, "libcw: k:%s\n", optarg);
int weighting = atoi(optarg);
if (weighting < CW_WEIGHTING_MIN || weighting > CW_WEIGHTING_MAX) {
fprintf(stderr, "libcw: weighting out of range: %d\n", weighting);
return CW_FAILURE;
} else {
config->weighting = weighting;
}
break;
}
case 'T':
{
// fprintf(stderr, "libcw: T:%s\n", optarg);
int time = atoi(optarg);
if (time < 0) {
fprintf(stderr, "libcw: practice time is negative\n");
return CW_FAILURE;
} else {
config->practice_time = time;
}
break;
}
case 'f':
if (optarg && strlen(optarg)) {
config->input_file = strdup(optarg);
} else {
fprintf(stderr, "libcw: no input file specified for option -f\n");
return CW_FAILURE;
}
/* TODO: access() */
break;
case 'F':
if (optarg && strlen(optarg)) {
config->output_file = strdup(optarg);
} else {
fprintf(stderr, "libcw: no output file specified for option -F\n");
return CW_FAILURE;
}
/* TODO: access() */
break;
case 'e':
config->do_echo = false;
break;
case 'm':
config->do_errors = false;
break;
case 'c':
config->do_commands = false;
break;
case 'o':
config->do_combinations = false;
break;
case 'p':
config->do_comments = false;
break;
case 'h':
cw_print_help(argv0, config);
exit(EXIT_SUCCESS);
case 'V':
fprintf(stderr, _("%s version %s\n"), argv0, PACKAGE_VERSION);
fprintf(stderr, "%s\n", CW_COPYRIGHT);
exit(EXIT_SUCCESS);
case '?':
default: /* '?' */
cw_print_usage(argv0);
return CW_FAILURE;
}
return CW_SUCCESS;
}
void cw_print_usage(const char *argv0)
{
const char *format = has_longopts()
? _("Try '%s --help' for more information.\n")
: _("Try '%s -h' for more information.\n");
fprintf(stderr, format, argv0);
return;
}
unixcw-3.0.2/src/cwutils/dictionary.h 0000644 0001750 0001750 00000002671 11702277404 017464 0 ustar acerion acerion /*
* Copyright (C) 2001-2006 Simon Baldwin (simon_baldwin@yahoo.com)
* Copyright (C) 2011-2012 Kamil Ignacak (acerion@wp.pl)
*
* 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.
*/
#ifndef _CWDICTIONARY_H
#define _CWDICTIONARY_H
#if defined(__cplusplus)
extern "C" {
#endif
typedef struct dictionary_s dictionary;
extern void dictionary_unload (void);
extern int dictionary_load (const char *file);
extern const dictionary *dictionary_iterate (const dictionary *dict);
extern int dictionary_write (const char *file);
extern const char *get_dictionary_description (const dictionary *dict);
extern int get_dictionary_group_size (const dictionary *dict);
extern const char *get_dictionary_random_word (const dictionary *dict);
#if defined(__cplusplus)
}
#endif
#endif /* _CWDICTIONARY_H */
unixcw-3.0.2/src/cwutils/i18n.c 0000644 0001750 0001750 00000003237 11702277377 016101 0 ustar acerion acerion /*
* Copyright (C) 2001-2006 Simon Baldwin (simon_baldwin@yahoo.com)
* Copyright (C) 2011-2012 Kamil Ignacak (acerion@wp.pl)
*
* 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.
*/
#include "../config.h"
#include
#include "i18n.h"
/*---------------------------------------------------------------------*/
/* Internationalization */
/*---------------------------------------------------------------------*/
enum { FALSE = 0, TRUE = !FALSE };
/*
* i18n_initialize()
*
* Set locale, and message locations if available.
*/
void
i18n_initialize (void)
{
setlocale (LC_ALL, "");
}
/*
* i18n_gettext()
*
* Wrapper for gettext(). This function is the destination for _("mumble").
*/
const char *
i18n_gettext (const char *msgid)
{
#if defined(HAVE_LIBINTL_H)
static int is_initialized = FALSE;
if (!is_initialized)
{
textdomain (PACKAGE_NAME);
is_initialized = TRUE;
}
return gettext (msgid);
#else
return msgid;
#endif
}
unixcw-3.0.2/src/cwutils/cw_common.c 0000644 0001750 0001750 00000013513 11702277457 017300 0 ustar acerion acerion /*
* Copyright (C) 2001-2006 Simon Baldwin (simon_baldwin@yahoo.com)
* Copyright (C) 2011-2012 Kamil Ignacak (acerion@wp.pl)
*
* 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.
*/
/* Code that is common for all _applications_ from unixcw package.
Wrappers for some libcw functions, that probably don't belong
to libcw.c. */
#include /* fprintf(stderr, ...) */
#include /* malloc() / free() */
#include "libcw.h"
#include "cw_common.h"
static void cw_generator_apply_config(cw_config_t *config);
enum { FALSE = 0, TRUE = !FALSE };
cw_config_t *cw_config_new(void)
{
cw_config_t *config = (cw_config_t *) malloc(sizeof (cw_config_t));
if (!config) {
fprintf(stderr, "libcw: can't allocate memory for configuration\n");
return NULL;
}
config->audio_system = CW_AUDIO_NONE;
config->audio_device = NULL;
config->send_speed = CW_SPEED_INITIAL;
config->frequency = CW_FREQUENCY_INITIAL;
config->volume = CW_VOLUME_INITIAL;
config->gap = CW_GAP_INITIAL;
config->weighting = CW_WEIGHTING_INITIAL;
config->practice_time = CW_PRACTICE_TIME_INITIAL;
config->input_file = NULL;
config->output_file = NULL;
config->is_cw = 0;
config->has_practice_time = 0;
config->has_outfile = 0;
config->has_infile = true; /* TODO: set to false by default, update sources */
config->do_echo = TRUE;
config->do_errors = TRUE;
config->do_commands = TRUE;
config->do_combinations = TRUE;
config->do_comments = TRUE;
return config;
}
void cw_config_delete(cw_config_t **config)
{
if (*config) {
if ((*config)->audio_device) {
free((*config)->audio_device);
(*config)->audio_device = NULL;
}
if ((*config)->input_file) {
free((*config)->input_file);
(*config)->input_file = NULL;
}
if ((*config)->output_file) {
free((*config)->output_file);
(*config)->output_file = NULL;
}
free(*config);
*config = NULL;
}
return;
}
/*
* cw_config_is_valid()
*
* Check consistency and correctness of configuration.
*/
int cw_config_is_valid(cw_config_t *config)
{
/* Deal with odd argument combinations. */
if (config->audio_device) {
if (config->audio_system == CW_AUDIO_SOUNDCARD) {
fprintf(stderr, "libcw: a device has been specified for 'soundcard' argument\n");
fprintf(stderr, "libcw: a device can be specified only for 'console', 'oss' or 'alsa'\n");
return CW_FAILURE;
} else {
; /* audio_system is one that accepts custom "audio device" */
}
} else {
; /* no custom "audio device" specified, a default will be used */
}
return CW_SUCCESS;
}
/* A wrapper for common functionality.
For a lack of better place I put it in this file */
int cw_generator_new_from_config(cw_config_t *config, const char *argv0)
{
if (config->audio_system == CW_AUDIO_NONE
|| config->audio_system == CW_AUDIO_OSS
|| config->audio_system == CW_AUDIO_SOUNDCARD) {
if (cw_is_oss_possible(config->audio_device)) {
if (cw_generator_new(CW_AUDIO_OSS, config->audio_device)) {
cw_generator_apply_config(config);
return CW_SUCCESS;
} else {
fprintf(stderr,
"%s: failed to open OSS output with device \"%s\"\n",
argv0, cw_get_soundcard_device());
}
} else {
fprintf(stderr, "%s: OSS output not available\n", argv0);
}
/* fall through to try with next audio system type */
}
if (config->audio_system == CW_AUDIO_NONE
|| config->audio_system == CW_AUDIO_ALSA
|| config->audio_system == CW_AUDIO_SOUNDCARD) {
if (cw_is_alsa_possible(config->audio_device)) {
if (cw_generator_new(CW_AUDIO_ALSA, config->audio_device)) {
cw_generator_apply_config(config);
return CW_SUCCESS;
} else {
fprintf(stderr,
"%s: failed to open ALSA output with device \"%s\"\n",
argv0, cw_get_soundcard_device());
}
} else {
fprintf(stderr, "%s: ALSA output not available\n", argv0);
}
/* fall through to try with next audio system type */
}
if (config->audio_system == CW_AUDIO_NONE
|| config->audio_system == CW_AUDIO_CONSOLE) {
if (cw_is_console_possible(config->audio_device)) {
if (cw_generator_new(CW_AUDIO_CONSOLE, config->audio_device)) {
cw_generator_apply_config(config);
return CW_SUCCESS;
} else {
fprintf(stderr,
"%s: failed to open console output with device %s\n",
/* FIXME: this condition doesn't look 100% correct */
argv0, cw_get_soundcard_device() ? cw_get_soundcard_device() : config->audio_device);
}
} else {
fprintf(stderr, "%s: console output not available\n", argv0);
}
/* fall through to try with next audio system type */
}
/* there is no next audio system type to try */
return CW_FAILURE;
}
void cw_generator_apply_config(cw_config_t *config)
{
cw_set_frequency(config->frequency);
cw_set_volume(config->volume);
cw_set_send_speed(config->send_speed);
cw_set_gap(config->gap);
cw_set_weighting(config->weighting);
return;
}
void cw_start_beep(void)
{
cw_flush_tone_queue();
cw_queue_tone(20000, 500);
cw_queue_tone(20000, 1000);
cw_wait_for_tone_queue();
return;
}
void cw_end_beep(void)
{
cw_flush_tone_queue();
cw_queue_tone(20000, 500);
cw_queue_tone(20000, 1000);
cw_queue_tone(20000, 500);
cw_queue_tone(20000, 1000);
cw_wait_for_tone_queue();
return;
}
unixcw-3.0.2/src/cwutils/cwwords.h 0000644 0001750 0001750 00000062203 11702277440 017004 0 ustar acerion acerion /*
* Copyright (C) 2001-2006 Simon Baldwin (simon_baldwin@yahoo.com)
* Copyright (C) 2011-2012 Kamil Ignacak (acerion@wp.pl)
*
* 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.
*/
#ifndef _CWWORDS_H
#define _CWWORDS_H
/*
* Bulk string data for generating characters to send. These string entries
* are used as initializers for the default dictionary set.
*/
static const char *const CW_ALPHABETIC[] = {
"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",NULL};
static const char *const CW_NUMERIC[] = {
"0","1","2","3","4","5","6","7","8","9",NULL};
static const char *const CW_ALPHANUMERIC[] = {
"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","0","1","2","3","4","5","6","7","8","9",NULL};
static const char *const CW_ALL_CHARACTERS[] = {
"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","0","1","2","3","4","5","6","7","8","9",
"=","-",",","?",".",";",")","/","\"","'","$","(","+",":","_",NULL};
static const char *const CW_EISH5[] = {"E","I","S","H","5",NULL};
static const char *const CW_TMO0[] = {"T","M","O","0",NULL};
static const char *const CW_AUV4[] = {"A","U","V","4",NULL};
static const char *const CW_NDB6[] = {"N","D","B","6",NULL};
static const char *const CW_KXffRP[] = {"K","X","=","-","R","P",NULL};
static const char *const CW_FLYQC[] = {"F","L","Y","Q","C",NULL};
static const char *const CW_WJ1GZ[] = {"W","J","1","G","Z",NULL};
static const char *const CW_23789[] = {"2","3","7","8","9",NULL};
static const char *const CW_FIGURES_1[] = {",","?",".",";",")","/",NULL};
static const char *const CW_FIGURES_2[] = {"\"","'","$","(","+",":","_",NULL};
static const char *const CW_SHORT_WORDS[] = {
"ACT","ADD","AGE","AGO","AID","AIM","AIR","ALL","AND","ANY","APE","ARC",
"ARE","ARK","ARM","ART","ASH","ASK","ATE","AWE","BAD","BAG","BAR","BAT",
"BAY","BED","BEE","BEG","BET","BID","BIG","BIN","BIT","BOB","BOO","BOW",
"BOX","BOY","BUD","BUN","BUS","BUT","BUY","BYE","CAB","CAN","CAR","CAT",
"CON","COP","COW","CRY","CUP","CUT","DAN","DAY","DEW","DID","DIE","DIG",
"DIM","DIN","DIP","DOG","DON","DOT","DRY","DUE","DUG","EAR","EAT","EBB",
"EGG","EGO","END","ERA","ERE","ERR","EYE","FAN","FAR","FAT","FED","FEE",
"FEN","FEW","FIN","FIT","FIX","FLY","FOG","FOR","FOX","FRY","FUN","FUR",
"GAG","GAP","GAS","GET","GIG","GIN","GOD","GOT","GUM","GUN","GUT","GUY",
"HAD","HAM","HAN","HAP","HAS","HAT","HAY","HER","HEY","HID","HIM","HIP",
"HIS","HIT","HOP","HOT","HOW","HUB","HUG","HUH","HUM","HUT","ICE","ICY",
"ILL","ION","ITS","JAR","JAW","JAY","JET","JIG","JIM","JOB","JOT","JOY",
"JUG","KEY","KID","KIT","LAB","LAD","LAG","LAP","LAW","LAY","LED","LEG",
"LET","LID","LIE","LIP","LIT","LOS","LOT","LOU","LOW","MAD","MAN","MAP",
"MAX","MAY","MEG","MEN","MET","MID","MIX","MOB","MUD","MUG","NAG","NAP",
"NED","NET","NEW","NIL","NIP","NOD","NON","NOR","NOT","NOW","NUT","ODD",
"ODE","OFF","OIL","OLD","ONE","OUR","OUT","OWE","OWN","PAD","PAL","PAN",
"PAT","PAY","PEN","PER","PET","PIG","PIN","PIT","POP","POT","PUB","PUN",
"PUT","RAG","RAM","RAN","RAP","RAT","RAY","RED","RIB","RID","RIG","RIM",
"RIP","ROB","ROD","RON","ROT","ROW","RUB","RUM","RUN","SAD","SAN","SAT",
"SAW","SAY","SEA","SEE","SET","SHE","SHY","SIP","SIR","SIT","SIX","SKY",
"SOB","SOD","SOL","SON","SUB","SUE","SUM","SUN","TAB","TAN","TAP","TAR",
"TAU","TAX","TEA","TED","TEN","TEX","THE","TIE","TIN","TIP","TOE","TON",
"TOO","TOP","TOY","TRY","TUG","TWO","UGH","URN","USE","VAN","VAT","VIA",
"VIE","WAG","WAN","WAR","WAS","WAY","WEB","WET","WHO","WHY","WIN","WIT",
"WON","WOO","YES","YET","YOU","ZOO",
"ABLE","ACHE","ACID","ACTS","AGED","AGES","AIRY","AJAR","AKIN","ALEC",
"ALLY","ALSO","AMEN","ANDY","ANTI","ANTS","ARCH","ARCS","AREA","ARID",
"ARMS","ARMY","ARTS","ASKS","ATOM","AUNT","AVID","AWAY","AWED","AXEL",
"AXES","AXIS","BABY","BACK","BAGS","BAIL","BAIT","BALL","BAND","BANG",
"BANK","BARK","BARS","BASE","BASK","BASS","BATH","BATS","BAYS","BEAD",
"BEAK","BEAM","BEAN","BEAR","BEAT","BEDS","BEEN","BEEP","BEER","BEES",
"BELL","BELT","BEND","BENT","BEST","BETA","BIDS","BIKE","BILL","BINS",
"BIRD","BITE","BITS","BLEW","BLIP","BLOB","BLOT","BLOW","BLUE","BLUR",
"BOAT","BOBS","BODY","BOER","BOIL","BOLD","BOLT","BOMB","BONE","BONY",
"BOOK","BOOM","BOOT","BORE","BORN","BOSS","BOTH","BOUT","BOWL","BOYS",
"BRIM","BROW","BUCK","BUDS","BULK","BULL","BUMP","BUMS","BUNK","BURN",
"BURY","BUSH","BUST","BUSY","BUYS","BUZZ","CAFE","CAGE","CAKE","CALL",
"CALM","CAME","CANS","CANT","CAPE","CARD","CARE","CARS","CART","CASE",
"CASH","CAST","CATS","CAVE","CENT","CHAP","CHAT","CHEF","CHEW","CHIN",
"CHIP","CITY","CLAD","CLAP","CLIP","CLOT","CLUB","CLUE","COAT","COAX",
"CODE","COGS","COIN","COKE","COLD","COME","COOK","COOL","COPE","COPS",
"COPY","CORE","CORN","COST","COWS","CRAB","CREW","CUPS","CURE","CURL",
"CUTE","DAMP","DARE","DARK","DARN","DART","DASH","DATA","DATE","DAWN",
"DAYS","DAZE","DEAD","DEAL","DEAR","DEBT","DECK","DEEP","DEER","DENT",
"DENY","DESK","DEWY","DIAL","DICE","DIED","DIES","DIET","DINE","DINT",
"DIRE","DIRT","DISC","DISH","DISK","DIVE","DOCK","DOES","DOGS","DOLE",
"DOLL","DOME","DONE","DOOM","DOOR","DOSE","DOTS","DOWN","DRAG","DRAW",
"DREW","DRIP","DROP","DRUG","DRUM","DUCK","DUET","DULL","DULY","DUMB",
"DUMP","DUNG","DUSK","DUST","DUTY","DYED","EACH","EARS","EASE","EAST",
"EASY","ECHO","EDDY","EDEN","EDGE","EDIT","EELS","EGGS","ELMS","ELSE",
"EMIT","ENDS","ENID","ENVY","EPIC","ERAS","ERIC","EVEN","EVER","EVIL",
"EXIT","EYED","EYES","FACE","FACT","FADE","FAIL","FAIR","FAKE","FALL",
"FAME","FARE","FARM","FAST","FATE","FEAR","FEAT","FEED","FEEL","FEET",
"FELL","FELT","FEND","FERN","FIAT","FILE","FILL","FILM","FIND","FINE",
"FINS","FIRE","FIRM","FISH","FIST","FITS","FIVE","FLAG","FLAP","FLAT",
"FLAW","FLEA","FLED","FLEE","FLEW","FLEX","FLIP","FLIT","FLOP","FLOW",
"FOAM","FOIL","FOLD","FOND","FOOD","FOOL","FOOT","FORD","FORK","FORM",
"FOUL","FOUR","FRAY","FREE","FRET","FROG","FROM","FULL","FURS","FURY",
"FUSS","GAIL","GAIN","GAIT","GAME","GARY","GASH","GASP","GATE","GAVE",
"GAZE","GEAR","GENE","GETS","GIFT","GIRD","GIRL","GIST","GIVE","GLAD",
"GLEN","GLOW","GNAT","GNAW","GOAL","GOAT","GODS","GOES","GOLD","GOLF",
"GONE","GONG","GOOD","GOWN","GRAB","GREW","GREY","GRIM","GRIN","GRIP",
"GRIT","GROW","GULF","GUNS","GUYS","HACK","HAIR","HALE","HALF","HALL",
"HALT","HAND","HANG","HARD","HARM","HATE","HATS","HAUL","HAVE","HAWK",
"HAZE","HAZY","HEAD","HEAP","HEAR","HEAT","HECK","HEEL","HELD","HELL",
"HELP","HERD","HERE","HERO","HERS","HIDE","HIGH","HILL","HIND","HINT",
"HIPS","HIRE","HISS","HOLD","HOLE","HOLY","HOME","HOOK","HOOP","HOOT",
"HOPE","HORN","HOSE","HOST","HOUR","HOWL","HUGE","HULL","HUMS","HUNG",
"HUNK","HUNT","HURL","HURT","HUSH","HUSK","HUTS","HYDE","HYMN","ICED",
"IDEA","IDLE","IDLY","INCH","INTO","IRON","ITEM","JAIL","JANE","JAWS",
"JAZZ","JETS","JOBS","JOIN","JOKE","JOLT","JOYS","JUMP","JUNK","JURY",
"JUST","KARL","KEEL","KEEN","KEEP","KENT","KEPT","KEYS","KICK","KIDS",
"KILL","KIND","KING","KISS","KNEE","KNEW","KNOB","KNOT","KNOW","LABS",
"LACK","LADS","LADY","LAID","LAIN","LAKE","LAME","LAMP","LAND","LANE",
"LARK","LAST","LATE","LAVA","LAWN","LAWS","LAYS","LAZY","LEAD","LEAF",
"LEAK","LEAN","LEAP","LEFT","LEGS","LEND","LESS","LETS","LEWD","LICK",
"LIED","LIES","LIFE","LIFT","LIKE","LIMB","LIMP","LINE","LINK","LIPS",
"LISA","LIST","LIVE","LOAD","LOAF","LOAN","LOCK","LOGO","LONE","LONG",
"LOOK","LOOM","LOOP","LORD","LOSE","LOSS","LOST","LOTS","LOUD","LOVE",
"LUCK","LUMP","LURE","LURK","LUSH","LYNX","MADE","MAIL","MAIN","MAKE",
"MANE","MANS","MANY","MAPS","MARK","MARS","MASH","MASS","MATE","MAZE",
"MEAL","MEAN","MEAT","MEET","MELT","MEND","MENS","MENU","MERE","MESS",
"MICE","MIKE","MILD","MILE","MILK","MILL","MIND","MINE","MINI","MINT",
"MIRE","MISS","MIST","MOCK","MODE","MOOD","MOON","MORE","MOSS","MOST",
"MOTH","MOVE","MUCH","MUCK","MUST","MUTE","MYTH","NAIL","NAME","NEAR",
"NEAT","NECK","NEED","NEON","NEST","NEWS","NEWT","NEXT","NICE","NINE",
"NOEL","NONE","NOON","NOSE","NOTE","NUMB","NUTS","OATH","ODDS","OILY",
"ONCE","ONES","ONLY","ONTO","OPEN","OUCH","OURS","OVEN","OVER","OWED",
"OWLS","OWNS","PACE","PACK","PADS","PAGE","PAID","PAIN","PAIR","PALE",
"PALL","PALM","PANG","PARK","PART","PASS","PAST","PATH","PAUL","PEAK",
"PEAR","PEAT","PEEL","PEEP","PEER","PEGS","PENT","PHIL","PICK","PIES",
"PIGS","PILE","PINE","PING","PINK","PINS","PINT","PISA","PITS","PITY",
"PLAN","PLAY","PLOD","PLOT","PLOY","PLUG","PLUS","PODS","POEM","POET",
"POKE","POLE","POLO","POND","PONY","POOL","POOR","PORK","PORT","POSE",
"POST","POUR","PRAY","PREY","PRIM","PROD","PROP","PROW","PUBS","PUFF",
"PULL","PULP","PUMP","PURE","PURR","PUSH","PUTS","QUIZ","RACE","RAFT",
"RAGE","RAID","RAIL","RAIN","RAMP","RANG","RANK","RAPT","RARE","RASP",
"RATE","RATS","RAVE","RAYS","READ","REAL","REAR","REEL","RELY","REND",
"RENT","REST","RIBS","RICE","RICH","RICK","RIDE","RIFT","RING","RISE",
"RISK","ROAD","ROAM","ROAR","ROBE","ROCK","RODE","RODS","ROLE","ROLL",
"ROME","ROOF","ROOM","ROOT","ROPE","ROSE","RUDE","RUIN","RULE","RUNG",
"RUNS","RUSH","RUST","SACK","SAFE","SAGA","SAGE","SAID","SAIL","SAKE",
"SALE","SALT","SAME","SAND","SANE","SANG","SANK","SASH","SAVE","SAWS",
"SAYS","SCAN","SEAL","SEAS","SEAT","SEED","SEEK","SEEM","SEEN","SEER",
"SEES","SELF","SELL","SEMI","SEND","SENT","SETS","SHED","SHIP","SHOD",
"SHOE","SHOP","SHOT","SHOW","SHUT","SICK","SIDE","SIGH","SIGN","SILK",
"SILO","SING","SINK","SINS","SITE","SITS","SITU","SIZE","SKID","SKIN",
"SKIP","SKIS","SLAP","SLAY","SLEW","SLID","SLIM","SLIP","SLOT","SLOW",
"SLUG","SLUM","SMUG","SNAP","SNOW","SNUG","SOAP","SODA","SOFA","SOFT",
"SOIL","SOLD","SOLE","SOLO","SOME","SONG","SONY","SOON","SORE","SORT",
"SOUL","SOUP","SOUR","SPAN","SPAT","SPED","SPIN","SPIT","SPOT","SPUN",
"SPUR","STAB","STAR","STAY","STEP","STIR","STOP","STUB","STUN","SUCH",
"SUED","SUIT","SULK","SUMS","SUNK","SUNS","SURE","SURF","SWAB","SWAM",
"SWAY","SWIM","TACT","TAIL","TAKE","TALK","TALL","TANK","TAPE","TAPS",
"TASK","TAXI","TEAM","TEAR","TELL","TEND","TENS","TENT","TERM","TEST",
"TEXT","THAN","THAT","THEM","THEN","THEY","THIN","THIS","THOR","THUD",
"THUS","TICK","TIDE","TIED","TIES","TILE","TILL","TILT","TIME","TINY",
"TIPS","TIRE","TOES","TOLD","TOLL","TOMB","TONE","TONS","TOOK","TOOL",
"TOPS","TORE","TORN","TOTO","TOUR","TOWN","TRAP","TRAY","TREE","TREK",
"TRIM","TRIP","TROD","TROT","TRUE","TUBE","TUFT","TUNE","TURF","TURN",
"TWIG","TWIN","TWOS","TYPE","UGLY","UNIT","UNIX","UNTO","UPON","URGE",
"URSA","USED","VAIN","VARY","VAST","VEIL","VERY","VIEW","VILE","VOID",
"VOTE","VOWS","WAFT","WAGE","WAIL","WAIT","WAKE","WALK","WALL","WANT",
"WARD","WARM","WARN","WARP","WARS","WART","WARY","WASH","WAVE","WAYS",
"WEAK","WEAR","WEBS","WEEK","WEEP","WELL","WENT","WERE","WEST","WHAT",
"WHEN","WHIM","WHIP","WHOM","WICK","WIDE","WIFE","WIGS","WILD","WILL",
"WILT","WIND","WINE","WING","WINK","WINS","WIPE","WIRE","WIRY","WISE",
"WISH","WISP","WITH","WOKE","WOLF","WONT","WOOD","WOOF","WORD","WORE",
"WORK","WORM","WORN","WRAP","YANK","YAWN","YEAR","YELL","YELP","YORK",
"YOUR","ZERO","ZEST","ZONE","ZOOM",
"ABACK","ABOUT","ABOVE","ABUSE","ACHED","ACHES","ACORN","ACRID","ACTOR",
"ACUTE","ADDED","ADMIT","ADOPT","AFOOT","AFTER","AGAIN","AGENT","AGONY",
"AGREE","AHEAD","AIMED","AISLE","ALARM","ALBUM","ALERT","ALGOL","ALIEN",
"ALIVE","ALLEN","ALLEY","ALLOW","ALOFT","ALONE","ALONG","ALOUD","ALPHA",
"ALTAR","ALTER","AMISS","AMONG","AMPLY","ANGEL","ANGER","ANGLE","ANGRY",
"ANGST","ANKLE","ANNOY","ANTIC","APART","APPLE","APPLY","APRIL","APRON",
"AREAS","ARGUE","ARISE","ARMED","AROSE","ARRAY","ARROW","ASHEN","ASHES",
"ASIDE","ASKED","ATLAS","ATOLL","ATOMS","ATONE","AURAL","AVIAN","AVOID",
"AWAKE","AWARD","AWARE","AWFUL","AWOKE","BABEL","BACKS","BACON","BADLY",
"BAGGY","BAKED","BAKER","BALLS","BALMY","BANDS","BANGS","BANKS","BARED",
"BARRY","BASED","BASIC","BASIS","BATHS","BEACH","BEADS","BEADY","BEAMS",
"BEARD","BEAST","BEERS","BEGAN","BEGIN","BEGUN","BEING","BELLS","BELOW",
"BELTS","BENCH","BERTH","BETEL","BILLS","BINGO","BIRDS","BIRTH","BLACK",
"BLADE","BLAME","BLANK","BLAST","BLAZE","BLEAK","BLEND","BLESS","BLIND",
"BLINK","BLITZ","BLOBS","BLOCK","BLOKE","BLOND","BLOOM","BLOWN","BLUER",
"BLUNT","BLURS","BOARD","BOATS","BOBBY","BOLTS","BONES","BOOKS","BOOTH",
"BOOTS","BOOZE","BORED","BORNE","BOUND","BOUTS","BOWED","BOWLS","BOXES",
"BRAIN","BRAKE","BRAND","BRASH","BRASS","BRAUN","BRAVE","BREAD","BREAK",
"BRICK","BRIEF","BRING","BRINK","BRISK","BROAD","BROCK","BROKE","BROWN",
"BROWS","BRUSH","BUDGE","BUGGY","BUILD","BUILT","BULKY","BUNCH","BURLY",
"BURNS","BURNT","BURST","BUSES","CABIN","CACTI","CAFES","CAKES","CALLS",
"CAPES","CARDS","CARED","CARES","CARGO","CAROL","CARRY","CARTS","CARVE",
"CASES","CATCH","CATER","CAUSE","CAVED","CAVES","CEASE","CELLS","CHAIN",
"CHAIR","CHANT","CHAOS","CHAPS","CHARM","CHART","CHASE","CHASM","CHEAP",
"CHECK","CHEEK","CHEER","CHEFS","CHESS","CHIEF","CHILD","CHILL","CHIME",
"CHINA","CHINK","CHINS","CHOIR","CHOKE","CHOSE","CHUCK","CHURN","CHUTE",
"CIGAR","CIVIL","CLAIM","CLARE","CLASS","CLAWS","CLEAN","CLEAR","CLERK",
"CLICK","CLIFF","CLIMB","CLING","CLOAK","CLOCK","CLOGS","CLONE","CLOSE",
"CLOTH","CLOUD","CLUBS","CLUES","CLUMP","CLUNG","COACH","COAST","COATS",
"COBOL","CODES","COINS","COMBS","COMES","COMET","COMMA","COOKS","CORKS",
"CORPS","COSTS","COUCH","COUGH","COULD","COUNT","COURT","COVER","CRAFT",
"CRAGS","CRASH","CRAVE","CRAWL","CRAZY","CREAK","CREAM","CREEP","CREPT",
"CREST","CREWS","CRIED","CRIES","CRIME","CROOK","CROPS","CROSS","CROWD",
"CROWN","CRUDE","CRUEL","CRUMB","CRUST","CRYPT","CUBES","CUBIC","CURES",
"CURSE","CURVE","CYCLE","DADDY","DAILY","DAIRY","DANCE","DARED","DARTS",
"DATED","DAVID","DAWNS","DAZED","DEALS","DEALT","DEATH","DECAY","DEEDS",
"DELAY","DELTA","DENSE","DENTS","DEPTH","DESKS","DETER","DEVIL","DEVON",
"DIALS","DIARY","DIMLY","DINER","DIODE","DIRGE","DIRTY","DIVED","DIZZY",
"DODGE","DOING","DOMED","DONOR","DOORS","DOUBT","DOWNS","DOZED","DOZEN",
"DRAMA","DRANK","DRAWL","DRAWN","DREAM","DRESS","DRIED","DRIER","DRIFT",
"DRILL","DRINK","DRIVE","DRONE","DROPS","DROVE","DRUGS","DRUMS","DRUNK",
"DUCKS","DULLY","DUSTY","DWELL","DYING","EAGER","EAGLE","EARLY","EARTH",
"EASED","EASES","EATEN","EATER","EBONY","EDDIE","EDGED","EDGES","EDITS",
"EERIE","EIGHT","EJECT","ELBOW","ELDER","ELVIS","EMILY","EMPTY","ENDED",
"ENJOY","ENTER","ENTRY","EQUAL","ERROR","ESSAY","ETHEL","ETHER","ETHIC",
"EVENT","EVERY","EXACT","EXERT","EXILE","EXIST","EXTRA","FACED","FACES",
"FACTO","FACTS","FADED","FADES","FAINT","FAITH","FAKED","FALLS","FALSE",
"FAMED","FANCY","FANGS","FARED","FARMS","FATES","FAULT","FEAST","FEEDS",
"FEELS","FENCE","FERNS","FETCH","FETID","FEVER","FEWER","FIELD","FIERY",
"FIFTH","FIFTY","FIGHT","FILED","FILES","FILMS","FINAL","FINDS","FINER",
"FIRED","FIRES","FIRST","FISTS","FIXED","FLAGS","FLAME","FLARE","FLASH",
"FLASK","FLATS","FLAWS","FLEET","FLESH","FLICK","FLIES","FLING","FLINT",
"FLIPS","FLOAT","FLOCK","FLOOD","FLOOR","FLOWN","FLOWS","FLUFF","FLUID",
"FLUNG","FLYER","FOAMY","FOCUS","FOLDS","FOLKS","FOLLY","FOODS","FOOLS",
"FORCE","FORDS","FORGE","FORMS","FORTH","FORTY","FOUND","FRAME","FRANK",
"FRAUD","FREAK","FREED","FRESH","FRIED","FRIES","FROGS","FRONT","FROST",
"FROTH","FROWN","FROZE","FRUIT","FUDGE","FUGUE","FULLY","FUMED","FUMES",
"FUNNY","FURRY","GAILY","GAMES","GAMMA","GAPED","GASES","GASPS","GAUGE",
"GAUNT","GAZED","GEARS","GEESE","GENES","GENUS","GERMS","GHOST","GIANT",
"GIDDY","GIFTS","GIRLS","GIVEN","GIVES","GLADE","GLAND","GLARE","GLASS",
"GLEAM","GLINT","GLOBE","GLOOM","GLORY","GLOSS","GOALS","GOATS","GOING",
"GOLDS","GONER","GOOSE","GRACE","GRAFT","GRAIN","GRAND","GRANT","GRAPH",
"GRASP","GRASS","GRATE","GRAVE","GRAVY","GREAT","GREEK","GREEN","GREET",
"GRIEF","GRILL","GRIME","GRINS","GRIPS","GROAN","GROOM","GROUP","GROWL",
"GROWN","GROWS","GRUNT","GUARD","GUESS","GUEST","GUIDE","GUILT","GUISE",
"GULLY","GUSTS","GYPSY","HABIT","HADES","HALLS","HANDS","HANDY","HAPPY",
"HARMS","HARSH","HATCH","HATED","HATES","HAVEN","HAVOC","HEADS","HEARD",
"HEART","HEAVE","HEAVY","HEDGE","HEELS","HEFTY","HEIRS","HELLO","HENCE",
"HERDS","HERES","HIKED","HIKER","HILLS","HITCH","HOBBY","HOLDS","HOLES",
"HOMED","HOMES","HONDO","HONED","HONEY","HOOPS","HOPED","HOPES","HORNS",
"HORSE","HOSTS","HOTEL","HOTLY","HOURS","HOUSE","HOVEL","HOVER","HUMAN",
"HUMID","HUNCH","HUNTS","HURRY","HURTS","HUSKY","HYENA","IDEAL","IDEAS",
"IDIOT","IGLOO","IMAGE","INANE","INDEX","INDIA","INEPT","INERT","INFRA",
"INNER","INPUT","IRATE","IRONY","ISSUE","ITALY","ITEMS","JAMES","JEANS",
"JOKES","JOLLY","JUDGE","JUICE","JUMPS","JUMPY","JUNKY","KAPPA","KEEPS",
"KEVIN","KICKS","KILLS","KINDS","KINGS","KNACK","KNEEL","KNEES","KNELT",
"KNIFE","KNOBS","KNOCK","KNOTS","KNOWN","KNOWS","LACES","LACEY","LADEN",
"LANDS","LARGE","LASER","LASTS","LATER","LAUGH","LAYER","LEADS","LEAFY",
"LEAKY","LEAPS","LEAPT","LEARN","LEAST","LEAVE","LEDGE","LEGAL","LEMON",
"LEVEL","LEVER","LICKS","LIFTS","LIGHT","LIKED","LIKES","LILAC","LIMBS",
"LIMIT","LINED","LINEN","LINER","LINES","LINKS","LIONS","LIVED","LIVER",
"LIVES","LIVID","LLOYD","LOBBY","LOCAL","LOCKS","LODGE","LOGIC","LOOKS",
"LOOPS","LOOSE","LORDS","LORRY","LOSER","LOUSY","LOVED","LOVES","LOWER",
"LUCKY","LUMPS","LUMPY","LUNCH","LUNGS","LURCH","LYING","MADAM","MAGIC",
"MAGNA","MAJOR","MAKER","MAKES","MANIC","MARCH","MARKS","MARRY","MARSH",
"MATCH","MAYBE","MAZES","MEALS","MEANS","MEANT","MEATY","MEDIA","MEETS",
"MELON","MEMOS","MENUS","MERRY","MESON","MESSY","METAL","MICRO","MIGHT",
"MILES","MINCE","MINDS","MINES","MINOR","MINUS","MISTS","MISTY","MIXED",
"MODEL","MOIST","MONEY","MONKS","MONTH","MOODS","MOONS","MOPED","MORAL",
"MOSES","MOTEL","MOTOR","MOTTO","MOUSE","MOUTH","MOVED","MOVER","MOVES",
"MOVIE","MOWER","MUDDY","MULTI","MURAL","MURKY","MUSED","MUSIC","MUSTY",
"MUTED","NAIVE","NAKED","NAMED","NAMES","NANCY","NASTY","NAVEL","NEEDS",
"NERVE","NEVER","NEWLY","NICER","NIFTY","NIGHT","NOBLE","NOISE","NOISY",
"NORTH","NOTES","NYLON","OBEYS","OCCUR","OCEAN","ODDLY","OFFER","OFTEN",
"OILED","OLDER","OLIVE","OMITS","OOZED","OPENS","OPERA","OPTED","OPTIC",
"ORBIT","ORDER","ORGAN","ORION","OTHER","OTTER","OUGHT","OUTER","OWNED",
"OWNER","OZONE","PACED","PACES","PACKS","PADDY","PAGES","PAINS","PAINT",
"PAIRS","PALMS","PANEL","PANIC","PAPER","PARKS","PARTS","PARTY","PATCH",
"PATHS","PAULA","PAUSE","PAVED","PEACE","PEAKS","PEARS","PEDAL","PENCE",
"PENNY","PERCH","PERIL","PERKY","PETER","PETTY","PHASE","PHONE","PHOTO",
"PIECE","PIGGY","PILED","PILES","PILLS","PILOT","PINTS","PIOUS","PIPED",
"PIPER","PIPES","PITCH","PIZZA","PLACE","PLAIN","PLANE","PLANK","PLANS",
"PLANT","PLATE","PLAYS","PLAZA","PLEAD","PLIED","PLUCK","PLUSH","PLUTO",
"POEMS","POETS","POINT","POKED","POLES","POOLS","PORED","PORTS","POSSE",
"POUCH","POUND","POWER","PRESS","PRICE","PRIDE","PRIME","PRINT","PRIOR",
"PRISM","PRIZE","PROBE","PRONE","PRONG","PROOF","PROUD","PROVE","PROWL",
"PULSE","PUMPS","PUNCH","PUPPY","PUTTY","QUARK","QUEST","QUEUE","QUICK",
"QUIET","QUILL","QUITE","QUOTE","RACED","RACES","RACKS","RADIO","RAGED",
"RAGES","RAINS","RAISE","RAKED","RANGE","RANKS","RAPID","RAVED","REACH",
"REACT","READY","REDLY","REEDS","REFER","RELAX","RENEW","RENTS","REPLY",
"RESET","RIDES","RIDGE","RIGHT","RIGID","RINGS","RIOTS","RISEN","RISES",
"RISKS","RIVAL","RIVER","ROADS","ROAST","ROBED","ROBES","ROBOT","ROCKS",
"ROCKY","ROLLS","ROOMS","ROOTS","ROSES","ROUGH","ROUND","ROUTE","ROYAL",
"RUINS","RULED","RULER","RULES","RUSTS","RUSTY","SADLY","SAFER","SAGES",
"SAINT","SALAD","SALES","SALLY","SANDS","SANDY","SANER","SANTA","SAUCE",
"SAVED","SAVES","SAWED","SCALE","SCALP","SCALY","SCARE","SCARF","SCARS",
"SCARY","SCENE","SCENT","SCOOP","SCOPE","SCORE","SCOUT","SCOWL","SCREW",
"SCRUB","SEALS","SEAMS","SEATS","SEEDS","SEEDY","SEEMS","SEERS","SEIZE",
"SELLS","SENDS","SENSE","SERVE","SETUP","SEVEN","SHACK","SHADE","SHADY",
"SHAKE","SHAKY","SHALL","SHAME","SHAPE","SHARD","SHARE","SHARK","SHARP",
"SHEAF","SHEEN","SHEEP","SHEER","SHEET","SHELF","SHIED","SHIFT","SHINE",
"SHINY","SHIPS","SHIRT","SHOAL","SHOCK","SHOES","SHONE","SHOOK","SHOOT",
"SHOPS","SHORE","SHORT","SHOUT","SHOVE","SHOWN","SHOWS","SHRUG","SHUTS",
"SIDES","SIEVE","SIGHT","SIGNS","SILKY","SILLY","SIMON","SINAI","SINCE",
"SINKS","SIXTH","SIXTY","SIZED","SKIES","SKILL","SKINS","SKIPS","SKULL",
"SLANG","SLASH","SLATE","SLEEK","SLEEP","SLEPT","SLICE","SLIDE","SLIME",
"SLIMY","SLITS","SLOPE","SLUMP","SLUNG","SMACK","SMALL","SMART","SMASH",
"SMELL","SMELT","SMILE","SMIRK","SMITH","SMOKE","SNARL","SNEAK","SNEER",
"SNIFF","SNOWS","SNOWY","SOBER","SOCKS","SOFAS","SOGGY","SOLAR","SOLES",
"SOLID","SOLVE","SONGS","SONIC","SONNY","SORRY","SORTS","SOULS","SOUND",
"SOUTH","SPACE","SPANS","SPARE","SPASM","SPEAK","SPEAR","SPECK","SPEED",
"SPELL","SPEND","SPENT","SPIKE","SPILL","SPILT","SPINE","SPITE","SPLIT",
"SPOIL","SPOKE","SPOON","SPORT","SPOTS","SPOUT","SPRAY","SQUAD","SQUAT",
"STACK","STAFF","STAGE","STAIR","STAKE","STALE","STALK","STALL","STAMP",
"STAND","STARE","STARK","STARS","START","STATE","STAYS","STEAD","STEAK",
"STEAL","STEAM","STEEL","STEEP","STEER","STEPS","STERN","STEVE","STICK",
"STILL","STING","STINT","STOCK","STOLE","STOMP","STONE","STONY","STOOD",
"STOPS","STORE","STORM","STORY","STOUT","STOVE","STRAW","STRAY","STRIP",
"STRUT","STUCK","STUDY","STUFF","STUMP","STUNG","STUNT","STYLE","SUGAR",
"SUING","SUITE","SUITS","SUNNY","SUPER","SURGE","SURLY","SWAMP","SWARM",
"SWEAR","SWEAT","SWEEP","SWEET","SWELL","SWEPT","SWIFT","SWING","SWISH",
"SWISS","SWOON","SWOOP","SWORE","SWORN","SWUNG","SYRUP","TABLE","TAINT",
"TAKEN","TAKES","TALES","TALKS","TALLY","TANKS","TAPES","TASTE","TAXIS",
"TEACH","TEAMS","TEARS","TEASE","TEETH","TELLS","TENDS","TENEX","TENOR",
"TENSE","TENTH","TERMS","TESTS","THANK","THATS","THEFT","THEIR","THEME",
"THERE","THESE","THICK","THIEF","THIGH","THING","THINK","THIRD","THOSE",
"THREE","THREW","THROB","THROW","THUDS","THUGS","THUMB","THUMP","TIDAL",
"TIDES","TIGHT","TILES","TIMER","TIMES","TIRED","TITAN","TITLE","TOAST",
"TODAY","TOKEN","TOMBS","TONES","TONGS","TONIC","TOOLS","TOOTH","TORCH",
"TOTAL","TOUCH","TOUGH","TOWEL","TOWER","TOWNS","TOYED","TRACE","TRACK",
"TRACT","TRADE","TRAIL","TRAIN","TRAMP","TRASH","TREAD","TREES","TRESS",
"TRIAL","TRIBE","TRICK","TRIED","TRIES","TRUCK","TRULY","TRUNK","TRUST",
"TRUTH","TUBES","TUNED","TURNS","TWANG","TWICE","TWIST","TYING","TYPES",
"ULTRA","UNDER","UNION","UNITS","UNTIL","UPPER","UPSET","URGED","USAGE",
"USERS","USHER","USING","USUAL","UTTER","VAGUE","VALUE","VAULT","VENUS",
"VERBS","VERSE","VESTS","VEXED","VIDEO","VIEWS","VILLA","VIRGO","VIRUS",
"VISIT","VITAL","VIVID","VOCAL","VOICE","VOTED","VOWED","WADED","WAIST",
"WALES","WALLS","WANED","WANLY","WANTS","WASPS","WASTE","WATCH","WATER",
"WAVED","WAVER","WAVES","WAYNE","WEARY","WEAVE","WEEDS","WEEKS","WEIRD",
"WETLY","WHACK","WHALE","WHEEL","WHERE","WHICH","WHILE","WHINE","WHIPS",
"WHITE","WHOLE","WHOOP","WHOSE","WIDER","WIDTH","WIELD","WILLS","WINDS",
"WINDY","WINES","WINGS","WIPED","WIPER","WIRES","WISER","WISPS","WIVES",
"WOMAN","WOMEN","WOODS","WOODY","WORDS","WORKS","WORLD","WORRY","WORSE",
"WORST","WORTH","WOULD","WOUND","WRAPS","WRECK","WREST","WRIST","WRITE",
"WRONG","WROTE","YARDS","YEARS","YIELD","YOUNG","YOURS","YOUTH","ZAIRE",
"ZEBRA","ZONES",NULL};
static const char *const CW_CW_WORDS[] = {
"(","+","73","88","AA","AB","ABT","ADR","AGN","AM","ANT","AS","B4","BCI",
"BCL","BK","BN","BUG","C","CFM","CL","CLD","CLG","CQ","CW","DLD","DLVD",
"DR","DX","ES","FB","FM","GA","GM","GN","GND","GUD","HI","HR","HV","HW",
"K","LID","MA","MILS","MSG","N","NCS","ND","NIL","NM","NR","NW","OB","OC",
"OM","OP","OPR","OT","PBL","PSE","PWR","PX","QRG","QRH","QRI","QRJ","QRK",
"QRL","QRM","QRN","QRO","QRP","QRQ","QRS","QRT","QRU","QRV","QRW","QRX",
"QRY","QRZ","QSA","QSB","QSD","QSG","QSK","QSL","QSM","QSN","QSO","QSP",
"QST","QSU","QSW","QSX","QSY","QSZ","QTA","QTB","QTC","QTH","QTR","R",
"RCD","RCVR","REF","RFI","RIG","RTTY","RX","SASE","SED","SIG","SKED","SRI",
"SSB","SVC","T","TFC","TKS","TMW","TNX","TT","TU","TVI","TX","TXT","UR",
"URS","VFO","VY","WA","WB","WD","WDS","WKD","WKG","WL","WUD","WX","XCVR",
"XMTR","XTAL","XYL","YL","BURO","HPE","CU","SN","TEST","TEMP","MNI","RST",
"599","5NN","559","CPY","DE","OK","RPT","ANI","BCNU","BD","BLV","CC","CK",
"CNT","CO","CONDX","CPSE","CRD","CUD","CUAGN","CUL","ELBUG","ENUF","FER",
"FONE","FREQ","GB","GD","GE","HVY","II","INPT","LSN","PA","PP","RPRT","RPT",
"SA","STN","SUM","SWL","TRX","WID",NULL};
static const char *const CW_PARIS[] = {"PARIS",NULL};
#endif /* _CWWORDS_H */
unixcw-3.0.2/src/cwutils/memory.h 0000644 0001750 0001750 00000002133 11702277360 016621 0 ustar acerion acerion /*
* Copyright (C) 2001-2006 Simon Baldwin (simon_baldwin@yahoo.com)
* Copyright (C) 2011-2012 Kamil Ignacak (acerion@wp.pl)
*
* 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.
*/
#ifndef _CWMEMORY_H
#define _CWMEMORY_H
#if defined(__cplusplus)
extern "C" {
#endif
void *safe_malloc (size_t size);
void *safe_realloc (void *ptr, size_t size);
char *safe_strdup (const char *s);
#if defined(__cplusplus)
}
#endif
#endif /* _CWMEMORY_H */
unixcw-3.0.2/src/cwutils/copyright.h 0000644 0001750 0001750 00000002740 11702277475 017334 0 ustar acerion acerion /*
* Copyright (C) 2001-2006 Simon Baldwin (simon_baldwin@yahoo.com)
* Copyright (C) 2011-2012 Kamil Ignacak (acerion@wp.pl)
*
* 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.
*/
#ifndef _CWCOPYRIGHT_H
#define _CWCOPYRIGHT_H
#include "i18n.h"
#if defined(__cplusplus)
extern "C" {
#endif
static const char *const CW_COPYRIGHT =
N_("Copyright (C) 2001-2006 Simon Baldwin\n"
"Copyright (C) 2011-2012 Kamil Ignacak\n\n"
"This program comes with ABSOLUTELY NO WARRANTY; for details please see\n"
"the file 'COPYING' supplied with the source code. This is free software,\n"
"and you are welcome to redistribute it under certain conditions; again,\n"
"see 'COPYING' for details. This program is released under the GNU General\n"
"Public License.\n");
#if defined(__cplusplus)
}
#endif
#endif /* _CWCOPYRIGHT_H */
unixcw-3.0.2/src/cwutils/memory.c 0000644 0001750 0001750 00000003705 11702277365 016627 0 ustar acerion acerion /*
* Copyright (C) 2001-2006 Simon Baldwin (simon_baldwin@yahoo.com)
* Copyright (C) 2011-2012 Kamil Ignacak (acerion@wp.pl)
*
* 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.
*/
#include "../config.h"
#include
#include
#if defined(HAVE_STRING_H)
# include
#endif
#if defined(HAVE_STRINGS_H)
# include
#endif
#include "memory.h"
/*---------------------------------------------------------------------*/
/* Memory allocation wrappers */
/*---------------------------------------------------------------------*/
/*
* safe_malloc()
* safe_realloc()
* safe_strdup()
*
* Non-failing wrappers around malloc(), realloc(), and strdup().
*/
void *
safe_malloc (size_t size)
{
void *pointer;
pointer = malloc (size);
if (!pointer)
{
perror ("malloc");
exit (EXIT_FAILURE);
}
return pointer;
}
void *
safe_realloc (void *ptr, size_t size)
{
void *pointer;
pointer = realloc (ptr, size);
if (!pointer)
{
perror ("realloc");
exit (EXIT_FAILURE);
}
return pointer;
}
char *
safe_strdup (const char *s)
{
char *copy;
copy = malloc (strlen (s) + 1);
if (!copy)
{
perror ("strdup");
exit (EXIT_FAILURE);
}
strcpy (copy, s);
return copy;
}
unixcw-3.0.2/src/cwutils/cmdline.h 0000644 0001750 0001750 00000003053 11702277511 016724 0 ustar acerion acerion /*
* Copyright (C) 2001-2006 Simon Baldwin (simon_baldwin@yahoo.com)
* Copyright (C) 2011-2012 Kamil Ignacak (acerion@wp.pl)
*
* 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.
*/
#ifndef _CWCMDLINE_H
#define _CWCMDLINE_H
#include
#include "cw_common.h" /* cw_config_t */
#if defined(__cplusplus)
extern "C" {
#endif
extern const char *program_basename(const char *argv0);
extern void combine_arguments(const char *env_variable,
int argc, char *const argv[],
int *new_argc, char **new_argv[]);
extern int cw_process_argv(int argc, char *const argv[], const char *options, cw_config_t *config);
extern bool has_longopts(void);
extern int get_option(int argc, char *const argv[],
const char *descriptor,
int *option, char **argument);
extern int get_optind(void);
#if defined(__cplusplus)
}
#endif
#endif /* _CWCMDLINE_H */
unixcw-3.0.2/src/cwutils/cw_common.h 0000644 0001750 0001750 00000004575 11702277450 017306 0 ustar acerion acerion /*
* Copyright (C) 2001-2006 Simon Baldwin (simon_baldwin@yahoo.com)
* Copyright (C) 2011-2012 Kamil Ignacak (acerion@wp.pl)
*
* 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.
*/
#ifndef _CW_COMMON_H
#define _CW_COMMON_H
#if defined(__cplusplus)
extern "C" {
#endif
#define CW_PRACTICE_TIME_MIN 1
#define CW_PRACTICE_TIME_MAX 99
#define CW_PRACTICE_TIME_INITIAL 15
#define CW_PRACTICE_TIME_STEP 1
typedef struct {
int audio_system;
char *audio_device;
int send_speed;
int frequency;
int volume;
int gap;
int weighting;
int practice_time;
char *input_file;
char *output_file;
int is_cw;
int has_practice_time;
int has_outfile;
bool has_infile;
/*
* Program-specific state variables, settable from the command line, or from
* embedded input stream commands. These options may be set by the embedded
* command parser to values other than strictly TRUE or FALSE; all non-zero
* values are equivalent to TRUE.
*
* These fields are used only in cw.
*/
int do_echo; /* Echo characters */
int do_errors; /* Print error messages to stderr */
int do_commands; /* Execute embedded commands */
int do_combinations; /* Execute [...] combinations */
int do_comments; /* Allow {...} as comments */
} cw_config_t;
extern void cw_print_help(const char *program_name, cw_config_t *config);
extern cw_config_t *cw_config_new(void);
extern void cw_config_delete(cw_config_t **config);
extern int cw_config_is_valid(cw_config_t *config);
extern int cw_generator_new_from_config(cw_config_t *config, const char *argv0);
extern void cw_start_beep(void);
extern void cw_end_beep(void);
#if defined(__cplusplus)
}
#endif
#endif /* _CW_COMMON_H */
unixcw-3.0.2/src/libcw/ 0000755 0001750 0001750 00000000000 11767330325 014551 5 ustar acerion acerion unixcw-3.0.2/src/libcw/Makefile 0000644 0001750 0001750 00000010105 11767330325 016206 0 ustar acerion acerion # Copyright (C) 2001-2006 Simon Baldwin (simon_baldwin@yahoo.com)
# Copyright (C) 2011-2012 Kamil Ignacak (acerion@wp.pl)
#
# 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.
#
include ../../Makefile.inc
CC = $(AC_CC)
CFLAGS = $(AC_CFLAGS) $(AC_CFLAG_PIC) $(AC_DEFS)
AWK = $(AC_AWK)
RANLIB = $(AC_RANLIB)
LD = $(AC_LD)
LN_S = $(AC_LN_S)
GZIP = $(AC_GZIP)
LDCONFIG= $(AC_LDCONFIG)
CC_LINKS_SO = $(AC_CC_LINKS_SO)
LD_LINKS_SO = $(AC_LD_LINKS_SO)
SHELL = /bin/sh
COMMON_LIBS = -lm -lpthread -lasound
default: all
all: libcw.a libcw.so.3.0.1 libcw.so.3 libcw.so libcw.pc libcw.3 libcwtest
# Build the static and shared libraries.
libcw.a: libcw.o
rm -f libcw.a; ar -cr libcw.a libcw.o
$(RANLIB) libcw.a
libcw.so.3.0.1: libcw.o
if [ "$(CC_LINKS_SO)" = "yes" ]; then \
$(CC) $(LDFLAGS) -shared -Wl,-soname,libcw.so.3 \
-o libcw.so.3.0.1 libcw.o $(COMMON_LIBS); \
else \
if [ "$(LD_LINKS_SO)" = "yes" ]; then \
$(LD) $(LDFLAGS) -G -Wl,-soname,libcw.so.3 \
-o libcw.so.3.0.1 libcw.o $(COMMON_LIBS); \
fi \
fi
libcw.so.3: libcw.so.3.0.1
$(LN_S) -f libcw.so.3.0.1 libcw.so.3
libcw.so: libcw.so.3.0.1
$(LN_S) -f libcw.so.3.0.1 libcw.so
# Build the library man page.
libcw.3: libcw.3.m4 libcw.c
$(AWK) -f libdoc.awk signatures
$(AWK) -f libdoc.awk functions
$(AWK) -f include.awk libcw.3
rm -f signatures functions
# Build the unit test.
libcwtest: libcwtest.o
$(CC) -o libcwtest libcwtest.o -L. -lcw
# Build the pkgconfig metadata file.
libcw.pc:
$(AWK) -vprefix="$(prefix)" -v exec_prefix="$(exec_prefix)" \
-vlibdir="$(libdir)" -v includedir="$(includedir)" \
-vstrip="$$RPM_BUILD_ROOT" \
-vconfig_h="../config.h" -f libpc.awk >libcw.pc
# Define dependencies related to header/include files.
libcw.o: Makefile libcw.h
libcwtest.o: Makefile libcw.h
# Install targets.
install: all
$(INSTALL) -d $(includedir) $(libdir) $(mandir)/man3 $(mandir)/man7 \
$(libdir)/pkgconfig
$(INSTALL_DATA) libcw.h $(includedir)/libcw.h
$(INSTALL_DATA) libcw.a $(libdir)/libcw.a
if [ "$(CC_LINKS_SO)" = "yes" -o "$(LD_LINKS_SO)" = "yes" ]; then \
$(INSTALL_PROGRAM) libcw.so.3.0.1 $(libdir)/libcw.so.3.0.1; \
$(LN_S) -f libcw.so.3.0.1 $(libdir)/libcw.so.3; \
$(LN_S) -f libcw.so.3.0.1 $(libdir)/libcw.so; \
$(LDCONFIG) -n $(libdir); \
fi
$(INSTALL_DATA) libcw.3 $(mandir)/man3/libcw.3
$(GZIP) -f -9 $(mandir)/man3/libcw.3
$(INSTALL_DATA) cw.7 $(mandir)/man7/cw.7
$(GZIP) -f -9 $(mandir)/man7/cw.7
$(INSTALL_DATA) cw.7 $(mandir)/man7/CW.7
$(GZIP) -f -9 $(mandir)/man7/CW.7
$(INSTALL_DATA) libcw.pc $(libdir)/pkgconfig/libcw.pc
install-strip:
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install
uninstall:
rm -f $(includedir)/libcw.h
rm -f $(libdir)/libcw.a
rm -f $(libdir)/libcw.so $(libdir)/libcw.so.3 $(libdir)/libcw.so.3.0.1
$(LDCONFIG) -n $(libdir)
rm -f $(mandir)/man3/libcw.3 $(mandir)/man3/libcw.3.gz
rm -f $(mandir)/man7/cw.7 $(mandir)/man7/cw.7.gz
rm -f $(mandir)/man7/CW.7 $(mandir)/man7/CW.7.gz
rm -f $(libdir)/pkgconfig/libcw.pc
# Cleanup targets.
clean:
rm -f libcw.a libcw.so libcw.so.3 libcw.so.3.0.1 *.s libcw.pc *.o
rm -f libcw.3 signatures functions
rm -f libcwtest
rm -f core core.*
distclean: clean
rm -f Makefile.port
mostlyclean: clean
maintainer-clean: distclean
# Test targets.
check: all libcwtest
-LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH ./libcwtest
# Unimplemented targets.
TAGS:
info:
dvi:
dist:
unixcw-3.0.2/src/libcw/include.awk 0000644 0001750 0001750 00000003174 11702277766 016715 0 ustar acerion acerion #!/bin/awk -f
#
# Copyright (C) 2001-2006 Simon Baldwin (simon_baldwin@yahoo.com)
# Copyright (C) 2011-2012 Kamil Ignacak (acerion@wp.pl)
#
# 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.
#
#
# AWK script to replicate just the include() function of m4. This avoids
# the need for a full m4 binary; overkill for what we really need.
#
# Catch 'include(...)' special lines; watch out, mawk doesn't support
# POSIX character classes (http://ubuntuforums.org/archive/index.php/t-619985.html)
/^include\([^\)]*\)$/ {
# Find the name of the file being included.
file = $0
sub(/^include\(/, "", file)
sub(/\)$/, "", file)
# Read in each line of the file, and print it out.
while ((status=getline line 0)
print line
close (file)
# Check for read or general getline error.
if (status != 0)
{
printf ("Error reading file %s: %s\n", file, ERRNO) | "cat 1>&2"
exit 1
}
next
}
# Pass unchanged all lines that don't look like 'include(...)'
{
print $0
}
unixcw-3.0.2/src/libcw/libcw.c 0000644 0001750 0001750 00000611545 11702303336 016020 0 ustar acerion acerion /*
* Copyright (C) 2001-2006 Simon Baldwin (simon_baldwin@yahoo.com)
* Copyright (C) 2011-2012 Kamil Ignacak (acerion@wp.pl)
*
* 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.
*/
#define _BSD_SOURCE /* usleep() */
#define _POSIX_SOURCE /* signaction() */
#include "../config.h"
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#ifndef M_PI /* C99 may not define M_PI */
#define M_PI 3.14159265358979323846
#endif
#if (defined(__unix__) || defined(unix)) && !defined(USG)
# include
#endif
#if defined(HAVE_STRING_H)
# include
#endif
#if defined(HAVE_STRINGS_H)
# include
#endif
#if defined(HAVE_SYS_KD_H)
# include
#elif defined(HAVE_SYS_VTKD_H)
# include
#elif defined(HAVE_SYS_KBIO_H)
# include
#endif
#if defined(HAVE_SYS_SOUNDCARD_H)
# include
#elif defined(HAVE_SOUNDCARD_H)
# include
#else
# error "Neither sys/soundcard.h nor soundcard.h header file available"
#endif
#if defined(BSD)
# define ERR_NO_SUPPORT EPROTONOSUPPORT
#else
# define ERR_NO_SUPPORT EPROTO
#endif
#include "libcw.h"
#include "../cwutils/copyright.h" /* I will get rid of this access path once I will update build system, promise ;) */
struct cw_gen_struct {
cw_sample_t *buffer;
int buffer_n_samples;
/* none/console/OSS/ALSA */
int audio_system;
/* true/false */
int audio_device_open;
/* Path to console file, or path to OSS soundcard file,
or ALSA sound device name. */
char *audio_device;
/* output file descriptor for audio data (console, OSS) */
int audio_sink;
/* output handle for audio data (ALSA) */
snd_pcm_t *alsa_handle;
/* output file descriptor for debug data (console, OSS) */
int debug_sink;
int volume; /* this is the level of sound that you want to have */
int frequency; /* this is the frequency of sound that you want to generate */
int sample_rate; /* set to the same value of sample rate as
you have used when configuring sound card */
int slope; /* used to control initial and final phase of
non-zero-amplitude sine wave; slope/attack
makes it possible to start or end a wave
without clicks;
this field provides a very convenient way to
turn on/off a sound, just assign:
+CW_OSS_GENERATOR_SLOPE to turn sound on,
-CW_OSS_GENERATOR_SLOPE to turn sound off */
/* start/stop flag;
set to 1 before creating generator;
set to 0 to stop generator; generator gets "destroyed"
handling the flag is wrapped in cw_oss_start_generator()
and cw_oss_stop_generator() */
int generate;
/* these are generator's internal state variables; */
int amplitude; /* current amplitude of generated sine wave
(as in x(t) = A * sin(t)); in fixed/steady state
the amplitude is either zero or .volume */
double phase_offset;
double phase;
/* Thread function is used to generate sine wave
and write the wave to audio sink. */
pthread_t thread;
pthread_attr_t thread_attr;
int thread_error; /* 0 when no problems, errno when some error occurred */
};
static int cw_open_device_oss(const char *device);
static void cw_close_device_oss(void);
static int cw_open_device_console(const char *device);
static void cw_close_device_console(void);
static int cw_open_device_alsa(const char *device);
static void cw_close_device_alsa(void);
static int cw_set_alsa_hw_params(snd_pcm_t *handle, snd_pcm_hw_params_t *params);
#ifdef CW_DEV
static int cw_print_alsa_params(snd_pcm_hw_params_t *params);
#endif
static int cw_set_audio_device(const char *device);
static void *cw_generator_write_sine_wave_oss(void *arg);
static void *cw_generator_write_sine_wave_alsa(void *arg);
static int cw_generator_calculate_sine_wave(cw_gen_t *gen);
static int cw_generator_calculate_amplitude(cw_gen_t *gen);
static int cw_sound_console_internal(int state);
static int cw_sound_soundcard_internal(int state);
static int cw_release_sound_internal(void);
static int cw_sound_internal(int frequency);
static bool cw_is_debugging_internal(unsigned int flag);
static int cw_open_device_oss_ioctls(int *fd, int *sample_rate);
static const char *cw_lookup_character_internal(char c);
static unsigned int cw_hash_representation_internal(const char *representation);
static char cw_lookup_representation_internal(const char *representation);
static const char *cw_lookup_procedural_character_internal(char c, int *is_usually_expanded);
static void cw_sync_parameters_internal(void);
static void cw_sigalrm_handler_internal(int signal_number);
static int cw_set_timer_internal(int usecs);
static int cw_request_timeout_internal(int usecs, void (*request_handler)(void));
static int cw_release_timeouts_internal(void);
static int cw_check_signal_mask_internal(void);
static int cw_block_signal_internal(int is_block);
static int cw_wait_for_signal_internal(void);
static void cw_finalization_clock_internal(void);
static void cw_schedule_finalization_internal(void);
static void cw_cancel_finalization_internal(void);
static void cw_interpose_signal_handler_internal(int signal_number);
static void cw_key_control_internal(int requested_key_state);
static int cw_get_tone_queue_length_internal(void);
static int cw_next_tone_queue_index_internal(int current);
static void cw_tone_queue_clock_internal(void);
static int cw_enqueue_tone_internal(int usecs, int frequency);
static int cw_send_element_internal(char element);
static int cw_send_representation_internal(const char *representation, int partial);
static int cw_send_character_internal(char c, int partial);
static void cw_set_adaptive_receive_internal(bool flag);
static int cw_validate_timestamp_internal(const struct timeval *timestamp, struct timeval *return_timestamp);
static int cw_compare_timestamps_internal(const struct timeval *earlier, const struct timeval *later);
static int cw_identify_receive_tone_internal(int element_usec, char *representation);
static void cw_update_adaptive_tracking_internal(int element_usec, char element);
static int cw_receive_buffer_element_internal(const struct timeval *timestamp, char element);
static void cw_keyer_clock_internal(void);
static void cw_straight_key_clock_internal(void);
/* Conditional compilation flags */
#define CW_MAIN 0 /* for stand-alone compilation and tests of this file */
#define CW_DEV 0 /* development support */
#define CW_OSS_SET_FRAGMENT 1 /* ioctl(fd, SNDCTL_DSP_SETFRAGMENT, ¶m) */
#define CW_OSS_SET_POLICY 0 /* ioctl(fd, SNDCTL_DSP_POLICY, ¶m) */
#define CW_ALSA_HW_BUFFER_CONFIG 1 /* set up hw buffer parameters, doesn't work 100% correctly (yet) */
/* Generic constants - common for all audio systems (or not used in some of systems) */
static const unsigned int CW_AUDIO_SAMPLE_RATE_A = 44100; /* Primary sound sample rate */
static const unsigned int CW_AUDIO_SAMPLE_RATE_B = 48000; /* Secondary sound sample rate */
static const int CW_AUDIO_CHANNELS = 1; /* Sound in mono */
static const long int CW_AUDIO_VOLUME_RANGE = (1 << 15); /* 2^15 = 32768 */
// enum { CW_AUDIO_GENERATOR_BUF_SIZE = 128 }; /* Size of buffer storing samples, the value works well for both OSS and ALSA */
static const float CW_AUDIO_GENERATOR_SLOPE_RATIO = 1.0; /* ~1.0 for 44.1/48 kHz sample rate */
/* 0Hz = silent 'tone'. */
static const int CW_TONE_SILENT = 0;
/* Constants specific to OSS audio system configuration */
static const int CW_OSS_SETFRAGMENT = 7; /* Sound fragment size, 2^7 samples */
static const int CW_OSS_SAMPLE_FORMAT = AFMT_S16_NE; /* Sound format AFMT_S16_NE = signed 16 bit, native endianess; LE = Little endianess */
/* Constants specific to ALSA audio system configuration */
static const snd_pcm_format_t CW_ALSA_SAMPLE_FORMAT = SND_PCM_FORMAT_S16; /* "Signed 16 bit CPU endian"; I'm guessing that "CPU endian" == "native endianess" */
/* indexed by values of 'enum cw_audio_systems' */
static const char *default_audio_devices[] = {
(char *) NULL,
CW_DEFAULT_CONSOLE_DEVICE,
CW_DEFAULT_OSS_DEVICE,
CW_DEFAULT_ALSA_DEVICE };
/* main data container; this is a global variable in library file,
so in future the variable must be moved from the file to client code;
this is a global variable that should be converted into
a function argument; this pointer should exist only in
client's code, should initially be returned by new(), and
deleted by delete();
TODO: perform the conversion later, when you figure out
ins and outs of the library */
static cw_gen_t *generator = NULL;
/**
\brief Return version number of libcw library
Return the version number of the library.
Version numbers (major and minor) are returned as an int,
composed of major_version << 16 | minor_version.
\return library's major and minor version number encoded as single int
*/
int cw_version(void)
{
unsigned int major = 0, minor = 0;
sscanf(PACKAGE_VERSION, "%u.%u", &major, &minor);
return major << 16 | minor;
}
/**
\brief Print libcw's license text to stdout
Function prints information about libcw version, followed
by short text presenting libcw's copyright and license notice.
*/
void cw_license(void)
{
printf("libcw version %s\n", PACKAGE_VERSION);
printf("%s\n", CW_COPYRIGHT);
return;
}
/* ************************ */
/* Debugging */
/* ************************ */
/* Current debug flags setting; no debug unless requested. */
static unsigned int cw_debug_flags = 0;
/**
\brief Set a value of internal debug flags variable
Assign specified value to library's internal debug flags variable.
Note that this function doesn't *append* given flag to the variable,
it erases existing value and assigns new one. Use cw_get_debug_flags()
if you want to OR new flag with existing ones.
\param new_value - new value to be assigned to the library
*/
void cw_set_debug_flags(unsigned int new_value)
{
cw_debug_flags = new_value;
}
/**
\brief Get current library's debug flags
Function returns value of library's internal debug variable.
\return value of library's debug flags variable
*/
unsigned int cw_get_debug_flags(void)
{
/* TODO: extract reading LIBCW_DEBUG env
variable to separate function. */
static bool is_initialized = false;
if (!is_initialized) {
/* Do not overwrite any debug flags already set. */
if (cw_debug_flags == 0) {
/*
* Set the debug flags from LIBCW_DEBUG. If it is an invalid
* numeric, treat it as 0; there is no error checking.
*/
const char *debug_value = getenv("LIBCW_DEBUG");
if (debug_value) {
cw_debug_flags = strtoul(debug_value, NULL, 0);
}
}
is_initialized = true;
}
return cw_debug_flags;
}
/**
\brief Check if given debug flag is set
Function checks if a specified debug flag is set in internal
variable of libcw library.
\param flag - flag to be checked.
\return true if given flag is set
\return false if given flag is not set
*/
bool cw_is_debugging_internal(unsigned int flag)
{
return cw_get_debug_flags() & flag;
}
/* macro supporting multiple arguments */
#define cw_debug(flag, ...) \
{ \
if (cw_is_debugging_internal(flag)) { \
fprintf(stderr, "libcw: "); \
fprintf(stderr, __VA_ARGS__); \
fprintf(stderr, "\n"); \
} \
}
/* Debugging message for library developer */
#if CW_DEV
#define cw_dev_debug(...) \
{ \
fprintf(stderr, "libcw: "); \
fprintf(stderr, "%s: %d: ", __func__, __LINE__); \
fprintf(stderr, __VA_ARGS__); \
fprintf(stderr, "\n"); \
}
#else
#define cw_dev_debug(...) {}
#endif
/*---------------------------------------------------------------------*/
/* Core Morse code data and lookup */
/*---------------------------------------------------------------------*/
/*
* Morse code characters table. This table allows lookup of the Morse shape
* of a given alphanumeric character. Shapes are held as a string, with '-'
* representing dash, and '.' representing dot. The table ends with a NULL
* entry.
*/
typedef struct
{
const char character; /* Character represented */
const char *const representation; /* Dot-dash shape of the character */
} cw_entry_t;
static const cw_entry_t CW_TABLE[] = {
/* ASCII 7bit letters */
{'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', "--.."},
/* Numerals */
{'0', "-----"}, {'1', ".----"}, {'2', "..---"},
{'3', "...--"}, {'4', "....-"}, {'5', "....."},
{'6', "-...."}, {'7', "--..."}, {'8', "---.."},
{'9', "----."},
/* Punctuation */
{'"', ".-..-."}, {'\'', ".----."}, {'$', "...-..-"},
{'(', "-.--."}, {')', "-.--.-"}, {'+', ".-.-."},
{',', "--..--"}, {'-', "-....-"}, {'.', ".-.-.-"},
{'/', "-..-."}, {':', "---..."}, {';', "-.-.-."},
{'=', "-...-"}, {'?', "..--.."}, {'_', "..--.-"},
{'@', ".--.-."},
/* ISO 8859-1 accented characters */
{'\334', "..--"}, /* U with diaeresis */
{'\304', ".-.-"}, /* A with diaeresis */
{'\307', "-.-.."}, /* C with cedilla */
{'\326', "---."}, /* O with diaeresis */
{'\311', "..-.."}, /* E with acute */
{'\310', ".-..-"}, /* E with grave */
{'\300', ".--.-"}, /* A with grave */
{'\321', "--.--"}, /* N with tilde */
/* ISO 8859-2 accented characters */
{'\252', "----"}, /* S with cedilla */
{'\256', "--..-"}, /* Z with dot above */
/* Non-standard procedural signal extensions to standard CW characters. */
{'<', "...-.-"}, /* VA/SK, end of work */
{'>', "-...-.-"}, /* BK, break */
{'!', "...-."}, /* SN, understood */
{'&', ".-..."}, /* AS, wait */
{'^', "-.-.-"}, /* KA, starting signal */
{'~', ".-.-.."}, /* AL, paragraph */
/* Sentinel end of table value */
{0, NULL}
};
/**
* Returns the number of characters represented in the character lookup
* table.
*/
int cw_get_character_count(void)
{
static int character_count = 0;
if (character_count == 0)
{
const cw_entry_t *cw_entry;
for (cw_entry = CW_TABLE; cw_entry->character; cw_entry++)
character_count++;
}
return character_count;
}
/**
* Returns into list a string containing all of the Morse characters
* represented in the table. The length of list must be at least one greater
* than the number of characters represented in the character lookup table,
* returned by cw_get_character_count.
*/
void cw_list_characters(char *list)
{
const cw_entry_t *cw_entry;
int index;
/* Append each table character to the output string. */
index = 0;
for (cw_entry = CW_TABLE; cw_entry->character; cw_entry++)
list[index++] = cw_entry->character;
list[index] = '\0';
}
/**
* Returns the string length of the longest representation in the character
* lookup table.
*/
int cw_get_maximum_representation_length(void)
{
static int maximum_length = 0;
if (maximum_length == 0)
{
const cw_entry_t *cw_entry;
/* Traverse the main lookup table, finding the longest. */
for (cw_entry = CW_TABLE; cw_entry->character; cw_entry++)
{
int length;
length = (int) strlen (cw_entry->representation);
if (length > maximum_length)
maximum_length = length;
}
}
return maximum_length;
}
/**
* Look up the given character, and return the representation of that
* character. Returns NULL if there is no table entry for the given
* character.
*/
const char *cw_lookup_character_internal(char c)
{
static const cw_entry_t *lookup[UCHAR_MAX]; /* Fast lookup table */
static bool is_initialized = false;
const cw_entry_t *cw_entry;
/*
* If this is the first call, set up the fast lookup table to give direct
* access to the CW table for a given character.
*/
if (!is_initialized)
{
cw_debug (CW_DEBUG_LOOKUPS, "initialize fast lookup table");
for (cw_entry = CW_TABLE; cw_entry->character; cw_entry++)
lookup[(unsigned char) cw_entry->character] = cw_entry;
is_initialized = true;
}
/*
* There is no differentiation in the table between upper and lower case
* characters; everything is held as uppercase. So before we do the lookup,
* we convert to ensure that both cases work.
*/
c = toupper (c);
/*
* Now use the table to lookup the table entry. Unknown characters return
* NULL, courtesy of the fact that explicitly uninitialized static variables
* are initialized to zero, so lookup[x] is NULL if it's not assigned to in
* the above loop.
*/
cw_entry = lookup[(unsigned char) c];
if (cw_is_debugging_internal (CW_DEBUG_LOOKUPS))
{
if (cw_entry)
fprintf (stderr, "cw: lookup '%c' returned <'%c':\"%s\">\n",
c, cw_entry->character, cw_entry->representation);
else if (isprint (c))
fprintf (stderr, "cw: lookup '%c' found nothing\n", c);
else
fprintf (stderr, "cw: lookup 0x%02x found nothing\n",
(unsigned char) c);
}
return cw_entry ? cw_entry->representation : NULL;
}
/**
* Returns the string 'shape' of a given Morse code character. The routine
* returns true on success, and fills in the string pointer passed in. On
* error, it returns false and sets errno to ENOENT, indicating that the
* character could not be found. The length of representation must be at
* least one greater than the longest representation held in the character
* lookup table, returned by cw_get_maximum_representation_length.
*/
int cw_lookup_character(char c, char *representation)
{
const char *retval;
/* Lookup the character, and if found, return the string. */
retval = cw_lookup_character_internal (c);
if (retval)
{
if (representation)
strcpy (representation, retval);
return CW_SUCCESS;
}
/* Failed to find the requested character. */
errno = ENOENT;
return CW_FAILURE;
}
/**
* Return a hash value, in the range 2-255, for a lookup table representation.
* The routine returns 0 if no valid hash could be made from the string. To
* avoid casting the value a lot in the caller (we want to use it as an array
* index), we actually return an unsigned int.
*
* This hash algorithm is designed ONLY for valid CW representations; that is,
* strings composed of only '.' and '-', and in this case, strings shorter than
* eight characters. The algorithm simply turns the representation into
* a 'bitmask', based on occurrences of '.' and '-'. The first bit set in the
* mask indicates the start of data (hence the 7-character limit). This mask
* is viewable as an integer in the range 2 (".") to 255 ("-------"), and can
* be used as an index into a fast lookup array.
*/
unsigned int cw_hash_representation_internal(const char *representation)
{
int length, index;
unsigned int hash;
/*
* Our algorithm can handle only 7 characters of representation. And we
* insist on there being at least one character, too.
*/
length = (int) strlen (representation);
if (length > CHAR_BIT - 1 || length < 1)
return 0;
/*
* Build up the hash based on the dots and dashes; start at 1, the sentinel
* (start) bit.
*/
hash = 1;
for (index = 0; index < length; index++)
{
/* Left-shift everything so far. */
hash <<= 1;
/*
* If the next element is a dash, OR in another bit. If it is not a
* dash or a dot, then there is an error in the representation string.
*/
if (representation[index] == CW_DASH_REPRESENTATION)
hash |= 1;
else if (representation[index] != CW_DOT_REPRESENTATION)
return 0;
}
return hash;
}
/**
* Look up the given representation, and return the character that it
* represents. Returns zero if there is no table entry for the given
* representation.
*/
char cw_lookup_representation_internal(const char *representation)
{
static const cw_entry_t *lookup[UCHAR_MAX]; /* Fast lookup table */
static bool is_complete = true; /* Set to false if there are any
lookup table entries not in
the fast lookup table */
static bool is_initialized = false;
const cw_entry_t *cw_entry;
unsigned int hash;
/*
* If this is the first call, set up the fast lookup table to give direct
* access to the CW table for a hashed representation.
*/
if (!is_initialized)
{
cw_debug (CW_DEBUG_LOOKUPS, "initialize hash lookup table");
/*
* For each main table entry, create a hash entry. If the hashing
* of any entry fails, note that the table is not complete and ignore
* that entry for now (for the current lookup table, this should not
* happen). The hashed table speeds up lookups of representations by
* a factor of 5-10.
*/
for (cw_entry = CW_TABLE; cw_entry->character; cw_entry++)
{
hash = cw_hash_representation_internal (cw_entry->representation);
if (hash)
lookup[hash] = cw_entry;
else
is_complete = false;
}
if (!is_complete) {
cw_debug (CW_DEBUG_LOOKUPS, "hash lookup table incomplete");
}
is_initialized = true;
}
/* Hash the representation to get an index for the fast lookup. */
hash = cw_hash_representation_internal (representation);
/*
* If the hashed lookup table is complete, we can simply believe any
* hash value that came back. That is, we just use what is at the index
* 'hash', since this is either the entry we want, or NULL.
*/
if (is_complete)
cw_entry = lookup[hash];
else
{
/*
* If the hashed lookup table is not complete, the lookup might still
* have found us the entry we are looking for. Here, we'll check to
* see if it did.
*/
if (hash && lookup[hash] && lookup[hash]->representation
&& strcmp (lookup[hash]->representation, representation) == 0)
{
/* Found it in an incomplete table. */
cw_entry = lookup[hash];
}
else
{
/*
* We have no choice but to search the table entry by entry,
* sequentially, from top to bottom.
*/
for (cw_entry = CW_TABLE; cw_entry->character; cw_entry++)
{
if (strcmp (cw_entry->representation, representation) == 0)
break;
}
/* If we got to the end of the table, return NULL. */
cw_entry = cw_entry->character ? cw_entry : NULL;
}
}
if (cw_is_debugging_internal (CW_DEBUG_LOOKUPS))
{
if (cw_entry)
fprintf (stderr, "cw: lookup [0x%02x]'%s' returned <'%c':\"%s\">\n",
hash, representation,
cw_entry->character, cw_entry->representation);
else
fprintf (stderr, "cw: lookup [0x%02x]'%s' found nothing\n",
hash, representation);
}
return cw_entry ? cw_entry->character : 0;
}
/**
* Checks that the given string is a valid Morse representation. A valid
* string is one composed of only '.' and '-' characters. On success, the
* routine returns true. On error, it returns false, with errno set to EINVAL.
*/
int cw_check_representation(const char *representation)
{
int index;
/* Check the characters in representation. */
for (index = 0; representation[index]; index++)
{
if (representation[index] != CW_DOT_REPRESENTATION
&& representation[index] != CW_DASH_REPRESENTATION)
{
errno = EINVAL;
return CW_FAILURE;
}
}
return CW_SUCCESS;
}
/**
* Returns the character for a given Morse representation. On success, the
* routine returns true, and fills in char *c. On error, it returns false,
* and sets errno to EINVAL if any character of the representation is
* invalid, or ENOENT to indicate that the representation could not be found.
*/
int cw_lookup_representation(const char *representation, char *c)
{
char character;
/* Check the characters in representation. */
if (!cw_check_representation (representation))
{
errno = EINVAL;
return CW_FAILURE;
}
/* Lookup the representation, and if found, return the character. */
character = cw_lookup_representation_internal (representation);
if (character)
{
if (c)
*c = character;
return CW_SUCCESS;
}
/* Failed to find the requested representation. */
errno = ENOENT;
return CW_FAILURE;
}
/*---------------------------------------------------------------------*/
/* Extended Morse code data and lookup */
/*---------------------------------------------------------------------*/
/*
* Ancilliary procedural signals table. This table maps procedural signal
* characters in the main table to their expansions, along with a flag noting
* if the character is usually expanded for display.
*/
typedef struct
{
const char character; /* Character represented */
const char *const expansion; /* Procedural expansion of the character */
const int is_usually_expanded; /* If expanded display is usual */
} cw_prosign_entry_t;
static const cw_prosign_entry_t CW_PROSIGN_TABLE[] = {
/* Standard procedural signals */
{'"', "AF", false}, {'\'', "WG", false}, {'$', "SX", false},
{'(', "KN", false}, {')', "KK", false}, {'+', "AR", false},
{',', "MIM", false}, {'-', "DU", false}, {'.', "AAA", false},
{'/', "DN", false}, {':', "OS", false}, {';', "KR", false},
{'=', "BT", false}, {'?', "IMI", false}, {'_', "IQ", false},
{'@', "AC", false},
/* Non-standard procedural signal extensions to standard CW characters. */
{'<', "VA", true}, /* VA/SK, end of work */
{'>', "BK", true}, /* BK, break */
{'!', "SN", true}, /* SN, understood */
{'&', "AS", true}, /* AS, wait */
{'^', "KA", true}, /* KA, starting signal */
{'~', "AL", true}, /* AL, paragraph */
/* Sentinel end of table value */
{0, NULL, false}
};
/**
* Returns the number of characters represented in the procedural signal
* expansion lookup table.
*/
int cw_get_procedural_character_count(void)
{
static int character_count = 0;
if (character_count == 0)
{
const cw_prosign_entry_t *cw_prosign;
for (cw_prosign = CW_PROSIGN_TABLE; cw_prosign->character; cw_prosign++)
character_count++;
}
return character_count;
}
/**
* Returns into list a string containing all of the Morse characters for which
* procedural expansion are available. The length of list must be at least
* one greater than the number of characters represented in the procedural
* signal expansion lookup table, returned by cw_get_procedural_character_count.
*/
void cw_list_procedural_characters(char *list)
{
const cw_prosign_entry_t *cw_prosign;
int index;
/* Append each table character to the output string. */
index = 0;
for (cw_prosign = CW_PROSIGN_TABLE; cw_prosign->character; cw_prosign++)
list[index++] = cw_prosign->character;
list[index] = '\0';
}
/**
* Returns the string length of the longest expansion in the procedural
* signal expansion table.
*/
int cw_get_maximum_procedural_expansion_length(void)
{
static int maximum_length = 0;
if (maximum_length == 0)
{
const cw_prosign_entry_t *cw_prosign;
/* Traverse the main lookup table, finding the longest. */
for (cw_prosign = CW_PROSIGN_TABLE; cw_prosign->character; cw_prosign++)
{
int length;
length = (int) strlen (cw_prosign->expansion);
if (length > maximum_length)
maximum_length = length;
}
}
return maximum_length;
}
/**
* Look up the given procedural character, and return the expansion of that
* procedural character, with a display hint in is_usually_expanded. Returns
* NULL if there is no table entry for the given character.
*/
const char *cw_lookup_procedural_character_internal(char c, int *is_usually_expanded)
{
static const cw_prosign_entry_t *lookup[UCHAR_MAX]; /* Fast lookup table */
static bool is_initialized = false;
const cw_prosign_entry_t *cw_prosign;
/*
* If this is the first call, set up the fast lookup table to give direct
* access to the procedural expansions table for a given character.
*/
if (!is_initialized)
{
cw_debug (CW_DEBUG_LOOKUPS, "initialize prosign fast lookup table");
for (cw_prosign = CW_PROSIGN_TABLE; cw_prosign->character; cw_prosign++)
lookup[(unsigned char) cw_prosign->character] = cw_prosign;
is_initialized = true;
}
/*
* Lookup the procedural signal table entry. Unknown characters return
* NULL. All procedural signals are non-alphabetical, so no need to use
* any uppercase coercion here.
*/
cw_prosign = lookup[(unsigned char) c];
if (cw_is_debugging_internal (CW_DEBUG_LOOKUPS))
{
if (cw_prosign)
fprintf (stderr, "cw: prosign lookup '%c' returned <'%c':\"%s\":%d>\n",
c, cw_prosign->character,
cw_prosign->expansion, cw_prosign->is_usually_expanded);
else if (isprint (c))
fprintf (stderr, "cw: prosign lookup '%c' found nothing\n", c);
else
fprintf (stderr, "cw: prosign lookup 0x%02x found nothing\n",
(unsigned char) c);
}
/* If found, return any display hint and the expansion; otherwise, NULL. */
if (cw_prosign)
*is_usually_expanded = cw_prosign->is_usually_expanded;
return cw_prosign ? cw_prosign->expansion : NULL;
}
/**
* Returns the string expansion of a given Morse code procedural signal
* character. The routine returns true on success, filling in the string
* pointer passed in and setting is_usuall_expanded to true as a display
* hint for the caller. On error, it returns false and sets errno to ENOENT,
* indicating that the procedural signal character could not be found. The
* length of representation must be at least one greater than the longest
* representation held in the procedural signal character lookup table,
* returned by cw_get_maximum_procedural_expansion_length.
*/
int cw_lookup_procedural_character(char c, char *representation,
int *is_usually_expanded)
{
const char *retval;
int is_expanded;
/* Lookup, and if found, return the string and display hint. */
retval = cw_lookup_procedural_character_internal (c, &is_expanded);
if (retval)
{
if (representation)
strcpy (representation, retval);
if (is_usually_expanded)
*is_usually_expanded = is_expanded;
return CW_SUCCESS;
}
/* Failed to find the requested procedural signal character. */
errno = ENOENT;
return CW_FAILURE;
}
/*
* Phonetics table. Not really CW, but it might be handy to have. The
* table contains ITU/NATO phonetics.
*/
static const char *const CW_PHONETICS[27] = {
"Alfa", "Bravo", "Charlie", "Delta", "Echo", "Foxtrot", "Golf", "Hotel",
"India", "Juliett", "Kilo", "Lima", "Mike", "November", "Oscar", "Papa",
"Quebec", "Romeo", "Sierra", "Tango", "Uniform", "Victor", "Whiskey",
"X-ray", "Yankee", "Zulu", NULL
};
/**
* Returns the string length of the longest phonetic in the phonetics
* lookup table.
*/
int cw_get_maximum_phonetic_length(void)
{
static int maximum_length = 0;
if (maximum_length == 0)
{
int phonetic;
/* Traverse the main lookup table, finding the longest. */
for (phonetic = 0; CW_PHONETICS[phonetic]; phonetic++)
{
int length;
length = (int) strlen (CW_PHONETICS[phonetic]);
if (length > maximum_length)
maximum_length = length;
}
}
return maximum_length;
}
/**
* Returns the phonetic of a given character. The routine returns true on
* success, and fills in the string pointer passed in. On error, it returns
* false and sets errno to ENOENT, indicating that the character could not be
* found. The length of phonetic must be at least one greater than the
* longest phonetic held in the phonetic lookup table, returned by
* cw_get_maximum_phonetic_length.
*/
int cw_lookup_phonetic(char c, char *phonetic)
{
/* Coerce to uppercase, and verify the input argument. */
c = toupper (c);
if (c >= 'A' && c <= 'Z')
{
if (phonetic)
strcpy (phonetic, CW_PHONETICS[c - 'A']);
return CW_SUCCESS;
}
/* No such phonetic. */
errno = ENOENT;
return CW_FAILURE;
}
/*---------------------------------------------------------------------*/
/* Morse code controls and timing parameters */
/*---------------------------------------------------------------------*/
/* Dot length magic number; from PARIS calibration, 1 Dot=1200000/WPM usec. */
enum { DOT_CALIBRATION = 1200000 };
/* Default initial values for library controls. */
enum
{
CW_INITIAL_ADAPTIVE = false, /* Initial adaptive receive setting */
CW_INITIAL_THRESHOLD = (DOT_CALIBRATION / CW_SPEED_INITIAL) * 2,
/* Initial adaptive speed threshold */
CW_INITIAL_NOISE_THRESHOLD = (DOT_CALIBRATION / CW_SPEED_MAX) / 2
/* Initial noise filter threshold */
};
/*
* Library variables, indicating the user-selected parameters for generating
* Morse code output and receiving Morse code input. These values can be
* set by client code; setting them may trigger a recalculation of the low
* level timing values held and set below.
*/
static int cw_send_speed = CW_SPEED_INITIAL,
cw_gap = CW_GAP_INITIAL,
cw_receive_speed = CW_SPEED_INITIAL,
cw_tolerance = CW_TOLERANCE_INITIAL,
cw_weighting = CW_WEIGHTING_INITIAL,
cw_noise_spike_threshold = CW_INITIAL_NOISE_THRESHOLD;
static bool cw_is_adaptive_receive_enabled = CW_INITIAL_ADAPTIVE;
/*
* The following variables must be recalculated each time any of the above
* Morse parameters associated with speeds, gap, tolerance, or threshold
* change. Keeping these in step means that we then don't have to spend time
* calculating them on the fly.
*
* Since they have to be kept in sync, the problem of how to have them
* calculated on first call if none of the above parameters has been
* changed is taken care of with a synchronization flag. Doing this saves
* us from otherwise having to have a 'library initialize' function.
*/
static bool cw_is_in_sync = false; /* Synchronization flag */
/* Sending parameters: */
static int cw_send_dot_length = 0, /* Length of a send Dot, in usec */
cw_send_dash_length = 0, /* Length of a send Dash, in usec */
cw_end_of_ele_delay = 0, /* Extra delay at the end of element */
cw_end_of_char_delay = 0, /* Extra delay at the end of a char */
cw_additional_delay = 0, /* More delay at the end of a char */
cw_end_of_word_delay = 0, /* Extra delay at the end of a word */
cw_adjustment_delay = 0, /* More delay at the end of a word */
/* Receiving parameters: */
cw_receive_dot_length = 0, /* Length of a receive Dot, in usec */
cw_receive_dash_length = 0, /* Length of a receive Dash, in usec */
cw_dot_range_minimum = 0, /* Shortest dot period allowable */
cw_dot_range_maximum = 0, /* Longest dot period allowable */
cw_dash_range_minimum = 0, /* Shortest dot period allowable */
cw_dash_range_maximum = 0, /* Longest dot period allowable */
cw_eoe_range_minimum = 0, /* Shortest end of ele allowable */
cw_eoe_range_maximum = 0, /* Longest end of ele allowable */
cw_eoe_range_ideal = 0, /* Ideal end of ele, for stats */
cw_eoc_range_minimum = 0, /* Shortest end of char allowable */
cw_eoc_range_maximum = 0, /* Longest end of char allowable */
cw_eoc_range_ideal = 0; /* Ideal end of char, for stats */
/*
* Library variable which is automatically maintained from the Morse input
* stream, rather than being settable by the user.
*/
static int cw_adaptive_receive_threshold = CW_INITIAL_THRESHOLD;
/* Initially 2-dot threshold for
adaptive speed */
/**
\brief Get speed limits
Get (through function's arguments) limits on speed of morse code that
can be generated by current generator.
See CW_SPEED_MIN and CW_SPEED_MAX in libcw.h for values.
\param min_speed - minimal allowed speed
\param max_speed - maximal allowed speed
*/
void cw_get_speed_limits(int *min_speed, int *max_speed)
{
if (min_speed) {
*min_speed = CW_SPEED_MIN;
}
if (max_speed) {
*max_speed = CW_SPEED_MAX;
}
return;
}
/**
\brief Get frequency limits
Get (through function's arguments) limits on frequency that can
be generated by current generator.
See CW_FREQUENCY_MIN and CW_FREQUENCY_MAX in libcw.h for values.
\param min_frequency - minimal allowed frequency
\param max_frequency - maximal allowed frequency
*/
void cw_get_frequency_limits(int *min_frequency, int *max_frequency)
{
if (min_frequency) {
*min_frequency = CW_FREQUENCY_MIN;
}
if (max_frequency) {
*max_frequency = CW_FREQUENCY_MAX;
}
return;
}
/**
\brief Get volume limits
Get (through function's arguments) limits on volume of sound
generated by current generator.
See CW_VOLUME_MIN and CW_VOLUME_MAX in libcw.h for values.
\param min_volume - minimal allowed volume
\param max_volume - maximal allowed volume
*/
void cw_get_volume_limits(int *min_volume, int *max_volume)
{
if (min_volume) {
*min_volume = CW_VOLUME_MIN;
}
if (max_volume) {
*max_volume = CW_VOLUME_MAX;
}
return;
}
/**
\brief Get gap limits
Get (through function's arguments) limits on gap in cw signal
generated by current generator.
See CW_GAP_MIN and CW_GAP_MAX in libcw.h for values.
\param min_gap - minimal allowed gap
\param max_gap - maximal allowed gap
*/
void cw_get_gap_limits(int *min_gap, int *max_gap)
{
if (min_gap) {
*min_gap = CW_GAP_MIN;
}
if (max_gap) {
*max_gap = CW_GAP_MAX;
}
return;
}
/**
\brief Get tolerance limits
Get (through function's arguments) limits on 'tolerance' parameter
of current generator.
See CW_TOLERANCE_MIN and CW_TOLERANCE_MAX in libcw.h for values.
\param min_tolerance - minimal allowed tolerance
\param max_tolerance - maximal allowed tolerance
*/
void cw_get_tolerance_limits(int *min_tolerance, int *max_tolerance)
{
if (min_tolerance) {
*min_tolerance = CW_TOLERANCE_MIN;
}
if (max_tolerance) {
*max_tolerance = CW_TOLERANCE_MAX;
}
return;
}
/**
\brief Get weighting limits
Get (through function's arguments) limits on 'weighting' parameter
of current generator.
See CW_WEIGHTING_MIN and CW_WEIGHTING_MAX in libcw.h for values.
\param min_weighting - minimal allowed weighting
\param max_weighting - maximal allowed weighting
*/
void cw_get_weighting_limits(int *min_weighting, int *max_weighting)
{
if (min_weighting) {
*min_weighting = CW_WEIGHTING_MIN;
}
if (max_weighting) {
*max_weighting = CW_WEIGHTING_MAX;
}
return;
}
/**
* Synchronize the dot, dash, end of element, end of character, and end
* of word timings and ranges to new values of Morse speed, 'Farnsworth'
* gap, receive tolerance, or weighting.
*/
void cw_sync_parameters_internal(void)
{
/* Do nothing if we are already synchronized with speed/gap. */
if (!cw_is_in_sync)
{
int unit_length, weighting_length;
/*
* Send parameters:
*
* Set the length of a Dot to be a Unit with any weighting adjustment,
* and the length of a Dash as three Dot lengths. The weighting
* adjustment is by adding or subtracting a length based on 50 % as a
* neutral weighting.
*/
unit_length = DOT_CALIBRATION / cw_send_speed;
weighting_length = (2 * (cw_weighting - 50) * unit_length) / 100;
cw_send_dot_length = unit_length + weighting_length;
cw_send_dash_length = 3 * cw_send_dot_length;
/*
* An end of element length is one Unit, perhaps adjusted, the end of
* character is three Units total, and end of word is seven Units total.
*
* The end of element length is adjusted by 28/22 times weighting
* length to keep PARIS calibration correctly timed (PARIS has 22 full
* units, and 28 empty ones). End of element and end of character
* delays take weightings into account.
*/
cw_end_of_ele_delay = unit_length - (28 * weighting_length) / 22;
cw_end_of_char_delay = 3 * unit_length - cw_end_of_ele_delay;
cw_end_of_word_delay = 7 * unit_length - cw_end_of_char_delay;
cw_additional_delay = cw_gap * unit_length;
/*
* For 'Farnsworth', there also needs to be an adjustment delay added
* to the end of words, otherwise the rhythm is lost on word end. I
* don't know if there is an "official" value for this, but 2.33 or so
* times the gap is the correctly scaled value, and seems to sound
* okay.
*
* Thanks to Michael D. Ivey for identifying this
* in earlier versions of libcw.
*/
cw_adjustment_delay = (7 * cw_additional_delay) / 3;
cw_debug (CW_DEBUG_PARAMETERS, "send usec timings <%d>: %d, %d, %d, %d, %d, %d, %d",
cw_send_speed, cw_send_dot_length, cw_send_dash_length,
cw_end_of_ele_delay, cw_end_of_char_delay,
cw_end_of_word_delay, cw_additional_delay, cw_adjustment_delay);
/*
* Receive parameters:
*
* First, depending on whether we are set for fixed speed or adaptive
* speed, calculate either the threshold from the receive speed, or the
* receive speed from the threshold, knowing that the threshold is
* always, effectively, two dot lengths. Weighting is ignored for
* receive parameters, although the core unit length is recalculated
* for the receive speed, which may differ from the send speed.
*/
unit_length = DOT_CALIBRATION / cw_receive_speed;
if (cw_is_adaptive_receive_enabled)
cw_receive_speed = DOT_CALIBRATION
/ (cw_adaptive_receive_threshold / 2);
else
cw_adaptive_receive_threshold = 2 * unit_length;
/*
* Calculate the basic receive dot and dash lengths.
*/
cw_receive_dot_length = unit_length;
cw_receive_dash_length = 3 * unit_length;
/*
* Set the ranges of respectable timing elements depending very much on
* whether we are required to adapt to the incoming Morse code speeds.
*/
if (cw_is_adaptive_receive_enabled)
{
/*
* For adaptive timing, calculate the Dot and Dash timing ranges
* as zero to two Dots is a Dot, and anything, anything at all,
* larger than this is a Dash.
*/
cw_dot_range_minimum = 0;
cw_dot_range_maximum = 2 * cw_receive_dot_length;
cw_dash_range_minimum = cw_dot_range_maximum;
cw_dash_range_maximum = INT_MAX;
/*
* Make the inter-element gap be anything up to the adaptive
* threshold lengths - that is two Dots. And the end of character
* gap is anything longer than that, and shorter than five dots.
*/
cw_eoe_range_minimum = cw_dot_range_minimum;
cw_eoe_range_maximum = cw_dot_range_maximum;
cw_eoc_range_minimum = cw_eoe_range_maximum;
cw_eoc_range_maximum = 5 * cw_receive_dot_length;
}
else
{
int tolerance;
/*
* For fixed speed receiving, calculate the Dot timing range as the
* Dot length +/- dot*tolerance%, and the Dash timing range as the
* Dash length including +/- dot*tolerance% as well.
*/
tolerance = (cw_receive_dot_length * cw_tolerance) / 100;
cw_dot_range_minimum = cw_receive_dot_length - tolerance;
cw_dot_range_maximum = cw_receive_dot_length + tolerance;
cw_dash_range_minimum = cw_receive_dash_length - tolerance;
cw_dash_range_maximum = cw_receive_dash_length + tolerance;
/*
* Make the inter-element gap the same as the Dot range. Make the
* inter-character gap, expected to be three Dots, the same as Dash
* range at the lower end, but make it the same as the Dash range
* _plus_ the 'Farnsworth' delay at the top of the range.
*
* Any gap longer than this is by implication inter-word.
*/
cw_eoe_range_minimum = cw_dot_range_minimum;
cw_eoe_range_maximum = cw_dot_range_maximum;
cw_eoc_range_minimum = cw_dash_range_minimum;
cw_eoc_range_maximum = cw_dash_range_maximum
+ cw_additional_delay + cw_adjustment_delay;
}
/*
* For statistical purposes, calculate the ideal end of element and
* end of character timings.
*/
cw_eoe_range_ideal = unit_length;
cw_eoc_range_ideal = 3 * unit_length;
cw_debug (CW_DEBUG_PARAMETERS, "receive usec timings <%d>: %d-%d, %d-%d, %d-%d[%d], %d-%d[%d], %d",
cw_receive_speed,
cw_dot_range_minimum, cw_dot_range_maximum,
cw_dash_range_minimum, cw_dash_range_maximum,
cw_eoe_range_minimum, cw_eoe_range_maximum, cw_eoe_range_ideal,
cw_eoc_range_minimum, cw_eoc_range_maximum, cw_eoc_range_ideal,
cw_adaptive_receive_threshold);
/* Set the parameters in sync flag. */
cw_is_in_sync = true;
}
}
/**
* Reset the library speed, frequency, volume, gap, tolerance, weighting,
* adaptive receive, and noise spike threshold to their initial default values:
* send/receive speed 12 WPM, volume 70 %, frequency 800 Hz, gap 0 dots,
* tolerance 50 %, and weighting 50 %.
*/
void cw_reset_send_receive_parameters(void)
{
cw_send_speed = CW_SPEED_INITIAL;
generator->frequency = CW_FREQUENCY_INITIAL;
generator->volume = CW_VOLUME_INITIAL;
cw_gap = CW_GAP_INITIAL;
cw_receive_speed = CW_SPEED_INITIAL;
cw_tolerance = CW_TOLERANCE_INITIAL;
cw_weighting = CW_WEIGHTING_INITIAL;
cw_is_adaptive_receive_enabled = CW_INITIAL_ADAPTIVE;
cw_noise_spike_threshold = CW_INITIAL_NOISE_THRESHOLD;
/* Changes require resynchronization. */
cw_is_in_sync = false;
cw_sync_parameters_internal ();
}
/**
* cw_set_[send_speed|receive_speed|frequency|volume|gap|tolerance|weighting]()
* cw_get_[send_speed|receive_speed|frequency|volume|gap|tolerance|weighting]()
*
* Get and set routines for all the Morse code parameters available to
* control the library. Set routines return true on success, or false on
* failure, with errno set to indicate the problem, usually EINVAL, except for
* cw_set_receive_speed, which returns EINVAL if the new value is
* invalid, or EPERM if the receive mode is currently set for adaptive
* receive speed tracking. Get routines simply return the current value.
*
* The default values of the parameters where none are explicitly set are
* send/receive speed 12 WPM, volume 70 %, frequency 800 Hz, gap 0 dots,
* tolerance 50 %, and weighting 50 %. Note that volume settings are not
* fully possible for the console speaker; in this case, volume settings
* greater than zero indicate console speaker sound is on, and setting volume
* to zero will turn off console speaker sound.
*/
int cw_set_send_speed(int new_value)
{
if (new_value < CW_SPEED_MIN || new_value > CW_SPEED_MAX)
{
errno = EINVAL;
return CW_FAILURE;
}
if (new_value != cw_send_speed)
{
cw_send_speed = new_value;
/* Changes of send speed require resynchronization. */
cw_is_in_sync = false;
cw_sync_parameters_internal ();
}
return CW_SUCCESS;
}
/**
See documentation of cw_set_send_speed() for more information.
*/
int cw_set_receive_speed(int new_value)
{
if (cw_is_adaptive_receive_enabled)
{
errno = EPERM;
return CW_FAILURE;
}
else
{
if (new_value < CW_SPEED_MIN || new_value > CW_SPEED_MAX)
{
errno = EINVAL;
return CW_FAILURE;
}
}
if (new_value != cw_receive_speed)
{
cw_receive_speed = new_value;
/* Changes of receive speed require resynchronization. */
cw_is_in_sync = false;
cw_sync_parameters_internal ();
}
return CW_SUCCESS;
}
/**
\brief Set frequency of current generator
Set frequency of sound wave generated by current generator.
The frequency must be within limits marked by CW_FREQUENCY_MIN
and CW_FREQUENCY_MAX.
The function sets errno to EINVAL on errors.
\param new_value - new value of frequency to be associated with current generator
\return CW_SUCCESS on success
\return CW_FAILURE on failure
*/
int cw_set_frequency(int new_value)
{
if (new_value < CW_FREQUENCY_MIN || new_value > CW_FREQUENCY_MAX) {
errno = EINVAL;
return CW_FAILURE;
} else {
generator->frequency = new_value;
return CW_SUCCESS;
}
}
/**
\brief Set volume of current generator
Set volume of sound wave generated by current generator.
The volume must be within limits marked by CW_VOLUME_MIN and CW_VOLUME_MAX.
The function sets errno to EINVAL on errors.
\param new_value - new value of volume to be associated with current generator
\return CW_SUCCESS on success
\return CW_FAILURE on failure
*/
int cw_set_volume(int new_value)
{
if (new_value < CW_VOLUME_MIN || new_value > CW_VOLUME_MAX) {
errno = EINVAL;
return CW_FAILURE;
} else {
generator->volume = new_value;
return CW_SUCCESS;
}
}
/**
See documentation of cw_set_send_speed() for more information.
*/
int cw_set_gap(int new_value)
{
if (new_value < CW_GAP_MIN || new_value > CW_GAP_MAX)
{
errno = EINVAL;
return CW_FAILURE;
}
if (new_value != cw_gap)
{
cw_gap = new_value;
/* Changes of gap require resynchronization. */
cw_is_in_sync = false;
cw_sync_parameters_internal ();
}
return CW_SUCCESS;
}
/**
See documentation of cw_set_send_speed() for more information.
*/
int cw_set_tolerance(int new_value)
{
if (new_value < CW_TOLERANCE_MIN || new_value > CW_TOLERANCE_MAX)
{
errno = EINVAL;
return CW_FAILURE;
}
if (new_value != cw_tolerance)
{
cw_tolerance = new_value;
/* Changes of tolerance require resynchronization. */
cw_is_in_sync = false;
cw_sync_parameters_internal ();
}
return CW_SUCCESS;
}
/**
See documentation of cw_set_send_speed() for more information.
*/
int cw_set_weighting(int new_value)
{
if (new_value < CW_WEIGHTING_MIN || new_value > CW_WEIGHTING_MAX)
{
errno = EINVAL;
return CW_FAILURE;
}
if (new_value != cw_weighting)
{
cw_weighting = new_value;
/* Changes of weighting require resynchronization. */
cw_is_in_sync = false;
cw_sync_parameters_internal ();
}
return CW_SUCCESS;
}
/**
See documentation of cw_set_send_speed() for more information.
*/
int cw_get_send_speed(void)
{
return cw_send_speed;
}
/**
See documentation of cw_set_send_speed() for more information.
*/
int cw_get_receive_speed(void)
{
return cw_receive_speed;
}
/**
\brief Return frequency of current generator
Function returns 'frequency' parameter of current generator,
even if the generator is stopped, or volume of generated sound is zero.
\return Frequency of current generator
*/
int cw_get_frequency(void)
{
return generator->frequency;
}
/**
\brief Return volume of current generator
Function returns 'volume' parameter of current generator,
even if the generator is stopped.
\return Volume of current generator
*/
int cw_get_volume(void)
{
return generator->volume;
}
/**
See documentation of cw_set_send_speed() for more information.
*/
int cw_get_gap(void)
{
return cw_gap;
}
/**
See documentation of cw_set_send_speed() for more information.
*/
int cw_get_tolerance(void)
{
return cw_tolerance;
}
/**
See documentation of cw_set_send_speed() for more information.
*/
int cw_get_weighting(void)
{
return cw_weighting;
}
/**
* Return the low-level timing parameters calculated from the speed, gap,
* tolerance, and weighting set. Parameter values are returned in
* microseconds. Use NULL for the pointer argument to any parameter value
* not required.
*/
void cw_get_send_parameters(int *dot_usecs, int *dash_usecs,
int *end_of_element_usecs,
int *end_of_character_usecs, int *end_of_word_usecs,
int *additional_usecs, int *adjustment_usecs)
{
cw_sync_parameters_internal ();
if (dot_usecs)
*dot_usecs = cw_send_dot_length;
if (dash_usecs)
*dash_usecs = cw_send_dash_length;
if (end_of_element_usecs)
*end_of_element_usecs = cw_end_of_ele_delay;
if (end_of_character_usecs)
*end_of_character_usecs = cw_end_of_char_delay;
if (end_of_word_usecs)
*end_of_word_usecs = cw_end_of_word_delay;
if (additional_usecs)
*additional_usecs = cw_additional_delay;
if (adjustment_usecs)
*adjustment_usecs = cw_adjustment_delay;
}
/**
See documentation of cw_get_send_parameters() for more information
*/
void cw_get_receive_parameters(int *dot_usecs, int *dash_usecs,
int *dot_min_usecs, int *dot_max_usecs,
int *dash_min_usecs, int *dash_max_usecs,
int *end_of_element_min_usecs,
int *end_of_element_max_usecs,
int *end_of_element_ideal_usecs,
int *end_of_character_min_usecs,
int *end_of_character_max_usecs,
int *end_of_character_ideal_usecs,
int *adaptive_threshold)
{
cw_sync_parameters_internal ();
if (dot_usecs)
*dot_usecs = cw_receive_dot_length;
if (dash_usecs)
*dash_usecs = cw_receive_dash_length;
if (dot_min_usecs)
*dot_min_usecs = cw_dot_range_minimum;
if (dot_max_usecs)
*dot_max_usecs = cw_dot_range_maximum;
if (dash_min_usecs)
*dash_min_usecs = cw_dash_range_minimum;
if (dash_max_usecs)
*dash_max_usecs = cw_dash_range_maximum;
if (end_of_element_min_usecs)
*end_of_element_min_usecs = cw_eoe_range_minimum;
if (end_of_element_max_usecs)
*end_of_element_max_usecs = cw_eoe_range_maximum;
if (end_of_element_ideal_usecs)
*end_of_element_ideal_usecs = cw_eoe_range_ideal;
if (end_of_character_min_usecs)
*end_of_character_min_usecs = cw_eoc_range_minimum;
if (end_of_character_max_usecs)
*end_of_character_max_usecs = cw_eoc_range_maximum;
if (end_of_character_ideal_usecs)
*end_of_character_ideal_usecs = cw_eoc_range_ideal;
if (adaptive_threshold)
*adaptive_threshold = cw_adaptive_receive_threshold;
}
/**
* Set and get the period shorter than which, on receive, received tones are
* ignored. This allows the receive tone functions to apply noise canceling
* for very short apparent tones. For useful results the value should never
* exceed the dot length of a dot at maximum speed; 20,000 microseconds (the
* dot length at 60WPM). Setting a noise threshold of zero turns off receive
* tone noise canceling. The default noise spike threshold is 10,000
* microseconds.
*/
int cw_set_noise_spike_threshold(int threshold)
{
if (threshold < 0)
{
errno = EINVAL;
return CW_FAILURE;
}
cw_noise_spike_threshold = threshold;
return CW_SUCCESS;
}
/**
See documentation of cw_set_noise_spike_threshold() for more information
*/
int cw_get_noise_spike_threshold(void)
{
return cw_noise_spike_threshold;
}
/*---------------------------------------------------------------------*/
/* SIGALRM and timer handling */
/*---------------------------------------------------------------------*/
/* Microseconds in a second, for struct timeval handling. */
static const int USECS_PER_SEC = 1000000;
/*
* The library registers a single central SIGALRM handler. This handler will
* call all of the functions on a list sequentially on each SIGALRM received.
* This is where the list is kept.
*/
enum { SIGALRM_HANDLERS = 32 };
static void (*cw_request_handlers[SIGALRM_HANDLERS])(void);
/*
* Flag to tell us if the SIGALRM handler is installed, and a place to keep
* the old SIGALRM disposition, so we can restore it when the library decides
* it can stop handling SIGALRM for a while.
*/
static bool cw_is_sigalrm_handler_installed = false;
static struct sigaction cw_sigalrm_original_disposition;
/**
* Common SIGALRM handler. This function calls the signal handlers of the
* library subsystems, expecting them to ignore unexpected calls.
*/
void cw_sigalrm_handler_internal(int signal_number)
{
int handler;
/* Avoid compiler warnings about unused argument. */
signal_number = 0;
/*
* Call the known functions that are interested in this signal. Stop on
* the first free slot found; valid because the array is filled in order
* from index 0, and there are no deletions.
*/
for (handler = 0;
handler < SIGALRM_HANDLERS && cw_request_handlers[handler]; handler++)
{
void (*request_handler)(void);
request_handler = cw_request_handlers[handler];
(*request_handler) ();
}
}
/**
* Convenience function to set the itimer for a single shot timeout after a
* given number of microseconds.
*/
int cw_set_timer_internal(int usecs)
{
int status;
struct itimerval itimer;
/* Set up a single shot timeout for the given period. */
itimer.it_interval.tv_sec = 0;
itimer.it_interval.tv_usec = 0;
itimer.it_value.tv_sec = usecs / USECS_PER_SEC;
itimer.it_value.tv_usec = usecs % USECS_PER_SEC;
status = setitimer (ITIMER_REAL, &itimer, NULL);
if (status == -1)
{
perror ("cw: setitimer");
return CW_FAILURE;
}
return CW_SUCCESS;
}
/**
* Install the SIGALRM handler, if not yet installed. Add any given lower
* level handler to the list of registered handlers. Then set an itimer
* to expire after the requested number of microseconds.
*/
int cw_request_timeout_internal(int usecs, void (*request_handler)(void))
{
struct sigaction action;
/* Install the SIGALRM handler if not currently installed. */
if (!cw_is_sigalrm_handler_installed)
{
int status;
/*
* Register the SIGALRM handler routine, and keep the old information
* so we can put it back when useful to do so.
*/
action.sa_handler = cw_sigalrm_handler_internal;
action.sa_flags = SA_RESTART;
sigemptyset (&action.sa_mask);
status = sigaction (SIGALRM, &action, &cw_sigalrm_original_disposition);
if (status == -1)
{
perror ("cw: sigaction");
return CW_FAILURE;
}
cw_is_sigalrm_handler_installed = true;
}
/*
* If it's not already present, and one was given, add the request handler
* address to the list of known handlers.
*/
if (request_handler)
{
int handler;
/*
* Search for this handler, or the first free entry, stopping at the
* last entry in the table even if it's not a match and not free.
*/
for (handler = 0; handler < SIGALRM_HANDLERS - 1; handler++)
{
if (!cw_request_handlers[handler]
|| cw_request_handlers[handler] == request_handler)
break;
}
/*
* If the handler is already there, do no more. Otherwise, if we ended
* the search at an unused entry, add it to the list of lower level
* handlers.
*/
if (cw_request_handlers[handler] != request_handler)
{
if (cw_request_handlers[handler])
{
errno = ENOMEM;
perror ("cw: overflow cw_request_handlers");
return CW_FAILURE;
}
cw_request_handlers[handler] = request_handler;
}
}
/*
* The fact that we receive a call means that something is using timeouts
* and sound, so make sure that any pending finalization doesn't happen.
*/
cw_cancel_finalization_internal ();
/*
* Depending on the value of usec, either set an itimer, or send ourselves
* SIGALRM right away.
*/
if (usecs <= 0)
{
/* Send ourselves SIGALRM immediately. */
if (raise (SIGALRM) != 0)
{
perror ("cw: raise");
return CW_FAILURE;
}
}
else
{
/*
* Set the itimer to produce a single interrupt after the given
* duration.
*/
if (!cw_set_timer_internal (usecs))
return CW_FAILURE;
}
return CW_SUCCESS;
}
/**
* Uninstall the SIGALRM handler, if installed. Return SIGALRM's disposition
* for the system to the state we found it in before we installed our own
* SIGALRM handler.
*/
int cw_release_timeouts_internal(void)
{
/* Ignore the call if we haven't installed our handler. */
if (cw_is_sigalrm_handler_installed)
{
int status;
/* Cancel any pending itimer setting. */
if (!cw_set_timer_internal (0))
return CW_FAILURE;
/* Put back the SIGALRM information saved earlier. */
status = sigaction (SIGALRM, &cw_sigalrm_original_disposition, NULL);
if (status == -1)
{
perror ("cw: sigaction");
return CW_FAILURE;
}
cw_is_sigalrm_handler_installed = false;
}
return CW_SUCCESS;
}
/**
* Check the signal mask of the process, and return an error, with errno
* set to EDEADLK, if SIGALRM is blocked.
*/
int cw_check_signal_mask_internal(void)
{
int status;
sigset_t empty_set, current_set;
/* Block a empty set of signals to obtain the current mask. */
sigemptyset (&empty_set);
status = sigprocmask (SIG_BLOCK, &empty_set, ¤t_set);
if (status == -1)
{
perror ("cw: sigprocmask");
return CW_FAILURE;
}
/* Check that SIGALRM is not blocked in the current mask. */
if (sigismember (¤t_set, SIGALRM))
{
errno = EDEADLK;
return CW_FAILURE;
}
return CW_SUCCESS;
}
/**
* Block SIGALRM for the duration of certain critical sections, or unblock
* after; passed true to block SIGALRM, and false to unblock.
*/
int cw_block_signal_internal(int is_block)
{
int status;
sigset_t block_set;
/* Block or unblock SIGALRM for the process. */
sigemptyset (&block_set);
sigaddset (&block_set, SIGALRM);
status = sigprocmask (is_block ? SIG_BLOCK : SIG_UNBLOCK, &block_set, NULL);
if (status == -1)
{
perror ("cw: sigprocmask");
return CW_FAILURE;
}
return CW_SUCCESS;
}
/**
* Blocks the callback from being called for a critical section of caller
* code if is_block is true, and unblocks the callback if block is false.
* Works by blocking SIGALRM; a block should always be matched by an unblock,
* otherwise the tone queue will suspend forever.
*/
void cw_block_callback(int is_block)
{
cw_block_signal_internal (is_block);
}
/**
* Wait for a signal, usually a SIGALRM. Assumes SIGALRM is not blocked.
*/
int cw_wait_for_signal_internal(void)
{
int status;
sigset_t empty_set, current_set;
/* Block a empty set of signals to obtain the current mask. */
sigemptyset (&empty_set);
status = sigprocmask (SIG_BLOCK, &empty_set, ¤t_set);
if (status == -1)
{
perror ("cw: sigprocmask");
return CW_FAILURE;
}
/* Wait on the current mask. */
status = sigsuspend (¤t_set);
if (status == -1 && errno != EINTR)
{
perror ("cw: sigsuspend");
return CW_FAILURE;
}
return CW_SUCCESS;
}
/*---------------------------------------------------------------------*/
/* Console and soundcard control */
/*---------------------------------------------------------------------*/
/**
\brief Set audio device name or path
Set path to audio device, or name of audio device. The path/name
will be associated with current generator, and used when opening
audio device.
Use this function only when setting up a generator.
Function creates its own copy of input string.
\param device - device to be associated with generator
\return CW_SUCCESS on success
\return CW_FAILURE on errors
*/
int cw_set_audio_device(const char *device)
{
/* this should be NULL, either because it has been
initialized statically as NULL, or set to
NULL by generator destructor */
assert (!generator->audio_device);
assert (generator->audio_system != CW_AUDIO_NONE);
if (generator->audio_system == CW_AUDIO_NONE) {
generator->audio_device = (char *) NULL;
cw_dev_debug ("no audio system specified");
return CW_FAILURE;
}
if (device) {
generator->audio_device = strdup(device);
} else {
generator->audio_device = strdup(default_audio_devices[generator->audio_system]);
}
if (!generator->audio_device) {
cw_debug (CW_DEBUG_SYSTEM, "error: malloc error\n");
return CW_FAILURE;
} else {
return CW_SUCCESS;
}
}
/**
\brief Return char string with console device path
Returned pointer is owned by library.
\return char string with current console device path
*/
const char *cw_get_console_device(void)
{
return generator->audio_device;
}
/**
\brief Return char string with soundcard device name/path
Returned pointer is owned by library.
\return char string with current soudcard device name or device path
*/
const char *cw_get_soundcard_device(void)
{
return generator->audio_device;
}
/**
\brief Start generating a sound using soundcard
Start generating sound on soundcard with frequency depending on
state of current generator. The function has a single argument 'state'.
The argument toggles between zero volume (state == 0)
and full volume (frequency > 0).
The function only initializes generation, you have to do another
function call to change the tone generated.
\param state - toggle between full volume and no volume
\return CW_SUCCESS on success
\return CW_FAILURE on errors
*/
int cw_sound_soundcard_internal(int state)
{
if (generator->audio_system != CW_AUDIO_OSS
&& generator->audio_system != CW_AUDIO_ALSA) {
cw_dev_debug ("called the function for output other than sound card (%d)",
generator->audio_system);
/* Strictly speaking this should be CW_FAILURE, but this
is not a place and time to do anything more. The above
message printed to stderr should be enough to catch
problems during development phase */
return CW_SUCCESS;
}
/* TODO:
With this new scheme of producing a sound the sound is
a bit longer than a dot (or a dash) by a time needed to
decrease amplitude of sine wave from 'volume' to zero.
When a timer signals that it's time to stop generating
a sound, the library proceeds to gradually decrease
amplitude of sine wave producing a falling slope. Length
of the slope is inversely proportional to
CW_AUDIO_GENERATOR_SLOPE.
This additional time used to generate falling slope is rather
small but cannot be tolerated. Thus I need to come up with
better way of ending a sound. Somehow the slope must appear
(i.e. the amplitude needs to start decreasing) *before*
expected end of sound. */
/* use 'slope' to control amplitude of sine wave generator:
negative slope decreases amplitude to zero, positive slope
increases amplitude to current volume level */
/* having slope dependent on volume helps us avoiding shorter
slopes at lower volumes; with constant slope it would take
shorter to switch from zero to max (and from max to zero),
which may result in pops at low volumes */
int minimum_slope = 1;
int slope = generator->volume ?
CW_AUDIO_GENERATOR_SLOPE_RATIO * generator->volume :
minimum_slope;
if (state == CW_TONE_SILENT) { /* TONE_SILENT == 0, silence the sound */
generator->slope = -slope;
} else {
generator->slope = slope;
}
return CW_SUCCESS;
}
/**
\brief Stop and delete generator
Stop and delete current generator.
This causes silencing current sound wave.
\return CW_SUCCESS
*/
int cw_release_sound_internal(void)
{
cw_generator_stop();
cw_generator_delete();
return CW_SUCCESS;
}
/**
\brief Start generating a sound
Start generating sound with frequency depending on state of current
generator. The function has a single argument 'frequency'. The name
is old and meaningless, the argument now only toggles between
zero volume (frequency == 0, or frequency == CW_TONE_SILENCE),
and full volume (frequency > 0).
Current generator decides if the sound will be played using
soundcard or console buzzer.
The function only initializes generation, you have to do another
function call to change the tone generated.
\param frequency - toggle between full volume and no volume
\return CW_SUCCESS on success
\return CW_FAILURE on errors
*/
int cw_sound_internal(int frequency)
{
/* If silence requested, then ignore the call. */
if (cw_is_debugging_internal(CW_DEBUG_SILENT)) {
return CW_SUCCESS;
}
if (!generator) {
/* this may happen because the process of finalizing
usage of libcw is rather complicated; this should
be somehow resolved */
cw_dev_debug ("called the function for NULL generator");
return CW_SUCCESS;
}
int state = frequency == CW_TONE_SILENT ? 0 : 1;
int status = CW_SUCCESS;
if (generator->audio_system == CW_AUDIO_OSS
|| generator->audio_system == CW_AUDIO_ALSA) {
status = cw_sound_soundcard_internal(state);
} else if (generator->audio_system == CW_AUDIO_CONSOLE) {
status = cw_sound_console_internal(state);
} else {
;
}
return status;
}
/*---------------------------------------------------------------------*/
/* Finalization and cleanup */
/*---------------------------------------------------------------------*/
/*
* We prefer to close the soundcard after a period of library inactivity,
* so that other applications can use it. Ten seconds seems about right.
* We do it in one-second timeouts so that any leaked pending timeouts from
* other facilities don't cause premature finalization.
*/
static const int FINALIZATION_DELAY = 10000000;
/* Counter counting down the number of clock calls before we finalize. */
static volatile bool cw_is_finalization_pending = false;
static volatile int cw_finalization_countdown = 0;
/* Use a mutex to suppress delayed finalizations on complete resets. */
static volatile bool cw_is_finalization_locked_out = false;
/* http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=403043 */
#if defined(NSIG) /* Debian GNU/Linux: signal.h; Debian kFreeBSD: signal.h (libc0.1-dev_2.13-21_kfreebsd-i386.deb) */
#define CW_SIG_MAX (NSIG)
#elif defined(_NSIG) /* Debian GNU/Linux: asm-generic/signal.h; Debian kFreeBSD: i386-kfreebsd-gnu/bits/signum.h->signal.h (libc0.1-dev_2.13-21_kfreebsd-i386.deb) */
#define CW_SIG_MAX (_NSIG)
#elif defined(RTSIG_MAX) /* Debian GNU/Linux: linux/limits.h */
#define CW_SIG_MAX ((RTSIG_MAX)+1)
#else
#error "unknown number of signals"
#endif
/*
* Array of callbacks registered for convenience signal handling. They're
* initialized dynamically to SIG_DFL (if SIG_DFL is not NULL, which it
* seems that it is in most cases).
*/
static void (*cw_signal_callbacks[CW_SIG_MAX]) (int);
/**
* If finalization is pending, decrement the countdown, and if this reaches
* zero, we've waited long enough to release sound and timeouts.
*/
void cw_finalization_clock_internal(void)
{
if (cw_is_finalization_pending)
{
/* Decrement the timeout countdown, and finalize if we reach zero. */
cw_finalization_countdown--;
if (cw_finalization_countdown <= 0)
{
cw_debug (CW_DEBUG_FINALIZATION, "finalization timeout, closing down");
cw_release_timeouts_internal ();
// cw_release_sound_internal ();
cw_is_finalization_pending = false;
cw_finalization_countdown = 0;
}
else
{
cw_debug (CW_DEBUG_FINALIZATION, "finalization countdown %d", cw_finalization_countdown);
/* Request another timeout. This results in a call to our
* cw_cancel_finalization_internal below; to ensure that it doesn't
* really cancel finalization, unset the pending flag, then set it
* back again after reqesting the timeout.
*/
cw_is_finalization_pending = false;
cw_request_timeout_internal (USECS_PER_SEC, NULL);
cw_is_finalization_pending = true;
}
}
}
/**
* Set the finalization pending flag, and request a timeout to call the
* finalization function after a delay of a few seconds. Cancel any pending
* finalization on noting other library activity, indicated by a call from
* the timeout request function telling us that it is setting a timeout.
*/
void cw_schedule_finalization_internal(void)
{
if (!cw_is_finalization_locked_out && !cw_is_finalization_pending)
{
cw_request_timeout_internal (USECS_PER_SEC,
cw_finalization_clock_internal);
/*
* Set the flag and countdown last; calling cw_request_timeout_internal
* above results in a call to our cw_cancel_finalization, which clears
* the flag and countdown if we set them early.
*/
cw_is_finalization_pending = true;
cw_finalization_countdown = FINALIZATION_DELAY / USECS_PER_SEC;
cw_debug (CW_DEBUG_FINALIZATION, "finalization scheduled");
}
}
/**
See documentation of cw_schedule_finalization_internal() for more information
*/
void cw_cancel_finalization_internal(void)
{
if (cw_is_finalization_pending)
{
/* Cancel pending finalization and return to doing nothing. */
cw_is_finalization_pending = false;
cw_finalization_countdown = 0;
cw_debug (CW_DEBUG_FINALIZATION, "finalization canceled");
}
}
/**
* Reset all library features to their default states. Clears the tone
* queue, receive buffers and retained state information, any current
* keyer activity, and any straight key activity, returns to silence, and
* closes soundcard and console devices. This function is suitable for
* calling from an application exit handler.
*/
void cw_complete_reset(void)
{
/*
* If the finalizer thinks it's pending, stop it, then temporarily lock
* out finalizations.
*/
cw_cancel_finalization_internal ();
cw_is_finalization_locked_out = true;
/* Silence sound, and shutdown use of the sound devices. */
//cw_sound_soundcard_internal (CW_TONE_SILENT);
cw_release_sound_internal ();
cw_release_timeouts_internal ();
/* Call the reset functions for each subsystem. */
cw_reset_tone_queue ();
cw_reset_receive ();
cw_reset_keyer ();
cw_reset_straight_key ();
/* Now we can re-enable delayed finalizations. */
cw_is_finalization_locked_out = false;
}
/**
* Signal handler function registered when cw_register_signal_handler is
* requested. Resets the library, and then either calls any supplied
* sub-handler, exits (if SIG_DFL) or continues (if SIG_IGN).
*/
void cw_interpose_signal_handler_internal(int signal_number)
{
void (*callback_func) (int);
cw_debug (CW_DEBUG_FINALIZATION, "caught signal %d", signal_number);
/* Reset the library and retrieve the signal's handler. */
cw_complete_reset ();
callback_func = cw_signal_callbacks[signal_number];
/* The default action is to stop the process; exit(1) seems to cover it. */
if (callback_func == SIG_DFL)
exit (EXIT_FAILURE);
/* If we didn't exit, invoke any additional handler callback function. */
if (callback_func != SIG_IGN)
(*callback_func) (signal_number);
}
/**
* Register a signal handler and optional callback function for signals. On
* receipt of that signal, all library features will be reset to their default
* states. Following the reset, if callback_func is a function pointer, the
* function is called; if it is SIG_DFL, the library calls exit(); and if it
* is SIG_IGN, the library returns from the signal handler. This is a
* convenience function for clients that need to clean up library on signals,
* with either exit, continue, or an additional function call; in effect, a
* wrapper round a restricted form of sigaction. The signal_number argument
* indicates which signal to catch. Returns true if the signal handler
* installs correctly, false otherwise, with errno set to EINVAL if
* signal_number is invalid or if a handler is already installed for that
* signal, or to the sigaction error code.
*/
int cw_register_signal_handler(int signal_number,
void (*callback_func) (int))
{
static bool is_initialized = false;
struct sigaction action, original_disposition;
int status;
/* On first call, initialize all signal_callbacks to SIG_DFL. */
if (!is_initialized)
{
int index;
for (index = 0; index < CW_SIG_MAX; index++)
cw_signal_callbacks[index] = SIG_DFL;
is_initialized = true;
}
/* Reject invalid signal numbers, and SIGALRM, which we use internally. */
if (signal_number < 0 || signal_number >= CW_SIG_MAX
|| signal_number == SIGALRM)
{
errno = EINVAL;
return CW_FAILURE;
}
/* Install our handler as the actual handler. */
action.sa_handler = cw_interpose_signal_handler_internal;
action.sa_flags = SA_RESTART;
sigemptyset (&action.sa_mask);
status = sigaction (signal_number, &action, &original_disposition);
if (status == -1)
{
perror ("cw: sigaction");
return CW_FAILURE;
}
/* If we trampled another handler, replace it and return false. */
if (!(original_disposition.sa_handler == cw_interpose_signal_handler_internal
|| original_disposition.sa_handler == SIG_DFL
|| original_disposition.sa_handler == SIG_IGN))
{
status = sigaction (signal_number, &original_disposition, NULL);
if (status == -1)
{
perror ("cw: sigaction");
return CW_FAILURE;
}
errno = EINVAL;
return CW_FAILURE;
}
/* Save the callback function (it may validly be SIG_DFL or SIG_IGN). */
cw_signal_callbacks[signal_number] = callback_func;
return CW_SUCCESS;
}
/**
* Removes a signal handler interception previously registered with
* cw_register_signal_handler. Returns true if the signal handler uninstalls
* correctly, false otherwise, with errno set to EINVAL or to the sigaction
* error code.
*/
int cw_unregister_signal_handler(int signal_number)
{
struct sigaction action, original_disposition;
int status;
/* As above, reject unacceptable signal numbers. */
if (signal_number < 0 || signal_number >= CW_SIG_MAX
|| signal_number == SIGALRM)
{
errno = EINVAL;
return CW_FAILURE;
}
/* See if the current handler was put there by us. */
status = sigaction (signal_number, NULL, &original_disposition);
if (status == -1)
{
perror ("cw: sigaction");
return CW_FAILURE;
}
if (original_disposition.sa_handler != cw_interpose_signal_handler_internal)
{
errno = EINVAL;
return CW_FAILURE;
}
/* Remove the signal handler by resetting to SIG_DFL. */
action.sa_handler = SIG_DFL;
action.sa_flags = 0;
sigemptyset (&action.sa_mask);
status = sigaction (signal_number, &action, NULL);
if (status == -1)
{
perror ("cw: sigaction");
return CW_FAILURE;
}
/* Reset the callback entry for tidiness. */
cw_signal_callbacks[signal_number] = SIG_DFL;
return CW_SUCCESS;
}
/*---------------------------------------------------------------------*/
/* Keying control */
/*---------------------------------------------------------------------*/
/*
* External keying function. It may be useful for a client to have this
* library control an external keying device, for example, an oscillator,
* or a transmitter. Here is where we keep the address of a function that
* is passed to us for this purpose, and a void* argument for it.
*/
static void (*cw_kk_key_callback)(void*, int) = NULL;
static void *cw_kk_key_callback_arg = NULL;
/**
* Register a function that should be called when a tone state changes from
* key-up to key-down, or vice-versa. The first argument passed out to the
* registered function is the supplied callback_arg, if any. The second
* argument passed out is the key state: true for down, false for up. Calling
* this routine with an NULL function address disables keying callbacks. Any
* callback supplied will be called in signal handler context.
*/
void cw_register_keying_callback(void (*callback_func)(void*, int),
void *callback_arg)
{
cw_kk_key_callback = callback_func;
cw_kk_key_callback_arg = callback_arg;
}
/**
* Control function that calls any requested keying callback only when there
* is a change of keying state. This function filters successive key-down
* or key-up actions into a single action.
*/
void cw_key_control_internal(int requested_key_state)
{
static bool current_key_state = false; /* Maintained key control state */
if (current_key_state != requested_key_state)
{
cw_debug (CW_DEBUG_KEYING, "keying state %d->%d", current_key_state, requested_key_state);
/* Set the new keying state, and call any requested callback. */
current_key_state = requested_key_state;
if (cw_kk_key_callback)
(*cw_kk_key_callback) (cw_kk_key_callback_arg, current_key_state);
}
}
/*---------------------------------------------------------------------*/
/* Tone queue */
/*---------------------------------------------------------------------*/
/*
* Tone queue. This is a circular list of tone durations and frequencies
* pending, and a pair of indexes, tail (enqueue) and head (dequeue) to
* manage additions and asynchronous sending.
*/
enum
{ TONE_QUEUE_CAPACITY = 3000, /* ~= 5 minutes at 12 WPM */
TONE_QUEUE_HIGH_WATER_MARK = 2900 /* Refuse characters if <100 free */
};
typedef struct
{
int usecs; /* Tone duration in usecs */
int frequency; /* Frequency of the tone */
} cw_queued_tone_t;
static volatile cw_queued_tone_t cw_tone_queue[TONE_QUEUE_CAPACITY];
static volatile int cw_tq_tail = 0, /* Tone queue tail index */
cw_tq_head = 0; /* Tone queue head index */
/*
* It's useful to have the tone queue dequeue function call a client-supplied
* callback routine when the amount of data in the queue drops below a
* defined low water mark. This routine can then refill the buffer, as
* required.
*/
static volatile int cw_tq_low_water_mark = 0;
static void (*cw_tq_low_water_callback)(void*) = NULL;
static void *cw_tq_low_water_callback_arg = NULL;
/**
* Return the count of tones currently held in the circular tone buffer, and
* advance a tone queue index, including circular wrapping.
*/
int cw_get_tone_queue_length_internal(void)
{
return cw_tq_tail >= cw_tq_head
? cw_tq_tail - cw_tq_head
: cw_tq_tail - cw_tq_head + TONE_QUEUE_CAPACITY;
}
/**
See documentation of cw_get_tone_queue_length_internal() for more information
*/
int cw_next_tone_queue_index_internal(int current)
{
return (current + 1) % TONE_QUEUE_CAPACITY;
}
/*
* The CW tone queue functions implement the following state graph:
*
* (queue empty)
* +-------------------------------+
* | |
* v (queue started) |
* --> QS_IDLE ---------------> QS_BUSY --+
* ^ |
* | |
* +-----+
* (queue not empty)
*/
static volatile enum { QS_IDLE, QS_BUSY } cw_dequeue_state = QS_IDLE;
/**
* Signal handler for itimer. Dequeue a tone request, and send the ioctl to
* generate the tone. If the queue is empty when we get the signal, then
* we're at the end of the work list, so set the dequeue state to idle and
* return.
*/
void cw_tone_queue_clock_internal(void)
{
/* Decide what to do based on the current state. */
switch (cw_dequeue_state)
{
/* Ignore calls if our state is idle. */
case QS_IDLE:
return;
/*
* If busy, dequeue the next tone, or if no more tones, go to the idle
* state.
*/
case QS_BUSY:
if (cw_tq_head != cw_tq_tail)
{
int usecs, frequency, queue_length;
/*
* Get the current queue length. Later on, we'll compare with the
* length after we've scanned over every tone we can omit, and use it
* to see if we've crossed the low water mark, if any.
*/
queue_length = cw_get_tone_queue_length_internal ();
/*
* Advance over the tones list until we find the first tone with a
* duration of more than zero usecs, or until the end of the list.
*/
do
{
cw_tq_head = cw_next_tone_queue_index_internal (cw_tq_head);
}
while (cw_tq_head != cw_tq_tail
&& cw_tone_queue[cw_tq_head].usecs == 0);
/* Dequeue the next tone to send. */
usecs = cw_tone_queue[cw_tq_head].usecs;
frequency = cw_tone_queue[cw_tq_head].frequency;
cw_debug (CW_DEBUG_TONE_QUEUE, "dequeue tone %d usec, %d Hz", usecs, frequency);
/*
* Start the tone. If the ioctl fails, there's nothing we can do at
* this point, in the way of returning error codes.
*/
cw_sound_internal (frequency);
/*
* Notify the key control function that there might have been a
* change of keying state (and then again, there might not have
* been -- it will sort this out for us).
*/
cw_key_control_internal (frequency != CW_TONE_SILENT);
/*
* If microseconds is zero, leave it at that. This way, a queued
* tone of 0 usec implies leaving the sound in this state, and 0
* usec and 0 frequency leaves silence.
*/
if (usecs > 0)
{
/*
* Request a timeout. If it fails, there's little we can do at
* this point. But it shouldn't fail.
*/
cw_request_timeout_internal (usecs, NULL);
}
else
{
/* Autonomous dequeuing has finished for the moment. */
cw_dequeue_state = QS_IDLE;
cw_schedule_finalization_internal ();
}
/*
* If there is a low water mark callback registered, and if we passed
* under the water mark, call the callback here. We want to be sure
* to call this late in the processing, especially after setting the
* state to idle, since the most likely action of this routine is to
* queue tones, and we don't want to play with the state here after
* that.
*/
if (cw_tq_low_water_callback)
{
/*
* If the length we originally calculated was above the low water
* mark, and the one we have now is below or equal to it, call
* the callback.
*/
if (queue_length > cw_tq_low_water_mark
&& cw_get_tone_queue_length_internal ()
<= cw_tq_low_water_mark)
(*cw_tq_low_water_callback) (cw_tq_low_water_callback_arg);
}
}
else
{
/*
* This is the end of the last tone on the queue, and since we got a
* signal we know that it had a usec greater than zero. So this is
* the time to return to silence.
*/
cw_sound_internal (CW_TONE_SILENT);
/* Notify the keying control function, as above. */
cw_key_control_internal (false);
/*
* Set state to idle, indicating that autonomous dequeueing has
* finished for the moment. We need this set whenever the queue
* indexes are equal and there is no pending itimeout.
*/
cw_dequeue_state = QS_IDLE;
cw_schedule_finalization_internal ();
}
}
}
/**
* Enqueue a tone for specified frequency and number of microseconds. This
* routine adds the new tone to the queue, and if necessary starts the
* itimer process to have the tone sent. The routine returns true on success.
* If the tone queue is full, the routine returns false, with errno set to
* EAGAIN. If the iambic keyer or straight key are currently busy, the
* routine returns false, with errno set to EBUSY.
*/
int cw_enqueue_tone_internal(int usecs, int frequency)
{
int new_tq_tail;
/*
* If the keyer or straight key are busy, return an error. This is because
* they use the sound card/console tones and key control, and will interfere
* with us if we try to use them at the same time.
*/
if (cw_is_keyer_busy () || cw_is_straight_key_busy ())
{
errno = EBUSY;
return CW_FAILURE;
}
/* Get the new value of the queue tail index. */
new_tq_tail = cw_next_tone_queue_index_internal (cw_tq_tail);
/*
* If the new value is bumping against the head index, then the queue
* is currently full, so return EAGAIN.
*/
if (new_tq_tail == cw_tq_head)
{
errno = EAGAIN;
return CW_FAILURE;
}
cw_debug (CW_DEBUG_TONE_QUEUE, "enqueue tone %d usec, %d Hz", usecs, frequency);
/* Set the new tail index, and enqueue the new tone. */
cw_tq_tail = new_tq_tail;
cw_tone_queue[cw_tq_tail].usecs = usecs;
cw_tone_queue[cw_tq_tail].frequency = frequency;
/*
* If there is currently no autonomous dequeue happening, kick off the
* itimer process.
*/
if (cw_dequeue_state == QS_IDLE)
{
cw_dequeue_state = QS_BUSY;
cw_request_timeout_internal (0, cw_tone_queue_clock_internal);
}
return CW_SUCCESS;
}
/**
* Registers a function to be called automatically by the dequeue routine
* whenever the tone queue falls to a given level; callback_arg may be used
* to give a value passed back on callback calls. A NULL function pointer
* suppresses callbacks. On success, the routine returns true. If level is
* invalid, the routine returns false with errno set to EINVAL. Any callback
* supplied will be called in signal handler context.
*/
int cw_register_tone_queue_low_callback(void (*callback_func)(void*),
void *callback_arg, int level)
{
if (level < 0 || level >= TONE_QUEUE_CAPACITY - 1)
{
errno = EINVAL;
return CW_FAILURE;
}
/* Store the function and low water mark level. */
cw_tq_low_water_mark = level;
cw_tq_low_water_callback = callback_func;
cw_tq_low_water_callback_arg = callback_arg;
return CW_SUCCESS;
}
/**
* Indicates if the tone sender is busy; returns true if there are still
* entries in the tone queue, false if the queue is empty.
*/
bool cw_is_tone_busy(void)
{
return cw_dequeue_state != QS_IDLE;
}
/**
* Wait for the current tone to complete. The routine returns true on
* success. If called with SIGALRM blocked, the routine returns false, with
* errno set to EDEADLK, to avoid indefinite waits.
*/
int cw_wait_for_tone(void)
{
int status, check_tq_head;
/* Check that SIGALRM is not blocked. */
status = cw_check_signal_mask_internal ();
if (!status)
return CW_FAILURE;
/* Wait for the tail index to change or the dequeue to go idle. */
check_tq_head = cw_tq_head;
while (cw_tq_head == check_tq_head && cw_dequeue_state != QS_IDLE)
cw_wait_for_signal_internal ();
return CW_SUCCESS;
}
/**
* Wait for the tone queue to drain. The routine returns true on success.
* If called with SIGALRM blocked, the routine returns false, with errno set
* to EDEADLK, to avoid indefinite waits.
*/
int cw_wait_for_tone_queue(void)
{
int status;
/* Check that SIGALRM is not blocked. */
status = cw_check_signal_mask_internal ();
if (!status)
return CW_FAILURE;
/* Wait until the dequeue indicates it's hit the end of the queue. */
while (cw_dequeue_state != QS_IDLE)
cw_wait_for_signal_internal ();
return CW_SUCCESS;
}
/**
* Wait for the tone queue to drain until only as many tones as given
* in level remain queued. This routine is for use by programs that want
* to optimize themselves to avoid the cleanup that happens when the tone
* queue drains completely; such programs have a short time in which to
* add more tones to the queue. The routine returns true on success. If
* called with SIGALRM blocked, the routine returns false, with errno set to
* EDEADLK, to avoid indefinite waits.
*/
int cw_wait_for_tone_queue_critical(int level)
{
int status;
/* Check that SIGALRM is not blocked. */
status = cw_check_signal_mask_internal ();
if (!status)
return CW_FAILURE;
/* Wait until the queue length is at or below criticality. */
while (cw_get_tone_queue_length_internal () > level)
cw_wait_for_signal_internal ();
return CW_SUCCESS;
}
/**
* Indicates if the tone queue is full, returning true if full, false if not.
*/
bool cw_is_tone_queue_full(void)
{
/* If advancing would meet the tail index, return true. */
return cw_next_tone_queue_index_internal(cw_tq_tail) == cw_tq_head;
}
/**
* Returns the number of entries the tone queue can accommodate.
*/
int cw_get_tone_queue_capacity(void)
{
/*
* Since the head and tail indexes cannot be equal, the perceived capacity
* for the client is always one less than the actual declared queue size.
*/
return TONE_QUEUE_CAPACITY - 1;
}
/**
* Returns the number of entries currently pending in the tone queue.
*/
int cw_get_tone_queue_length(void)
{
return cw_get_tone_queue_length_internal ();
}
/**
* Cancel all pending queued tones, and return to silence. If there is a
* tone in progress, the function will wait until this last one has
* completed, then silence the tones.
*
* This function may be called with SIGALRM blocked, in which case it
* will empty the queue as best it can, then return without waiting for
* the final tone to complete. In this case, it may not be possible to
* guarantee silence after the call.
*/
void cw_flush_tone_queue(void)
{
/* Empty the queue, by setting the head to the tail. */
cw_tq_head = cw_tq_tail;
/* If we can, wait until the dequeue goes idle. */
if (cw_check_signal_mask_internal ())
cw_wait_for_tone_queue ();
/*
* Force silence on the speaker anyway, and stop any background soundcard
* tone generation.
*/
cw_sound_internal (CW_TONE_SILENT);
cw_schedule_finalization_internal ();
}
/**
* Provides primitive access to simple tone generation. This routine queues
* a tone of given duration and frequency. The routine returns true on
* success. If usec or frequency are invalid, it returns false with errno
* set to EINVAL. If the sound card, console speaker, or keying function are
* busy, it returns false with errno set to EBUSY. If the tone queue is full,
* it returns false with errno set to EAGAIN.
*/
int cw_queue_tone(int usecs, int frequency)
{
/*
* Check the arguments given for realistic values. Note that we do nothing
* here to protect the caller from setting up neverending (0 usecs) tones,
* if that's what they want to do.
*/
if (usecs < 0 || frequency < 0
|| frequency < CW_FREQUENCY_MIN || frequency > CW_FREQUENCY_MAX)
{
errno = EINVAL;
return CW_FAILURE;
}
return cw_enqueue_tone_internal (usecs, frequency);
}
/**
* Cancel all pending queued tones, reset any queue low callback registered,
* and return to silence. This function is suitable for calling from an
* application exit handler.
*/
void cw_reset_tone_queue(void)
{
/* Empty the queue, and force state to idle. */
cw_tq_head = cw_tq_tail;
cw_dequeue_state = QS_IDLE;
/* Reset low water mark details to their initial values. */
cw_tq_low_water_mark = 0;
cw_tq_low_water_callback = NULL;
cw_tq_low_water_callback_arg = NULL;
/* Silence sound and stop any background soundcard tone generation. */
cw_sound_internal (CW_TONE_SILENT);
cw_schedule_finalization_internal ();
cw_debug (CW_DEBUG_TONE_QUEUE, "tone queue reset");
}
/*---------------------------------------------------------------------*/
/* Sending */
/*---------------------------------------------------------------------*/
/**
* Low level primitive to send a tone element of the given type, followed
* by the standard inter-element silence.
*/
int cw_send_element_internal(char element)
{
int status;
/* Synchronize low-level timings if required. */
cw_sync_parameters_internal ();
/* Send either a dot or a dash element, depending on representation. */
if (element == CW_DOT_REPRESENTATION)
status = cw_enqueue_tone_internal (cw_send_dot_length, generator->frequency);
else if (element == CW_DASH_REPRESENTATION)
status = cw_enqueue_tone_internal (cw_send_dash_length, generator->frequency);
else
{
errno = EINVAL;
status = CW_FAILURE;
}
if (!status)
return CW_FAILURE;
/* Send the inter-element gap. */
status = cw_enqueue_tone_internal (cw_end_of_ele_delay, CW_TONE_SILENT);
if (!status)
return CW_FAILURE;
return CW_SUCCESS;
}
/**
* cw_send_[dot|dash|character_space|word_space]()
*
* Low level primitives, available to send single dots, dashes, character
* spaces, and word spaces. The dot and dash routines always append the
* normal inter-element gap after the tone sent. The cw_send_character_space
* routine sends space timed to exclude the expected prior dot/dash
* inter-element gap. The cw_send_word_space routine sends space timed to
* exclude both the expected prior dot/dash inter-element gap and the prior
* end of character space. These functions return true on success, or false
* with errno set to EBUSY or EAGAIN on error.
*/
int cw_send_dot(void)
{
return cw_send_element_internal (CW_DOT_REPRESENTATION);
}
/**
See documentation of cw_send_dot() for more information
*/
int cw_send_dash(void)
{
return cw_send_element_internal (CW_DASH_REPRESENTATION);
}
/**
See documentation of cw_send_dot() for more information
*/
int cw_send_character_space(void)
{
/* Synchronize low-level timing parameters. */
cw_sync_parameters_internal ();
/*
* Delay for the standard end of character period, plus any additional
* inter-character gap
*/
return cw_enqueue_tone_internal (cw_end_of_char_delay + cw_additional_delay,
CW_TONE_SILENT);
}
/**
See documentation of cw_send_dot() for more information
*/
int cw_send_word_space(void)
{
/* Synchronize low-level timing parameters. */
cw_sync_parameters_internal ();
/*
* Send silence for the word delay period, plus any adjustment that may be
* needed at end of word.
*/
return cw_enqueue_tone_internal (cw_end_of_word_delay + cw_adjustment_delay,
CW_TONE_SILENT);
}
/**
* Send the given string as dots and dashes, adding the post-character
* gap.
*/
int cw_send_representation_internal(const char *representation, int partial)
{
int index;
/*
* Before we let this representation loose on tone generation, we'd really
* like to know that all of its tones will get queued up successfully. The
* right way to do this is to calculate the number of tones in our
* representation, then check that the space exists in the tone queue.
* However, since the queue is comfortably long, we can get away with just
* looking for a high water mark.
*/
if (cw_get_tone_queue_length () >= TONE_QUEUE_HIGH_WATER_MARK)
{
errno = EAGAIN;
return CW_FAILURE;
}
/* Sound the elements of the CW equivalent. */
for (index = 0; representation[index] != '\0'; index++)
{
int status;
/*
* Send a tone of dot or dash length, followed by the normal, standard,
* inter-element gap.
*/
status = cw_send_element_internal (representation[index]);
if (!status)
return CW_FAILURE;
}
/*
* If this representation is stated as being 'partial', then suppress any
* and all end of character delays.
*/
if (!partial)
{
int status;
status = cw_send_character_space ();
if (!status)
return CW_FAILURE;
}
return CW_SUCCESS;
}
/**
* Checks, then sends the given string as dots and dashes. The representation
* passed in is assumed to be a complete Morse character; that is, all post-
* character delays will be added when the character is sent. On success,
* the routine returns true. On error, it returns false, with errno set to
* EINVAL if any character of the representation is invalid, EBUSY if the
* sound card, console speaker, or keying system is busy, or EAGAIN if the
* tone queue is full, or if there is insufficient space to queue the tones
* for the representation.
*/
int cw_send_representation(const char *representation)
{
if (!cw_check_representation (representation))
{
errno = EINVAL;
return CW_FAILURE;
}
return cw_send_representation_internal (representation, false);
}
/**
* Check, then send the given string as dots and dashes. The representation
* passed in is assumed to be only part of a larger Morse representation;
* that is, no post-character delays will be added when the character is sent.
* On success, the routine returns true. On error, it returns false, with
* errno set to EINVAL if any character of the representation is invalid,
* EBUSY if the sound card, console speaker, or keying system is busy, or
* EAGAIN if the tone queue is full, or if there is insufficient space to
* queue the tones for the representation.
*/
int cw_send_representation_partial(const char *representation)
{
if (!cw_check_representation (representation))
{
errno = ENOENT;
return CW_FAILURE;
}
return cw_send_representation_internal (representation, true);
}
/**
* Lookup, and send a given ASCII character as cw. If 'partial' is set, the
* end of character delay is not appended to the Morse sent. On success,
* the routine returns true, otherwise it returns an error.
*/
int cw_send_character_internal(char c, int partial)
{
int status;
const char *representation;
/* Handle space special case; delay end-of-word and return. */
if (c == ' ')
return cw_send_word_space ();
/* Lookup the character, and sound it. */
representation = cw_lookup_character_internal (c);
if (!representation)
{
errno = ENOENT;
return CW_FAILURE;
}
status = cw_send_representation_internal (representation, partial);
if (!status)
return CW_FAILURE;
return CW_SUCCESS;
}
/**
* Checks that the given character is validly sendable in Morse. If it is,
* the routine returns true. If not, the routine returns false, with errno
* set to ENOENT.
*/
int cw_check_character(char c)
{
/*
* If the character is the space special-case, or if not, but it is in the
* lookup table, return success.
*/
if (c == ' ' || cw_lookup_character_internal (c))
return CW_SUCCESS;
errno = ENOENT;
return CW_FAILURE;
}
/**
* Lookup, and send a given ASCII character as Morse. The end of character
* delay is appended to the Morse sent. On success, the routine returns true.
* On error, it returns false, with errno set to ENOENT if the given character
* is not a valid Morse character, EBUSY if the sound card, console speaker,
* or keying system is busy, or EAGAIN if the tone queue is full, or if
* there is insufficient space to queue the tones for the representation.
*
* This routine returns as soon as the character has been successfully
* queued for send; that is, almost immediately. The actual sending happens
* in background processing. See cw_wait_for_tone and cw_wait_for_tone_queue
* for ways to check the progress of sending.
*/
int cw_send_character(char c)
{
if (!cw_check_character (c))
{
errno = ENOENT;
return CW_FAILURE;
}
return cw_send_character_internal (c, false);
}
/**
* Lookup, and send a given ASCII character as Morse. The end of character
* delay is not appended to the Morse sent by the function, to support the
* formation of combination characters. On success, the routine returns true.
* On error, it returns false, with errno set to ENOENT if the given character
* is not a valid Morse character, EBUSY if the sound card, console speaker,
* or keying system is busy, or EAGAIN if the tone queue is full, or if
* there is insufficient space to queue the tones for the representation.
*
* This routine queues its arguments for background processing. See
* cw_send_character for details of how to check the queue status.
*/
int cw_send_character_partial(char c)
{
if (!cw_check_character (c))
{
errno = ENOENT;
return CW_FAILURE;
}
return cw_send_character_internal (c, true);
}
/**
* Checks that each character in the given string is validly sendable in Morse.
* On success, the routine returns true. On error, it returns false, with
* errno set to EINVAL.
*/
int cw_check_string(const char *string)
{
int index;
/*
* Check that each character in the string has a Morse representation, or
* is the space special case.
*/
for (index = 0; string[index] != '\0'; index++)
{
if (!(string[index] == ' '
|| cw_lookup_character_internal (string[index])))
{
errno = EINVAL;
return CW_FAILURE;
}
}
return CW_SUCCESS;
}
/**
* Send a given ASCII string as cw. On success, the routine returns true.
* On error, it returns false, with errno set to ENOENT if any character in
* the string is not a valid Morse character, EBUSY if the sound card, console
* speaker, or keying system is in use by the iambic keyer or the straight
* key, or EAGAIN if the tone queue is full. If the tone queue runs out
* of space part way through queueing the string, the function returns EAGAIN.
* However, an indeterminate number of the characters from the string will
* have already been queued. For safety, clients can ensure the tone queue
* is empty before queueing a string, or use cw_send_character() if they
* need finer control.
*
* This routine queues its arguments for background processing. See
* cw_send_character for details of how to check the queue status.
*/
int cw_send_string(const char *string)
{
int index;
/* Check the string is composed of sendable characters. */
if (!cw_check_string (string))
{
errno = ENOENT;
return CW_FAILURE;
}
/* Send every character in the string. */
for (index = 0; string[index] != '\0'; index++)
{
int status;
status = cw_send_character_internal (string[index], false);
if (!status)
return CW_FAILURE;
}
return CW_SUCCESS;
}
/*---------------------------------------------------------------------*/
/* Receive tracking and statistics helpers */
/*---------------------------------------------------------------------*/
/*
* Receive adaptive speed tracking. A moving averages structure, comprising
* a small array of element lengths, a circular index into the array, and a
* a running sum of elements for efficient calculation of moving averages.
*/
enum { AVERAGE_ARRAY_LENGTH = 4 };
typedef struct {
int buffer[AVERAGE_ARRAY_LENGTH]; /* Buffered element lengths */
int cursor; /* Circular buffer cursor */
int sum; /* Running sum */
} cw_tracking_t;
static cw_tracking_t cw_dot_tracking = { {0}, 0, 0 },
cw_dash_tracking = { {0}, 0, 0 };
static void cw_reset_adaptive_average_internal(cw_tracking_t *tracking, int initial);
static void cw_update_adaptive_average_internal(cw_tracking_t *tracking, int element_usec);
static int cw_get_adaptive_average_internal(cw_tracking_t *tracking);
/**
* Moving average functions for smoothed tracking of dot and dash lengths.
*/
void cw_reset_adaptive_average_internal(cw_tracking_t *tracking, int initial)
{
int element;
for (element = 0; element < AVERAGE_ARRAY_LENGTH; element++)
tracking->buffer[element] = initial;
tracking->sum = initial * AVERAGE_ARRAY_LENGTH;
tracking->cursor = 0;
}
/**
See documentation of cw_reset_adaptive_average_internal() for more information
*/
void cw_update_adaptive_average_internal(cw_tracking_t *tracking, int element_usec)
{
tracking->sum += element_usec - tracking->buffer[tracking->cursor];
tracking->buffer[tracking->cursor++] = element_usec;
tracking->cursor %= AVERAGE_ARRAY_LENGTH;
}
/**
See documentation of cw_reset_adaptive_average_internal() for more information
*/
int cw_get_adaptive_average_internal(cw_tracking_t *tracking)
{
return tracking->sum / AVERAGE_ARRAY_LENGTH;
}
/*
* Receive timing statistics. A circular buffer of entries indicating the
* difference between the actual and the ideal timing for a receive element,
* tagged with the type of statistic held, and a circular buffer pointer.
* STAT_NONE must be zero so that the statistics buffer is initially empty.
*/
typedef enum
{ STAT_NONE = 0, STAT_DOT, STAT_DASH, STAT_END_ELEMENT, STAT_END_CHARACTER
} stat_type_t;
typedef struct {
stat_type_t type; /* Record type */
int delta; /* Difference between actual and ideal timing */
} cw_statistics_t;
enum { STATISTICS_ARRAY_LENGTH = 256 };
static cw_statistics_t
cw_receive_statistics[STATISTICS_ARRAY_LENGTH] = { {0, 0} };
static int cw_statistics_cursor = 0;
static void cw_add_receive_statistic_internal(stat_type_t type, int usecs);
static double cw_get_receive_statistic_internal(stat_type_t type);
/**
* Add an element timing with a given statistic type to the circular
* statistics buffer. The buffer stores only the delta from the ideal value;
* the ideal is inferred from the type passed in.
*/
void cw_add_receive_statistic_internal(stat_type_t type, int usecs)
{
int delta;
/* Synchronize low-level timings if required. */
cw_sync_parameters_internal ();
/* Calculate delta as difference between usec and the ideal value. */
delta = usecs - ((type == STAT_DOT) ? cw_receive_dot_length
: (type == STAT_DASH) ? cw_receive_dash_length
: (type == STAT_END_ELEMENT) ? cw_eoe_range_ideal
: (type == STAT_END_CHARACTER) ? cw_eoc_range_ideal : usecs);
/* Add this statistic to the buffer. */
cw_receive_statistics[cw_statistics_cursor].type = type;
cw_receive_statistics[cw_statistics_cursor++].delta = delta;
cw_statistics_cursor %= STATISTICS_ARRAY_LENGTH;
}
/**
* Calculate and return one given timing statistic type. If no records of
* that type were found, return 0.0.
*/
double cw_get_receive_statistic_internal(stat_type_t type)
{
double sum_of_squares;
int count, cursor;
/*
* Sum and count elements matching the given type. A cleared buffer always
* begins refilling at element zero, so to optimize we can stop on the first
* unoccupied slot in the circular buffer.
*/
sum_of_squares = 0.0;
count = 0;
for (cursor = 0; cursor < STATISTICS_ARRAY_LENGTH; cursor++)
{
if (cw_receive_statistics[cursor].type == type)
{
int delta;
delta = cw_receive_statistics[cursor].delta;
sum_of_squares += (double) delta * (double) delta;
count++;
}
else if (cw_receive_statistics[cursor].type == STAT_NONE)
break;
}
/* Return the standard deviation, or zero if no matching elements. */
return count > 0 ? sqrt (sum_of_squares / (double) count) : 0.0;
}
/**
* Calculate and return receive timing statistics. These statistics may be
* used to obtain a measure of the accuracy of received CW. The values
* dot_sd and dash_sd contain the standard deviation of dot and dash lengths
* from the ideal values, and element_end_sd and character_end_sd the
* deviations for inter element and inter character spacing. Statistics are
* held for all timings in a 256 element circular buffer. If any statistic
* cannot be calculated, because no records for it exist, the returned value
* is 0.0. Use NULL for the pointer argument to any statistic not required.
*/
void cw_get_receive_statistics(double *dot_sd, double *dash_sd,
double *element_end_sd, double *character_end_sd)
{
if (dot_sd)
*dot_sd = cw_get_receive_statistic_internal (STAT_DOT);
if (dash_sd)
*dash_sd = cw_get_receive_statistic_internal (STAT_DASH);
if (element_end_sd)
*element_end_sd = cw_get_receive_statistic_internal (STAT_END_ELEMENT);
if (character_end_sd)
*character_end_sd = cw_get_receive_statistic_internal (STAT_END_CHARACTER);
}
/**
* Clear the receive statistics buffer, removing all records from it and
* returning it to its initial default state.
*/
void cw_reset_receive_statistics(void)
{
int cursor;
for (cursor = 0; cursor < STATISTICS_ARRAY_LENGTH; cursor++)
{
cw_receive_statistics[cursor].type = STAT_NONE;
cw_receive_statistics[cursor].delta = 0;
}
cw_statistics_cursor = 0;
}
/*---------------------------------------------------------------------*/
/* Receiving */
/*---------------------------------------------------------------------*/
/*
* Receive buffering. This is a fixed-length representation, filled in
* as tone on/off timings are taken. The buffer is vastly longer than
* any practical representation, and along with it we maintain a cursor
* indicating the current write position.
*/
enum { RECEIVE_CAPACITY = 256 };
static char cw_receive_representation_buffer[RECEIVE_CAPACITY];
static int cw_rr_current = 0;
/* Retained tone start and end timestamps. */
static struct timeval cw_rr_start_timestamp = {0, 0},
cw_rr_end_timestamp = {0, 0};
/**
* Set the value of the flag that controls whether, on receive, the receive
* functions do fixed speed receive, or track the speed of the received Morse
* code by adapting to the input stream.
*/
void cw_set_adaptive_receive_internal(bool flag)
{
/* Look for change of adaptive receive state. */
if ((cw_is_adaptive_receive_enabled && !flag)
|| (!cw_is_adaptive_receive_enabled && flag))
{
cw_is_adaptive_receive_enabled = flag;
/* Changing the flag forces a change in low-level parameters. */
cw_is_in_sync = false;
cw_sync_parameters_internal ();
/*
* If we have just switched to adaptive mode, (re-)initialize the
* averages array to the current dot/dash lengths, so that initial
* averages match the current speed.
*/
if (cw_is_adaptive_receive_enabled)
{
cw_reset_adaptive_average_internal (&cw_dot_tracking,
cw_receive_dot_length);
cw_reset_adaptive_average_internal (&cw_dash_tracking,
cw_receive_dash_length);
}
}
}
/**
* Enable/disable/get adaptive receive speeds. If adaptive speed tracking
* is enabled, the receive functions will attempt to automatically adjust
* the receive speed setting to match the speed of the incoming Morse code.
* If it is disabled, the receive functions will use fixed speed settings,
* and reject incoming Morse which is not at the expected speed. The
* cw_get_adaptive_receive_state function returns true if adaptive speed
* tracking is enabled, false otherwise. Adaptive speed tracking uses a
* moving average of the past four elements as its baseline for tracking
* speeds. The default state is adaptive tracking disabled.
*/
void cw_enable_adaptive_receive(void)
{
cw_set_adaptive_receive_internal (true);
}
/**
See documentation of cw_enable_adaptive_receive() for more information
*/
void cw_disable_adaptive_receive(void)
{
cw_set_adaptive_receive_internal (false);
}
/**
See documentation of cw_enable_adaptive_receive() for more information
*/
bool cw_get_adaptive_receive_state(void)
{
return cw_is_adaptive_receive_enabled;
}
/**
* If an input timestamp is given, validate it for correctness, and if valid,
* copy it into return_timestamp and return true. If invalid, return false
* with errno set to EINVAL. If an input timestamp is not given (NULL), return
* true with the current system time in return_timestamp.
*/
int cw_validate_timestamp_internal(const struct timeval *timestamp,
struct timeval *return_timestamp)
{
if (timestamp)
{
if (timestamp->tv_sec < 0 || timestamp->tv_usec < 0
|| timestamp->tv_usec >= USECS_PER_SEC)
{
errno = EINVAL;
return CW_FAILURE;
}
*return_timestamp = *timestamp;
}
else
{
if (gettimeofday (return_timestamp, NULL) != 0)
{
perror ("cw: gettimeofday");
return CW_FAILURE;
}
}
return CW_SUCCESS;
}
/*
* The CW receive functions implement the following state graph:
*
* +----------------- RS_ERR_WORD <-------------------+
* |(clear) ^ |
* | (delay=long)| |
* | | |
* +----------------- RS_ERR_CHAR <---------+ |
* |(clear) ^ | | |
* | | +-------------+ |(error,
* | | (delay=short) | delay=long)
* | (error,delay=short)| |
* | | +-----------------------+
* | | |
* +--------------------+ | |
* | (noise)| | |
* | | | |
* v (start tone) | | | (end tone,noise)
* --> RS_IDLE ------------> RS_IN_TONE ------------> RS_AFTER_TONE <------- +
* | ^ ^ | | | ^ | |
* | | (delay=short) +---------------+ | | | +-----------+
* | | +--------------+ (start tone) | | | (not ready,
* | | | | | | | buffer dot,
* | | +-------> RS_END_CHAR <--------------+ | | buffer dash)
* | | | | (delay=short) | |
* | +-------------------+ | | |
* | |(clear) | | |
* | | (delay=long)| | |
* | | v | |
* | +----------------- RS_END_WORD <-------------------+ |
* | (clear) (delay=long) |(buffer dot,
* | | buffer dash)
* +-------------------------------------------------------+
*/
static enum
{ RS_IDLE, RS_IN_TONE, RS_AFTER_TONE, RS_END_CHAR, RS_END_WORD, RS_ERR_CHAR,
RS_ERR_WORD
}
cw_receive_state = RS_IDLE;
/**
* Compare two timestamps, and return the difference between them in
* microseconds, taking care to clamp values which would overflow an int.
* This routine always returns a positive integer in the range 0 to INT_MAX.
*/
int cw_compare_timestamps_internal(const struct timeval *earlier,
const struct timeval *later)
{
int delta_usec;
/*
* Compare the timestamps, taking care on overflows.
*
* At 4 WPM, the dash length is 3*(1200000/4)=900,000 usecs, and the word
* gap is 2,100,000 usecs. With the maximum Farnsworth additional delay,
* the word gap extends to 20,100,000 usecs. This fits into an int with a
* lot of room to spare, in fact, an int can represent 2,147,483,647 usecs,
* or around 33 minutes. This is way, way longer than we'd ever want to
* differentiate, so if by some chance we see timestamps farther apart than
* this, and it ought to be very, very unlikely, then we'll clamp the
* return value to INT_MAX with a clear conscience.
*
* Note: passing nonsensical or bogus timevals in may result in unpredict-
* able results. Nonsensical includes timevals with -ve tv_usec, -ve
* tv_sec, tv_usec >= 1,000,000, etc. To help in this, we check all
* incoming timestamps for 'well-formedness'. However, we assume the
* gettimeofday() call always returns good timevals. All in all, timeval
* could probably be a better thought-out structure.
*/
/* Calculate an initial delta, possibly with overflow. */
delta_usec = (later->tv_sec - earlier->tv_sec) * USECS_PER_SEC
+ later->tv_usec - earlier->tv_usec;
/* Check specifically for overflow, and clamp if it did. */
if ((later->tv_sec - earlier->tv_sec) > (INT_MAX / USECS_PER_SEC) + 1
|| delta_usec < 0)
delta_usec = INT_MAX;
return delta_usec;
}
/**
* Called on the start of a receive tone. If the timestamp is NULL, the
* current time is used. On success, the routine returns true. On error,
* it returns false, with errno set to ERANGE if the call is directly after
* another cw_start_receive_tone call or if an existing received character
* has not been cleared from the buffer, or EINVAL if the timestamp passed
* in is invalid.
*/
int cw_start_receive_tone(const struct timeval *timestamp)
{
/*
* If the receive state is not idle or after a tone, this is a state error.
* A receive tone start can only happen while we are idle, or in the middle
* of a character.
*/
if (cw_receive_state != RS_IDLE && cw_receive_state != RS_AFTER_TONE)
{
errno = ERANGE;
return CW_FAILURE;
}
/* Validate and save the timestamp, or get one and then save it. */
if (!cw_validate_timestamp_internal (timestamp, &cw_rr_start_timestamp))
return CW_FAILURE;
/*
* If we are in the after tone state, we can measure the inter-element
* gap by comparing the start timestamp with the last end one, guaranteed
* set by getting to the after tone state via cw_end_receive tone, or in
* extreme cases, by cw_receive_buffer_element_internal.
*
* Do that, then, and update the relevant statistics.
*/
if (cw_receive_state == RS_AFTER_TONE)
{
int space_usec;
space_usec = cw_compare_timestamps_internal (&cw_rr_end_timestamp,
&cw_rr_start_timestamp);
cw_add_receive_statistic_internal (STAT_END_ELEMENT, space_usec);
}
/* Set state to indicate we are inside a tone. */
cw_receive_state = RS_IN_TONE;
cw_debug (CW_DEBUG_RECEIVE_STATES, "receive state ->%d", cw_receive_state);
return CW_SUCCESS;
}
/**
* Analyses a tone using the ranges provided by the low level timing
* parameters. On success, it returns true and sends back either a dot or
* a dash in representation. On error, it returns false with errno set to
* ENOENT if the tone is not recognizable as either a dot or a dash,
* and sets the receive state to one of the error states, depending on
* the tone length passed in.
*
* Note; for adaptive timing, the tone should _always_ be recognized as
* a dot or a dash, because the ranges will have been set to cover 0 to
* INT_MAX.
*/
int cw_identify_receive_tone_internal(int element_usec, char *representation)
{
/* Synchronize low level timings if required */
cw_sync_parameters_internal ();
/* If the timing was, within tolerance, a dot, return dot to the caller. */
if (element_usec >= cw_dot_range_minimum
&& element_usec <= cw_dot_range_maximum)
{
*representation = CW_DOT_REPRESENTATION;
return CW_SUCCESS;
}
/* Do the same for a dash. */
if (element_usec >= cw_dash_range_minimum
&& element_usec <= cw_dash_range_maximum)
{
*representation = CW_DASH_REPRESENTATION;
return CW_SUCCESS;
}
/*
* This element is not a dot or a dash, so we have an error case. Depending
* on the timestamp difference, we pick which of the error states to move
* to, and move to it. The comparison is against the expected end-of-char
* delay. If it's larger, then fix at word error, otherwise settle on char
* error.
*
* Note that we should never reach here for adaptive timing receive.
*/
cw_receive_state = element_usec > cw_eoc_range_maximum
? RS_ERR_WORD : RS_ERR_CHAR;
cw_debug (CW_DEBUG_RECEIVE_STATES, "receive state ->%d", cw_receive_state);
/* Return ENOENT to the caller. */
errno = ENOENT;
return CW_FAILURE;
}
/**
* Updates the averages of dot and dash lengths, and recalculates the
* adaptive threshold for the next receive tone.
*/
void cw_update_adaptive_tracking_internal(int element_usec, char element)
{
int average_dot, average_dash;
/* We are not going to tolerate being called in fixed speed mode. */
if (!cw_is_adaptive_receive_enabled)
return;
/*
* We will update the information held for either dots or dashes. Which we
* pick depends only on what the representation of the character was
* identified as earlier.
*/
if (element == CW_DOT_REPRESENTATION)
cw_update_adaptive_average_internal (&cw_dot_tracking, element_usec);
else if (element == CW_DASH_REPRESENTATION)
cw_update_adaptive_average_internal (&cw_dash_tracking, element_usec);
/*
* Recalculate the adaptive threshold from the values currently held in the
* moving averages. The threshold is calculated as (avg dash length -
* avg dot length) / 2 + avg dot_length.
*/
average_dot = cw_get_adaptive_average_internal (&cw_dot_tracking);
average_dash = cw_get_adaptive_average_internal (&cw_dash_tracking);
cw_adaptive_receive_threshold = (average_dash - average_dot) / 2
+ average_dot;
/*
* Resynchronize the low level timing data following recalculation. If the
* resultant recalculated speed is outside the limits, clamp the speed to
* the limit value and recalculate again.
*
* Resetting the speed directly really means unsetting adaptive mode,
* resyncing to calculate the new threshold, which unfortunately recalcu-
* lates everything else according to fixed speed; so, we then have to reset
* adaptive and resyncing one more time, to get all other timing parameters
* back to where they should be.
*/
cw_is_in_sync = false;
cw_sync_parameters_internal ();
if (cw_receive_speed < CW_SPEED_MIN || cw_receive_speed > CW_SPEED_MAX)
{
cw_receive_speed = cw_receive_speed < CW_SPEED_MIN
? CW_SPEED_MIN : CW_SPEED_MAX;
cw_is_adaptive_receive_enabled = false;
cw_is_in_sync = false;
cw_sync_parameters_internal ();
cw_is_adaptive_receive_enabled = true;
cw_is_in_sync = false;
cw_sync_parameters_internal ();
}
}
/**
* Called on the end of a receive tone. If the timestamp is NULL, the
* current time is used. On success, the routine adds a dot or dash to
* the receive representation buffer, and returns true. On error, it
* returns false, with errno set to ERANGE if the call was not preceded by
* a cw_start_receive_tone call, EINVAL if the timestamp passed in is not
* valid, ENOENT if the tone length was out of bounds for the permissible
* dot and dash lengths and fixed speed receiving is selected, ENOMEM if
* the representation buffer is full, or EAGAIN if the tone was shorter
* than the threshold for noise and was therefore ignored.
*/
int cw_end_receive_tone(const struct timeval *timestamp)
{
int status, element_usec;
char representation;
struct timeval saved_end_timestamp;
/* The receive state is expected to be inside a tone. */
if (cw_receive_state != RS_IN_TONE)
{
errno = ERANGE;
return CW_FAILURE;
}
/*
* Take a safe copy of the current end timestamp, in case we need to put
* it back if we decide this tone is really just noise.
*/
saved_end_timestamp = cw_rr_end_timestamp;
/* Save the timestamp passed in, or get one. */
if (!cw_validate_timestamp_internal (timestamp, &cw_rr_end_timestamp))
return CW_FAILURE;
/* Compare the timestamps to determine the length of the tone. */
element_usec = cw_compare_timestamps_internal (&cw_rr_start_timestamp,
&cw_rr_end_timestamp);
/*
* If the tone length is shorter than any noise canceling threshold that
* has been set, then ignore this tone. This means reverting to the state
* before the call to cw_start_receive_tone. Now, by rights, we should use
* an extra state, RS_IN_FIRST_TONE, say, so that we know whether to go
* back to the idle state, or to after tone. But to make things a touch
* simpler, here we can just look at the current receive buffer pointer.
* If it's zero, we came from idle, otherwise we came from after tone.
*/
if (cw_noise_spike_threshold > 0
&& element_usec <= cw_noise_spike_threshold)
{
cw_receive_state = cw_rr_current == 0 ? RS_IDLE : RS_AFTER_TONE;
/*
* Put the end tone timestamp back to how it was when we came in to
* the routine.
*/
cw_rr_end_timestamp = saved_end_timestamp;
cw_debug (CW_DEBUG_RECEIVE_STATES, "receive state ->%d", cw_receive_state);
errno = EAGAIN;
return CW_FAILURE;
}
/*
* At this point, we have to make a decision about the element just
* received. We'll use a routine that compares ranges to tell us what it
* thinks this element is. If it can't decide, it will hand us back an
* error which we return to the caller. Otherwise, it returns a character,
* dot or dash, for us to buffer.
*/
status = cw_identify_receive_tone_internal (element_usec, &representation);
if (!status)
return CW_FAILURE;
/*
* Update the averaging buffers so that the adaptive tracking of received
* Morse speed stays up to date. But only do this if we have set adaptive
* receiving; don't fiddle about trying to track for fixed speed receive.
*/
if (cw_is_adaptive_receive_enabled)
cw_update_adaptive_tracking_internal (element_usec, representation);
/*
* Update dot and dash timing statistics. It may seem odd to do this after
* calling cw_update_adaptive_tracking_internal, rather than before, as
* this function changes the ideal values we're measuring against. But if
* we're on a speed change slope, the adaptive tracking smoothing will
* cause the ideals to lag the observed speeds. So by doing this here, we
* can at least ameliorate this effect, if not eliminate it.
*/
if (representation == CW_DOT_REPRESENTATION)
cw_add_receive_statistic_internal (STAT_DOT, element_usec);
else
cw_add_receive_statistic_internal (STAT_DASH, element_usec);
/* Add the representation character to the receive buffer. */
cw_receive_representation_buffer[cw_rr_current++] = representation;
/*
* We just added a representation to the receive buffer. If it's full,
* then we have to do something, even though it's unlikely. What we'll do
* is make a unilateral declaration that if we get this far, we go to
* end-of-char error state automatically.
*/
if (cw_rr_current == RECEIVE_CAPACITY - 1)
{
cw_receive_state = RS_ERR_CHAR;
cw_debug (CW_DEBUG_RECEIVE_STATES, "receive state ->%d", cw_receive_state);
errno = ENOMEM;
return CW_FAILURE;
}
/* All is well. Move to the more normal after-tone state. */
cw_receive_state = RS_AFTER_TONE;
cw_debug (CW_DEBUG_RECEIVE_STATES, "receive state ->%d", cw_receive_state);
return CW_SUCCESS;
}
/**
* Adds either a dot or a dash to the receive representation buffer. If
* the timestamp is NULL, the current timestamp is used. The receive state
* is updated as if we had just received a call to cw_end_receive_tone.
*/
int cw_receive_buffer_element_internal(const struct timeval *timestamp,
char element)
{
/*
* The receive state is expected to be idle or after a tone in order to
* use this routine.
*/
if (cw_receive_state != RS_IDLE && cw_receive_state != RS_AFTER_TONE)
{
errno = ERANGE;
return CW_FAILURE;
}
/*
* This routine functions as if we have just seen a tone end, yet without
* really seeing a tone start. To keep timing information for routines
* that come later, we need to make sure that the end of tone timestamp is
* set here. This is because the receive representation routine looks at
* the time since the last end of tone to determine whether we are at the
* end of a word, or just at the end of a character. It doesn't matter that
* the start of tone timestamp is never set - this is just for timing the
* tone length, and we don't need to do that since we've already been told
* whether this is a dot or a dash.
*/
if (!cw_validate_timestamp_internal (timestamp, &cw_rr_end_timestamp))
return CW_FAILURE;
/* Add the element to the receive representation buffer. */
cw_receive_representation_buffer[cw_rr_current++] = element;
/*
* We just added an element to the receive buffer. As above, if it's full,
* then we have to do something, even though it's unlikely to actually be
* full.
*/
if (cw_rr_current == RECEIVE_CAPACITY - 1)
{
cw_receive_state = RS_ERR_CHAR;
cw_debug (CW_DEBUG_RECEIVE_STATES, "receive state ->%d", cw_receive_state);
errno = ENOMEM;
return CW_FAILURE;
}
/*
* Since we effectively just saw the end of a tone, move to the after-tone
* state.
*/
cw_receive_state = RS_AFTER_TONE;
cw_debug (CW_DEBUG_RECEIVE_STATES, "receive state ->%d", cw_receive_state);
return CW_SUCCESS;
}
/**
\brief Add a dot to the receive representation buffer.
* If the timestamp is NULL, the current timestamp is used. These routines
* are for callers that have already determined whether a dot or dash was
* received by a method other than calling the routines cw_start_receive_tone
* and cw_end_receive_tone. On success, the relevant element is added to
* the receive representation buffer. On error, the routines return false,
* with errno set to ERANGE if preceded by a cw_start_receive_tone call
* with no matching cw_end_receive_tone or if an error condition currently
* exists within the receive buffer, or ENOMEM if the receive representation
* buffer is full.
*/
int cw_receive_buffer_dot(const struct timeval *timestamp)
{
return cw_receive_buffer_element_internal (timestamp, CW_DOT_REPRESENTATION);
}
/**
\brief Add a dash to the receive representation buffer.
See documentation of cw_receive_buffer_dot() for more information
*/
int cw_receive_buffer_dash(const struct timeval *timestamp)
{
return cw_receive_buffer_element_internal (timestamp, CW_DASH_REPRESENTATION);
}
/**
* Returns the current buffered representation from the receive buffer.
* On success, the function returns true, and fills in representation with the
* contents of the current representation buffer. On error, it returns false,
* with errno set to ERANGE if not preceded by a cw_end_receive_tone call,
* a prior successful cw_receive_representation call, or a prior
* cw_receive_buffer_dot or cw_receive_buffer_dash, EINVAL if the timestamp
* passed in is invalid, or EAGAIN if the call is made too early to determine
* whether a complete representation has yet been placed in the buffer
* (that is, less than the inter-character gap period elapsed since the last
* cw_end_receive_tone or cw_receive_buffer_dot/dash call). is_end_of_word
* indicates that the delay after the last tone received is longer that the
* inter-word gap, and is_error indicates that the representation was
* terminated by an error condition.
*/
int cw_receive_representation(const struct timeval *timestamp,
char *representation, bool *is_end_of_word,
bool *is_error)
{
int space_usec;
struct timeval now_timestamp;
/*
* If the the receive state indicates that we have in our possession a
* completed representation at the end of word, just [re-]return it.
*/
if (cw_receive_state == RS_END_WORD || cw_receive_state == RS_ERR_WORD)
{
if (is_end_of_word)
*is_end_of_word = true;
if (is_error)
*is_error = (cw_receive_state == RS_ERR_WORD);
*representation = '\0';
strncat (representation, cw_receive_representation_buffer, cw_rr_current);
return CW_SUCCESS;
}
/*
* If the receive state is also not end-of-char, and also not after a tone,
* then we are idle or in a tone; in these cases, we return ERANGE.
*/
if (cw_receive_state != RS_AFTER_TONE
&& cw_receive_state != RS_END_CHAR && cw_receive_state != RS_ERR_CHAR)
{
errno = ERANGE;
return CW_FAILURE;
}
/*
* We now know the state is after a tone, or end-of-char, perhaps with
* error. For all three of these cases, we're going to [re-]compare the
* timestamp with the end of tone timestamp. This could mean that in the
* case of end-of-char, we revise our opinion on later calls to end-of-word.
* This is correct, since it models reality.
*/
/*
* If we weren't supplied with one, get the current timestamp for comparison
* against the latest end timestamp.
*/
if (!cw_validate_timestamp_internal (timestamp, &now_timestamp))
return CW_FAILURE;
/*
* Now we need to compare the timestamps to determine the length of the
* inter-tone gap.
*/
space_usec = cw_compare_timestamps_internal (&cw_rr_end_timestamp,
&now_timestamp);
/* Synchronize low level timings if required */
cw_sync_parameters_internal ();
/*
* If the timing was, within tolerance, a character space, then that is
* what we'll call it. In this case, we complete the representation and
* return it.
*/
if (space_usec >= cw_eoc_range_minimum
&& space_usec <= cw_eoc_range_maximum)
{
/*
* If state is after tone, we can validly move at this point to end of
* char. If it's not, then we're at end char or at end char with error
* already, so leave it. On moving, update timing statistics for an
* identified end of character.
*/
if (cw_receive_state == RS_AFTER_TONE)
{
cw_add_receive_statistic_internal (STAT_END_CHARACTER, space_usec);
cw_receive_state = RS_END_CHAR;
}
cw_debug (CW_DEBUG_RECEIVE_STATES, "receive state ->%d", cw_receive_state);
/* Return the representation buffered. */
if (is_end_of_word)
*is_end_of_word = false;
if (is_error)
*is_error = (cw_receive_state == RS_ERR_CHAR);
*representation = '\0';
strncat (representation, cw_receive_representation_buffer, cw_rr_current);
return CW_SUCCESS;
}
/*
* If the timing indicated a word space, again we complete the representation
* and return it. In this case, we also need to inform the client that this
* looked like the end of a word, not just a character. And, we don't care
* about the maximum period, only that it exceeds the low end of the range.
*/
if (space_usec > cw_eoc_range_maximum)
{
/*
* In this case, we have a transition to an end of word case. If we
* were sat in an error case, we need to move to the correct end of word
* state, otherwise, at after tone, we go safely to the non-error end
* of word.
*/
cw_receive_state = cw_receive_state == RS_ERR_CHAR
? RS_ERR_WORD : RS_END_WORD;
cw_debug (CW_DEBUG_RECEIVE_STATES, "receive state ->%d", cw_receive_state);
/* Return the representation buffered. */
if (is_end_of_word)
*is_end_of_word = true;
if (is_error)
*is_error = (cw_receive_state == RS_ERR_WORD);
*representation = '\0';
strncat (representation, cw_receive_representation_buffer, cw_rr_current);
return CW_SUCCESS;
}
/*
* If none of these conditions holds, then we cannot yet make a judgement
* on what we have in the buffer, so return EAGAIN.
*/
errno = EAGAIN;
return CW_FAILURE;
}
/**
* Returns the current buffered character from the representation buffer.
* On success, the function returns true, and fills char *c with the contents
* of the current representation buffer, translated into a character. On
* error, it returns false, with errno set to ERANGE if not preceded by a
* cw_end_receive_tone call, a prior successful cw_receive_character
* call, or a cw_receive_buffer_dot or cw_receive_buffer dash call, EINVAL
* if the timestamp passed in is invalid, or EAGAIN if the call is made too
* early to determine whether a complete character has yet been placed in the
* buffer (that is, less than the inter-character gap period elapsed since
* the last cw_end_receive_tone or cw_receive_buffer_dot/dash call).
* is_end_of_word indicates that the delay after the last tone received is
* longer that the inter-word gap, and is_error indicates that the character
* was terminated by an error condition.
*/
int cw_receive_character(const struct timeval *timestamp,
char *c, bool *is_end_of_word, bool *is_error)
{
int status;
bool end_of_word, error;
char character, representation[RECEIVE_CAPACITY + 1];
/* See if we can obtain a representation from the receive routines. */
status = cw_receive_representation (timestamp, representation,
&end_of_word, &error);
if (!status)
return CW_FAILURE;
/* Look up the representation using the lookup functions. */
character = cw_lookup_representation_internal (representation);
if (!character)
{
errno = ENOENT;
return CW_FAILURE;
}
/* If we got this far, all is well, so return what we uncovered. */
if (c)
*c = character;
if (is_end_of_word)
*is_end_of_word = end_of_word;
if (is_error)
*is_error = error;
return CW_SUCCESS;
}
/**
* Clears the receive representation buffer to receive tones again. This
* routine must be called after successful, or terminating,
* cw_receive_representation or cw_receive_character calls, to clear the
* states and prepare the buffer to receive more tones.
*/
void cw_clear_receive_buffer(void)
{
cw_rr_current = 0;
cw_receive_state = RS_IDLE;
cw_debug (CW_DEBUG_RECEIVE_STATES, "receive state ->%d", cw_receive_state);
}
/**
* Returns the number of entries the receive buffer can accommodate. The
* maximum number of character written out by cw_receive_representation is
* the capacity + 1, the extra character being used for the terminating
* NUL.
*/
int cw_get_receive_buffer_capacity(void)
{
return RECEIVE_CAPACITY;
}
/**
* Returns the number of elements currently pending in the receive buffer.
*/
int cw_get_receive_buffer_length(void)
{
return cw_rr_current;
}
/**
* Clear the receive representation buffer, statistics, and any retained
* receive state. This function is suitable for calling from an application
* exit handler.
*/
void cw_reset_receive(void)
{
cw_rr_current = 0;
cw_receive_state = RS_IDLE;
cw_reset_receive_statistics ();
cw_debug (CW_DEBUG_RECEIVE_STATES, "receive state ->%d (reset)", cw_receive_state);
}
/*---------------------------------------------------------------------*/
/* Iambic keyer */
/*---------------------------------------------------------------------*/
/*
* Iambic keyer status. The keyer functions maintain the current known state
* of the paddles, and latch false-to-true transitions while busy, to form the
* iambic effect. For Curtis mode B, the keyer also latches any point where
* both paddle states are true at the same time.
*/
static volatile bool cw_ik_dot_paddle = false, /* Dot paddle state */
cw_ik_dash_paddle = false, /* Dash paddle state */
cw_ik_dot_latch = false, /* Dot false->true latch */
cw_ik_dash_latch = false, /* Dash false->true latch */
cw_ik_curtis_b_latch = false; /* Curtis Dot&&Dash latch */
/*
* Iambic keyer "Curtis" mode A/B selector. Mode A and mode B timings differ
* slightly, and some people have a preference for one or the other. Mode A
* is a bit less timing-critical, so we'll make that the default.
*/
static volatile bool cw_ik_curtis_mode_b = false;
/**
* Normally, the iambic keying functions will emulate Curtis 8044 Keyer
* mode A. In this mode, when both paddles are pressed together, the last
* dot or dash being sent on release is completed, and nothing else is sent.
* In mode B, when both paddles are pressed together, the last dot or dash
* being sent on release is completed, then an opposite element is also sent.
* Some operators prefer mode B, but timing is more critical in this mode.
* The default mode is Curtis mode A.
*/
void cw_enable_iambic_curtis_mode_b(void)
{
cw_ik_curtis_mode_b = true;
}
/**
See documentation of cw_enable_iambic_curtis_mode_b() for more information
*/
void cw_disable_iambic_curtis_mode_b(void)
{
cw_ik_curtis_mode_b = false;
}
/**
See documentation of cw_enable_iambic_curtis_mode_b() for more information
*/
int cw_get_iambic_curtis_mode_b_state(void)
{
return cw_ik_curtis_mode_b;
}
/*
* The CW keyer functions implement the following state graph:
*
* +-----------------------------------------------------+
* | (all latches clear) |
* | (dot latch) |
* | +--------------------------+
* | | |
* | v |
* | +-------------> KS_IN_DOT_[A|B] -------> KS_AFTER_DOT_[A|B]
* | |(dot paddle) ^ (delay) |
* | | | |(dash latch/
* | | +------------+ | _B)
* v | | |
* --> KS_IDLE --+ +--------------------------+
* ^ | | |
* | | | +-------------+(dot latch/
* | | | | _B)
* | |(dash paddle) v (delay) |
* | +-------------> KS_IN_DASH_[A|B] -------> KS_AFTER_DASH_[A|B]
* | ^ |
* | | |
* | +--------------------------+
* | (dash latch) |
* | (all latches clear) |
* +-----------------------------------------------------+
*/
static volatile enum
{ KS_IDLE, KS_IN_DOT_A, KS_IN_DASH_A, KS_AFTER_DOT_A, KS_AFTER_DASH_A,
KS_IN_DOT_B, KS_IN_DASH_B, KS_AFTER_DOT_B, KS_AFTER_DASH_B
}
cw_keyer_state = KS_IDLE;
/**
* Informs the internal keyer states that the itimer expired, and we received
* SIGALRM.
*/
void cw_keyer_clock_internal(void)
{
/* Synchronize low level timing parameters if required. */
cw_sync_parameters_internal ();
/* Decide what to do based on the current state. */
switch (cw_keyer_state)
{
/* Ignore calls if our state is idle. */
case KS_IDLE:
return;
/*
* If we were in a dot, turn off tones and begin the after-dot delay. Do
* much the same if we are in a dash. No routine status checks are made
* since we are in a signal handler, and can't readily return error codes
* to the client.
*/
case KS_IN_DOT_A:
case KS_IN_DOT_B:
cw_sound_internal (CW_TONE_SILENT);
cw_key_control_internal (false);
cw_request_timeout_internal (cw_end_of_ele_delay, NULL);
cw_keyer_state = cw_keyer_state == KS_IN_DOT_A
? KS_AFTER_DOT_A : KS_AFTER_DOT_B;
cw_debug (CW_DEBUG_KEYER_STATES, "keyer ->%d", cw_keyer_state);
break;
case KS_IN_DASH_A:
case KS_IN_DASH_B:
cw_sound_internal (CW_TONE_SILENT);
cw_key_control_internal (false);
cw_request_timeout_internal (cw_end_of_ele_delay, NULL);
cw_keyer_state = cw_keyer_state == KS_IN_DASH_A
? KS_AFTER_DASH_A : KS_AFTER_DASH_B;
cw_debug (CW_DEBUG_KEYER_STATES, "keyer ->%d", cw_keyer_state);
break;
/*
* If we have just finished a dot or a dash and its post-element delay,
* then reset the latches as appropriate. Next, if in a _B state, go
* straight to the opposite element state. If in an _A state, check the
* latch states; if the opposite latch is set true, then do the iambic
* thing and alternate dots and dashes. If the same latch is true,
* repeat. And if nothing is true, then revert to idling.
*/
case KS_AFTER_DOT_A:
case KS_AFTER_DOT_B:
if (!cw_ik_dot_paddle)
cw_ik_dot_latch = false;
if (cw_keyer_state == KS_AFTER_DOT_B)
{
cw_sound_internal (generator->frequency);
cw_key_control_internal (true);
cw_request_timeout_internal (cw_send_dash_length, NULL);
cw_keyer_state = KS_IN_DASH_A;
}
else if (cw_ik_dash_latch)
{
cw_sound_internal (generator->frequency);
cw_key_control_internal (true);
cw_request_timeout_internal (cw_send_dash_length, NULL);
if (cw_ik_curtis_b_latch)
{
cw_ik_curtis_b_latch = false;
cw_keyer_state = KS_IN_DASH_B;
}
else
cw_keyer_state = KS_IN_DASH_A;
}
else if (cw_ik_dot_latch)
{
cw_sound_internal (generator->frequency);
cw_key_control_internal (true);
cw_request_timeout_internal (cw_send_dot_length, NULL);
cw_keyer_state = KS_IN_DOT_A;
}
else
{
cw_keyer_state = KS_IDLE;
cw_schedule_finalization_internal ();
}
cw_debug (CW_DEBUG_KEYER_STATES, "keyer ->%d", cw_keyer_state);
break;
case KS_AFTER_DASH_A:
case KS_AFTER_DASH_B:
if (!cw_ik_dash_paddle)
cw_ik_dash_latch = false;
if (cw_keyer_state == KS_AFTER_DASH_B)
{
cw_sound_internal (generator->frequency);
cw_key_control_internal (true);
cw_request_timeout_internal (cw_send_dot_length, NULL);
cw_keyer_state = KS_IN_DOT_A;
}
else if (cw_ik_dot_latch)
{
cw_sound_internal (generator->frequency);
cw_key_control_internal (true);
cw_request_timeout_internal (cw_send_dot_length, NULL);
if (cw_ik_curtis_b_latch)
{
cw_ik_curtis_b_latch = false;
cw_keyer_state = KS_IN_DOT_B;
}
else
cw_keyer_state = KS_IN_DOT_A;
}
else if (cw_ik_dash_latch)
{
cw_sound_internal (generator->frequency);
cw_key_control_internal (true);
cw_request_timeout_internal (cw_send_dash_length, NULL);
cw_keyer_state = KS_IN_DASH_A;
}
else
{
cw_keyer_state = KS_IDLE;
cw_schedule_finalization_internal ();
}
cw_debug (CW_DEBUG_KEYER_STATES, "keyer ->%d", cw_keyer_state);
break;
}
}
/**
* Informs the internal keyer states that the keyer paddles have changed
* state. The new paddle states are recorded, and if either transition from
* false to true, paddle latches, for iambic functions, are also set.
* On success, the routine returns true. On error, it returns false, with
* errno set to EBUSY if the tone queue or straight key are using the sound
* card, console speaker, or keying system.
*
* If appropriate, this routine starts the keyer functions sending the
* relevant element. Element send and timing occurs in the background, so
* this routine returns almost immediately. See cw_keyer_element_wait and
* cw_keyer_wait for details about how to check the current status of
* iambic keyer background processing.
*/
int cw_notify_keyer_paddle_event(int dot_paddle_state,
int dash_paddle_state)
{
/*
* If the tone queue or the straight key are busy, this is going to conflict
* with our use of the sound card, console sounder, and keying system. So
* return an error status in this case.
*/
if (cw_is_straight_key_busy () || cw_is_tone_busy ())
{
errno = EBUSY;
return CW_FAILURE;
}
/* Clean up and save the paddle states passed in. */
cw_ik_dot_paddle = (dot_paddle_state != 0);
cw_ik_dash_paddle = (dash_paddle_state != 0);
/*
* Update the paddle latches if either paddle goes true. The latches are
* checked in the signal handler, so if the paddles go back to false during
* this element, the item still gets actioned. The signal handler is also
* responsible for clearing down the latches.
*/
if (cw_ik_dot_paddle)
cw_ik_dot_latch = true;
if (cw_ik_dash_paddle)
cw_ik_dash_latch = true;
/*
* If in Curtis mode B, make a special check for both paddles true at the
* same time. This flag is checked by the signal handler, to determine
* whether to add mode B trailing timing elements.
*/
if (cw_ik_curtis_mode_b && cw_ik_dot_paddle && cw_ik_dash_paddle)
cw_ik_curtis_b_latch = true;
cw_debug (CW_DEBUG_KEYER_STATES, "keyer paddles %d,%d, latches %d,%d, curtis_b %d",
cw_ik_dot_paddle, cw_ik_dash_paddle,
cw_ik_dot_latch, cw_ik_dash_latch, cw_ik_curtis_b_latch);
/* If the current state is idle, give the state process a nudge. */
if (cw_keyer_state == KS_IDLE)
{
if (cw_ik_dot_paddle)
{
/* Pretend we just finished a dash. */
cw_keyer_state = cw_ik_curtis_b_latch
? KS_AFTER_DASH_B : KS_AFTER_DASH_A;
cw_request_timeout_internal (0, cw_keyer_clock_internal);
}
else if (cw_ik_dash_paddle)
{
/* Pretend we just finished a dot. */
cw_keyer_state = cw_ik_curtis_b_latch
? KS_AFTER_DOT_B : KS_AFTER_DOT_A;
cw_request_timeout_internal (0, cw_keyer_clock_internal);
}
}
cw_debug (CW_DEBUG_KEYER_STATES, "keyer ->%d", cw_keyer_state);
return CW_SUCCESS;
}
/**
* Convenience functions to alter the state of just one of the two iambic
* keyer paddles. The other paddle state of the paddle pair remains unchanged.
*
* See cw_keyer_paddle_event for details of iambic keyer background processing,
* and how to check its status.
*/
int cw_notify_keyer_dot_paddle_event(int dot_paddle_state)
{
return cw_notify_keyer_paddle_event (dot_paddle_state, cw_ik_dash_paddle);
}
/**
See documentation of cw_notify_keyer_dot_paddle_event() for more information
*/
int cw_notify_keyer_dash_paddle_event(int dash_paddle_state)
{
return cw_notify_keyer_paddle_event (cw_ik_dot_paddle, dash_paddle_state);
}
/**
* Returns the current saved states of the two paddles.
*/
void cw_get_keyer_paddles(int *dot_paddle_state, int *dash_paddle_state)
{
if (dot_paddle_state)
*dot_paddle_state = cw_ik_dot_paddle;
if (dash_paddle_state)
*dash_paddle_state = cw_ik_dash_paddle;
}
/**
* Returns the current saved states of the two paddle latches. A paddle
* latches is set to true when the paddle state becomes true, and is
* cleared if the paddle state is false when the element finishes sending.
*/
void cw_get_keyer_paddle_latches(int *dot_paddle_latch_state,
int *dash_paddle_latch_state)
{
if (dot_paddle_latch_state)
*dot_paddle_latch_state = cw_ik_dot_latch;
if (dash_paddle_latch_state)
*dash_paddle_latch_state = cw_ik_dash_latch;
}
/**
\brief Check if a keyer is busy
\return true if keyer is busy
\return false if keyer is not busy
*/
bool cw_is_keyer_busy(void)
{
return cw_keyer_state != KS_IDLE;
}
/**
* Waits until the end of the current element, dot or dash, from the keyer.
* This routine returns true on success. On error, it returns false, with
* errno set to EDEADLK if SIGALRM is blocked.
*/
int cw_wait_for_keyer_element(void)
{
int status;
/* Check that SIGALRM is not blocked. */
status = cw_check_signal_mask_internal ();
if (!status)
return CW_FAILURE;
/*
* First wait for the state to move to idle (or just do nothing if it's
* not), or to one of the after- states.
*/
while (cw_keyer_state != KS_IDLE
&& cw_keyer_state != KS_AFTER_DOT_A
&& cw_keyer_state != KS_AFTER_DOT_B
&& cw_keyer_state != KS_AFTER_DASH_A
&& cw_keyer_state != KS_AFTER_DASH_B)
cw_wait_for_signal_internal ();
/*
* Now wait for the state to move to idle (unless it is, or was, already),
* or one of the in- states, at which point we know we're actually at the
* end of the element we were in when we entered this routine.
*/
while (cw_keyer_state != KS_IDLE
&& cw_keyer_state != KS_IN_DOT_A
&& cw_keyer_state != KS_IN_DOT_B
&& cw_keyer_state != KS_IN_DASH_A
&& cw_keyer_state != KS_IN_DASH_B)
cw_wait_for_signal_internal ();
return CW_SUCCESS;
}
/**
* Waits for the current keyer cycle to complete. The routine returns true on
* success. On error, it returns false, with errno set to EDEADLK if SIGALRM
* is blocked or if either paddle state is true.
*/
int cw_wait_for_keyer(void)
{
int status;
/* Check that SIGALRM is not blocked. */
status = cw_check_signal_mask_internal ();
if (!status)
return CW_FAILURE;
/*
* Check that neither paddle is true; if either is, then the signal cycle
* is going to continue forever, and we'll never return from this routine.
*/
if (cw_ik_dot_paddle || cw_ik_dash_paddle)
{
errno = EDEADLK;
return CW_FAILURE;
}
/* Wait for the keyer state to go idle. */
while (cw_keyer_state != KS_IDLE)
cw_wait_for_signal_internal ();
return CW_SUCCESS;
}
/**
* Clear all keyer latches and paddle states, return to Curtis 8044 Keyer
* mode A, and return to silence. This function is suitable for calling from
* an application exit handler.
*/
void cw_reset_keyer(void)
{
cw_ik_dot_paddle = false;
cw_ik_dash_paddle = false;
cw_ik_dot_latch = false;
cw_ik_dash_latch = false;
cw_ik_curtis_b_latch = false;
cw_ik_curtis_mode_b = false;
cw_keyer_state = KS_IDLE;
/* Silence sound and stop any background soundcard tone generation. */
cw_sound_internal (CW_TONE_SILENT);
cw_schedule_finalization_internal ();
cw_debug (CW_DEBUG_KEYER_STATES, "keyer ->%d (reset)", cw_keyer_state);
}
/*---------------------------------------------------------------------*/
/* Straight key */
/*---------------------------------------------------------------------*/
/*
* Period of constant tone generation after which we need another timeout,
* to ensure that the soundcard doesn't run out of data.
*/
static const int STRAIGHT_KEY_TIMEOUT = 500000;
/* Straight key status; just a key-up or key-down indication. */
static volatile bool cw_sk_key_down = false;
/**
* Soundcard tone data is only buffered to last about a second on each
* cw_generate_sound_internal() call, and holding down the straight key for
* longer than this could cause a soundcard data underrun. To guard against
* this, a timeout is generated every half-second or so while the straight
* key is down. The timeout generates a chunk of sound data for the soundcard.
*/
void cw_straight_key_clock_internal(void)
{
if (cw_sk_key_down)
{
/* Generate a quantum of tone data, and request another timeout. */
/* cw_generate_sound_internal (); */
cw_request_timeout_internal (STRAIGHT_KEY_TIMEOUT, NULL);
}
}
/**
* Informs the library that the straight key has changed state. This routine
* returns true on success. On error, it returns false, with errno set to
* EBUSY if the tone queue or iambic keyer are using the sound card, console
* speaker, or keying control system. If key_state indicates no change of
* state, the call is ignored.
*/
int cw_notify_straight_key_event(int key_state)
{
/*
* If the tone queue or the keyer are busy, we can't use the sound card,
* console sounder, or the key control system.
*/
if (cw_is_tone_busy () || cw_is_keyer_busy ())
{
errno = EBUSY;
return CW_FAILURE;
}
/* If the key state did not change, ignore the call. */
if ((cw_sk_key_down && !key_state) || (!cw_sk_key_down && key_state))
{
/* Save the new key state. */
cw_sk_key_down = (key_state != 0);
cw_debug (CW_DEBUG_STRAIGHT_KEY, "straight key state ->%s", cw_sk_key_down ? "DOWN" : "UP");
/*
* Do tones and keying, and set up timeouts and soundcard activities to
* match the new key state.
*/
if (cw_sk_key_down)
{
cw_sound_internal (generator->frequency);
cw_key_control_internal (true);
/* Start timeouts to keep soundcard tones running. */
cw_request_timeout_internal (STRAIGHT_KEY_TIMEOUT,
cw_straight_key_clock_internal);
}
else
{
cw_sound_internal (CW_TONE_SILENT);
cw_key_control_internal (false);
/*
* Indicate that we have finished with timeouts, and also with the
* soundcard too. There's no way of knowing when straight keying
* is completed, so the only thing we can do here is to schedule
* release on each key up event.
*/
cw_schedule_finalization_internal ();
}
}
return CW_SUCCESS;
}
/**
* Returns the current saved state of the straight key; true if the key is
* down, false if up.
*/
int cw_get_straight_key_state(void)
{
return cw_sk_key_down;
}
/**
* Returns true if the straight key is busy, false if not. This routine is
* just a pseudonym for cw_get_straight_key_state, and exists to fill a hole
* in the API naming conventions.
*/
bool cw_is_straight_key_busy(void)
{
return cw_sk_key_down;
}
/**
* Clears the straight key state, and returns to silence. This function is
* suitable for calling from an application exit handler.
*/
void cw_reset_straight_key(void)
{
cw_sk_key_down = false;
/* Silence sound and stop any background soundcard tone generation. */
cw_sound_internal (CW_TONE_SILENT);
cw_schedule_finalization_internal ();
cw_debug (CW_DEBUG_STRAIGHT_KEY, "straight key state ->UP (reset)");
}
/* ************************ */
/* Generator - generic */
/* ************************ */
static const char *cw_audio_system_labels[] = {
"None",
"Console",
"OSS",
"ALSA",
"Soundcard" };
/**
\brief Get a readable label of current audio system
The function returns one of following strings:
None, Console, OSS, ALSA, Soundcard
\return audio system's label
*/
const char *cw_generator_get_audio_system_label(void)
{
return cw_audio_system_labels[generator->audio_system];
}
/**
\brief Create new generator
Allocate memory for new generator data structure, set up default values
of some of the generator's properties.
The function does not start the generator (generator does not produce
a sound), you have to use cw_generator_start() for this.
\param audio_system - audio system to be used by the generator (console, OSS, ALSA, soundcard, see 'enum cw_audio_systems')
\param device - name of audio device to be used; if NULL then library will use default device.
*/
int cw_generator_new(int audio_system, const char *device)
{
generator = (cw_gen_t *) malloc(sizeof (cw_gen_t));
if (!generator) {
cw_debug (CW_DEBUG_SYSTEM, "error: malloc");
return CW_FAILURE;
}
generator->audio_device = NULL;
generator->audio_system = audio_system;
generator->audio_device_open = 0;
generator->debug_sink = -1;
generator->frequency = CW_FREQUENCY_INITIAL;
generator->volume = CW_VOLUME_INITIAL;
generator->buffer = NULL;
generator->buffer_n_samples = -1;
pthread_attr_init(&(generator->thread_attr));
pthread_attr_setdetachstate(&(generator->thread_attr), PTHREAD_CREATE_DETACHED);
generator->thread_error = 0;
cw_set_audio_device(device);
int rv = CW_FAILURE;
if (audio_system == CW_AUDIO_CONSOLE) {
rv = cw_open_device_console(generator->audio_device);
} else if (audio_system == CW_AUDIO_OSS) {
rv = cw_open_device_oss(generator->audio_device);
} else if (audio_system == CW_AUDIO_ALSA) {
rv = cw_open_device_alsa(generator->audio_device);
} else {
cw_dev_debug ("unsupported audio system");
rv = CW_FAILURE;
}
if (rv == CW_SUCCESS) {
if (audio_system == CW_AUDIO_CONSOLE) {
/* console output does not require audio buffer */
return CW_SUCCESS;
}
generator->buffer = (cw_sample_t *) malloc(generator->buffer_n_samples * sizeof (cw_sample_t));
if (generator->buffer != NULL) {
return CW_SUCCESS;
} else {
cw_debug (CW_DEBUG_SYSTEM, "error: malloc");
}
}
return CW_FAILURE;
}
/**
\brief Deallocate generator
Deallocate/destroy generator data structure created with call
to cw_generator_new(). You can't start nor use the generator
after the call to this function.
*/
void cw_generator_delete(void)
{
if (generator) {
/* Wait for "write" thread to end accessing output
file descriptor. I have come up with value 500
after doing some experiments. */
usleep(500);
if (generator->audio_device) {
free(generator->audio_device);
generator->audio_device = NULL;
}
if (generator->buffer) {
free(generator->buffer);
generator->buffer = NULL;
}
if (generator->audio_system == CW_AUDIO_CONSOLE) {
cw_close_device_console();
} else if (generator->audio_system == CW_AUDIO_OSS) {
cw_close_device_oss();
} else if (generator->audio_system == CW_AUDIO_ALSA) {
cw_close_device_alsa();
} else {
cw_dev_debug ("missed audio system %d", generator->audio_system);
}
pthread_attr_destroy(&(generator->thread_attr));
generator->audio_system = CW_AUDIO_NONE;
free(generator);
generator = NULL;
}
return;
}
/**
\brief Start a generator
Start producing sound using generator created with
cw_generator_new().
\return CW_FAILURE on errors
\return CW_SUCCESS on success
*/
int cw_generator_start(void)
{
generator->phase_offset = 0.0;
generator->phase = 0.0;
/* both values being zero here means that generator
has started working, but its output is silence;
set .slope to a positive value to start generating
a sound with non-zero amplitude */
generator->slope = 0;
generator->amplitude = 0;
generator->generate = 1;
if (generator->audio_system == CW_AUDIO_CONSOLE) {
; /* no thread needed for generating sound on console */
} else if (generator->audio_system == CW_AUDIO_OSS) {
int rv = pthread_create(&(generator->thread), &(generator->thread_attr),
cw_generator_write_sine_wave_oss,
(void *) generator);
if (rv != 0) {
cw_debug (CW_DEBUG_SYSTEM, "error: failed to create OSS generator thread\n");
return CW_FAILURE;
} else {
/* for some yet unknown reason you have to
put usleep() here, otherwise a generator
may work incorrectly */
usleep(100000);
return CW_SUCCESS;
}
} else if (generator->audio_system == CW_AUDIO_ALSA) {
int rv = pthread_create(&(generator->thread), &(generator->thread_attr),
cw_generator_write_sine_wave_alsa,
(void *) generator);
if (rv != 0) {
cw_debug (CW_DEBUG_SYSTEM, "error: failed to create ALSA generator thread\n");
return CW_FAILURE;
} else {
/* for some yet unknown reason you have to
put usleep() here, otherwise a generator
may work incorrectly */
usleep(100000);
return CW_SUCCESS;
}
} else {
cw_dev_debug ("unsupported audio system %d", generator->audio_system);
}
return CW_SUCCESS;
}
/**
\brief Shut down a generator
Silence tone generated by generator (level of generated sine wave is
set to zero, with falling slope), and shut the generator down. If you
want to use the generator again, you have to call cw_generator_start().
*/
void cw_generator_stop(void)
{
if (!generator) {
cw_dev_debug ("called the function for NULL generator");
return;
}
if (generator->audio_system == CW_AUDIO_CONSOLE) {
/* sine wave generation should have been stopped
by a code generating dots/dashes, but
just in case... */
ioctl(generator->audio_sink, KIOCSOUND, 0);
} else if (generator->audio_system == CW_AUDIO_OSS
|| generator->audio_system == CW_AUDIO_ALSA) {
cw_sound_soundcard_internal(CW_TONE_SILENT);
/* time needed between initiating stop sequence and
ending write() to device and closing the device */
int usleep_time = generator->sample_rate / (2 * generator->buffer_n_samples);
usleep_time /= 1000000;
usleep(usleep_time * 1.2);
generator->generate = 0;
/* Sleep some more to postpone closing a device.
This way we can avoid a situation when 'generate' is set
to zero and device is being closed while a new buffer is
being prepared, and while write() tries to write this
new buffer to already closed device.
Without this usleep(), writei() from ALSA library may
return "File descriptor in bad state" error - this
happened when writei() tried to write to closed ALSA
handle. */
usleep(10000);
} else {
cw_dev_debug ("called stop() function for generator without audio system specified");
}
return;
}
/**
\brief Calculate a fragment of sine wave
Calculate a fragment of sine wave, as many samples as can be
fitted in generator's buffer. There will be gen->buffer_n_samples
samples put into gen->buffer, starting from gen->buffer[0].
The function takes into account all state variables from gen,
so initial phase of new fragment of sine wave in the buffer matches
ending phase of a sine wave generated in current call.
\param gen - current generator
\return CW_SUCCESS
*/
int cw_generator_calculate_sine_wave(cw_gen_t *gen)
{
int i = 0;
double phase = 0.0;
for (i = 0; i < gen->buffer_n_samples; i++) {
double phase = (2.0 * M_PI
* (double) gen->frequency * (double) i
/ (double) gen->sample_rate)
+ gen->phase_offset;
int amplitude = cw_generator_calculate_amplitude(gen);
gen->buffer[i] = amplitude * sin(phase);
}
/* Compute the phase of the last generated sample
(or is it phase of first sample in next series?). */
phase = (2.0 * M_PI
* (double) gen->frequency * (double) i
/ (double) gen->sample_rate)
+ gen->phase_offset;
/* Extract the normalized phase offset. */
int n_periods = floor(phase / (2.0 * M_PI));
gen->phase_offset = phase - n_periods * 2.0 * M_PI;
return CW_SUCCESS;
}
/**
\brief Calculate value of a sample of sine wave
\param gen - generator used to generate a sine wave
\return value of a sample of sine wave, a non-negative number
*/
int cw_generator_calculate_amplitude(cw_gen_t *gen)
{
int volume = (gen->volume * CW_AUDIO_VOLUME_RANGE) / 100;
if (gen->slope == 0) {
;
} else if (gen->slope < 0) {
if (gen->amplitude > 0) {
gen->amplitude += gen->slope; /* yes, += */
} else if (gen->amplitude < 0) {
gen->amplitude = 0;
gen->slope = 0;
} else { /* gen->amplitude == 0 */
gen->slope = 0;
}
} else { /* gen->slope > 0 */
if (gen->amplitude < volume) {
gen->amplitude += gen->slope;
} else if (gen->amplitude > volume) {
gen->amplitude = volume;
gen->slope = 0;
} else { /* gen->amplitude == volume; */
gen->slope = 0;
}
}
/* because CW_AUDIO_VOLUME_RANGE may not be exact multiple
of gen->slope, gen->amplitude may be sometimes out
of range; this may produce audible clicks;
remove values out of range */
if (gen->amplitude > CW_AUDIO_VOLUME_RANGE) {
gen->amplitude = CW_AUDIO_VOLUME_RANGE;
} else if (gen->amplitude < 0) {
gen->amplitude = 0;
} else {
;
}
return gen->amplitude;
}
/* ************************ */
/* Console output */
/* ************************ */
/*
* Clock tick rate used for KIOCSOUND console ioctls. This value is taken
* from linux/include/asm-i386/timex.h, included here for portability.
*/
static const int KIOCSOUND_CLOCK_TICK_RATE = 1193180;
/**
\brief Check if it is possible to open console output
Function does a test opening and test writing to console device,
but it closes it before returning.
The function tests that the given console file exists, and that it
will accept the KIOCSOUND ioctl. It unconditionally returns false
on platforms that do no support the KIOCSOUND ioctl.
Call to ioctl will fail if calling code doesn't have root privileges.
This is the only place where we ask if KIOCSOUND is defined, so client
code must call this function whenever it wants to use console output,
as every other function called to perform console operations will
happily assume that it is allowed to perform such operations.
\param device - name of console device to be used; if NULL then library will use default device.
\return true if opening console output succeeded;
\return false if opening console output failed;
*/
bool cw_is_console_possible(const char *device)
{
#if defined(KIOCSOUND)
/* no need to allocate space for device path, just a
pointer (to a memory allocated somewhere else by
someone else) will be sufficient in local scope */
const char *dev = device ? device : CW_DEFAULT_CONSOLE_DEVICE;
int fd = open(dev, O_WRONLY);
if (fd == -1) {
cw_debug (CW_DEBUG_SYSTEM, "error: open(%s): %s\n", dev, strerror(errno));
return CW_FAILURE;
}
int rv = ioctl(fd, KIOCSOUND, 0);
close(fd);
if (rv == -1) {
/* console device can be opened, even with WRONLY perms, but,
if you aren't root user, you can't call ioctl()s on it,
and - as a result - can't generate sound on the device */
return CW_FAILURE;
} else {
return CW_SUCCESS;
}
#else
return CW_FAILURE;
#endif
}
/**
\brief Open console PC speaker device
The function doesn't check if ioctl(fd, KIOCSOUND, ...) works,
the client code must use cw_is_console_possible() instead, prior
to calling this function.
\param device - name of console device to be used; if NULL then library will use default device.
\return CW_FAILURE on errors
\return CW_SUCCESS on success
*/
int cw_open_device_console(const char *device)
{
#ifndef KIOCSOUND
assert (0); /* You should have called cw_is_console_possible(). Bad developer, bad! */
#endif
assert (device);
if (generator->audio_device_open) {
/* Ignore the call if the console device is already open. */
return CW_SUCCESS;
}
int console = open(device, O_WRONLY);
if (console == -1) {
cw_debug (CW_DEBUG_SYSTEM, "error: open(%s): \"%s\"", device, strerror(errno));
return CW_FAILURE;
} else {
cw_dev_debug ("open successfully, console = %d", console);
}
generator->audio_sink = console;
generator->audio_device_open = 1;
return CW_SUCCESS;
}
/**
\brief Close console device associated with current generator
*/
void cw_close_device_console(void)
{
close(generator->audio_sink);
generator->audio_sink = -1;
generator->audio_device_open = 0;
cw_debug (CW_DEBUG_SOUND, "console closed");
return;
}
/**
\brief Start generating a sound using console PC speaker
The function calls the KIOCSOUND ioctl to start a particular tone.
Once started, the console tone generation needs no maintenance.
The function only initializes generation, you have to do another
function call to change the tone generated.
\param state - flag deciding if a sound should be generated (> 0) or not (== 0)
\return CW_FAILURE on errors
\return CW_SUCCESS on success
*/
int cw_sound_console_internal(int state)
{
/*
* Calculate the correct argument for KIOCSOUND. There's nothing we
* can do to control the volume, but if we find the volume is set to
* zero, the one thing we can do is to just turn off tones. A bit
* crude, but perhaps just slightly better than doing nothing.
*/
int argument = 0;
if (generator->volume > 0 && state) {
argument = KIOCSOUND_CLOCK_TICK_RATE / generator->frequency;
}
cw_debug (CW_DEBUG_SOUND, "KIOCSOUND arg = %d (switch: %d, frequency: %d Hz, volume: %d %%)",
argument, state, generator->frequency, generator->volume);
/* Call the ioctl, and return any error status. */
if (ioctl(generator->audio_sink, KIOCSOUND, argument) == -1) {
cw_debug (CW_DEBUG_SYSTEM, "error: ioctl KIOCSOUND: \"%s\"\n", strerror(errno));
return CW_FAILURE;
} else {
return CW_SUCCESS;
}
}
/* ************************ */
/* OSS output */
/* ************************ */
/**
\brief Check if it is possible to open OSS output
Function does a test opening and test configuration of OSS output,
but it closes it before returning.
\param device - name of OSS device to be used; if NULL then library will use default device.
\return true if opening OSS output succeeded;
\return false if opening OSS output failed;
*/
bool cw_is_oss_possible(const char *device)
{
const char *dev = device ? device : CW_DEFAULT_OSS_DEVICE;
/* Open the given soundcard device file, for write only. */
int soundcard = open(dev, O_WRONLY);
if (soundcard == -1) {
cw_debug (CW_DEBUG_SYSTEM, "error: libcw: open(%s): \"%s\"", dev, strerror(errno));
return false;
}
int parameter = 0;
if (ioctl(soundcard, OSS_GETVERSION, ¶meter) == -1) {
cw_debug (CW_DEBUG_SYSTEM, "error: ioctl OSS_GETVERSION");
close(soundcard);
return false;
} else {
cw_dev_debug ("OSS version %X.%X.%X",
(parameter & 0xFF0000) >> 16,
(parameter & 0x00FF00) >> 8,
(parameter & 0x0000FF) >> 0);
}
/*
http://manuals.opensound.com/developer/OSS_GETVERSION.html:
about OSS_GETVERSION ioctl:
"This ioctl call returns the version number OSS API used in
the current system. Applications can use this information to
find out if the OSS version is new enough to support the
features required by the application. However this methods
should be used with great care. Usually it's recommended
that applications check availability of each ioctl() by
calling it and by checking if the call returned errno=EINVAL."
So, we call all necessary ioctls to be 100% sure that all
needed features are available. cw_open_device_oss_ioctls()
doesn't specifically look for EINVAL, it only checks return
values from ioctl() and returns CW_FAILURE if one of ioctls()
returns -1. */
int dummy;
int rv = cw_open_device_oss_ioctls(&soundcard, &dummy);
close(soundcard);
if (rv != CW_SUCCESS) {
cw_debug (CW_DEBUG_SYSTEM, "error: one or more OSS ioctl() calls failed");
return false;
} else {
return true;
}
}
/**
\brief Open OSS output, associate it with current generator
\param device - name of OSS device to be used; if NULL then library will use default device.
\return CW_FAILURE on errors
\return CW_SUCCESS on success
*/
int cw_open_device_oss(const char *device)
{
/* Open the given soundcard device file, for write only. */
int soundcard = open(device, O_WRONLY);
if (soundcard == -1) {
cw_debug (CW_DEBUG_SYSTEM, "error: open(%s): \"%s\"\n", device, strerror(errno));
return CW_FAILURE;
}
int rv = cw_open_device_oss_ioctls(&soundcard, &(generator->sample_rate));
if (rv != CW_SUCCESS) {
cw_debug (CW_DEBUG_SYSTEM, "error: one or more OSS ioctl() calls failed\n");
close(soundcard);
return CW_FAILURE;
}
int size = 0;
/* Get fragment size in bytes, may be different than requested
with ioctl(..., SNDCTL_DSP_SETFRAGMENT), and, in particular,
can be different than 2^N. */
if ((rv = ioctl(soundcard, SNDCTL_DSP_GETBLKSIZE, &size)) == -1) {
cw_debug (CW_DEBUG_SYSTEM, "error: ioctl(SNDCTL_DSP_GETBLKSIZE): \"%s\"\n", strerror(errno));
close(soundcard);
return CW_FAILURE;
}
if ((size & 0x0000ffff) != (1 << CW_OSS_SETFRAGMENT)) {
cw_debug (CW_DEBUG_SYSTEM, "error: OSS fragment size not set, %d\n", size);
close(soundcard);
return CW_FAILURE;
} else {
cw_dev_debug ("OSS fragment size = %d", size);
}
generator->buffer_n_samples = size;
/* Note sound as now open for business. */
generator->audio_device_open = 1;
generator->audio_sink = soundcard;
generator->debug_sink = open("/tmp/cw_file.raw", O_WRONLY | O_NONBLOCK);
return CW_SUCCESS;
}
/**
\brief Perform all necessary ioctl calls on OSS file descriptor
Wrapper function for ioctl calls that need to be done when configuring
file descriptor \param fd for OSS playback.
\param fd - file descriptor of open OSS file;
\param sample_rate - sample rate configured by ioctl calls (output parameter)
\return CW_FAILURE on errors
\return CW_SUCCESS on success
*/
int cw_open_device_oss_ioctls(int *fd, int *sample_rate)
{
int parameter = 0; /* ignored */
if (ioctl(*fd, SNDCTL_DSP_SYNC, ¶meter) == -1) {
cw_debug (CW_DEBUG_SYSTEM, "error: ioctl(SNDCTL_DSP_SYNC): \"%s\"\n", strerror(errno));
return CW_FAILURE;
}
parameter = 0; /* ignored */
if (ioctl(*fd, SNDCTL_DSP_POST, ¶meter) == -1) {
cw_debug (CW_DEBUG_SYSTEM, "error: ioctl(SNDCTL_DSP_POST): \"%s\"\n", strerror(errno));
return CW_FAILURE;
}
/* Set the audio format to 8-bit unsigned. */
parameter = CW_OSS_SAMPLE_FORMAT;
if (ioctl(*fd, SNDCTL_DSP_SETFMT, ¶meter) == -1) {
cw_debug (CW_DEBUG_SYSTEM, "error: ioctl(SNDCTL_DSP_SETFMT): \"%s\"\n", strerror(errno));
return CW_FAILURE;
}
if (parameter != CW_OSS_SAMPLE_FORMAT) {
cw_debug (CW_DEBUG_SYSTEM, "error: sample format not supported\n");
return CW_FAILURE;
}
/* Set up mono mode - a single audio channel. */
parameter = CW_AUDIO_CHANNELS;
if (ioctl(*fd, SNDCTL_DSP_CHANNELS, ¶meter) == -1) {
cw_debug (CW_DEBUG_SYSTEM, "error: ioctl(SNDCTL_DSP_CHANNELS): \"%s\"\n", strerror(errno));
return CW_FAILURE;
}
if (parameter != CW_AUDIO_CHANNELS) {
cw_debug (CW_DEBUG_SYSTEM, "error: number of channels not supported\n");
return CW_FAILURE;
}
/*
* Set up a standard sampling rate based on the notional correct value,
* and retain the one we actually get in the library variable.
*/
unsigned int rate = CW_AUDIO_SAMPLE_RATE_A;
if (ioctl(*fd, SNDCTL_DSP_SPEED, &rate) == -1) {
rate = CW_AUDIO_SAMPLE_RATE_B;
if (ioctl(*fd, SNDCTL_DSP_SPEED, &rate) == -1) {
cw_debug (CW_DEBUG_SYSTEM, "error: ioctl(SNDCTL_DSP_SPEED): \"%s\"\n", strerror(errno));
return CW_FAILURE;
}
}
if (rate != CW_AUDIO_SAMPLE_RATE_A && rate != CW_AUDIO_SAMPLE_RATE_B) {
cw_dev_debug ("warning: imprecise sample rate: %d", rate);
}
*sample_rate = rate;
audio_buf_info buff;
if (ioctl(*fd, SNDCTL_DSP_GETOSPACE, &buff) == -1) {
cw_debug (CW_DEBUG_SYSTEM, "error: ioctl(SNDCTL_DSP_GETOSPACE): \"%s\"\n", strerror(errno));
return CW_FAILURE;
} else {
/*
fprintf(stderr, "before:\n");
fprintf(stderr, "buff.fragments = %d\n", buff.fragments);
fprintf(stderr, "buff.fragsize = %d\n", buff.fragsize);
fprintf(stderr, "buff.bytes = %d\n", buff.bytes);
fprintf(stderr, "buff.fragstotal = %d\n", buff.fragstotal);
*/
}
#if CW_OSS_SET_FRAGMENT
/*
* Live a little dangerously, by trying to set the fragment size of the
* card. We'll try for a relatively short fragment of 128 bytes. This
* gives us a little better granularity over the amounts of audio data
* we write periodically to the soundcard output buffer. We may not get
* the requested fragment size, and may be stuck with the default. The
* argument has the format 0xMMMMSSSS - fragment size is 2^SSSS, and
* setting 0x7fff for MMMM allows as many fragments as the driver can
* support.
*/
/* parameter = 0x7fff << 16 | CW_OSS_SETFRAGMENT; */
parameter = 0x0032 << 16 | CW_OSS_SETFRAGMENT;
if (ioctl(*fd, SNDCTL_DSP_SETFRAGMENT, ¶meter) == -1) {
cw_debug (CW_DEBUG_SYSTEM, "error: ioctl(SNDCTL_DSP_SETFRAGMENT): \"%s\"\n", strerror(errno));
return CW_FAILURE;
}
cw_debug (CW_DEBUG_SOUND, "fragment size is %d", parameter & 0x0000ffff);
/* Query fragment size just to get the driver buffers set. */
if (ioctl(*fd, SNDCTL_DSP_GETBLKSIZE, ¶meter) == -1) {
cw_debug (CW_DEBUG_SYSTEM, "error: ioctl(SNDCTL_DSP_GETBLKSIZE): \"%s\"\n", strerror(errno));
return CW_FAILURE;
}
if (parameter != (1 << CW_OSS_SETFRAGMENT)) {
cw_debug (CW_DEBUG_SYSTEM, "error: OSS fragment size not set, %d\n", parameter);
}
#endif
#if CW_OSS_SET_POLICY
parameter = 5;
if (ioctl(*fd, SNDCTL_DSP_POLICY, ¶meter) == -1) {
cw_debug (CW_DEBUG_SYSTEM, "error: ioctl(SNDCTL_DSP_POLICY): \"%s\"\n", strerror(errno));
return CW_FAILURE;
}
#endif
if (ioctl(*fd, SNDCTL_DSP_GETOSPACE, &buff) == -1) {
cw_debug (CW_DEBUG_SYSTEM, "error: ioctl(SNDCTL_GETOSPACE): \"%s\"\n", strerror(errno));
return CW_FAILURE;
} else {
/*
fprintf(stderr, "after:\n");
fprintf(stderr, "buff.fragments = %d\n", buff.fragments);
fprintf(stderr, "buff.fragsize = %d\n", buff.fragsize);
fprintf(stderr, "buff.bytes = %d\n", buff.bytes);
fprintf(stderr, "buff.fragstotal = %d\n", buff;3R.fragstotal);
*/
}
return CW_SUCCESS;
}
/**
\brief Close OSS device associated with current generator
*/
void cw_close_device_oss(void)
{
close(generator->audio_sink);
generator->audio_sink = -1;
generator->audio_device_open = 0;
if (generator->debug_sink != -1) {
close(generator->debug_sink);
generator->debug_sink = -1;
}
return;
}
/**
\brief Write a constant sine wave to OSS output
\param arg - current generator (casted to (void *))
\return NULL pointer
*/
void *cw_generator_write_sine_wave_oss(void *arg)
{
cw_gen_t *gen = (cw_gen_t *) arg;
int n_bytes = sizeof (gen->buffer[0]) * gen->buffer_n_samples;
while (gen->generate) {
cw_generator_calculate_sine_wave(gen);
if (write(gen->audio_sink, gen->buffer, n_bytes) != n_bytes) {
gen->thread_error = errno;
cw_debug (CW_DEBUG_SYSTEM, "error: audio write (OSS): %s\n", strerror(errno));
return NULL;
}
if (gen->debug_sink != -1) {
write(gen->debug_sink, gen->buffer, n_bytes);
}
} /* while() */
return NULL;
}
/* ************************ */
/* ALSA output */
/* ************************ */
/**
\brief Check if it is possible to open ALSA output
Function does a test opening of ALSA output, but it closes it
before returning.
\param device - name of ALSA device to be used; if NULL then library will use default device.
\return true if opening ALSA output succeeded;
\return false if opening ALSA output failed;
*/
bool cw_is_alsa_possible(const char *device)
{
const char *dev = device ? device : CW_DEFAULT_ALSA_DEVICE;
snd_pcm_t *alsa_handle;
int rv = snd_pcm_open(&alsa_handle,
dev, /* name */
SND_PCM_STREAM_PLAYBACK, /* stream (playback/capture) */
0); /* mode, 0 | SND_PCM_NONBLOCK | SND_PCM_ASYNC */
if (rv < 0) {
cw_debug (CW_DEBUG_SYSTEM, "error: can't open ALSA device \"%s\"\n", dev);
return false;
} else {
snd_pcm_close(alsa_handle);
return true;
}
}
/**
\brief Open ALSA output, associate it with current generator
\param device - name of ALSA device to be used; if NULL then library will use default device.
\return CW_FAILURE on errors
\return CW_SUCCESS on success
*/
int cw_open_device_alsa(const char *device)
{
int rv = snd_pcm_open(&(generator->alsa_handle),
device, /* name */
SND_PCM_STREAM_PLAYBACK, /* stream (playback/capture) */
0); /* mode, 0 | SND_PCM_NONBLOCK | SND_PCM_ASYNC */
if (rv < 0) {
cw_debug (CW_DEBUG_SYSTEM, "error: can't open ALSA device \"%s\"\n", device);
return CW_FAILURE;
}
/* TODO: move this to cw_set_alsa_hw_params(),
deallocate hw_params */
snd_pcm_hw_params_t *hw_params = NULL;
rv = snd_pcm_hw_params_malloc(&hw_params);
if (rv < 0) {
cw_debug (CW_DEBUG_SYSTEM, "error: can't allocate memory for ALSA hw params\n");
return CW_FAILURE;
}
rv = cw_set_alsa_hw_params(generator->alsa_handle, hw_params);
if (rv != CW_SUCCESS) {
cw_debug (CW_DEBUG_SYSTEM, "error: can't set ALSA hw params\n");
return CW_FAILURE;
}
rv = snd_pcm_prepare(generator->alsa_handle);
if (rv < 0) {
cw_debug (CW_DEBUG_SYSTEM, "error: can't prepare ALSA handler\n");
return CW_FAILURE;
}
/* Get size for data buffer */
snd_pcm_uframes_t frames; /* period size in frames */
int dir = 1;
rv = snd_pcm_hw_params_get_period_size(hw_params, &frames, &dir);
cw_dev_debug ("rv = %d, ALSA buffer size would be %u frames", rv, (unsigned int) frames);
/* The linker (?) that I use on Debian links libcw against
old version of get_period_size(), which returns
period size as return value. This is a workaround. */
if (rv > 1) {
generator->buffer_n_samples = rv;
} else {
generator->buffer_n_samples = frames;
}
cw_dev_debug ("ALSA buf size %u", (unsigned int) generator->buffer_n_samples);
return CW_SUCCESS;
}
/**
\brief Close ALSA device associated with current generator
*/
void cw_close_device_alsa(void)
{
snd_pcm_drain(generator->alsa_handle);
snd_pcm_close(generator->alsa_handle);
generator->audio_device_open = 0;
if (generator->debug_sink != -1) {
close(generator->debug_sink);
generator->debug_sink = -1;
}
return;
}
/**
\brief Write a constant sine wave to ALSA output
\param arg - current generator (casted to (void *))
\return NULL pointer
*/
void *cw_generator_write_sine_wave_alsa(void *arg)
{
cw_gen_t *gen = (cw_gen_t *) arg;
int n_bytes = sizeof (gen->buffer[0]) * gen->buffer_n_samples;
while (gen->generate) {
cw_generator_calculate_sine_wave(gen);
int rv = snd_pcm_writei(gen->alsa_handle, gen->buffer, gen->buffer_n_samples);
if (rv == -EPIPE) {
/* EPIPE means underrun */
cw_debug (CW_DEBUG_SYSTEM, "ALSA: underrun");
snd_pcm_prepare(gen->alsa_handle);
} else if (rv < 0) {
cw_debug (CW_DEBUG_SYSTEM, "ALSA: writei: %s\n", snd_strerror(rv));
} else if (rv != gen->buffer_n_samples) {
cw_debug (CW_DEBUG_SYSTEM, "ALSA: short write, %d != %d", rv, gen->buffer_n_samples);
} else {
;
}
if (gen->debug_sink != -1) {
write(gen->debug_sink, gen->buffer, n_bytes);
}
} /* while() */
return NULL;
}
/**
\brief Set up hardware buffer parameters of ALSA sink
\param handle - ALSA handle to configure
\param params - allocated hw params data structure to be used
\return CW_FAILURE on errors
\return CW_SUCCESS on success
*/
int cw_set_alsa_hw_params(snd_pcm_t *handle, snd_pcm_hw_params_t *params)
{
/* Get current hw configuration. */
int rv = snd_pcm_hw_params_any(handle, params);
if (rv < 0) {
cw_debug (CW_DEBUG_SYSTEM, "error: can't get current hw params: %s\n", snd_strerror(rv));
return CW_FAILURE;
}
/* Set the sample format */
rv = snd_pcm_hw_params_set_format(handle, params, CW_ALSA_SAMPLE_FORMAT);
if (rv < 0) {
cw_debug (CW_DEBUG_SYSTEM, "error: can't set sample format: %s\n", snd_strerror(rv));
return CW_FAILURE;
}
int dir = 0;
int sample_rates[] = {
CW_AUDIO_SAMPLE_RATE_A,
CW_AUDIO_SAMPLE_RATE_B,
-1 /* guard */
};
/* Set the sample rate (may set/influence/modify 'period size') */
int success = 0;
int i = 0;
while (sample_rates[i] != -1) {
#if defined(HAVE_SND_PCM_HW_PARAMS_TEST_RATE)
rv = snd_pcm_hw_params_test_rate(handle, params, sample_rates[i], dir);
if (rv == 0)
#endif
{
rv = snd_pcm_hw_params_set_rate(handle, params, sample_rates[i], dir);
if (rv == 0) {
success = 1;
break;
}
}
i++;
}
if (!success) {
cw_debug (CW_DEBUG_SYSTEM, "error: can't set sample rate\n");
return CW_FAILURE;
} else {
generator->sample_rate = sample_rates[i];
}
/* Set PCM access type */
rv = snd_pcm_hw_params_set_access(handle, params, SND_PCM_ACCESS_RW_INTERLEAVED);
if (rv < 0) {
cw_debug (CW_DEBUG_SYSTEM, "error: can't set access type: %s\n", snd_strerror(rv));
return CW_FAILURE;
}
/* Set number of channels */
rv = snd_pcm_hw_params_set_channels(handle, params, CW_AUDIO_CHANNELS);
if (rv < 0) {
cw_debug (CW_DEBUG_SYSTEM, "error: can't set number of channels: %s\n", snd_strerror(rv));
return CW_FAILURE;
}
#if CW_ALSA_HW_BUFFER_CONFIG && defined(HAVE_SND_PCM_HW_PARAMS_TEST_BUFFER_SIZE) && defined(HAVE_SND_PCM_HW_PARAMS_TEST_PERIODS)
/*
http://equalarea.com/paul/alsa-audio.html:
Buffer size:
This determines how large the hardware buffer is.
It can be specified in units of time or frames.
Interrupt interval:
This determines how many interrupts the interface will generate
per complete traversal of its hardware buffer. It can be set
either by specifying a number of periods, or the size of a
period. Since this determines the number of frames of space/data
that have to accumulate before the interface will interrupt
the computer. It is central in controlling latency.
http://www.alsa-project.org/main/index.php/FramesPeriods
"
"frame" represents the unit, 1 frame = # channels x sample_bytes.
In case of stereo, 2 bytes per sample, 1 frame corresponds to 2 channels x 2 bytes = 4 bytes.
"periods" is the number of periods in a ring-buffer.
In OSS, called "fragments".
So,
- buffer_size = period_size * periods
- period_bytes = period_size * bytes_per_frame
- bytes_per_frame = channels * bytes_per_sample
The "period" defines the frequency to update the status,
usually via the invocation of interrupts. The "period_size"
defines the frame sizes corresponding to the "period time".
This term corresponds to the "fragment size" on OSS. On major
sound hardwares, a ring-buffer is divided to several parts and
an irq is issued on each boundary. The period_size defines the
size of this chunk."
OSS ALSA definition
fragment period basic chunk of data sent to hw buffer
*/
{
/* Test and attempt to set buffer size */
snd_pcm_uframes_t accepted = 0; /* buffer size in frames */
dir = 0;
for (snd_pcm_uframes_t val = 0; val < 10000; val++) {
rv = snd_pcm_hw_params_test_buffer_size(handle, params, val);
if (rv == 0) {
cw_dev_debug ("accepted buffer size: %u", (unsigned int) accepted);
/* Accept only the smallest available buffer size */
accepted = val;
break;
}
}
if (accepted > 0) {
rv = snd_pcm_hw_params_set_buffer_size(handle, params, accepted);
if (rv < 0) {
cw_debug (CW_DEBUG_SYSTEM, "error: can't set accepted buffer size %u: %s\n", (unsigned int) accepted, snd_strerror(rv));
}
} else {
cw_debug (CW_DEBUG_SYSTEM, "error: no accepted buffer size\n");
}
}
{
/* Test and attempt to set number of periods */
dir = 0;
unsigned int accepted = 0; /* number of periods per buffer */
/* this limit should be enough, 'accepted' on my machine is 8 */
const unsigned int n_periods_max = 30;
for (unsigned int val = 1; val < n_periods_max; val++) {
rv = snd_pcm_hw_params_test_periods(handle, params, val, dir);
if (rv == 0) {
accepted = val;
cw_dev_debug ("accepted number of periods: %d", accepted);
}
}
if (accepted > 0) {
rv = snd_pcm_hw_params_set_periods(handle, params, accepted, dir);
if (rv < 0) {
cw_dev_debug ("can't set accepted number of periods %d: %s", accepted, snd_strerror(rv));
}
} else {
cw_debug (CW_DEBUG_SYSTEM, "error: no accepted number of periods\n");
}
}
#if 0
{
/* Test period size */
dir = 0;
for (snd_pcm_uframes_t val = 0; val < 100000; val++) {
rv = snd_pcm_hw_params_test_period_size(handle, params, val, dir);
if (rv == 0) {
fprintf(stderr, "libcw: accepted period size: %d\n", val);
// break;
}
}
}
{
/* Test buffer time */
dir = 0;
for (unsigned int val = 0; val < 100000; val++) {
rv = snd_pcm_hw_params_test_buffer_time(handle, params, val, dir);
if (rv == 0) {
fprintf(stderr, "libcw: accepted buffer time: %d\n", val);
// break;
}
}
}
#endif
#endif
/* Save hw parameters to device */
rv = snd_pcm_hw_params(handle, params);
if (rv < 0) {
cw_debug (CW_DEBUG_SYSTEM, "error: can't save hw parameters: %s\n", snd_strerror(rv));
return CW_FAILURE;
} else {
/* Get size for data buffer */
snd_pcm_uframes_t frames; /* period size in frames */
int dir = 0;
snd_pcm_hw_params_get_period_size(params, &frames, &dir);
cw_dev_debug ("%d, ALSA buffer size would be %u frames", rv, (unsigned int) frames);
return CW_SUCCESS;
}
}
#if CW_DEV
/* debug function */
int cw_print_alsa_params(snd_pcm_hw_params_t *params)
{
unsigned int val = 0;
int dir = 0;
int rv = snd_pcm_hw_params_get_periods(params, &val, &dir);
if (rv < 0) {
cw_debug (CW_DEBUG_SYSTEM, "error: can't get 'periods': %s", snd_strerror(rv));
} else {
cw_dev_debug ("'periods' = %u", val);
}
snd_pcm_uframes_t period_size = 0;
rv = snd_pcm_hw_params_get_period_size(params, &period_size, &dir);
if (rv < 0) {
cw_debug (CW_DEBUG_SYSTEM, "error: can't get 'period size': %s", snd_strerror(rv));
} else {
cw_dev_debug ("'period size' = %u", (unsigned int) period_size);
}
snd_pcm_uframes_t buffer_size;
rv = snd_pcm_hw_params_get_buffer_size(params, &buffer_size);
if (rv < 0) {
cw_debug (CW_DEBUG_SYSTEM, "error: can't get buffer size: %s", snd_strerror(rv));
} else {
cw_dev_debug ("'buffer size' = %u", (unsigned int) buffer_size);
}
return CW_SUCCESS;
}
#endif
/* ************************ */
/* main() */
/* ************************ */
#if CW_MAIN
typedef bool (*predicate_t)(const char *device);
static void main_helper(int audio_system, const char *name, const char *device, predicate_t predicate);
/* for stand-alone testing */
int main(void)
{
main_helper(CW_AUDIO_ALSA, "ALSA", CW_DEFAULT_ALSA_DEVICE, cw_is_alsa_possible);
main_helper(CW_AUDIO_CONSOLE, "console", CW_DEFAULT_CONSOLE_DEVICE, cw_is_console_possible);
main_helper(CW_AUDIO_OSS, "OSS", CW_DEFAULT_OSS_DEVICE, cw_is_oss_possible);
return 0;
}
void main_helper(int audio_system, const char *name, const char *device, predicate_t predicate)
{
int rv = CW_FAILURE;
rv = predicate(device);
if (rv == CW_SUCCESS) {
rv = cw_generator_new(audio_system, device);
if (rv == CW_SUCCESS) {
cw_reset_send_receive_parameters();
cw_set_send_speed(22);
cw_generator_start();
cw_send_string("morse");
cw_wait_for_tone_queue();
cw_generator_stop();
cw_generator_delete();
} else {
cw_debug (CW_DEBUG_SYSTEM, "error: can't create %s generator\n", name);
}
} else {
cw_debug (CW_DEBUG_SYSTEM, "error: %s output is not available\n", name);
}
}
#endif
unixcw-3.0.2/src/libcw/Makefile~ 0000644 0001750 0001750 00000010062 11702300206 016366 0 ustar acerion acerion # Copyright (C) 2001-2006 Simon Baldwin (simon_baldwin@yahoo.com)
# Copyright (C) 2011-2012 Kamil Ignacak (acerion@wp.pl)
#
# 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.
#
include ../../Makefile.inc
CC = $(AC_CC)
CFLAGS = $(AC_CFLAGS) $(AC_CFLAG_PIC) $(AC_DEFS)
AWK = $(AC_AWK)
RANLIB = $(AC_RANLIB)
LD = $(AC_LD)
LN_S = $(AC_LN_S)
GZIP = $(AC_GZIP)
LDCONFIG= $(AC_LDCONFIG)
CC_LINKS_SO = $(AC_CC_LINKS_SO)
LD_LINKS_SO = $(AC_LD_LINKS_SO)
SHELL = /bin/sh
COMMON_LIBS = -lm -lpthread -lasound
default: all
all: libcw.a libcw.so.3.0.1 libcw.so.3 libcw.so libcw.pc libcw.3 libcwtest
# Build the static and shared libraries.
libcw.a: libcw.o
rm -f libcw.a; ar -cr libcw.a libcw.o
$(RANLIB) libcw.a
libcw.so.3.0.1: libcw.o
if [ "$(CC_LINKS_SO)" = "yes" ]; then \
$(CC) -shared -Wl,-soname,libcw.so.3 \
-o libcw.so.3.0.1 libcw.o $(COMMON_LIBS); \
else \
if [ "$(LD_LINKS_SO)" = "yes" ]; then \
$(LD) -G -Wl,-soname,libcw.so.3 \
-o libcw.so.3.0.1 libcw.o $(COMMON_LIBS); \
fi \
fi
libcw.so.3: libcw.so.3.0.1
$(LN_S) -f libcw.so.3.0.1 libcw.so.3
libcw.so: libcw.so.3.0.1
$(LN_S) -f libcw.so.3.0.1 libcw.so
# Build the library man page.
libcw.3: libcw.3.m4 libcw.c
$(AWK) -f libdoc.awk signatures
$(AWK) -f libdoc.awk functions
$(AWK) -f include.awk libcw.3
rm -f signatures functions
# Build the unit test.
libcwtest: libcwtest.o
$(CC) -o libcwtest libcwtest.o -L. -lcw
# Build the pkgconfig metadata file.
libcw.pc:
$(AWK) -vprefix="$(prefix)" -v exec_prefix="$(exec_prefix)" \
-vlibdir="$(libdir)" -v includedir="$(includedir)" \
-vstrip="$$RPM_BUILD_ROOT" \
-vconfig_h="../config.h" -f libpc.awk >libcw.pc
# Define dependencies related to header/include files.
libcw.o: Makefile libcw.h
libcwtest.o: Makefile libcw.h
# Install targets.
install: all
$(INSTALL) -d $(includedir) $(libdir) $(mandir)/man3 $(mandir)/man7 \
$(libdir)/pkgconfig
$(INSTALL_DATA) libcw.h $(includedir)/libcw.h
$(INSTALL_DATA) libcw.a $(libdir)/libcw.a
if [ "$(CC_LINKS_SO)" = "yes" -o "$(LD_LINKS_SO)" = "yes" ]; then \
$(INSTALL_PROGRAM) libcw.so.3.0.1 $(libdir)/libcw.so.3.0.1; \
$(LN_S) -f libcw.so.3.0.1 $(libdir)/libcw.so.3; \
$(LN_S) -f libcw.so.3.0.1 $(libdir)/libcw.so; \
$(LDCONFIG) -n $(libdir); \
fi
$(INSTALL_DATA) libcw.3 $(mandir)/man3/libcw.3
$(GZIP) -f -9 $(mandir)/man3/libcw.3
$(INSTALL_DATA) cw.7 $(mandir)/man7/cw.7
$(GZIP) -f -9 $(mandir)/man7/cw.7
$(INSTALL_DATA) cw.7 $(mandir)/man7/CW.7
$(GZIP) -f -9 $(mandir)/man7/CW.7
$(INSTALL_DATA) libcw.pc $(libdir)/pkgconfig/libcw.pc
install-strip:
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install
uninstall:
rm -f $(includedir)/libcw.h
rm -f $(libdir)/libcw.a
rm -f $(libdir)/libcw.so $(libdir)/libcw.so.3 $(libdir)/libcw.so.3.0.1
$(LDCONFIG) -n $(libdir)
rm -f $(mandir)/man3/libcw.3 $(mandir)/man3/libcw.3.gz
rm -f $(mandir)/man7/cw.7 $(mandir)/man7/cw.7.gz
rm -f $(mandir)/man7/CW.7 $(mandir)/man7/CW.7.gz
rm -f $(libdir)/pkgconfig/libcw.pc
# Cleanup targets.
clean:
rm -f libcw.a libcw.so libcw.so.3 libcw.so.3.0.1 *.s libcw.pc *.o
rm -f libcw.3 signatures functions
rm -f libcwtest
rm -f core core.*
distclean: clean
rm -f Makefile.port
mostlyclean: clean
maintainer-clean: distclean
# Test targets.
check: all libcwtest
-LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH ./libcwtest
# Unimplemented targets.
TAGS:
info:
dvi:
dist:
unixcw-3.0.2/src/libcw/libcwtest.c 0000644 0001750 0001750 00000130361 11702277636 016725 0 ustar acerion acerion /*
* Copyright (C) 2001-2006 Simon Baldwin (simon_baldwin@yahoo.com)
* Copyright (C) 2011-2012 Kamil Ignacak (acerion@wp.pl)
*
* 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.
*/
#define _XOPEN_SOURCE 600 /* signaction() + SA_RESTART */
#include "../config.h"
#include
#include
#include
#include
#include
#include
#include
#include
#if defined(HAVE_STRING_H)
# include
#endif
#if defined(HAVE_STRINGS_H)
# include
#endif
#include "libcw.h"
/*---------------------------------------------------------------------*/
/* Unit tests */
/*---------------------------------------------------------------------*/
/*
* cw_self_test_admin()
*/
static int cw_self_test_admin(void)
{
/* Test the cw_version and cw_license functions. */
fprintf(stderr, "libcw: version %d.%d\n", cw_version() >> 16, cw_version() & 0xff);
cw_license();
/* Test getting and setting of debug flags. */
unsigned int flags = cw_get_debug_flags();
int failures = 0;
for (unsigned int i = 0; i <= CW_DEBUG_MASK; i++) {
cw_set_debug_flags(i);
if (cw_get_debug_flags() != i) {
fprintf(stderr, "libcw: ERROR: cw_get/set_debug flags\n");
failures++;
break;
}
}
cw_set_debug_flags(flags);
fprintf(stderr, "libcw: cw_get/set_debug flags tests complete\n");
return failures;
}
/*
* cw_self_test_limits()
*/
static int
cw_self_test_limits (void)
{
int failures = 0;
int cw_min_speed, cw_max_speed, cw_min_frequency, cw_max_frequency,
cw_min_volume, cw_max_volume, cw_min_gap, cw_max_gap,
cw_min_tolerance, cw_max_tolerance, cw_min_weighting, cw_max_weighting;
/*
* Ensure that we can obtain the main parameter limits.
*/
cw_get_speed_limits (&cw_min_speed, &cw_max_speed);
printf ("libcw: cw_get_speed_limits=%d,%d\n",
cw_min_speed, cw_max_speed);
cw_get_frequency_limits (&cw_min_frequency, &cw_max_frequency);
printf ("libcw: cw_get_frequency_limits=%d,%d\n",
cw_min_frequency, cw_max_frequency);
cw_get_volume_limits (&cw_min_volume, &cw_max_volume);
printf ("libcw: cw_get_volume_limits=%d,%d\n",
cw_min_volume, cw_max_volume);
cw_get_gap_limits (&cw_min_gap, &cw_max_gap);
printf ("libcw: cw_get_gap_limits=%d,%d\n",
cw_min_gap, cw_max_gap);
cw_get_tolerance_limits (&cw_min_tolerance, &cw_max_tolerance);
printf ("libcw: cw_get_tolerance_limits=%d,%d\n",
cw_min_tolerance, cw_max_tolerance);
cw_get_weighting_limits (&cw_min_weighting, &cw_max_weighting);
printf ("libcw: cw_get_weighting_limits=%d,%d\n",
cw_min_weighting, cw_max_weighting);
printf ("libcw: cw_get_limits tests complete\n");
return failures;
}
/*
* cw_self_test_ranges()
*/
static int
cw_self_test_ranges (void)
{
int failures = 0;
int status, index, cw_min, cw_max;
int txdot_usecs, txdash_usecs, end_of_element_usecs, end_of_character_usecs,
end_of_word_usecs, additional_usecs, adjustment_usecs,
rxdot_usecs, rxdash_usecs, dot_min_usecs, dot_max_usecs, dash_min_usecs,
dash_max_usecs, end_of_element_min_usecs, end_of_element_max_usecs,
end_of_element_ideal_usecs, end_of_character_min_usecs,
end_of_character_max_usecs, end_of_character_ideal_usecs,
adaptive_threshold;
/* Print default low level timing values. */
cw_reset_send_receive_parameters ();
cw_get_send_parameters (&txdot_usecs, &txdash_usecs,
&end_of_element_usecs, &end_of_character_usecs,
&end_of_word_usecs, &additional_usecs,
&adjustment_usecs);
printf ("libcw: cw_get_send_parameters\n"
"libcw: %d, %d, %d, %d, %d, %d, %d\n",
txdot_usecs, txdash_usecs, end_of_element_usecs,
end_of_character_usecs,end_of_word_usecs, additional_usecs,
adjustment_usecs);
cw_get_receive_parameters (&rxdot_usecs, &rxdash_usecs,
&dot_min_usecs, &dot_max_usecs,
&dash_min_usecs, &dash_max_usecs,
&end_of_element_min_usecs,
&end_of_element_max_usecs,
&end_of_element_ideal_usecs,
&end_of_character_min_usecs,
&end_of_character_max_usecs,
&end_of_character_ideal_usecs,
&adaptive_threshold);
printf ("libcw: cw_get_receive_parameters\n"
"libcw: %d, %d, %d, %d, %d, %d, %d, %d\n"
"libcw: %d, %d, %d, %d, %d\n",
rxdot_usecs, rxdash_usecs, dot_min_usecs, dot_max_usecs,
dash_min_usecs, dash_max_usecs, end_of_element_min_usecs,
end_of_element_max_usecs, end_of_element_ideal_usecs,
end_of_character_min_usecs, end_of_character_max_usecs,
end_of_character_ideal_usecs, adaptive_threshold);
/*
* Set the main parameters to out-of-range values, and through their
* complete valid ranges.
*/
cw_get_speed_limits (&cw_min, &cw_max);
errno = 0;
status = cw_set_send_speed (cw_min - 1);
if (status || errno != EINVAL)
{
printf ("libcw: ERROR: cw_set_send_speed(cw_min_speed-1)\n");
failures++;
}
errno = 0;
status = cw_set_send_speed (cw_max + 1);
if (status || errno != EINVAL)
{
printf ("libcw: ERROR: cw_set_send_speed(cw_max_speed+1)\n");
failures++;
}
for (index = cw_min; index <= cw_max; index++)
{
cw_set_send_speed (index);
if (cw_get_send_speed () != index)
{
printf ("libcw: ERROR: cw_get/set_send_speed\n");
failures++;
break;
}
}
errno = 0;
status = cw_set_receive_speed (cw_min - 1);
if (status || errno != EINVAL)
{
printf ("libcw: ERROR: cw_set_receive_speed(cw_min_speed-1)\n");
failures++;
}
errno = 0;
status = cw_set_receive_speed (cw_max + 1);
if (status || errno != EINVAL)
{
printf ("libcw: ERROR: cw_set_receive_speed(cw_max_speed+1)\n");
failures++;
}
for (index = cw_min; index <= cw_max; index++)
{
cw_set_receive_speed (index);
if (cw_get_receive_speed () != index)
{
printf ("libcw: ERROR: cw_get/set_receive_speed\n");
failures++;
break;
}
}
printf ("libcw: cw_set/get_send/receive_speed tests complete\n");
cw_get_frequency_limits (&cw_min, &cw_max);
errno = 0;
status = cw_set_frequency (cw_min - 1);
if (status || errno != EINVAL)
{
printf ("libcw: ERROR: cw_set_frequency(cw_min_frequency-1)\n");
failures++;
}
errno = 0;
status = cw_set_frequency (cw_max + 1);
if (status || errno != EINVAL)
{
printf ("libcw: ERROR: cw_set_frequency(cw_max_frequency+1)\n");
failures++;
}
for (index = cw_min; index <= cw_max; index++)
{
cw_set_frequency (index);
if (cw_get_frequency () != index)
{
printf ("libcw: ERROR: cw_get/set_frequency\n");
failures++;
break;
}
}
printf ("libcw: cw_set/get_frequency tests complete\n");
cw_get_volume_limits (&cw_min, &cw_max);
errno = 0;
status = cw_set_volume (cw_min - 1);
if (status || errno != EINVAL)
{
printf ("libcw: ERROR: cw_set_volume(cw_min_volume-1)\n");
failures++;
}
errno = 0;
status = cw_set_volume (cw_max + 1);
if (status || errno != EINVAL)
{
printf ("libcw: ERROR: cw_set_volume(cw_max_volume+1)\n");
failures++;
}
for (index = cw_min; index <= cw_max; index++)
{
cw_set_volume (index);
if (cw_get_volume () != index)
{
printf ("libcw: ERROR: cw_get/set_volume\n");
failures++;
break;
}
}
printf ("libcw: cw_set/get_volume tests complete\n");
cw_get_gap_limits (&cw_min, &cw_max);
errno = 0;
status = cw_set_gap (cw_min - 1);
if (status || errno != EINVAL)
{
printf ("libcw: ERROR: cw_set_gap(cw_min_gap-1)\n");
failures++;
}
errno = 0;
status = cw_set_gap (cw_max + 1);
if (status || errno != EINVAL)
{
printf ("libcw: ERROR: cw_set_gap(cw_max_gap+1)\n");
failures++;
}
for (index = cw_min; index <= cw_max; index++)
{
cw_set_gap (index);
if (cw_get_gap () != index)
{
printf ("libcw: ERROR: cw_get/set_gap\n");
failures++;
break;
}
}
printf ("libcw: cw_set/get_gap tests complete\n");
cw_get_tolerance_limits (&cw_min, &cw_max);
errno = 0;
status = cw_set_tolerance (cw_min - 1);
if (status || errno != EINVAL)
{
printf ("libcw: ERROR: cw_set_tolerance(cw_min_tolerance-1)\n");
failures++;
}
errno = 0;
status = cw_set_tolerance (cw_max + 1);
if (status || errno != EINVAL)
{
printf ("libcw: ERROR: cw_set_tolerance(cw_max_tolerance+1)\n");
failures++;
}
for (index = cw_min; index <= cw_max; index++)
{
cw_set_tolerance (index);
if (cw_get_tolerance () != index)
{
printf ("libcw: ERROR: cw_get/set_tolerance\n");
failures++;
break;
}
}
printf ("libcw: cw_set/get_tolerance tests complete\n");
cw_get_weighting_limits (&cw_min, &cw_max);
errno = 0;
status = cw_set_weighting (cw_min - 1);
if (status || errno != EINVAL)
{
printf ("libcw: ERROR: cw_set_weighting(cw_min_weighting-1)\n");
failures++;
}
errno = 0;
status = cw_set_weighting (cw_max + 1);
if (status || errno != EINVAL)
{
printf ("libcw: ERROR: cw_set_weighting(cw_max_weighting+1)\n");
failures++;
}
for (index = cw_min; index <= cw_max; index++)
{
cw_set_weighting (index);
if (cw_get_weighting () != index)
{
printf ("libcw: ERROR: cw_get/set_weighting\n");
failures++;
break;
}
}
printf ("libcw: cw_set/get_weighting tests complete\n");
return failures;
}
/*
* cw_self_test_tone_parameters()
*/
static int
cw_self_test_tone_parameters (void)
{
int failures = 0;
int status, cw_min, cw_max;
/*
* Test the limits of the parameters to the tone queue routine.
*/
cw_get_frequency_limits (&cw_min, &cw_max);
errno = 0;
status = cw_queue_tone (-1, cw_min);
if (status || errno != EINVAL)
{
printf ("libcw: ERROR: cw_queue_tone(-1, cw_min_frequency)\n");
failures++;
}
errno = 0;
status = cw_queue_tone (0, cw_min - 1);
if (status || errno != EINVAL)
{
printf ("libcw: ERROR: cw_queue_tone(0, cw_min_frequency-1)\n");
failures++;
}
errno = 0;
status = cw_queue_tone (0, cw_max + 1);
if (status || errno != EINVAL)
{
printf ("libcw: ERROR: cw_queue_tone(0, cw_max_frequency+1)\n");
failures++;
}
printf ("libcw: cw_queue_tone argument tests complete\n");
return failures;
}
/*
* cw_self_test_simple_tones()
*/
static int
cw_self_test_simple_tones (void)
{
int failures = 0;
int index;
/*
* Ensure we can generate a few simple tones, and wait for them to end.
*/
cw_set_volume (70);
if (!cw_queue_tone (100000, 4000)
|| !cw_queue_tone (100000, 2000)
|| !cw_queue_tone (100000, 1000))
{
printf ("libcw: ERROR: cw_queue_tone(10000, 4000|2000|1000)\n");
failures++;
}
for (index = 0; index < 3; index++)
{
if (!cw_wait_for_tone ())
{
printf ("libcw: ERROR: cw_wait_for_tone()\n");
failures++;
}
}
if (cw_get_tone_queue_length () != 0)
{
printf ("libcw: ERROR: cw_get_tone_queue_length()\n");
failures++;
}
if (!cw_queue_tone (100000, 1000)
|| !cw_queue_tone (100000, 500))
{
printf ("libcw: ERROR: cw_queue_tone(10000, 1000|500)\n");
failures++;
}
if (!cw_wait_for_tone_queue ())
{
printf ("libcw: ERROR: cw_wait_for_tone_queue()\n");
failures++;
}
printf ("libcw: cw_queue_tone single tone test complete\n");
return failures;
}
/*
* cw_self_test_complex_tones()
*/
static int
cw_self_test_complex_tones (void)
{
int failures = 0;
int index, cw_min, cw_max;
/*
* Run the complete range of tone generation, at 100Hz intervals, first up
* the octaves, and then down. If the queue fills, though it shouldn't
* with this amount of data, then pause until it isn't so full.
*/
cw_set_volume (70);
cw_get_frequency_limits (&cw_min, &cw_max);
for (index = cw_min; index < cw_max; index += 100)
{
while (cw_is_tone_queue_full ())
{
if (!cw_wait_for_tone ())
{
printf ("libcw: ERROR: cw_wait_for_tone()\n");
failures++;
break;
}
}
if (!cw_queue_tone (10000, index))
{
printf ("libcw: ERROR: cw_queue_tone()\n");
failures++;
break;
}
}
for (index = cw_max; index > cw_min; index -= 100)
{
while (cw_is_tone_queue_full ())
{
if (!cw_wait_for_tone ())
{
printf ("libcw: ERROR: cw_wait_for_tone()\n");
failures++;
break;
}
}
if (!cw_queue_tone (10000, index))
{
printf ("libcw: ERROR: cw_queue_tone()\n");
failures++;
break;
}
}
if (!cw_wait_for_tone_queue ())
{
printf ("libcw: ERROR: cw_wait_for_tone_queue()\n");
failures++;
}
cw_queue_tone (0, 0);
cw_wait_for_tone_queue ();
printf ("libcw: cw_queue_tone/cw_wait_for_tone_queue tests complete\n");
return failures;
}
/*
* cw_self_test_tone_queue()
*/
static int
cw_self_test_tone_queue (void)
{
int failures = 0;
int index, status;
/*
* Test the tone queue manipulations, ensuring that we can fill the queue,
* that it looks full when it is, and that we can flush it all again
* afterwards, and recover.
*/
cw_set_volume (70);
printf ("libcw: cw_get_tone_queue_capacity=%d\n",
cw_get_tone_queue_capacity ());
printf ("libcw: empty cw_get_tone_queue_length=%d\n",
cw_get_tone_queue_length ());
index = 0;
while (!cw_is_tone_queue_full ())
cw_queue_tone (1000000, 100 + (index++ & 1) * 100);
printf ("libcw: full cw_get_tone_queue_length=%d\n",
cw_get_tone_queue_length ());
errno = 0;
status = cw_queue_tone (1000000, 100);
if (status || errno != EAGAIN)
{
printf ("libcw: ERROR: full cw_queue_tone()\n");
failures++;
}
cw_flush_tone_queue ();
if (cw_get_tone_queue_length () > 0)
{
printf ("libcw: ERROR: cw_get_tone_queue_length()\n");
failures++;
}
printf ("libcw: cw_flush_tone_queue/length/capacity tests complete\n");
return failures;
}
/*
* cw_self_test_volumes()
*/
static int
cw_self_test_volumes (void)
{
int failures = 0;
int index, cw_min, cw_max;
/*
* Fill the queue with short tones, then check that we can move the volume
* through its entire range. Flush the queue when complete.
*/
cw_get_volume_limits (&cw_min, &cw_max);
index = 0;
while (!cw_is_tone_queue_full ())
cw_queue_tone (100000, 800 + (index++ & 1) * 800);
for (index = cw_max; index >= cw_min; index -= 10)
{
cw_wait_for_tone ();
if (!cw_set_volume (index))
{
printf ("libcw: ERROR: cw_set_volume()\n");
failures++;
break;
}
if (cw_get_volume () != index)
{
printf ("libcw: ERROR: cw_get_volume()\n");
failures++;
break;
}
cw_wait_for_tone ();
}
for (index = cw_min; index <= cw_max; index += 10)
{
cw_wait_for_tone ();
if (!cw_set_volume (index))
{
printf ("libcw: ERROR: cw_set_volume()\n");
failures++;
break;
}
if (cw_get_volume () != index)
{
printf ("libcw: ERROR: cw_get_volume()\n");
failures++;
break;
}
cw_wait_for_tone ();
}
cw_wait_for_tone ();
cw_flush_tone_queue ();
printf ("libcw: cw_set/get_volume tests complete\n");
return failures;
}
/*
* cw_self_test_lookups()
*/
static int
cw_self_test_lookups (void)
{
int failures = 0;
int index;
char charlist[UCHAR_MAX + 1];
/*
* Collect and print out a list of characters in the main CW table.
*/
printf ("libcw: cw_get_character_count %d\n", cw_get_character_count ());
cw_list_characters (charlist);
printf ("libcw: cw_list_characters\n"
"libcw: %s\n", charlist);
/*
* For each character, look up its representation, the look up each
* representation in the opposite direction.
*/
printf ("libcw: cw_get_maximum_representation_length %d\n",
cw_get_maximum_representation_length ());
for (index = 0; charlist[index] != '\0'; index++)
{
char c, representation[256];
if (!cw_lookup_character (charlist[index], representation))
{
printf ("libcw: ERROR: cw_lookup_character()\n");
failures++;
break;
}
if (!cw_lookup_representation (representation, &c))
{
printf ("libcw: ERROR: cw_lookup_representation()\n");
failures++;
break;
}
if (charlist[index] != c)
{
printf ("libcw: ERROR: cw_lookup_() mapping wrong\n");
failures++;
break;
}
}
printf ("libcw: cw list and lookup tests complete\n");
return failures;
}
/*
* cw_self_test_prosign_lookups()
*/
static int
cw_self_test_prosign_lookups (void)
{
int failures = 0;
int index;
char charlist[UCHAR_MAX + 1];
/*
* Collect and print out a list of characters in the procedural signals
* expansion table.
*/
printf ("libcw: cw_get_procedural_character_count %d\n",
cw_get_procedural_character_count ());
cw_list_procedural_characters (charlist);
printf ("libcw: cw_list_procedural_characters\n"
"libcw: %s\n", charlist);
/*
* For each character, look up its expansion and check for two or three
* characters, and a true/false assignment to the display hint.
*/
printf ("libcw: cw_get_maximum_procedural_expansion_length %d\n",
cw_get_maximum_procedural_expansion_length ());
for (index = 0; charlist[index] != '\0'; index++)
{
char expansion[256];
int is_usually_expanded;
is_usually_expanded = -1;
if (!cw_lookup_procedural_character (charlist[index],
expansion, &is_usually_expanded))
{
printf ("libcw: ERROR: cw_lookup_procedural_character()\n");
failures++;
break;
}
if ((strlen (expansion) != 2 && strlen (expansion) != 3)
|| is_usually_expanded == -1)
{
printf ("libcw: ERROR: cw_lookup_procedural_() mapping wrong\n");
failures++;
break;
}
}
printf ("libcw: cw prosign list and lookup tests complete\n");
return failures;
}
/*
* cw_self_test_phonetic_lookups()
*/
static int
cw_self_test_phonetic_lookups (void)
{
int failures = 0;
int index;
/*
* For each ASCII character, look up its phonetic and check for a string
* that start with this character, if alphabetic, and false otherwise.
*/
printf ("libcw: cw_get_maximum_phonetic_length %d\n",
cw_get_maximum_phonetic_length ());
for (index = 0; index < UCHAR_MAX; index++)
{
int status;
char phonetic[256];
status = cw_lookup_phonetic ((char) index, phonetic);
if (status != (isalpha (index) ? true : false))
{
printf ("libcw: ERROR: cw_lookup_phonetic()\n");
failures++;
break;
}
if (status)
{
if (phonetic[0] != toupper (index))
{
printf ("libcw: ERROR: cw_lookup_phonetic() mapping wrong\n");
failures++;
break;
}
}
}
printf ("libcw: cw phonetics lookup tests complete\n");
return failures;
}
/*
* cw_self_test_dot_dash()
*/
static int
cw_self_test_dot_dash (void)
{
int failures = 0;
/*
* Send basic dot and dash using the library primitives.
*/
if (!cw_send_dot ())
{
printf ("libcw: ERROR: cw_send_dot()\n");
failures++;
}
if (!cw_send_dash ())
{
printf ("libcw: ERROR: cw_send_dash()\n");
failures++;
}
if (!cw_send_character_space ())
{
printf ("libcw: ERROR: cw_send_character_space()\n");
failures++;
}
if (!cw_send_word_space ())
{
printf ("libcw: ERROR: cw_send_word_space()\n");
failures++;
}
cw_wait_for_tone_queue ();
printf ("libcw: cw_send_dot/dash tests complete\n");
return failures;
}
/*
* cw_self_test_representations()
*/
static int
cw_self_test_representations (void)
{
int failures = 0;
/*
* Check just a couple of basic representations, and send the valid ones
* as tones.
*/
if (!cw_check_representation (".-.-.-")
|| cw_check_representation ("INVALID"))
{
printf ("libcw: ERROR: cw_check_representation()\n");
failures++;
}
if (!cw_send_representation_partial (".-.-.-"))
{
printf ("libcw: ERROR: cw_send_representation_partial()\n");
failures++;
}
if (!cw_send_representation (".-.-.-"))
{
printf ("libcw: ERROR: valid cw_send_representation()\n");
failures++;
}
if (cw_send_representation ("INVALID"))
{
printf ("libcw: ERROR: invalid cw_send_representation()\n");
failures++;
}
cw_wait_for_tone_queue ();
printf ("libcw: cw_send_representation tests complete\n");
return failures;
}
/*
* cw_self_test_characters()
*/
static int
cw_self_test_characters (void)
{
int failures = 0;
int index;
char charlist[UCHAR_MAX + 1];
/*
* Check all the single characters we can, up to UCHAR_MAX.
*/
cw_list_characters (charlist);
for (index = 0; index < UCHAR_MAX; index++)
{
if (index == ' '
|| (index != 0 && strchr (charlist, toupper (index)) != NULL))
{
if (!cw_check_character (index))
{
printf ("libcw: ERROR: valid cw_check_character()\n");
failures++;
break;
}
}
else
{
if (cw_check_character (index))
{
printf ("libcw: ERROR: invalid cw_check_character()\n");
failures++;
break;
}
}
}
/*
* Check the whole charlist item as a single string, then check a known
* invalid string.
*/
cw_list_characters (charlist);
if (!cw_check_string (charlist))
{
printf ("libcw: ERROR: cw_check_string()\n");
failures++;
}
if (cw_check_string ("%INVALID%"))
{
printf ("libcw: ERROR: invalid cw_check_string()\n");
failures++;
}
printf ("libcw: cw_check_character/string tests complete\n");
return failures;
}
/*
* cw_self_test_full_send()
*/
static int
cw_self_test_full_send (void)
{
int failures = 0;
int index;
char charlist[UCHAR_MAX + 1];
/*
* Send all the characters from the charlist individually.
*/
cw_list_characters (charlist);
printf ("libcw: cw_send_character\n"
"libcw: ");
for (index = 0; charlist[index] != '\0'; index++)
{
putchar (charlist[index]);
fflush (stdout);
if (!cw_send_character (charlist[index]))
{
printf ("libcw: ERROR: cw_send_character()\n");
failures++;
}
cw_wait_for_tone_queue ();
}
putchar ('\n');
if (cw_send_character (0))
{
printf ("libcw: ERROR: invalid cw_send_character()\n");
failures++;
}
/* Now send the complete charlist as a single string. */
printf ("libcw: cw_send_string\n"
"libcw: %s\n", charlist);
if (!cw_send_string (charlist))
{
printf ("libcw: ERROR: cw_send_string()\n");
failures++;
}
while (cw_get_tone_queue_length () > 0)
{
printf ("libcw: tone queue length %-6d\r", cw_get_tone_queue_length ());
fflush (stdout);
cw_wait_for_tone ();
}
printf ("libcw: tone queue length %-6d\n", cw_get_tone_queue_length ());
cw_wait_for_tone_queue ();
if (cw_send_string ("%INVALID%"))
{
printf ("libcw: ERROR: invalid cw_send_string()\n");
failures++;
}
printf ("libcw: cw_send_character/string tests complete\n");
return failures;
}
/*
* cw_self_test_fixed_receive()
*/
static int
cw_self_test_fixed_receive (void)
{
static const struct {
const char character;
const char *const representation;
const int usecs[9];
} TEST_DATA[] = { /* 60 WPM characters with jitter */
{'Q', "--.-", {63456, 20111, 63456, 20111, 23456, 20111, 63456, 60111, 0} },
{'R', ".-.", {17654, 20222, 57654, 20222, 17654, 60222, 0} },
{'P', ".--.", {23456, 20333, 63456, 20333, 63456, 20333, 23456, 60333, 0} },
{' ', NULL, {0} }
};
int failures = 0;
int index;
struct timeval tv;
double dot_sd, dash_sd, element_end_sd, character_end_sd;
/*
* Test receive functions by spoofing them with a timestamp. Getting the
* test suite to generate reliable timing events is a little too much work.
* Add just a little jitter to the timestamps. This is a _very_ minimal
* test, omitting all error states.
*/
printf ("libcw: cw_get_receive_buffer_capacity=%d\n",
cw_get_receive_buffer_capacity ());
cw_set_receive_speed (60);
cw_set_tolerance (35);
cw_disable_adaptive_receive ();
tv.tv_sec = 0;
tv.tv_usec = 0;
for (index = 0; TEST_DATA[index].representation; index++)
{
int entry;
bool is_word, is_error;
char c, representation[256];
tv.tv_sec++;
tv.tv_usec = 0;
for (entry = 0; TEST_DATA[index].usecs[entry] > 0; entry++)
{
entry & 1 ? cw_end_receive_tone (&tv) : cw_start_receive_tone (&tv);
tv.tv_usec += TEST_DATA[index].usecs[entry];
}
if (cw_get_receive_buffer_length ()
!= (int) strlen (TEST_DATA[index].representation))
{
printf ("libcw: ERROR: incorrect receive_buffer_length()\n");
failures++;
break;
}
if (!cw_receive_representation (&tv, representation, &is_word, &is_error))
{
printf ("libcw: ERROR: cw_receive_representation()\n");
failures++;
break;
}
if (strcmp (representation, TEST_DATA[index].representation) != 0)
{
printf ("libcw: ERROR: incorrect cw_receive_representation\n");
failures++;
break;
}
if (is_word)
{
printf ("libcw: ERROR: cw_receive_representation not char\n");
failures++;
break;
}
if (is_error)
{
printf ("libcw: ERROR: cw_receive_representation error\n");
failures++;
break;
}
if (!cw_receive_character (&tv, &c, &is_word, &is_error))
{
printf ("libcw: ERROR: cw_receive_character()\n");
failures++;
break;
}
if (c != TEST_DATA[index].character)
{
printf ("libcw: ERROR: incorrect cw_receive_character\n");
failures++;
break;
}
printf ("libcw: cw_receive_representation/character <%s>,<%c>\n",
representation, c);
cw_clear_receive_buffer ();
if (cw_get_receive_buffer_length () != 0)
{
printf ("libcw: ERROR: incorrect receive_buffer_length()\n");
failures++;
break;
}
}
cw_get_receive_statistics (&dot_sd, &dash_sd,
&element_end_sd, &character_end_sd);
printf ("libcw: cw_receive_statistics %.2f, %.2f, %.2f, %.2f\n",
dot_sd, dash_sd, element_end_sd, character_end_sd);
cw_reset_receive_statistics ();
printf ("libcw: cw_receive_representation/character tests complete\n"
"libcw: cw fixed speed receive tests complete\n");
return failures;
}
/*
* cw_self_test_adaptive_receive()
*/
static int
cw_self_test_adaptive_receive (void)
{
static const struct {
const char character;
const char *const representation;
const int usecs[9];
} TEST_DATA[] = { /* 60, 40, and 30 WPM (mixed speed) characters */
{'Q', "--.-", {60000, 20000, 60000, 20000, 20000, 20000, 60000, 60000, 0} },
{'R', ".-.", {30000, 30000, 90000, 30000, 30000, 90000, 0} },
{'P', ".--.", {40000, 40000, 120000, 40000, 120000, 40000, 40000,
280000, -1} }, /* Includes word end delay, -1 indicator */
{' ', NULL, {0} }
};
int failures = 0;
int index;
struct timeval tv;
double dot_sd, dash_sd, element_end_sd, character_end_sd;
/*
* Test adaptive receive functions in much the same sort of way. Again,
* this is a _very_ minimal test, omitting all error states.
*/
cw_set_receive_speed (45);
cw_set_tolerance (35);
cw_enable_adaptive_receive ();
tv.tv_sec = 0;
tv.tv_usec = 0;
for (index = 0; TEST_DATA[index].representation; index++)
{
int entry;
bool is_word, is_error;
char c, representation[256];
tv.tv_sec++;
tv.tv_usec = 0;
for (entry = 0; TEST_DATA[index].usecs[entry] > 0; entry++)
{
entry & 1 ? cw_end_receive_tone (&tv) : cw_start_receive_tone (&tv);
tv.tv_usec += TEST_DATA[index].usecs[entry];
}
if (cw_get_receive_buffer_length ()
!= (int) strlen (TEST_DATA[index].representation))
{
printf ("libcw: ERROR: incorrect receive_buffer_length()\n");
failures++;
break;
}
if (!cw_receive_representation (&tv, representation, &is_word, &is_error))
{
printf ("libcw: ERROR: cw_receive_representation()\n");
failures++;
break;
}
if (strcmp (representation, TEST_DATA[index].representation) != 0)
{
printf ("libcw: ERROR: incorrect cw_receive_representation\n");
failures++;
break;
}
if ((TEST_DATA[index].usecs[entry] == 0 && is_word)
|| (TEST_DATA[index].usecs[entry] < 0 && !is_word))
{
printf ("libcw: ERROR: cw_receive_representation not %s\n",
is_word ? "char" : "word");
failures++;
break;
}
if (is_error)
{
printf ("libcw: ERROR: cw_receive_representation error\n");
failures++;
break;
}
if (!cw_receive_character (&tv, &c, &is_word, &is_error))
{
printf ("libcw: ERROR: cw_receive_character()\n");
failures++;
break;
}
if (c != TEST_DATA[index].character)
{
printf ("libcw: ERROR: incorrect cw_receive_character\n");
failures++;
break;
}
printf ("libcw: adaptive speed tracking reports %d wpm\n",
cw_get_receive_speed ());
printf ("libcw: cw_receive_representation/character <%s>,<%c>\n",
representation, c);
cw_clear_receive_buffer ();
if (cw_get_receive_buffer_length () != 0)
{
printf ("libcw: ERROR: incorrect receive_buffer_length()\n");
failures++;
break;
}
}
cw_get_receive_statistics (&dot_sd, &dash_sd,
&element_end_sd, &character_end_sd);
printf ("libcw: cw_receive_statistics %.2f, %.2f, %.2f, %.2f\n",
dot_sd, dash_sd, element_end_sd, character_end_sd);
cw_reset_receive_statistics ();
printf ("libcw: cw_receive_representation/character tests complete\n"
"libcw: cw adaptive speed receive tests complete\n");
return failures;
}
/*
* cw_self_test_keyer()
*/
static int
cw_self_test_keyer (void)
{
int failures = 0;
int index, dot_paddle, dash_paddle;
/*
* Perform some tests on the iambic keyer. The latch finer timing points
* are not tested here, just the basics - dots, dashes, and alternating
* dots and dashes.
*/
if (!cw_notify_keyer_paddle_event (true, false))
{
printf ("libcw: ERROR: cw_notify_keyer_paddle_event\n");
failures++;
}
printf ("libcw: testing iambic keyer dots ");
fflush (stdout);
for (index = 0; index < 30; index++)
{
cw_wait_for_keyer_element ();
putchar ('#');
fflush (stdout);
}
putchar ('\n');
cw_get_keyer_paddles (&dot_paddle, &dash_paddle);
if (!dot_paddle || dash_paddle)
{
printf ("libcw: ERROR: cw_keyer_get_paddles mismatch\n");
failures++;
}
if (!cw_notify_keyer_paddle_event (false, true))
{
printf ("libcw: ERROR: cw_notify_keyer_paddle_event\n");
failures++;
}
printf ("libcw: testing iambic keyer dashes ");
fflush (stdout);
for (index = 0; index < 30; index++)
{
cw_wait_for_keyer_element ();
putchar ('#');
fflush (stdout);
}
putchar ('\n');
cw_get_keyer_paddles (&dot_paddle, &dash_paddle);
if (dot_paddle || !dash_paddle)
{
printf ("libcw: ERROR: cw_keyer_get_paddles mismatch\n");
failures++;
}
if (!cw_notify_keyer_paddle_event (true, true))
{
printf ("libcw: ERROR: cw_notify_keyer_paddle_event\n");
failures++;
}
printf ("libcw: testing iambic alternating ");
fflush (stdout);
for (index = 0; index < 30; index++)
{
cw_wait_for_keyer_element ();
putchar ('#');
fflush (stdout);
}
putchar ('\n');
cw_get_keyer_paddles (&dot_paddle, &dash_paddle);
if (!dot_paddle || !dash_paddle)
{
printf ("libcw: ERROR: cw_keyer_get_paddles mismatch\n");
failures++;
}
cw_notify_keyer_paddle_event (false, false);
cw_wait_for_keyer ();
printf ("libcw: cw_notify_keyer_paddle_event tests complete\n");
return failures;
}
/*
* cw_self_test_straight_key()
*/
static int
cw_self_test_straight_key (void)
{
int failures = 0;
int index;
/*
* Unusually, a nice simple set of tests.
*/
for (index = 0; index < 10; index++)
{
if (!cw_notify_straight_key_event (false))
{
printf ("libcw: ERROR: cw_notify_straight_key_event false\n");
failures++;
}
if (cw_get_straight_key_state ())
{
printf ("libcw: ERROR: cw_get_straight_key_state\n");
failures++;
}
if (cw_is_straight_key_busy ())
{
printf ("libcw: ERROR: cw_straight_key_busy\n");
failures++;
}
}
for (index = 0; index < 10; index++)
{
if (!cw_notify_straight_key_event (true))
{
printf ("libcw: ERROR: cw_notify_straight_key_event true\n");
failures++;
}
if (!cw_get_straight_key_state ())
{
printf ("libcw: ERROR: cw_get_straight_key_state\n");
failures++;
}
if (!cw_is_straight_key_busy ())
{
printf ("libcw: ERROR: cw_straight_key_busy\n");
failures++;
}
}
sleep (1);
for (index = 0; index < 10; index++)
{
if (!cw_notify_straight_key_event (false))
{
printf ("libcw: ERROR: cw_notify_straight_key_event false\n");
failures++;
}
}
if (cw_get_straight_key_state ())
{
printf ("libcw: ERROR: cw_get_straight_key_state\n");
failures++;
}
printf ("libcw: cw_notify_straight_key_event/busy tests complete\n");
return failures;
}
/*
* cw_self_test_delayed_release()
*/
static int
cw_self_test_delayed_release (void)
{
int failures = 0;
struct timeval start, finish;
int is_released, delay;
/*
* This is slightly tricky to detect, but circumstantial evidence is provided
* by SIGALRM disposition returning to SIG_DFL.
*/
if (!cw_send_character_space ())
{
printf ("libcw: ERROR: cw_send_character_space()\n");
failures++;
}
if (gettimeofday (&start, NULL) != 0)
{
printf ("libcw: WARNING: gettimeofday failed, test incomplete\n");
return failures;
}
printf ("libcw: waiting for cw_finalization delayed release");
fflush (stdout);
do
{
struct sigaction disposition;
sleep (1);
if (sigaction (SIGALRM, NULL, &disposition) != 0)
{
printf ("libcw: WARNING: sigaction failed, test incomplete\n");
return failures;
}
is_released = disposition.sa_handler == SIG_DFL;
if (gettimeofday (&finish, NULL) != 0)
{
printf ("libcw: WARNING: gettimeofday failed, test incomplete\n");
return failures;
}
delay = (finish.tv_sec - start.tv_sec) * 1000000 + finish.tv_usec
- start.tv_usec;
putchar ('.');
fflush (stdout);
}
while (!is_released && delay < 20000000);
putchar ('\n');
/*
* The release should be around 10 seconds after the end of the sent space.
* A timeout or two might leak in, reducing it by a bit; we'll be ecstatic
* with more than five seconds.
*/
if (is_released)
{
printf ("libcw: cw_finalization delayed release after %d usecs\n", delay);
if (delay < 5000000)
{
printf ("libcw: ERROR: cw_finalization release too quick\n");
failures++;
}
}
else
{
printf ("libcw: ERROR: cw_finalization release wait timed out\n");
failures++;
}
printf ("libcw: cw_finalization release tests complete\n");
return failures;
}
# if 0
/*
* cw_self_test_signal_handling_callback()
* cw_self_test_signal_handling()
*/
static int cw_self_test_signal_handling_callback_called = false;
static void
cw_self_test_signal_handling_callback (int signal_number)
{
signal_number = 0;
cw_self_test_signal_handling_callback_called = true;
}
static int
cw_self_test_signal_handling (void)
{
int failures = 0;
struct sigaction action, disposition;
/*
* Test registering, unregistering, and raising SIGUSR1. SIG_IGN and
* handlers are tested, but not SIG_DFL, because that stops the process.
*/
if (cw_unregister_signal_handler (SIGUSR1))
{
printf ("libcw: ERROR: cw_unregister_signal_handler invalid\n");
failures++;
}
if (!cw_register_signal_handler (SIGUSR1,
cw_self_test_signal_handling_callback))
{
printf ("libcw: ERROR: cw_register_signal_handler failed\n");
failures++;
}
cw_self_test_signal_handling_callback_called = false;
raise (SIGUSR1);
sleep (1);
if (!cw_self_test_signal_handling_callback_called)
{
printf ("libcw: ERROR: cw_self_test_signal_handling_callback missed\n");
failures++;
}
if (!cw_register_signal_handler (SIGUSR1, SIG_IGN))
{
printf ("libcw: ERROR: cw_register_signal_handler (overwrite) failed\n");
failures++;
}
cw_self_test_signal_handling_callback_called = false;
raise (SIGUSR1);
sleep (1);
if (cw_self_test_signal_handling_callback_called)
{
printf ("libcw: ERROR: cw_self_test_signal_handling_callback called\n");
failures++;
}
if (!cw_unregister_signal_handler (SIGUSR1))
{
printf ("libcw: ERROR: cw_unregister_signal_handler failed\n");
failures++;
}
if (cw_unregister_signal_handler (SIGUSR1))
{
printf ("libcw: ERROR: cw_unregister_signal_handler invalid\n");
failures++;
}
action.sa_handler = cw_self_test_signal_handling_callback;
action.sa_flags = SA_RESTART;
sigemptyset (&action.sa_mask);
if (sigaction (SIGUSR1, &action, &disposition) != 0)
{
printf ("libcw: WARNING: sigaction failed, test incomplete\n");
return failures;
}
if (cw_register_signal_handler (SIGUSR1, SIG_IGN))
{
printf ("libcw: ERROR: cw_register_signal_handler clobbered\n");
failures++;
}
if (sigaction (SIGUSR1, &disposition, NULL) != 0)
{
printf ("libcw: WARNING: sigaction failed, test incomplete\n");
return failures;
}
printf ("libcw: cw_[un]register_signal_handler tests complete\n");
return failures;
}
#endif
/*---------------------------------------------------------------------*/
/* Unit tests drivers */
/*---------------------------------------------------------------------*/
/*
* cw_self_test_setup()
*
* Run before each individual test, to handle setup of common test conditions.
*/
static void
cw_self_test_setup (void)
{
cw_reset_send_receive_parameters ();
cw_set_send_speed (30);
cw_set_receive_speed (30);
cw_disable_adaptive_receive ();
cw_reset_receive_statistics ();
cw_unregister_signal_handler (SIGUSR1);
errno = 0;
}
/*
* cw_self_test()
*
* Perform a series of self-tests on library public interfaces.
*/
static int cw_self_test (unsigned int testset)
{
static int (*const TEST_FUNCTIONS[])(void) = {
cw_self_test_admin, /* Version, license, debug flags */
cw_self_test_limits,
cw_self_test_ranges,
cw_self_test_tone_parameters,
cw_self_test_simple_tones,
cw_self_test_complex_tones,
cw_self_test_tone_queue,
cw_self_test_volumes,
cw_self_test_lookups,
cw_self_test_prosign_lookups,
cw_self_test_phonetic_lookups,
cw_self_test_dot_dash,
cw_self_test_representations,
cw_self_test_characters,
cw_self_test_full_send,
cw_self_test_fixed_receive,
cw_self_test_adaptive_receive,
cw_self_test_keyer,
cw_self_test_straight_key,
cw_self_test_delayed_release,
//cw_self_test_signal_handling, /* FIXME - not sure why this test fails :( */
NULL };
int output = CW_AUDIO_NONE;
if (cw_is_oss_possible(NULL)) {
output = CW_AUDIO_OSS;
} else {
fprintf(stderr, "libcw: OSS: soundcard device unavailable: %s\n", strerror(errno));
}
if (output == CW_AUDIO_NONE) {
if (cw_is_alsa_possible(NULL)) {
output = CW_AUDIO_ALSA;
} else {
fprintf(stderr, "libcw: ALSA: soundcard device unavailable: %s\n", strerror(errno));
}
}
if (output == CW_AUDIO_NONE) {
if (cw_is_console_possible(NULL)) {
output = CW_AUDIO_OSS;
} else {
fprintf(stderr, "libcw: console device cannot do sound: %s\n", strerror(errno));
}
}
if (output == CW_AUDIO_NONE) {
fprintf(stderr, "libcw: no audio output available, stopping the test\n");
return -1;
}
int rv = cw_generator_new(output, NULL);
if (rv != 1) {
fprintf(stderr, "libcw: can't create generator, stopping the test\n");
return -1;
}
rv = cw_generator_start();
if (rv != 1) {
fprintf(stderr, "libcw: can't start generator, stopping the test\n");
cw_generator_delete();
return -1;
}
int tests = 0, failures = 0;
/* Run each test specified in the testset bit mask,
and add up the errors that the tests report. */
for (int test = 0; TEST_FUNCTIONS[test]; test++) {
if (testset & (1 << test)) {
cw_self_test_setup();
tests++;
failures += (*TEST_FUNCTIONS[test])();
}
}
sleep(1);
cw_generator_stop();
sleep(1);
cw_generator_delete();
/* All tests done; return success if no failures,
otherwise return an error status code. */
if (failures == 0) {
fprintf(stderr, "libcw: %d test%c completed SUCCESSFULLY\n",
tests, tests == 1 ? ' ' : 's');
return 0;
} else {
fprintf(stderr, "libcw: %d test%c completed with %d ERROR%c\n",
tests, tests == 1 ? ' ' : 's',
failures, failures == 1 ? ' ' : 'S');
return -1;
}
}
/*
* main()
*
* Calls the main test function, and exits with EXIT_SUCCESS if all
* tests complete successfully, otherwise exits with EXIT_FAILURE.
*/
int main(int argc, const char *argv[])
{
static const int SIGNALS[] = { SIGHUP, SIGINT, SIGQUIT, SIGPIPE, SIGTERM, 0 };
unsigned int testset;
/* Obtain a bitmask of the tests to run from the command line
arguments. If none, then default to ~0, which effectively
requests all tests. */
if (argc > 1) {
testset = 0;
for (int arg = 1; arg < argc; arg++) {
unsigned int test = strtoul(argv[arg], NULL, 0);
testset |= 1 << test;
}
} else {
testset = ~0;
}
/* Arrange for the test to exit on a range of signals. */
for (int i = 0; SIGNALS[i] != 0; i++) {
if (!cw_register_signal_handler(SIGNALS[i], SIG_DFL)) {
fprintf(stderr, "libcw: ERROR: cw_register_signal_handler\n");
exit(EXIT_FAILURE);
}
}
/* Run each requested test. */
int rv = cw_self_test(testset);
return rv == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
unixcw-3.0.2/src/libcw/libpc.awk 0000644 0001750 0001750 00000004011 11702277614 016342 0 ustar acerion acerion #!/bin/awk -f
#
# Copyright (C) 2001-2006 Simon Baldwin (simon_baldwin@yahoo.com)
# Copyright (C) 2011-2012 Kamil Ignacak (acerion@wp.pl)
#
# 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.
#
#
# AWK script to produce a pkg-config metadata file.
#
# If we're building under RPM, we need to strip the RPM_BUILD_ROOT from the
# start of each of the prefixed items we use, passed in as strip.
function adjust(path) {
if (length (strip) > 0)
{
if (index (path, strip) == 1)
return substr (path, length (strip) + 1)
}
return path
}
# Extract the package version from config.h, passed in as config_h.
function version() {
while ((status=getline line 0)
{
if (line ~ /\#define PACKAGE_VERSION ".*"/)
{
split (line, pieces)
retval = pieces[3]
gsub (/"/, "", retval)
close (config_h)
return retval
}
}
return "[unknown]"
}
BEGIN {
# Start with prefix preamble.
printf ("prefix=%s\n", adjust(prefix))
printf ("exec_prefix=%s\n", adjust(exec_prefix))
printf ("libdir=%s\n", adjust(libdir))
printf ("includedir=%s\n\n", adjust(includedir))
# Print the remaining metadata.
printf ("Name: libcw\nDescription: CW (Morse code) library.\n")
printf ("Version: %s\nRequires: alsa\n", version())
printf ("Libs: -L${libdir} -lcw -lpthread -lm\nCflags: -I${includedir}\n")
}
unixcw-3.0.2/src/libcw/libdoc.awk 0000644 0001750 0001750 00000012625 11702277630 016515 0 ustar acerion acerion #!/bin/awk -f
#
# Copyright (C) 2001-2006 Simon Baldwin (simon_baldwin@yahoo.com)
# Copyright (C) 2011-2012 Kamil Ignacak (acerion@wp.pl)
#
# 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.
#
#
# Simple AWK script to produce documentation suitable for processing into
# man pages from a C source file.
# Feed output of this script to libsigs.awk and libfuncs.awk to get
# file with function signatures, and file with function
# signatures+documentation respectively.
#
# Initialize the states, tags, and indexes
BEGIN {
IDLE = 0
DOCUMENTATION = 1
FUNCTION_SPECIFICATION = 2
FUNCTION_BODY = 3
state = IDLE
DOCUMENTATION_TAG = "D"
FUNCTION_TAG = "F"
END_TAG = "E"
# line counter, starting from zero for every
# block
output_line = 0
}
function handle_global_space()
{
do {
if ($0 ~ /^static /) {
# potentially a static function declaration
start = match($0, /[a-zA-Z0-9_\* ]+ \**([a-zA-Z0-9_]+)\(/);
if (RSTART > 0) {
len = RLENGTH
name = substr($0, start, len);
static_functions[name] = name;
# print name > "/dev/stderr"
}
}
} while ($0 !~ /^\/\*\*/ && getline)
# caught beginning of documentation block (or end of file)
output_line = 0;
}
# Erase documentation lines from output[]
function delete_documentation(line)
{
while (line >= 0) {
output[line--] = "";
}
}
function handle_function_specification()
{
# catch function's name
start = match($0, /[a-zA-Z0-9_\* ]+ \**([a-zA-Z0-9_]+)\(/);
if (RSTART > 0) {
len = RLENGTH
name = substr($0, start, len);
# print name > "/dev/stderr"
}
if (static_functions[name]) {
# specification of static function;
# no point in processing it
delete_documentation(output_line - 1)
output_line = 0
while ($0 !~ /\)$/ && getline) {
# read and discard
}
} else {
# read and save function's specification
# (possibly multi-line)
do {
output[output_line++] = FUNCTION_TAG" "$0
} while ($0 !~ /\)$/ && getline)
}
}
function handle_function_documentation()
{
while ($0 !~ /^ *\*\//) {
# Some documentation texts still have " * " at the
# beginning sub (/^ \* /," *")
sub(/^ \* */,"")
# Handle Doxygen tags:
# \brief at the very beginning of top-level function comment,
# \param in function's parameters specification,
# \return in function's return values specification.
sub(/^ *\\brief /, "Brief: ")
sub(/^ *\\param /, "Parameter: ")
sub(/^ *\\return /, " Returns: ")
# Handle Doxygen tag:
# \param in the body of top-level function comment
start = match($0, /\\param ([0-9a-zA-Z_]+)/);
if (RSTART > 0) {
len = RLENGTH
# 7 - strlen(\\param )
param_name = substr($0, start + 7, len - 7);
param_name = "\\fB"param_name"\\fP"
gsub(/(\\param [0-9a-zA-Z_]+)/, param_name, $0)
# print param_name > "/dev/stderr"
}
output[output_line++] = DOCUMENTATION_TAG" "$0
getline
}
}
function handle_function_body()
{
# Ignore function body lines, but watch for a bracket that
# closes a function
while ($0 !~ /^\}/) {
# read and discard lines of function body
getline
}
}
function print_documentation_and_specification()
{
# Print out the specification and documentation lines we have found;
# reorder documentation and specification so that documentation
# lines come after the function signatures.
for (i = 0; i < output_line; i++) {
if (index(output[i], DOCUMENTATION_TAG) == 0) {
print output[i]
}
}
for (i = 0; i < output_line; i++) {
if (index(output[i], DOCUMENTATION_TAG) != 0) {
print output[i]
}
}
return i
}
# Ignore all blank lines outside of comments and function bodies
/^[[:space:]]*$/ {
if (state == IDLE) {
next
}
}
# Handle every other line in the file according to the state;
# This is the main 'loop' of the script.
{
# Process static function declarations and change
# state on '^/**'
if (state == IDLE) {
handle_global_space()
state = DOCUMENTATION
next
}
# Process function documentation blocks, stopping on ' */'.
if (state == DOCUMENTATION) {
handle_function_documentation()
state = FUNCTION_SPECIFICATION
next
}
# Process function specification line(s), stopping on ')$'.
if (state == FUNCTION_SPECIFICATION) {
handle_function_specification()
state = FUNCTION_BODY
next
}
# Process function body, stopping on '^}'
if (state == FUNCTION_BODY) {
handle_function_body()
state = IDLE
}
# Print function's documentation and specification,
# i.e. the data accumulated in above functions
print_documentation_and_specification()
print END_TAG
# prepare for next 'documentation + specification' section
state = IDLE
output_line = 0
}
# Simply dump anything we have so far on end of file.
END {
i = print_documentation_and_specification()
if (i > 0) {
print END_TAG
}
}
unixcw-3.0.2/src/libcw/libcw.h 0000644 0001750 0001750 00000027101 11702277673 016030 0 ustar acerion acerion /*
* Copyright (C) 2001-2006 Simon Baldwin (simon_baldwin@yahoo.com)
* Copyright (C) 2011-2012 Kamil Ignacak (acerion@wp.pl)
*
* 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.
*/
#ifndef _LIBCW_H
#define _LIBCW_H
#include /* For struct timeval */
#include
#include /* int16_t */
#include
#include
#if defined(__cplusplus)
extern "C"
{
#endif
enum cw_return_values {
CW_FAILURE = false,
CW_SUCCESS = true };
/* supported audio sound systems */
enum cw_audio_systems {
CW_AUDIO_NONE = 0,
CW_AUDIO_CONSOLE,
CW_AUDIO_OSS,
CW_AUDIO_ALSA,
CW_AUDIO_SOUNDCARD /* ALSA or OSS */
};
typedef int16_t cw_sample_t;
struct cw_gen_struct; /* Forward declaration, struct is defined in libcw.c. */
typedef struct cw_gen_struct cw_gen_t;
/* Default outputs for audio systems. Used by libcw unless
client code decides otherwise. */
#define CW_DEFAULT_CONSOLE_DEVICE "/dev/console"
#define CW_DEFAULT_OSS_DEVICE "/dev/audio"
#define CW_DEFAULT_ALSA_DEVICE "default"
/* Limits on values of CW send and timing parameters */
#define CW_SPEED_MIN 4 /* Lowest WPM allowed */
#define CW_SPEED_MAX 60 /* Highest WPM allowed */
#define CW_SPEED_STEP 1
#define CW_SPEED_INITIAL 12 /* Initial send speed in WPM */
#define CW_FREQUENCY_MIN 0 /* Lowest tone allowed (0=silent) */
#define CW_FREQUENCY_MAX 4000 /* Highest tone allowed */
#define CW_FREQUENCY_INITIAL 800 /* Initial tone in Hz */
#define CW_FREQUENCY_STEP 20
#define CW_VOLUME_MIN 0 /* Quietest volume allowed (0=silent) */
#define CW_VOLUME_MAX 100 /* Loudest volume allowed */
#define CW_VOLUME_INITIAL 70 /* Initial volume percent */
#define CW_VOLUME_STEP 1
#define CW_GAP_MIN 0 /* Lowest extra gap allowed */
#define CW_GAP_MAX 60 /* Highest extra gap allowed */
#define CW_GAP_INITIAL 0 /* Initial gap setting */
#define CW_GAP_STEP 1
#define CW_WEIGHTING_MIN 20 /* Lowest weighting allowed */
#define CW_WEIGHTING_MAX 80 /* Highest weighting allowed */
#define CW_WEIGHTING_INITIAL 50 /* Initial weighting setting */
#define CW_TOLERANCE_MIN 0 /* Lowest receive tolerance allowed */
#define CW_TOLERANCE_MAX 90 /* Highest receive tolerance allowed */
#define CW_TOLERANCE_INITIAL 50 /* Initial tolerance setting */
/*
* Representation characters for Dot and Dash. Only the following
* characters are permitted in Morse representation strings.
*/
enum { CW_DOT_REPRESENTATION = '.', CW_DASH_REPRESENTATION = '-' };
/* Debug levels definitions. */
enum
{ CW_DEBUG_SILENT = 1 << 0, /* Suppresses KIOCSOUND ioctls */
CW_DEBUG_KEYING = 1 << 1, /* Print out keying control data */
CW_DEBUG_SOUND = 1 << 2, /* Print out tone generation data */
CW_DEBUG_TONE_QUEUE = 1 << 3, /* Print out tone queue data */
CW_DEBUG_PARAMETERS = 1 << 4, /* Print out timing parameters */
CW_DEBUG_RECEIVE_STATES = 1 << 5, /* Print out receive state changes */
CW_DEBUG_KEYER_STATES = 1 << 6, /* Print out keyer information */
CW_DEBUG_STRAIGHT_KEY = 1 << 7, /* Print out straight key information */
CW_DEBUG_LOOKUPS = 1 << 8, /* Print out table lookup results */
CW_DEBUG_FINALIZATION = 1 << 9, /* Print out finalization actions */
CW_DEBUG_SYSTEM = 1 << 10, /* Print out OS problems (malloc, open,
ioctl, etc. Also configuration errors.) */
CW_DEBUG_MASK = (1 << 11) - 1 /* Bit mask of used debug bits */
};
/* CW library function prototypes. */
extern int cw_version (void);
extern void cw_license (void);
extern int cw_generator_new(int audio_system, const char *device);
extern void cw_generator_delete(void);
extern int cw_generator_start(void);
extern void cw_generator_stop(void);
extern const char *cw_generator_get_audio_system_label(void);
extern void cw_set_debug_flags (unsigned int new_value);
extern unsigned int cw_get_debug_flags (void);
extern int cw_get_character_count (void);
extern void cw_list_characters (char *list);
extern int cw_get_maximum_representation_length (void);
extern int cw_lookup_character (char c, char *representation);
extern int cw_check_representation (const char *representation);
extern int cw_lookup_representation (const char *representation, char *c);
extern int cw_get_procedural_character_count (void);
extern void cw_list_procedural_characters (char *list);
extern int cw_get_maximum_procedural_expansion_length (void);
extern int cw_lookup_procedural_character (char c, char *representation,
int *is_usually_expanded);
extern int cw_get_maximum_phonetic_length (void);
extern int cw_lookup_phonetic (char c, char *phonetic);
extern void cw_get_speed_limits (int *min_speed, int *max_speed);
extern void cw_get_frequency_limits (int *min_frequency, int *max_frequency);
extern void cw_get_volume_limits (int *min_volume, int *max_volume);
extern void cw_get_gap_limits (int *min_gap, int *max_gap);
extern void cw_get_tolerance_limits (int *min_tolerance, int *max_tolerance);
extern void cw_get_weighting_limits (int *min_weighting, int *max_weighting);
extern void cw_reset_send_receive_parameters (void);
extern int cw_set_send_speed (int new_value);
extern int cw_set_receive_speed (int new_value);
extern int cw_set_frequency (int new_value);
extern int cw_set_volume (int new_value);
extern int cw_set_gap (int new_value);
extern int cw_set_tolerance (int new_value);
extern int cw_set_weighting (int new_value);
extern int cw_get_send_speed (void);
extern int cw_get_receive_speed (void);
extern int cw_get_frequency (void);
extern int cw_get_volume (void);
extern int cw_get_gap (void);
extern int cw_get_tolerance (void);
extern int cw_get_weighting (void);
extern void cw_get_send_parameters (int *dot_usecs, int *dash_usecs,
int *end_of_element_usecs,
int *end_of_character_usecs,
int *end_of_word_usecs,
int *additional_usecs,
int *adjustment_usecs);
extern void cw_get_receive_parameters (int *dot_usecs, int *dash_usecs,
int *dot_min_usecs, int *dot_max_usecs,
int *dash_min_usecs, int *dash_max_usecs,
int *end_of_element_min_usecs,
int *end_of_element_max_usecs,
int *end_of_element_ideal_usecs,
int *end_of_character_min_usecs,
int *end_of_character_max_usecs,
int *end_of_character_ideal_usecs,
int *adaptive_threshold);
extern int cw_set_noise_spike_threshold (int threshold);
extern int cw_get_noise_spike_threshold (void);
extern void cw_block_callback (int is_block);
extern bool cw_is_console_possible(const char *device);
extern bool cw_is_oss_possible(const char *device);
extern bool cw_is_alsa_possible(const char *device);
extern const char *cw_get_console_device(void);
extern const char *cw_get_soundcard_device(void);
extern void cw_complete_reset (void);
extern int cw_register_signal_handler (int signal_number,
void (*callback_func) (int));
extern int cw_unregister_signal_handler (int signal_number);
extern void cw_register_keying_callback (void (*callback_func) (void*, int),
void *callback_arg);
extern int cw_register_tone_queue_low_callback (void (*callback_func) (void*),
void *callback_arg, int level);
extern bool cw_is_tone_busy (void);
extern int cw_wait_for_tone (void);
extern int cw_wait_for_tone_queue (void);
extern int cw_wait_for_tone_queue_critical (int level);
extern bool cw_is_tone_queue_full (void);
extern int cw_get_tone_queue_capacity (void);
extern int cw_get_tone_queue_length (void);
extern void cw_flush_tone_queue (void);
extern int cw_queue_tone (int usecs, int frequency);
extern void cw_reset_tone_queue (void);
extern int cw_send_dot (void);
extern int cw_send_dash (void);
extern int cw_send_character_space (void);
extern int cw_send_word_space (void);
extern int cw_send_representation (const char *representation);
extern int cw_send_representation_partial (const char *representation);
extern int cw_check_character (char c);
extern int cw_send_character (char c);
extern int cw_send_character_partial (char c);
extern int cw_check_string (const char *string);
extern int cw_send_string (const char *string);
extern void cw_get_receive_statistics (double *dot_sd, double *dash_sd,
double *element_end_sd,
double *character_end_sd);
extern void cw_reset_receive_statistics (void);
extern void cw_enable_adaptive_receive (void);
extern void cw_disable_adaptive_receive (void);
extern bool cw_get_adaptive_receive_state (void);
extern int cw_start_receive_tone (const struct timeval *timestamp);
extern int cw_end_receive_tone (const struct timeval *timestamp);
extern int cw_receive_buffer_dot (const struct timeval *timestamp);
extern int cw_receive_buffer_dash (const struct timeval *timestamp);
extern int cw_receive_representation (const struct timeval *timestamp,
char *representation,
bool *is_end_of_word, bool *is_error);
extern int cw_receive_character (const struct timeval *timestamp,
char *c, bool *is_end_of_word, bool *is_error);
extern void cw_clear_receive_buffer (void);
extern int cw_get_receive_buffer_capacity (void);
extern int cw_get_receive_buffer_length (void);
extern void cw_reset_receive (void);
extern void cw_enable_iambic_curtis_mode_b (void);
extern void cw_disable_iambic_curtis_mode_b (void);
extern int cw_get_iambic_curtis_mode_b_state (void);
extern int cw_notify_keyer_paddle_event (int dot_paddle_state,
int dash_paddle_state);
extern int cw_notify_keyer_dot_paddle_event (int dot_paddle_state);
extern int cw_notify_keyer_dash_paddle_event (int dash_paddle_state);
extern void cw_get_keyer_paddles (int *dot_paddle_state,
int *dash_paddle_state);
extern void cw_get_keyer_paddle_latches (int *dot_paddle_latch_state,
int *dash_paddle_latch_state);
extern bool cw_is_keyer_busy (void);
extern int cw_wait_for_keyer_element (void);
extern int cw_wait_for_keyer (void);
extern void cw_reset_keyer (void);
extern int cw_notify_straight_key_event (int key_state);
extern int cw_get_straight_key_state (void);
extern bool cw_is_straight_key_busy (void);
extern void cw_reset_straight_key (void);
#if defined(__cplusplus)
}
#endif
#endif /* _LIBCW_H */
unixcw-3.0.2/src/libcw/cw.7 0000644 0001750 0001750 00000012524 11702300000 015226 0 ustar acerion acerion .\"
.\" UnixCW CW Tutor Package - cw
.\" Copyright (C) 2001-2006 Simon Baldwin (simon_baldwin@yahoo.com)
.\" Copyright (C) 2011-2012 Kamil Ignacak (acerion@wp.pl)
.\"
.\" 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.
.\"
.\"
.TH CW 7 "CW Tutor Package" \" -*- nroff -*-
.SH NAME
.\"
CW \- the international Morse code
.\"
.\"
.\"
.SH DESCRIPTION
.\"
CW is an abbreviation for "continuous wave", the commonly used technical
term for Morse code communication. A basic knowledge or understanding of
Morse code is a requirement for Radio Amateurs and Marine Radio Operators
in many parts of the world.
.PP
.\"
.\"
.\"
.SS MORSE CODE TIMINGS
.\"
In Morse code, a dot or dash is referred to as an element. The basic
timing unit is the dot period. This is the time taken to send a dot,
not including any space before or after the dot. The lengths of all
other elements are then derived from this basic unit, using the
following rules:
.IP
The duration of a dash is three dots.
.IP
The time between each element (dot or dash) is one dot length.
.IP
The space between characters is three dot lengths.
.IP
The space between words is seven dot lengths.
.PP
The following formula calculates the dot period in microseconds from the
Morse code speed in words per minute:
.IP
.nf
dot period = ( 1200000 / speed )
.fi
.PP
This formula arises from the use of the word PARIS as a 'standard'
word for calibrating Morse code speed. PARIS is 50 units long when
sent in Morse code. Analysis of English plain-text indicates that
the average word is 50 units, including spaces.
.PP
.\"
.\"
.\"
.SS MORSE CODE CHARACTERS
.\"
The following list shows the IS0 8859-1 (Latin-1) characters that have
commonly understood representations in Morse code:
.IP
.\" \[u0022] = ", otherwise emacs syntax highlighting is messed up;
ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\[u0022]$()+\-./:;=?_@ and space
.PP
In addition, following ISO 8859-1 and ISO 8859-2 accented characters are
also part of the generally accepted international Morse code:
.IP
.\" ÜÄÇÖÉČŔŃŞŽ
\[:U]\[:A]\[,C]\[:O]\['E]\[`E]\[`A]\[~N]\[S u0327] (S with cedilla), \[vZ] (Z with caron/hacek),
.PP
Finally, \fBlibcw\fP adds the following ASCII characters as extensions to
single character procedural signals:
.IP
<>!&^~
.PP
.\"
.\"
.\"
.SS MORSE CODE CHARACTER TABLES
.\"
The following table shows the Morse code equivalents for the ISO 8859-1,
accented ISO 8859-1, and accented ISO 8859-2 characters above. The ASCII
portion of this table is taken from the \fIARRL Handbook\fP, and the
accented extensions from various other sources:
.\"
.TS
l l l l l l l l
_ _ _ _ _ _ _ _
l l l l l l l l .
Ch Code Ch Code Ch Code Ch Code
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 --..
.BR
0 ----- 1 .---- 2 ..--- 3 ...--
4 ....- 5 ..... 6 -.... 7 --...
8 ---.. 9 ----.
.BR
.\" \[u0022] = ", otherwise emacs syntax highlighting is messed up;
\[u0022] .-..-. ' .----. $ ...-..- ( -.--.
) -.--.- + .-.-. , --..-- - -....-
\. .-.-.- / -..-. : ---... ; -.-.-.
\(eq -...- ? ..--.. \(ul ..--.-
.TE
.TS
l l l l
_ _ _ _
l l l l .
Ch Code Ch Code
\[:U] ..-- \[:A] .-.-
\[,C] -.-.. \[:O] ---.
\['E] ..-.. \[`A] .-..-
\[`A] .--.- \[~N] --.--
\[S u0327] (S+cedilla) ---- \[vZ] (Z+caron/hacek) --..-
.TE
.PP
In addition to the above standard characters, the following characters
are conventionally used for punctuation and procedural signals as
follows:
.\"
.TS
l l l l l l l l
_ _ _ _ _ _ _ _
l l l l l l l l.
Ch Code Ch Code Ch Code Ch Code
.\" \[u0022] = "
\[u0022] .-..-. ' .----. $ ...-..- ( -.--.
) -.--.- + .-.-. , --..-- - -....-
\. .-.-.- / -..-. : ---... ; -.-.-.
\(eq -...- ? ..--.. \(ul ..--.- @ .--.-.
.TE
.PP
and the following are non-conventional extensions implemented
by \fBlibcw\fP:
.\"
.TS
l l l l l l l l
_ _ _ _ _ _ _ _
l l l l l l l l.
Ch Code Ch Code Ch Code Ch Code
< ...-.- > -...-.- ! ...-. & .-...
^ -.-.- ~ .-.-..
.TE
.PP
An alternative view of punctuation and procedural signals is as
combination Morse characters:
.\"
.TS
l l l l l l l l
_ _ _ _ _ _ _ _
l l l l l l l l.
Ch Prosig Ch Prosig Ch Prosig Ch Prosig
.\" \[u0022] = "
\[u0022] [AF] ' [WG] $ [SX] ( [KN]
) [KK] + [AR] , [MIM] - [DU]
\. [AAA] / [DN] : [OS] ; [KR]
\(eq [BT] ? [IMI] \(ul [IQ] @ [AC]
< [VA],[SK] > [BK] ! [SN] & [AS]
^ [KA] ~ [AL]
.TE
.PP
.\"
.\"
.\"
.SH NOTES
.\"
Despite the fact that this manual page constantly and consistently
refers to Morse code elements as dots and dashes, DO NOT think in these
terms when trying to learn Morse code. Always think of them as 'dit's
and 'dah's.
.PP
.\"
.\"
.\"
.SH SEE ALSO
.\"
Man pages for \fBlibcw\fP(3,LOCAL), \fBcw\fP(1,LOCAL), \fBcwgen\fP(1,LOCAL),
\fBcwcp\fP(1,LOCAL), and \fBxcwcp\fP(1,LOCAL).
.\"
unixcw-3.0.2/src/libcw/libfuncs.awk 0000644 0001750 0001750 00000004232 11702277621 017061 0 ustar acerion acerion #!/bin/awk -f
#
# Copyright (C) 2001-2006 Simon Baldwin (simon_baldwin@yahoo.com)
# Copyright (C) 2011-2012 Kamil Ignacak (acerion@wp.pl)
#
# 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.
#
#
# AWK script to produce function documentation strings from processed
# C source. Pass output of libdoc.awk script to input of this script.
#
# Initialize states and tags
BEGIN {
IDLE = 0
TYPE = 1
SPECIFICATION = 2
DOCUMENTATION = 3
state = IDLE
FUNCTION_TAG = "F"
DOCUMENTATION_TAG = "D"
END_TAG = "E"
}
# Handle each line containing function specification
$1 == FUNCTION_TAG {
sub(FUNCTION_TAG, "")
sub(/^ */, "")
gsub(/\t/, " ")
if (state != SPECIFICATION) {
# first line of specification;
# print empty line before printing (possibly
# multi-line) specification
print("\n.sp\n");
}
printf(".br\n.B \"%s\"\n", $0)
if ($0 ~ /\)$/) {
# newline line after last line of (possibly multi-line)
# specification
# printf(".sp\n", $0)
}
state = SPECIFICATION
next
}
# Handle all documentation lines
$1 == DOCUMENTATION_TAG {
if (state == SPECIFICATION) {
state = DOCUMENTATION
# line break between function prototype and
# function documentation
print(".br");
}
sub(DOCUMENTATION_TAG, "")
sub(/^ +/, "")
# line break for printing consecutive 'Returns: ' and 'Parameter: '
# in separate lines
if ($0 ~ /^Returns:/ || $0 ~ /^Parameter:/) {
print(".br")
}
print $0
next
}
# On end of a function specification, reset state
$1 == END_TAG {
state = IDLE
next
}
unixcw-3.0.2/src/libcw/libcw.3.m4 0000644 0001750 0001750 00000013516 11702277741 016263 0 ustar acerion acerion .\"
.\" UnixCW CW Tutor Package - LIBCW
.\" Copyright (C) 2001-2006 Simon Baldwin (simon_baldwin@yahoo.com)
.\" Copyright (C) 2011-2012 Kamil Ignacak (acerion@wp.pl)
.\"
.\" 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.
.\"
.\"
.TH LIBCW 3 "CW Tutor Package" "libcw ver. 3.0.1" \" -*- nroff -*-
.SH NAME
.\"
libcw \- general purpose Morse code functions library
.\"
.\"
.\"
.SH SYNOPSIS
.\"
.nf
.B #include
.sp
.fi
include(signatures)
.PP
.\"
.\"
.\"
.SS DESCRIPTION
.\"
.B libcw
is a general purpose CW (Morse code) functions library. It contains
routines for converting characters into Morse code representations
and back again, for sending Morse code characters, and for receiving
characters. It also contains routines to emulate an Iambic Morse
keyer, and a straight key.
.PP
The library can be included in any program that wishes to make use of
these features. It forms the heart of three Morse code tutor
applications that accompany the package in which it is distributed.
.PP
See the \fBcw\fP(7) man page for information on Morse code timings,
and the dot and dash representations for the various Morse characters.
.\"
.\"
.\"
.SS TONE QUEUE
.\"
.B libcw
contains an inbuilt tone queue. The queue is emptied by background
processing, using SIGALRM calls and itimers, so a caller program can
continue with other tasks while the library sends tones and keys any
external device.
.PP
As well as being used by the library functions that sound Morse code
characters and provide a keyer sidetone, the primitive tone queue
functions are publicly available to caller programs.
.PP
.\"
.\"
.\"
.SS CONTROLLING AN EXTERNAL DEVICE
.\"
.B libcw
may be passed the address of a function that controls external keying.
This function is called each time the library changes the keying state,
either as a result of sending a Morse character or representation, or
as a result of an iambic keyer or straight key state change. The argument
passed is a single integer, TRUE for key-down, and FALSE for key-up.
.PP
.B libcw
calls the external keying function only when the keying state changes.
A call is likely each time a tone is taken off the tone queue.
.PP
.\"
.\"
.\"
.SS SENDING CW CHARACTERS AND STRINGS
.\"
.B libcw
offers several functions that send individual characters and character
strings as Morse code. It also offers functions that allow
specialized 'representations' to be sent. A 'representation' is an ASCII
string that consists of only the characters '.' and '-'.
.PP
Characters and strings are converted into representations, and then the
correct tones for the dots and dashes in these representations are queued
on the tone queue, for action by the background queue emptying process.
.PP
.\"
.\"
.\"
.SS RECEIVING CW CHARACTERS AND REPRESENTATIONS
.\"
.B libcw
contains functions to allow it to receive Morse code. To receive, the
library must be told when a tone start is detected, and when a tone end
is detected. It then determines whether the tone was a dot or a dash
depending on the timing difference between the two. After the required
silence gap has passed, the library may be queried to see what the
received representation or character was.
.PP
Errors in receiving may be detected by means of the flags passed back on
receive character functions.
.PP
.\"
.\"
.\"
.SS IAMBIC KEYER
.\"
.B libcw
offers functions to simulate an Iambic Morse keyer. The caller program
needs to tell the library of paddle state changes. Iambic keyer functions
are mutually exclusive with character send and straight key functions.
.PP
.\"
.\"
.\"
.SS STRAIGHT KEY
.\"
.B libcw
offers simple functions to allow effective pass-through of straight key
information. The caller program needs to tell the library of key state
changes. Straight key functions are mutually exclusive with character
send and iambic keyer functions.
.PP
.\"
.\"
.\"
.SS FUNCTIONS
The following list describes the functions available to a \fBlibcw\fP caller:
include(functions)
.PP
.\"
.\"
.\"
.SH NOTES
.\"
Despite the fact that this manual page constantly and consistently
refers to Morse code elements as dots and dashes, DO NOT think in these
terms when trying to learn Morse code. Always think of them as 'dit's
and 'dah's.
.PP
.B libcw
uses system itimers for its internal timing. On most UNIX flavours,
itimers are not guaranteed to signal a program exactly at the specified
time, and they generally offer a resolution only as good as the normal
system 'clock tick' resolution. An itimer SIGALRM usually falls on a
system clock tick, making it accurate to no better than 10mS on a typical
100Hz kernel.
.PP
The effect of this is that an itimer period is generally either
exactly as specified, or, more likely, slightly longer. At higher
WPM settings, the cumulative effect of this affects timing accuracy,
because at higher speeds, there are fewer 10mS clock ticks in a dot
period. For example, at 12 WPM, the dot length is 100mS, enough to
contain five kernel clock ticks; at 60 WPM, the dot length is 20mS,
or just two kernel clock ticks. So at higher speeds, the effect of itimer
resolutions becomes more pronounced.
.PP
.\"
.\"
.\"
.SH SEE ALSO
.\"
Man pages for \fBcw\fP(7,LOCAL), \fBcw\fP(1,LOCAL), \fBcwgen\fP(1,LOCAL),
\fBcwcp\fP(1,LOCAL), and \fBxcwcp\fP(1,LOCAL).
.\"
unixcw-3.0.2/src/libcw/libsigs.awk 0000644 0001750 0001750 00000002361 11702277606 016714 0 ustar acerion acerion #!/bin/awk -f
#
# Copyright (C) 2001-2006 Simon Baldwin (simon_baldwin@yahoo.com)
# Copyright (C) 2011-2012 Kamil Ignacak (acerion@wp.pl)
#
# 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.
#
#
# AWK script to produce function signatures from processed C source.
# Pass output of libdoc.awk script to input of this script.
# Initialize tags
BEGIN {
FUNCTION_TAG = "F"
}
# Handle lines containing function specification
$1 == FUNCTION_TAG {
sub(FUNCTION_TAG, "")
sub(/^ */, "")
gsub(/\t/, " ")
printf(".BI \"%s\"\n.br\n", $0)
next
}
# Tidy up on end of file
END {
print(".fi\n")
}
unixcw-3.0.2/src/cw/ 0000755 0001750 0001750 00000000000 11767330160 014057 5 ustar acerion acerion unixcw-3.0.2/src/cw/demo.cw 0000644 0001750 0001750 00000003356 11665746644 015364 0 ustar acerion acerion {
Copyright (C) 2001-2006 Simon Baldwin (simon_baldwin@yahoo.com)
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.
Demonstration CW contact, to test CW sender program
===================================================
The following example contact is taken from the CW section of the
RSGB's publication "Amateur Radio Operating Manual".
}%M0;{
}%T800;CQ CQ CQ CQ DE G4ZZZ G4ZZZ K {
}%T1200;G4ZZZ G4ZZZ DE WD9ZZZ WD9ZZZ [AR] {
}%T800;WD9ZZZ DE G4ZZZ GA OM ES MNI TNX FER CALL = UR RST 579 = {
}NAME JOHN ES QTH LONDON = SO HW CPY? [AR] WD9ZZZ DE G4ZZZ K {
}%T1200;G4ZZZ DE WD9ZZZ R FB JOHN ES GM OM = UR RST 559 = {
}QTH SR [HH] SPRINGFIELD, ILL = NAME IS ED = SO HW? [AR] G4ZZZ DE WD9ZZZ K {
}%T800;WD9ZZZ DE G4ZZZ SRI OM QRM5 = PSE RPT UR NAME?? BK {
}%T1200;BK NAME IS ED ED ED BK {
}%T800;BK R R TNX ED = QRM GONE = RIG IS HOMEBREW WID 75W INPUT = {
}ANT IS DIPOLE = MNI TNX FER QSO ES CU AGN = {
}73 ES GB [AR] WD9ZZZ DE G4ZZZ [VA] {
}%T1200;G4ZZZ DE WD9ZZZ R UR RIG T9X ES FB = RIG HR IS TS520 = {
}ANT IS 2EL QUAD = WL QSL VIA BURO = SO 73 ES GUD DX = {
}GB [VA] G4ZZZ DE WD9ZZZ {
}
unixcw-3.0.2/src/cw/Makefile 0000644 0001750 0001750 00000004513 11767330160 015522 0 ustar acerion acerion # Copyright (C) 2001-2006 Simon Baldwin (simon_baldwin@yahoo.com)
# Copyright (C) 2011-2012 Kamil Ignacak (acerion@wp.pl)
#
# 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.
#
include ../../Makefile.inc
CC = $(AC_CC)
CFLAGS = $(AC_CFLAGS) $(AC_DEFS) -I../libcw -I../cwutils
GZIP = $(AC_GZIP)
SHELL = /bin/sh
default: all
LIBS = -L../libcw -lcw
# Build the cw binary.
all: cw
cw.o: cw.c ../libcw/libcw.h
cw: cw.o
$(CC) $(LDFLAGS) -o $@ cw.o ../cwutils/i18n.o ../cwutils/cw_common.o ../cwutils/cmdline.o \
../cwutils/memory.o $(LIBS) -g -O0
# Install targets.
install: all
$(INSTALL) -d $(includedir) $(bindir) $(mandir)/man1
$(INSTALL_DATA) cw.h $(includedir)/cw.h
$(INSTALL_PROGRAM) -m 4755 cw $(bindir)/cw
$(INSTALL_DATA) cw.1 $(mandir)/man1/cw.1
$(GZIP) -f -9 $(mandir)/man1/cw.1
install-strip:
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install
uninstall:
rm -f $(includedir)/cw.h
rm -f $(bindir)/cw
rm -f $(mandir)/man1/cw.1 $(mandir)/man1/cw.1.gz
# Cleanup targets.
clean:
rm -f cw *.s *.o
rm -f core core.*
distclean: clean
rm -f Makefile.port
mostlyclean: clean
maintainer-clean: distclean
# Test targets.
# This test target will be invoked when creating deb package.
check:
# This test target can be invoked manually.
real_check: all
( echo "Trying with OSS audio output"; \
LD_LIBRARY_PATH=../libcw:$$LD_LIBRARY_PATH ./cw -so -f test.cw ) || \
( echo "Retrying with ALSA audio output"; \
LD_LIBRARY_PATH=../libcw:$$LD_LIBRARY_PATH ./cw -sa -f test.cw ) || \
( echo "Retrying with console audio output"; \
LIBCW_DEBUG=1 \
LD_LIBRARY_PATH=../libcw:$$LD_LIBRARY_PATH ./cw -sc -f test.cw )
# Unimplemented targets.
TAGS:
info:
dvi:
dist:
unixcw-3.0.2/src/cw/Makefile~ 0000644 0001750 0001750 00000004500 11702277234 015715 0 ustar acerion acerion # Copyright (C) 2001-2006 Simon Baldwin (simon_baldwin@yahoo.com)
# Copyright (C) 2011-2012 Kamil Ignacak (acerion@wp.pl)
#
# 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.
#
include ../../Makefile.inc
CC = $(AC_CC)
CFLAGS = $(AC_CFLAGS) $(AC_DEFS) -I../libcw -I../cwutils
GZIP = $(AC_GZIP)
SHELL = /bin/sh
default: all
LIBS = -L../libcw -lcw
# Build the cw binary.
all: cw
cw.o: cw.c ../libcw/libcw.h
cw: cw.o
$(CC) -o $@ cw.o ../cwutils/i18n.o ../cwutils/cw_common.o ../cwutils/cmdline.o \
../cwutils/memory.o $(LIBS) -g -O0
# Install targets.
install: all
$(INSTALL) -d $(includedir) $(bindir) $(mandir)/man1
$(INSTALL_DATA) cw.h $(includedir)/cw.h
$(INSTALL_PROGRAM) -m 4755 cw $(bindir)/cw
$(INSTALL_DATA) cw.1 $(mandir)/man1/cw.1
$(GZIP) -f -9 $(mandir)/man1/cw.1
install-strip:
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install
uninstall:
rm -f $(includedir)/cw.h
rm -f $(bindir)/cw
rm -f $(mandir)/man1/cw.1 $(mandir)/man1/cw.1.gz
# Cleanup targets.
clean:
rm -f cw *.s *.o
rm -f core core.*
distclean: clean
rm -f Makefile.port
mostlyclean: clean
maintainer-clean: distclean
# Test targets.
# This test target will be invoked when creating deb package.
check:
# This test target can be invoked manually.
real_check: all
( echo "Trying with OSS audio output"; \
LD_LIBRARY_PATH=../libcw:$$LD_LIBRARY_PATH ./cw -so -f test.cw ) || \
( echo "Retrying with ALSA audio output"; \
LD_LIBRARY_PATH=../libcw:$$LD_LIBRARY_PATH ./cw -sa -f test.cw ) || \
( echo "Retrying with console audio output"; \
LIBCW_DEBUG=1 \
LD_LIBRARY_PATH=../libcw:$$LD_LIBRARY_PATH ./cw -sc -f test.cw )
# Unimplemented targets.
TAGS:
info:
dvi:
dist:
unixcw-3.0.2/src/cw/cw.c 0000644 0001750 0001750 00000041375 11702277175 014653 0 ustar acerion acerion /*
* Copyright (C) 2001-2006 Simon Baldwin (simon_baldwin@yahoo.com)
* Copyright (C) 2011-2012 Kamil Ignacak (acerion@wp.pl)
*
* 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.
*/
#define _BSD_SOURCE
#include "../config.h"
#include
#include
#include
#include
#include
#include
#include
#if defined(HAVE_STRING_H)
# include
#endif
#if defined(HAVE_STRINGS_H)
# include
#endif
#include "cw.h"
#include "libcw.h"
#include "i18n.h"
#include "cmdline.h"
#include "copyright.h"
/*---------------------------------------------------------------------*/
/* Module variables, miscellaneous other stuff */
/*---------------------------------------------------------------------*/
/* Assorted definitions and constants. */
enum { FALSE = 0, TRUE = !FALSE };
/* Forward declarations for printf-like functions with checkable arguments. */
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
static void write_to_echo_stream (const char *format, ...)
__attribute__ ((__format__ (__printf__, 1, 2)));
static void write_to_message_stream (const char *format, ...)
__attribute__ ((__format__ (__printf__, 1, 2)));
static void write_to_cw_sender (const char *format, ...)
__attribute__ ((__format__ (__printf__, 1, 2)));
#endif
/*
* Program-specific state variables, settable from the command line, or from
* embedded input stream commands. These options may be set by the embedded
* command parser to values other than strictly TRUE or FALSE; all non-zero
* values are equivalent to TRUE.
*/
#if 0
static int do_echo = TRUE, /* Echo characters */
do_errors = TRUE, /* Print error messages to stderr */
do_commands = TRUE, /* Execute embedded commands */
do_combinations = TRUE, /* Execute [...] combinations */
do_comments = TRUE; /* Allow {...} as comments */
#endif
static cw_config_t *config = NULL;
static const char *all_options = "s:|system,d:|device,"
"w:|wpm,t:|tone,v:|volume,"
"g:|gap,k:|weighting,"
"f:|infile,"
"e|noecho,m|nomessages,c|nocommands,o|nocombinations,p|nocomments,"
"h|help,V|version";
static const char *argv0 = NULL;
/*---------------------------------------------------------------------*/
/* Convenience functions */
/*---------------------------------------------------------------------*/
/*
* write_to_echo_stream()
* write_to_message_stream()
*
* Local fprintf functions that suppress output to if the appropriate flag
* is not set; writes are synchronously flushed.
*/
static void
write_to_echo_stream (const char *format, ...)
{
if (config->do_echo)
{
va_list ap;
va_start (ap, format);
vfprintf (stdout, format, ap);
fflush (stdout);
va_end (ap);
}
}
static void
write_to_message_stream (const char *format, ...)
{
if (config->do_errors)
{
va_list ap;
va_start (ap, format);
vfprintf (stderr, format, ap);
fflush (stderr);
va_end (ap);
}
}
/*
* write_to_cw_sender()
*
* Fprintf-like function that allows us to conveniently print to the cw
* output 'stream'.
*/
static void
write_to_cw_sender (const char *format, ...)
{
va_list ap;
char buffer[128];
/*
* Format the CW send buffer using vsnprintf. Formatted strings longer than
* the declared buffer will be silently truncated to the buffer length.
*/
va_start (ap, format);
vsnprintf (buffer, sizeof (buffer), format, ap);
va_end (ap);
/* Sound the buffer, and wait for the send to complete. */
if (!cw_send_string (buffer))
{
perror ("cw_send_string");
cw_flush_tone_queue ();
abort ();
}
if (!cw_wait_for_tone_queue_critical (1))
{
perror ("cw_wait_for_tone_queue_critical");
cw_flush_tone_queue ();
abort ();
}
}
/*---------------------------------------------------------------------*/
/* Embedded commands handling */
/*---------------------------------------------------------------------*/
/*
* parse_stream_query()
*
* Handle a query received in the input stream. The command escape character
* and the query character have already been read and recognized.
*/
static void
parse_stream_query (FILE *stream)
{
int c, value;
c = toupper (fgetc (stream));
switch (c)
{
case EOF:
return;
default:
write_to_message_stream ("%c%c%c", CW_STATUS_ERR, CW_CMD_QUERY, c);
return;
case CW_CMDV_FREQUENCY:
value = cw_get_frequency ();
break;
case CW_CMDV_VOLUME:
value = cw_get_volume ();
break;
case CW_CMDV_SPEED:
value = cw_get_send_speed ();
break;
case CW_CMDV_GAP:
value = cw_get_gap ();
break;
case CW_CMDV_WEIGHTING:
value = cw_get_weighting ();
break;
case CW_CMDV_ECHO:
value = config->do_echo;
break;
case CW_CMDV_ERRORS:
value = config->do_errors;
break;
case CW_CMDV_COMMANDS:
value = config->do_commands;
break;
case CW_CMDV_COMBINATIONS:
value = config->do_combinations;
break;
case CW_CMDV_COMMENTS:
value = config->do_comments;
break;
}
/* Write the value obtained above to the message stream. */
write_to_message_stream ("%c%c%d", CW_STATUS_OK, c, value);
}
/*
* parse_stream_cwquery()
*
* Handle a cwquery received in the input stream. The command escape
* character and the cwquery character have already been read and recognized.
*/
static void
parse_stream_cwquery (FILE *stream)
{
int c, value;
const char *format;
c = toupper (fgetc (stream));
switch (c)
{
case EOF:
return;
default:
write_to_message_stream ("%c%c%c", CW_STATUS_ERR, CW_CMD_CWQUERY, c);
return;
case CW_CMDV_FREQUENCY:
value = cw_get_frequency ();
format = _("%d HZ ");
break;
case CW_CMDV_VOLUME:
value = cw_get_volume ();
format = _("%d PERCENT ");
break;
case CW_CMDV_SPEED:
value = cw_get_send_speed ();
format = _("%d WPM ");
break;
case CW_CMDV_GAP:
value = cw_get_gap ();
format = _("%d DOTS ");
break;
case CW_CMDV_WEIGHTING:
value = cw_get_weighting ();
format = _("%d PERCENT ");
break;
case CW_CMDV_ECHO:
value = config->do_echo;
format = _("ECHO %s ");
break;
case CW_CMDV_ERRORS:
value = config->do_errors;
format = _("ERRORS %s ");
break;
case CW_CMDV_COMMANDS:
value = config->do_commands;
format = _("COMMANDS %s ");
break;
case CW_CMDV_COMBINATIONS:
value = config->do_combinations;
format = _("COMBINATIONS %s ");
break;
case CW_CMDV_COMMENTS:
value = config->do_comments;
format = _("COMMENTS %s ");
break;
}
switch (c)
{
case CW_CMDV_FREQUENCY:
case CW_CMDV_VOLUME:
case CW_CMDV_SPEED:
case CW_CMDV_GAP:
case CW_CMDV_WEIGHTING:
write_to_cw_sender (format, value);
break;
case CW_CMDV_ECHO:
case CW_CMDV_ERRORS:
case CW_CMDV_COMMANDS:
case CW_CMDV_COMBINATIONS:
case CW_CMDV_COMMENTS:
write_to_cw_sender (format, value ? _("ON") : _("OFF"));
break;
}
}
/*
* parse_stream_parameter()
*
* Handle a parameter setting command received in the input stream. The
* command type character has already been read from the stream, and is passed
* in as the first argument.
*/
static void
parse_stream_parameter (int c, FILE *stream)
{
int value;
int (*value_handler) (int);
/* Parse and check the new parameter value. */
if (fscanf (stream, "%d;", &value) != 1)
{
write_to_message_stream ("%c%c", CW_STATUS_ERR, c);
return;
}
/* Either assign a handler, or update the local flag, as appropriate. */
value_handler = NULL;
switch (c)
{
case EOF:
default:
return;
case CW_CMDV_FREQUENCY:
value_handler = cw_set_frequency;
break;
case CW_CMDV_VOLUME:
value_handler = cw_set_volume;
break;
case CW_CMDV_SPEED:
value_handler = cw_set_send_speed;
break;
case CW_CMDV_GAP:
value_handler = cw_set_gap;
break;
case CW_CMDV_WEIGHTING:
value_handler = cw_set_weighting;
break;
case CW_CMDV_ECHO:
config->do_echo = value;
break;
case CW_CMDV_ERRORS:
config->do_errors = value;
break;
case CW_CMDV_COMMANDS:
config->do_commands = value;
break;
case CW_CMDV_COMBINATIONS:
config->do_combinations = value;
break;
case CW_CMDV_COMMENTS:
config->do_comments = value;
break;
}
/*
* If not a local flag, apply the new value to a CW library control using
* the handler assigned above.
*/
if (value_handler)
{
if (!(*value_handler) (value))
{
write_to_message_stream ("%c%c", CW_STATUS_ERR, c);
return;
}
}
/* Confirm the new value with a stderr message. */
write_to_message_stream ("%c%c%d", CW_STATUS_OK, c, value);
}
/*
* parse_stream_command()
*
* Handle a command received in the input stream. The command escape
* character has already been read and recognized.
*/
static void
parse_stream_command (FILE *stream)
{
int c;
c = toupper (fgetc (stream));
switch (c)
{
case EOF:
return;
default:
write_to_message_stream ("%c%c%c", CW_STATUS_ERR, CW_CMD_ESCAPE, c);
return;
case CW_CMDV_FREQUENCY:
case CW_CMDV_VOLUME:
case CW_CMDV_SPEED:
case CW_CMDV_GAP:
case CW_CMDV_WEIGHTING:
case CW_CMDV_ECHO:
case CW_CMDV_ERRORS:
case CW_CMDV_COMMANDS:
case CW_CMDV_COMBINATIONS:
case CW_CMDV_COMMENTS:
parse_stream_parameter (c, stream);
break;
case CW_CMD_QUERY:
parse_stream_query (stream);
break;
case CW_CMD_CWQUERY:
parse_stream_cwquery (stream);
break;
case CW_CMDV_QUIT:
cw_flush_tone_queue ();
write_to_echo_stream ("%c", '\n');
exit (EXIT_SUCCESS);
}
}
/*---------------------------------------------------------------------*/
/* Input stream handling */
/*---------------------------------------------------------------------*/
/*
* send_cw_character()
*
* Sends the given character to the CW sender, and waits for it to complete
* sounding the tones. The character to send may be a partial or a complete
* character.
*/
static void
send_cw_character (int c, int is_partial)
{
int character, status;
/* Convert all whitespace into a single space. */
character = isspace (c) ? ' ' : c;
/* Send the character to the CW sender. */
status = is_partial ? cw_send_character_partial (character)
: cw_send_character (character);
if (!status)
{
if (errno != ENOENT)
{
perror ("cw_send_character[_partial]");
cw_flush_tone_queue ();
abort ();
}
else
{
write_to_message_stream ("%c%c", CW_STATUS_ERR, character);
return;
}
}
/* Echo the original character while sending it. */
write_to_echo_stream ("%c", c);
/* Wait for the character to complete. */
if (!cw_wait_for_tone_queue_critical (1))
{
perror ("cw_wait_for_tone_queue_critical");
cw_flush_tone_queue ();
abort ();
}
}
/*
* parse_stream()
*
* Read characters from a file stream, and either sound them, or interpret
* controls in them. Returns on end of file.
*/
static void
parse_stream (FILE *stream)
{
int c;
enum { NONE, COMBINATION, COMMENT, NESTED_COMMENT } state = NONE;
/*
* Cycle round states depending on input characters. Comments may be
* nested inside combinations, but not the other way around; that is,
* combination starts and ends are not special within comments.
*/
for (c = fgetc (stream); !feof (stream); c = fgetc (stream))
{
switch (state)
{
case NONE:
/*
* Start a comment or combination, handle a command escape, or send
* the character if none of these checks apply.
*/
if (config->do_comments && c == CW_COMMENT_START)
{
state = COMMENT;
write_to_echo_stream ("%c", c);
}
else if (config->do_combinations && c == CW_COMBINATION_START)
{
state = COMBINATION;
write_to_echo_stream ("%c", c);
}
else if (config->do_commands && c == CW_CMD_ESCAPE)
parse_stream_command (stream);
else
send_cw_character (c, FALSE);
break;
case COMBINATION:
/*
* Start a comment nested in a combination, end a combination,
* handle a command escape, or send the character if none of these
* checks apply.
*/
if (config->do_comments && c == CW_COMMENT_START)
{
state = NESTED_COMMENT;
write_to_echo_stream ("%c", c);
}
else if (c == CW_COMBINATION_END)
{
state = NONE;
write_to_echo_stream ("%c", c);
}
else if (config->do_commands && c == CW_CMD_ESCAPE)
parse_stream_command (stream);
else
{
/*
* If this is the final character in the combination, do not
* suppress the end of character delay. To do this, look ahead
* the next character, and suppress unless combination end.
*/
int lookahead;
lookahead = fgetc (stream);
ungetc (lookahead, stream);
send_cw_character (c, lookahead != CW_COMBINATION_END);
}
break;
case COMMENT:
case NESTED_COMMENT:
/*
* If in a comment nested in a combination and comment end seen,
* revert state to reflect in combination only. If in an unnested
* comment and comment end seen, reset state.
*/
if (c == CW_COMMENT_END)
state = (state == NESTED_COMMENT) ? COMBINATION : NONE;
write_to_echo_stream ("%c", c);
break;
}
}
}
/*
* main()
*
* Parse command line args, then produce CW output until end of file.
*/
int main (int argc, char *const argv[])
{
argv0 = program_basename(argv[0]);
/* Set locale and message catalogs. */
i18n_initialize();
/* Parse combined environment and command line arguments. */
int combined_argc;
char **combined_argv;
combine_arguments("CW_OPTIONS", argc, argv, &combined_argc, &combined_argv);
config = cw_config_new();
if (!config) {
return EXIT_FAILURE;
}
config->is_cw = 1;
if (!cw_process_argv(argc, argv, all_options, config)) {
fprintf(stderr, _("%s: failed to parse command line args\n"), argv0);
return EXIT_FAILURE;
}
if (!cw_config_is_valid(config)) {
fprintf(stderr, _("%s: inconsistent arguments\n"), argv0);
return EXIT_FAILURE;
}
if (config->input_file) {
if (!freopen(config->input_file, "r", stdin)) {
fprintf(stderr, _("%s: %s\n"), argv0, strerror(errno));
fprintf(stderr, _("%s: error opening input file %s\n"), argv0, config->input_file);
return EXIT_FAILURE;
}
}
if (!cw_generator_new_from_config(config, argv0)) {
//fprintf(stderr, "%s: failed to create generator with device '%s'\n", argv0, config->audio_device);
return EXIT_FAILURE;
}
/* Set up signal handlers to exit on a range of signals. */
int index;
static const int SIGNALS[] = { SIGHUP, SIGINT, SIGQUIT, SIGPIPE, SIGTERM, 0 };
for (index = 0; SIGNALS[index] != 0; index++) {
if (!cw_register_signal_handler(SIGNALS[index], SIG_DFL)) {
fprintf(stderr, _("%s: can't register signal: %s\n"), argv0, strerror(errno));
return EXIT_FAILURE;
}
}
/* Start producing sine wave (amplitude of the wave will be
zero as long as there are no characters to process). */
cw_generator_start();
/* Send stdin stream to CW parsing. */
parse_stream(stdin);
/* Await final tone completion before exiting. */
cw_wait_for_tone_queue();
cw_generator_stop();
cw_generator_delete();
cw_config_delete(&config);
return EXIT_SUCCESS;
}
unixcw-3.0.2/src/cw/prelude.cw 0000644 0001750 0001750 00000012127 11665747037 016071 0 ustar acerion acerion {
Copyright (C) 2001-2006 Simon Baldwin (simon_baldwin@yahoo.com)
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.
First Prelude in C - J.S. Bach
==============================
The following data is an abuse of the CW sender program, using it to sound
a short piece of music. The output has no charisma.
}[%T523;E%T659;E%T784;E%T1047;E%T1319;E%T784;E%T1047;E%T1319;E{
}%T523;E%T659;E%T784;E%T1047;E%T1319;E%T784;E%T1047;E%T1319;E{
}%T523;E%T587;E%T880;E%T1175;E%T1397;E%T880;E%T1175;E%T1397;E{
}%T523;E%T587;E%T880;E%T1175;E%T1397;E%T880;E%T1175;E%T1397;E{
}%T494;E%T587;E%T784;E%T1175;E%T1397;E%T784;E%T1175;E%T1397;E{
}%T494;E%T587;E%T784;E%T1175;E%T1397;E%T784;E%T1175;E%T1397;E{
}%T523;E%T659;E%T784;E%T1047;E%T1319;E%T784;E%T1047;E%T1319;E{
}%T523;E%T659;E%T784;E%T1047;E%T1319;E%T784;E%T1047;E%T1319;E{
}%T523;E%T659;E%T880;E%T1319;E%T1760;E%T880;E%T1319;E%T1760;E{
}%T523;E%T659;E%T880;E%T1319;E%T1760;E%T880;E%T1319;E%T1760;E{
}%T523;E%T587;E%T741;E%T880;E%T1175;E%T741;E%T880;E%T1175;E{
}%T523;E%T587;E%T741;E%T880;E%T1175;E%T741;E%T880;E%T1175;E{
}%T494;E%T587;E%T784;E%T1175;E%T1568;E%T784;E%T1175;E%T1568;E{
}%T494;E%T587;E%T784;E%T1175;E%T1568;E%T784;E%T1175;E%T1568;E{
}%T494;E%T523;E%T659;E%T784;E%T1047;E%T659;E%T784;E%T1047;E{
}%T494;E%T523;E%T659;E%T784;E%T1047;E%T659;E%T784;E%T1047;E{
}%T440;E%T523;E%T659;E%T784;E%T1047;E%T659;E%T784;E%T1047;E{
}%T440;E%T523;E%T659;E%T784;E%T1047;E%T659;E%T784;E%T1047;E{
}%T294;E%T440;E%T587;E%T741;E%T1047;E%T587;E%T741;E%T1047;E{
}%T294;E%T440;E%T587;E%T741;E%T1047;E%T587;E%T741;E%T1047;E{
}%T392;E%T494;E%T587;E%T784;E%T988;E%T587;E%T784;E%T988;E{
}%T392;E%T494;E%T587;E%T784;E%T988;E%T587;E%T784;E%T988;E{
}%T392;E%T467;E%T659;E%T784;E%T1111;E%T659;E%T784;E%T1111;E{
}%T392;E%T467;E%T659;E%T784;E%T1111;E%T659;E%T784;E%T1111;E{
}%T349;E%T440;E%T587;E%T880;E%T1175;E%T587;E%T880;E%T1175;E{
}%T349;E%T440;E%T587;E%T880;E%T1175;E%T587;E%T880;E%T1175;E{
}%T349;E%T416;E%T587;E%T698;E%T988;E%T587;E%T698;E%T988;E{
}%T349;E%T416;E%T587;E%T698;E%T988;E%T587;E%T698;E%T988;E{
}%T330;E%T392;E%T523;E%T784;E%T1047;E%T523;E%T784;E%T1047;E{
}%T330;E%T392;E%T523;E%T784;E%T1047;E%T523;E%T784;E%T1047;E{
}%T330;E%T349;E%T440;E%T523;E%T698;E%T440;E%T523;E%T698;E{
}%T330;E%T349;E%T440;E%T523;E%T698;E%T440;E%T523;E%T698;E{
}%T294;E%T349;E%T440;E%T523;E%T698;E%T440;E%T523;E%T698;E{
}%T294;E%T349;E%T440;E%T523;E%T698;E%T440;E%T523;E%T698;E{
}%T196;E%T294;E%T392;E%T494;E%T698;E%T392;E%T494;E%T698;E{
}%T196;E%T294;E%T392;E%T494;E%T698;E%T392;E%T494;E%T698;E{
}%T262;E%T330;E%T392;E%T523;E%T659;E%T392;E%T523;E%T659;E{
}%T262;E%T330;E%T392;E%T523;E%T659;E%T392;E%T523;E%T659;E{
}%T262;E%T392;E%T467;E%T523;E%T659;E%T467;E%T523;E%T659;E{
}%T262;E%T392;E%T467;E%T523;E%T659;E%T467;E%T523;E%T659;E{
}%T175;E%T349;E%T440;E%T523;E%T659;E%T440;E%T523;E%T659;E{
}%T175;E%T349;E%T440;E%T523;E%T659;E%T440;E%T523;E%T659;E{
}%T185;E%T262;E%T440;E%T523;E%T623;E%T440;E%T523;E%T623;E{
}%T185;E%T262;E%T440;E%T523;E%T623;E%T440;E%T523;E%T623;E{
}%T196;E%T312;E%T494;E%T523;E%T623;E%T494;E%T523;E%T623;E{
}%T196;E%T312;E%T494;E%T523;E%T623;E%T494;E%T523;E%T623;E{
}%T208;E%T349;E%T494;E%T523;E%T587;E%T494;E%T523;E%T587;E{
}%T208;E%T349;E%T494;E%T523;E%T587;E%T494;E%T523;E%T587;E{
}%T196;E%T349;E%T392;E%T494;E%T587;E%T392;E%T494;E%T587;E{
}%T196;E%T349;E%T392;E%T494;E%T587;E%T392;E%T494;E%T587;E{
}%T196;E%T330;E%T392;E%T523;E%T659;E%T392;E%T523;E%T659;E{
}%T196;E%T330;E%T392;E%T523;E%T659;E%T392;E%T523;E%T659;E{
}%T196;E%T294;E%T392;E%T523;E%T698;E%T392;E%T523;E%T698;E{
}%T196;E%T294;E%T392;E%T523;E%T698;E%T392;E%T523;E%T698;E{
}%T196;E%T294;E%T392;E%T494;E%T698;E%T392;E%T494;E%T698;E{
}%T196;E%T294;E%T392;E%T494;E%T698;E%T392;E%T494;E%T698;E{
}%T196;E%T312;E%T440;E%T523;E%T741;E%T440;E%T523;E%T741;E{
}%T196;E%T312;E%T440;E%T523;E%T741;E%T440;E%T523;E%T741;E{
}%T196;E%T330;E%T392;E%T523;E%T784;E%T392;E%T523;E%T784;E{
}%T196;E%T330;E%T392;E%T523;E%T784;E%T392;E%T523;E%T784;E{
}%T196;E%T294;E%T392;E%T523;E%T698;E%T392;E%T523;E%T698;E{
}%T196;E%T294;E%T392;E%T523;E%T698;E%T392;E%T523;E%T698;E{
}%T196;E%T294;E%T392;E%T494;E%T698;E%T392;E%T494;E%T698;E{
}%T196;E%T294;E%T392;E%T494;E%T698;E%T392;E%T494;E%T698;E{
}%T131;E%T262;E%T392;E%T467;E%T659;E%T392;E%T467;E%T659;E{
}%T131;E%T262;E%T392;E%T467;E%T659;E%T392;E%T467;E%T659;E{
}%T131;E%T262;E%T349;E%T440;E%T523;E%T698;E%T523;E%T440;E{
}%T523;E%T440;E%T349;E%T440;E%T349;E%T294;E%T349;E%T294;E{
}%T131;E%T247;E%T784;E%T988;E%T1175;E%T1397;E%T1175;E%T988;E{
}%T1175;E%T988;E%T784;E%T988;E%T587;E%T698;E%T659;E%T587;E{
}%T1047;T]{
}
unixcw-3.0.2/src/cw/cw.1 0000644 0001750 0001750 00000050122 11702304030 014534 0 ustar acerion acerion .\"
.\" UnixCW CW Tutor Package - CW
.\" Copyright (C) 2001-2006 Simon Baldwin (simon_baldwin@yahoo.com)
.\" Copyright (C) 2011-2012 Kamil Ignacak (acerion@wp.pl)
.\"
.\" 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.
.\"
.\"
.TH CW 1 "CW Tutor Package" "cw ver. 3.0.1" \" -*- nroff -*-
.SH NAME
.\"
cw \- sound characters as Morse code on the soundcard or console speaker
.\"
.\"
.\"
.SH SYNOPSIS
.\"
.B cw
[\-s\ \-\-system=\fISYSTEM\fP]
[\-d\ \-\-device=\fIDEVICE\fP]
[\-w\ \-\-wpm=\fIWPM\fP]
[\-t\ \-\-tone=\fIHZ\fP]
[\-v\ \-\-volume=\fIPERCENT\fP]
[\-g\ \-\-gap=\fIGAP\fP]
[\-k\ \-\-weighting=\fIWEIGHT\fP]
.BR
[\-e\ \-\-noecho]
[\-m\ \-\-nomessages]
[\-c\ \-\-nocommands]
[\-o\ \-\-nocombinations]
[\-p\ \-\-nocomments]
[\-f\ \-\-infile=\fIFILE\fP]
.BR
[\-h\ \-\-help]
[\-V\ \-\-version]
.BR
.PP
\fBcw\fP installed on GNU/Linux systems understands both short form
and long form command line options. \fBcw\fP installed on other
operating systems may understand only the short form options.
.PP
There are no mandatory options.
.PP
Options may be predefined in the environment variable \fBCW_OPTIONS\fP.
If defined, these options are used first; command line options take
precedence.
.PP
.\"
.\"
.\"
.SH DESCRIPTION
.\"
.PP
\fBcw\fP reads characters from an input file, or from standard input, and
sounds each valid character as Morse code on either the system sound card,
or the system console speaker. After it sounds a character, \fBcw\fP
echoes it to standard output. The input stream can contain embedded
command strings. These change the parameters used when sounding the
Morse code.
\fBcw\fP reports any errors in embedded commands on standard error.
.PP
Use 'Ctrl+D' key combination to exit \fBcw\fP.
.\"
.\"
.\"
.SS COMMAND LINE OPTIONS
.\"
\fBcw\fP understands the following command line options. The long
form options may not be available in non-LINUX versions.
.TP
.I "\-s, \-\-system=SYSTEM"
Specifies the way that \fBcw\fP generates tones. Valid values
are:
\fIconsole\fP for tones through the console speaker,
\fIalsa\fP for tones generated through the system sound card using ALSA
sound system,
\fIoss\fP for tones generated through system sound card using OSS sound
system,
\fIsoundcard\fP for tones generated through the system sound card, but
without explicit selection of sound system. These values can be
shortened to 'c', 'a', 'o', or 's', respectively. The default value
is 'oss'.
.TP
.I "\-d, \-\-device=DEVICE"
Specifies the device file to open for generating a sound.
\fBcw\fP will use default device if none is specified. The default
devices are:
\fI/dev/console\fP for sound produced through console,
\fIdefault\fP for ALSA sound system,
\fI/dev/audio\fP for OSS sound system.
See also \fINOTES ON USING A SOUND CARD\fP below.
.TP
.I "\-w, \-\-wpm=WPM"
Sets the initial sending speed in words per minute. The value must be
between 4 and 60. The default value is 12 WPM.
.TP
.I "\-t, \-\-tone=HZ"
Sets the initial sounder pitch in Hz. This value must be between 0
and 4,000. A value of 0 selects silent operation, and can be used for
timing checks or other testing. The default value is 800Hz,
.TP
.I "\-v, \-\-volume=PERCENT"
Sets the initial sending volume, as a percentage of full scale volume.
The value must be between 0 and 100. The default value is 70 %.
Sound volumes work fully for sound card tones, but \fBcw\fP cannot
control the volume of tones from the console speaker. In this case,
a volume of zero is silent, and all other volume values are simply sounded.
.TP
.I "\-g, \-\-gap=GAP"
Sets the initial extra gap, in dot lengths, between characters
(the 'Farnsworth' delay). It must be between 0 and 60. The default
is 0.
.TP
.I "\-k, \-\-weighting=WEIGHT"
Sets the initial weighting, as a percentage of dot lengths. It must be
between 20 and 80. The default is 50.
.TP
.I "\-e, \-\-noecho"
Stops \fBcw\fP echoing characters on standard output after they are
sounded. The default is to have echoing on.
.TP
.I "\-m, \-\-nomessages"
Stops \fBcw\fP printing error messages on standard error.
The default is to print messages.
.TP
.I "\-c, \-\-nocommands"
Stops \fBcw\fP from interpreting commands embedded in the input stream.
The default is to interpret embedded commands.
.TP
.I "\-o, \-\-nocombinations"
Stops \fBcw\fP from treating character strings bracketed by [...] as
a single combination character. The default is to honor combinations.
.TP
.I "\-p, \-\-nocomments"
Stops \fBcw\fP from treating character strings bracketed by {...}
as 'comments'. Characters inside these braces will be echoed to standard
output, but not sounded. When comments are being honored, any
embedded commands inside the braces will be ignored. The default is
to honor comments.
.TP
.I "\-f, \-\-infile=FILE"
Specifies a text file that \fBcw\fP can read to configure its practice
text.
.TP
.I "\-h, \-\-help"
Prints short help message.
.TP
.I "\-V, \-\-version"
Prints information about program's version, authors and license.
.PP
.\"
.\"
.\"
.SS SOUNDING CHARACTERS
.\"
\fBcw\fP reads characters, one at a time, from its standard input or
from its input file. Lowercase letters are converted internally to
uppercase. The following list shows the valid IS0 8859-1 (Latin-1)
characters that can be sounded by \fBcw\fP:
.\" \[u0022] = ", otherwise emacs syntax highlighting is messed up;
.IP
ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\[u0022]$()+\-./:;=?_@ and space
.PP
In addition, the program also understands the following ISO 8859-1
and ISO 8859-2 accented characters:
.\"
.\"
.\" �������Ѫ�
.\"
.\"
.\" This looks like a great place for tutorial on non-standard characters
.\" in troff document tutorial ;)
.\"
.\" Q: how to produce '�' ('S' with Cedilla)?
.\" A: use composite glyph; 'man 7 groff_char' gives this syntax of
.\" composite glyph:
.\" \[base_glyph composite_1 composite_2 ...]
.\" For '�' base glyph is 'S', and first (and only) composite is
.\" 'cedilla', represented by Unicode thingy 'u0327'. Thus:
.\" '�' = '\[S u0327]';
.\"
.\" Q: how to produce '�' ('Z' with caron/hacek)?
.\" A: in two ways: either as a composite glyph as demonstrated above),
.\" i.e. like this: '\[Z u030C]', or in 'regular' way, using
.\" non-composite glyph \[vZ]'
.\"
.\" Q: any more tips?
.\" A: two:
.\" - read 'man 7 groff_char' (or 'man 7 troff_char');
.\" - make sure that your terminal (terminal emulator) can display
.\" non-standard characters correctly (and I mean *really* correctly);
.\" make a little test: open 'man 7 troff_char' in your terminal,
.\" and open web page with html version of the man page, then search
.\" for non-standard characters (e.g. cedilla) in the html document
.\" and compare them with those displayed in the terminal;
.\"
.\"
.\"
.\"
.IP
\[:U]\[:A]\[,C]\[:O]\['E]\[`E]\[`A]\[~N]\[S u0327] (S with cedilla), \[vZ] (Z with caron/hacek),
.PP
and accepts the following as single character forms of common procedural
signals:
.IP
<>!&^~
.PP
See \fBcw\fP(7,LOCAL) for more information on the above characters
and Morse code.
.PP
If \fBcw\fP receives a character not in this set, it prints an error
message '?\fIc\fP', where \fIc\fP is the error character. The only
exceptions to this may be the \fBcw\fP command escape character '%',
the combination start and stop characters '[' and ']', and the
comment start and stop characters '{' and '}'.
See \fIEMBEDDED COMMANDS\fP and \fIMORSE CODE COMBINATIONS\fP below.
.PP
.\"
.\"
.\"
.SS EMBEDDED COMMANDS
.\"
\fBcw\fP recognizes special sequences in the input stream as embedded
commands. These commands alter the parameters of the \fBcw\fP while it is
running, or query current values. All commands are prefixed by the
command escape character '%', and those which set a value end with a
semicolon.
.PP
The format of an embedded command to change a parameter value is
.IP
%\fICvalue\fP;
.PP
where \fIC\fP is a command letter indicating what action \fBcw\fP
is to take, and \fIvalue\fP is the argument or value for the command.
.PP
Valid command letters are
.TP
.I "T"
Sets the tone pitch used to sound a character.
.TP
.I "W"
Sets the sending speed.
.TP
.I "G"
Sets the 'Farnsworth' gap between characters.
.TP
.I "K"
Sets the weighting.
.TP
.I "E"
Disables or re-enables echoing of sent characters on standard output.
.TP
.I "M"
Disables or re-enables error messages on standard error.
.TP
.I "S"
Disables or re-enables speaker tone generation.
.TP
.I "C"
Disables processing of embedded commands. Note that once disabled,
this command cannot re-enable them.
.TP
.I "O"
Disables or re-enables recognition of [...] character combinations.
.TP
.I "P"
Disables or re-enables recognition of {...} comments. When comments
are being recognized, any character after an opening '{' and before
any closing '}' will be echoed to standard output, but will not be
sounded, or have any other effect.
.PP
For example, the embedded command sequence
.IP
%W25;%T1200;
.PP
will set \fBcw\fP to a speed of 25 WPM, and a tone pitch of 1200Hz.
.PP
The 'T', 'W', 'G', and 'A' commands take values along with the command.
The limits on values given for embedded commands are the same as the
limits available for command line options, detailed above.
.PP
The 'E', 'M', 'S', 'C' and 'O' commands are flags, and treat a value of
zero as clear, and any other value as set. So, for example, the sequence
.IP
%M0;%C0;
.PP
will turn off error messages, and then turn off the processing of
embedded commands.
.PP
If a parameter is set successfully, \fBcw\fP reports the new setting on
standard error (except if no error messages is set). If an error is
detected in an embedded command, \fBcw\fP reports an error. For the
formats of error messages see the \fIMESSAGE FORMATS\fP section below.
.PP
The current values of parameters within \fBcw\fP may be queried,
as well as set. The command format
.IP
%?\fIC\fP
.PP
queries the value of the parameter normally set with command \fIC\fP.
.B cw
reports the current value on standard error, using the same format
as when new values are set.
.PP
The current values of parameters within \fBcw\fP may also be requested
as output in Morse code. The command format
.IP
%>\fIC\fP
.PP
will generate Morse output reporting the value of the parameter
normally set with command \fIC\fP.
.PP
If embedded commands are disabled, '%' characters are treated as any
other (in this case, invalid) input character.
.PP
Once processing of embedded commands has been switched off, any
command to switch this feature back on will not be recognized. That
is, after '%C0;', an '%C1;' will not be recognized.
.PP
There is one additional command, and that is '%Q'. This command
closes all open files and terminates \fBcw\fP. Any characters after
this command in the input stream will be lost.
.PP
The file \fIcw.h\fP provides a full set of definitions for the
commands, special characters, and status codes of \fBcw\fP.
.PP
.\"
.\"
.\"
.SS MESSAGE FORMATS
.\"
Where a parameter value is set correctly with an embedded command, the
message format
.IP
\=\fICvalue\fP
.PP
is returned. \fIC\fP is the command used, and \fIvalue\fP is the
new value.
.PP
If an invalid value is supplied for a parameter in an embedded
command, a message
.IP
?\fICvalue\fP
.PP
is returned.
.PP
Where an invalid command is encountered, the message format
.IP
?%\fIC\fP
.PP
is used. For an invalid query, the message is
.IP
??\fIC\fP
.PP
and for an invalid request for a parameter in Morse code the message
is
.IP
?>\fIC\fP
.PP
A character in the input stream that cannot be sounded produces a
message
.IP
?\fIC\fP
.PP
These messages are not intended to be user-friendly, but are designed
to be easily and quickly interpreted by another program. Similarly,
the format of embedded commands is more computer-friendly than
user-friendly.
.PP
If error messages are disabled, no messages of any type are printed on
standard error.
.PP
.\"
.\"
.\"
.SS MORSE CODE COMBINATIONS
.\"
The standard set of characters offered by \fBcw\fP may not be sufficient
for some purposes. For example, some international characters do not have
equivalent ISO 8859-1 and ISO 8859-2 that \fBcw\fP can sound directly.
.PP
To help in sounding such characters, \fBcw\fP offers the ability to form
combination characters by placing individual character components
between [...] brackets. \fBCw\fP sounds characters inside a combination
without the usual gap between them. In this way, any missing character
in the set can be built.
.PP
For example
.IP
[VA]
.PP
is one way to form the VA procedural signal, though
.IP
[SK]
.PP
works just as well. The eight-dot error signal can be sounded with
.IP
[HSE]
.PP
or the C-cedilla in international Morse code with
.IP
[CE]
.PP
There can be as many valid letters, numbers, or figures inside the [...]
brackets as required. For example, an alternative way of sending the
error signal could be
.IP
[EEEEEEEE]
.PP
Finally, three alternative ways of sending 73 might be
.IP
[TTEEE][EEETT]
.br
[TDE][EUT]
.br
[GEE][VT]
.PP
Embedded commands may be placed inside [...] combinations if required.
Combinations do not nest.
.PP
This feature can be disabled by using the \fI\-O\fP
or \fI\-\-nocombinations\fP command line flags, or with the 'O' embedded
command. If combinations are disabled, '[' and ']' characters are treated
as any other (invalid) input character.
.PP
.\"
.\"
.\"
.SS NOTES ON USING A SOUND CARD
.\"
By default, \fBcw\fP tries to open OSS device "/dev/audio" to access
the system sound card. This is generally the correct device to use,
but for systems with special requirements, or those with multiple sound
cards, the option \fI-d\fP or \fI\-\-device\fP, combined with
\fI-s\fP or \fI\-\-system\fP can be used to specify the device
and audio system for sound card access. If the sound card device
cannot be set up, \fBcw\fP prints the error message
.IP
cannot set up soundcard sound
.PP
and exits.
.PP
Sound card devices, when opened through OSS sound system, are usually
single-access devices, so that when one process has opened the device,
other processes are prevented from using it. In such cases \fBcw\fP
will of course conflict with any other programs that expect exclusive
use of the system sound card (for example, MP3 players).
If \fBcw\fP finds that the sound card is already busy, it prints the
error message
.IP
open /dev/audio: Device or resource busy
.PP
and exits.
.PP
.\" The main sound card device will often allow \fBcw\fP to control tone
.\" volumes directly, but where this is not possible, \fBcw\fP uses the
.\" mixer device instead. By default, this is "/dev/mixer", but the device
.\" can be specified with the \fI-y\fP or \fI\-\-mdevice\fP options. In
.\" general, as with the main sound card device, the default mixer device
.\" is usually the correct one to use.
.\" .PP
.\" The mixer device is only used if the sound card does not allow volume
.\" control through the main sound card device.
.PP
The sound card device is not used if \fBcw\fP is only sending tones on
the console speaker.
.PP
.\"
.\"
.\"
.SS AUDIO OUTPUT \- DEFAULTS AND SELECTION
.\"
\fBcw\fP first tries to access sound card using OSS audio system
and default OSS audio device name ('/dev/audio'), unless user
specifies other audio device with option \fI-d\fP or \fI\-\-device\fP.
.PP
If opening soundcard through OSS fails, \fBcw\fP tries to access
the sound card using ALSA audio system, and default ALSA audio device
name ('default'), unless user specifies other audio device with option
\fI-d\fP or \fI\-\-device\fP.
.PP
If opening soundcard through ALSA also fails, \fBcw\fP tries to access
system console buzzer using default buzzer device '/dev/console',
unless user specifies other audio device with option \fI-d\fP or
\fI\-\-device\fP.
.PP
It is very common that in order to access the console buzzer device
user has to have root privileges. For that reason trying to open
console buzzer almost always fails. This is not a program's bug,
this is a result of operating system's restrictions.
Making \fBcw\fP an suid binary bypasses this restriction. The program
does not fork() or exec(), so making it suid should be relatively safe.
Note however that this practice is discouraged for security reasons.
.PP
As stated, user can tell \fBcw\fP which device to use, using
\fI-d\fP or \fI\-\-device\fP option. Which device files are suitable
will depend on which operating system is running, which system
user ID runs \fBcw\fP, and which user groups user belongs to.
.PP
.\"
.\"
.\"
.SH NOTES
.\"
Despite the fact that this manual page constantly and consistently
refers to Morse code elements as dots and dashes, DO NOT think in these
terms when trying to learn Morse code. Always think of them as 'dit's
and 'dah's.
.PP
The Morse code table in the \fBcw\fP(7,LOCAL) man page is provided for
reference only. If learning for the first time, you will be much better
off learning by hearing the characters sent, rather than by looking at
the table.
.PP
Other programs running in the system may interfere with the timing of
the Morse code that \fBcw\fP is sending. If this is a problem,
either try to run on a quiescent system, or try running \fBcw\fP
with nice(1L,C,1). UNIX is not really designed for user-level programs
to do the sort of fine timing required to send Morse code. \fBcw\fP
is therefore more sensitive than most programs to other system activity.
.PP
.B cw
uses system itimers for its internal timing. On most UNIX flavors,
itimers are not guaranteed to signal a program exactly at the specified
time, and they generally offer a resolution only as good as the normal
system 'clock tick' resolution. An itimer SIGALRM usually falls on a
system clock tick, making it accurate to no better than 10mS on a typical
100Hz kernel.
.PP
The effect of this is that an itimer period is generally either
exactly as specified, or, more likely, slightly longer. At higher
WPM settings, the cumulative effect of this affects timing accuracy,
because at higher speeds, there are fewer 10mS clock ticks in a dot
period. For example, at 12 WPM, the dot length is 100mS, enough to
contain five kernel clock ticks. But at 60 WPM, the dot length is 20mS,
or just two kernel clock ticks. So at higher speeds, the effect of itimer
resolutions becomes more pronounced.
.PP
To test itimer timing, first try
.IP
X="PARIS PARIS PARIS PARIS "
.IP
echo "$X" | time cw -w 4
.PP
and note the elapsed time, which should be very close to one minute.
Next, try
.IP
echo "$X$X$X$X$X$X$X$X$X$X$X$X" | time cw -w 48
.PP
The elapsed time should be the same. If it has increased, this is the
effect of system itimers delaying for slightly longer than the specified
period (higher WPM rates make more itimer calls). That's itimers for you,
not perfect for this job, but the best there is without writing some,
and perhaps a lot of, kernel code.
.PP
Except for zero, which is silent, tone values lower than 10Hz may not
sound at the expected pitch.
.PP
.\"
.\"
.\"
.SH EXAMPLES
.\"
Send a string of characters at 25 WPM, 700Hz, with no extra gaps:
.IP
echo "UNIX CW SOUNDER" | cw \-w 25 \-t 700
.PP
Send a string at varying speeds and tones on both the sound card and
the console speaker, specifying a system console device:
.IP
echo "%W12;%T400;400HZ 12WPM %W25;%T1500;1500HZ 25WPM" |
cw \-m \-sb \-d /dev/tty2
.PP
Send C-cedilla, VA, and a report of the WPM setting, with extra spacing
at half volume:
.IP
echo "[CE] [VA] %>W" | cw \-g 10 \-v 50
.PP
.\"
.\"
.\"
.SH ERRORS AND OMISSIONS
.\"
Cut numbers are not provided, though they can be emulated, up to a
point, by pre-filtering.
.PP
An output to an optional external device, for example, keying a line
on the parallel port, or a serial line, might also be useful.
.PP
.\"
.\"
.\"
.SH SEE ALSO
.\"
Man pages for \fBcw\fP(7,LOCAL), \fBlibcw\fP(3,LOCAL), \fBcwgen\fP(1,LOCAL),
\fBcwcp\fP(1,LOCAL), and \fBxcwcp\fP(1,LOCAL).
.\"
unixcw-3.0.2/src/cw/cw.h 0000644 0001750 0001750 00000004623 11702277207 014647 0 ustar acerion acerion /*
* Copyright (C) 2001-2006 Simon Baldwin (simon_baldwin@yahoo.com)
* Copyright (C) 2011-2012 Kamil Ignacak (acerion@wp.pl)
*
* 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.
*/
#ifndef _CW_H
#define _CW_H
#if defined(__cplusplus)
extern "C" {
#endif
/* General command and query introducers. */
enum
{ CW_CMD_ESCAPE = '%', /* Command escape character */
CW_CMD_QUERY = '?', /* Query subcommand */
CW_CMD_CWQUERY = '>', /* CW report query subcommand */
CW_CMD_END = ';' /* Completes an embedded command */
};
/* Specific command value specifiers. */
enum
{ CW_CMDV_FREQUENCY = 'T', /* CW tone */
CW_CMDV_VOLUME = 'V', /* CW volume */
CW_CMDV_SPEED = 'W', /* CW words-per-minute */
CW_CMDV_GAP = 'G', /* CW extra gaps in sending */
CW_CMDV_WEIGHTING = 'K', /* CW weighting */
CW_CMDV_ECHO = 'E', /* CW echo chars to stdout */
CW_CMDV_ERRORS = 'M', /* CW error msgs to stderr */
CW_CMDV_SOUND = 'S', /* CW creates tones. otherwise silent */
CW_CMDV_COMMANDS = 'C', /* CW responds to @... embedded cmds */
CW_CMDV_COMBINATIONS = 'O', /* CW allows [..] combinations */
CW_CMDV_COMMENTS = 'P', /* CW allows {..} combinations */
CW_CMDV_QUIT = 'Q' /* CW program exit command */
};
/* Combination and comment start and end characters. */
enum
{ CW_COMBINATION_START = '[', /* Begin [..] */
CW_COMBINATION_END = ']', /* End [..] */
CW_COMMENT_START = '{', /* Begin {..} */
CW_COMMENT_END = '}' /* End {..} */
};
/* Status values - first character of stderr messages. */
enum
{ CW_STATUS_OK = '=', /* =... command accepted */
CW_STATUS_ERR = '?' /* ?... error in command */
};
#if defined(__cplusplus)
}
#endif
#endif /* _CW_H */
unixcw-3.0.2/src/cw/test.cw 0000644 0001750 0001750 00000004725 11665754345 015415 0 ustar acerion acerion {
Copyright (C) 2001-2006 Simon Baldwin (simon_baldwin@yahoo.com)
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.
Acceptance tests for CW sender program
======================================
Test the limits of the CW sender program, and verify its response under
error input conditions.
}{
Initialize the test to 30 WPM, 800Hz, 70% volume, no gaps, 50% weighting
}%C1;%P1;%M1;%E1;%O1;%G0;%K50;%T800;%V70;%W30;{
Demonstrate character set and combinations
}= {CHARSET } ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"$()+-./:;=?_ ={
}= {MIXED CASE } The lazy dog jumps over the quick brown fox ={
}= {COMBINATIONS} [AR] [VA] [CT] ={
Test the limits of WPM, gap, weighting, Hz, and volume
}%W4;= 4 WPM
%W60;= 60 WPM
%W30;={
}%G0;= GAP 0
%G60;= GAP 60
%G0;={
}%K20;= WEIGHTING 20
%K40;= WEIGHTING 40
%K60;= WEIGHTING 60
%K80;= WEIGHTING 80
%K50;={
}%T0;= TONE 0
%T10;= TONE 10
%T100;= TONE 100
%T1000;= TONE 1000
%T2000;= TONE 2000
%T4000;= TONE 4000
%T800;={
}%V0;= VOL 0
%V20;= VOL 20
%V40;= VOL 40
%V60;= VOL 60
%V80;= VOL 80
%V100;= VOL 100
%V70;={
Switch flags on and off
}%E0;= ECHO OFF
%?E%E1;= ECHO ON
%?E%E1;={
}%M0;= MESSAGES OFF
%?M%M1;= MESSAGES ON
%?M%M1;={
}%O0;= {COMBINATIONS OFF} [AR] [VA] [CT]
%?O%O1;= {COMBINATIONS ON} [AR] [VA] [CT]
%?O%O1;={
}%P0;= {COMMENTS OFF, SOUNDED}
%?P%P1;= {COMMENTS ON, NOT SOUNDED}
%?P%P1;={
Test the queries
}= {QUERIES } %?W%?T%?V%?G%?K%?C%?E%?M%?O%?P ={
}= {CW QUERIES} %>W%>T%>V%>G%>K%>C%>E%>M%>O%>P ={
Tests for errors on input
}= {BAD CHARACTERS } | \ # ={
}= {BAD COMMANDS } %J %B %% %# %; %| ={
}= {BAD COMMAND ARGS} %W61;%W0;%W-10;%T-1;%T4001;%T-100;%V-1;%V101 ={
}= {BAD COMMAND ARGS} %G-1;%G61;%K19;%K81; ={
}= {BAD QUERIES } %?J %?B %?% %?; %?| ={
}= {BAD CW QUERIES } %>J %>B %>% %>; %>| ={
Check that we can quit
}= QUIT %Q THIS TEXT SHOULD NOT APPEAR
unixcw-3.0.2/src/xcwcp/ 0000755 0001750 0001750 00000000000 11702312014 014555 5 ustar acerion acerion unixcw-3.0.2/src/xcwcp/Makefile 0000644 0001750 0001750 00000005662 11702300342 016227 0 ustar acerion acerion # Copyright (C) 2001-2006 Simon Baldwin (simon_baldwin@yahoo.com)
# Copyright (C) 2011-2012 Kamil Ignacak (acerion@wp.pl)
#
# 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.
#
include ../../Makefile.inc
CXX = $(AC_CXX)
CXXFLAGS= $(AC_CXXFLAGS) $(AC_DEFS) -I../libcw -I../cwutils -I$(AC_QT4INC) -I$(AC_QT4INC)/QtCore -I$(AC_QT4INC)/QtGui
GZIP = $(AC_GZIP)
SHELL = /bin/sh
# List of object files built in this directory.
OBJECTS = main.o modeset.o display.o sender.o receiver.o application.o \
moc_application.o
# Link to the shared libcw.
LIBS = -L../libcw -lcw -lQtGui -lQtCore
default: all
# Build the xcwcp binary.
all: xcwcp
xcwcp: $(OBJECTS)
$(CXX) $(LDFLAGS) -o xcwcp $(OBJECTS) ../cwutils/i18n.o ../cwutils/cw_common.o \
../cwutils/cmdline.o ../cwutils/dictionary.o ../cwutils/memory.o \
$(LIBS) -lm
main.o: main.cc application.h
modeset.o: modeset.cc modeset.h
display.o: display.cc display.h application.h
sender.o: sender.cc sender.h display.h modeset.h
receiver.o: receiver.cc receiver.h display.h modeset.h
application.o: application.cc sender.h receiver.h application.h \
modeset.h display.h
mod_application.o: moc_application.cc
moc_application.cc: application.h
$(AC_QT4MOC) $< -o $@
# Install targets.
install: all
$(INSTALL) -d $(bindir) $(mandir)/man1
$(INSTALL_PROGRAM) -m 4755 xcwcp $(bindir)/xcwcp
$(INSTALL_DATA) xcwcp.1 $(mandir)/man1/xcwcp.1
$(GZIP) -f -9 $(mandir)/man1/xcwcp.1
install-strip:
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install
uninstall:
rm -f $(bindir)/xcwcp
rm -f $(mandir)/man1/xcwcp.1 $(mandir)/man1/xcwcp.1.gz
# Cleanup targets.
clean:
rm -f xcwcp *.s *.o
rm -f moc_*.cc
rm -f core core.*
distclean: clean
rm -f Makefile.port
mostlyclean: clean
maintainer-clean: distclean
# Test targets.
# This test target will be invoked when creating deb package.
check:
# This test target can be invoked manually.
real_check: all
( echo "Trying with OSS audio output"; \
LD_LIBRARY_PATH=../libcw:$$LD_LIBRARY_PATH ./xcwcp -so ) || \
( echo "Retrying with ALSA audio output"; \
LD_LIBRARY_PATH=../libcw:$$LD_LIBRARY_PATH ./xcwcp -sa ) || \
( echo "Retrying the test in silent mode"; \
LIBCW_DEBUG=1 \
LD_LIBRARY_PATH=../libcw:$$LD_LIBRARY_PATH ./xcwcp -sc )
# Unimplemented targets.
TAGS:
info:
dvi:
dist:
unixcw-3.0.2/src/xcwcp/receiver.h 0000644 0001750 0001750 00000005771 11702300257 016552 0 ustar acerion acerion // Copyright (C) 2001-2006 Simon Baldwin (simon_baldwin@yahoo.com)
// Copyright (C) 2011-2012 Kamil Ignacak (acerion@wp.pl)
//
// 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.
//
#ifndef _XCWCP_RECEIVER_H
#define _XCWCP_RECEIVER_H
#include
#include
//-----------------------------------------------------------------------
// Class Receiver
//-----------------------------------------------------------------------
// Encapsulates the main application receiver data and functions. Receiver
// abstracts states associated with receiving, event handling, libcw keyer
// event handling, and data passed between signal handler and foreground
// contexts.
namespace cw {
class Display;
class Mode;
class Receiver
{
public:
Receiver (Display *display)
: display_ (display),
is_pending_space_ (false), libcw_receive_errno_ (0),
tracked_key_state_ (false) { }
// Poll timeout handler, and keypress and mouse event handlers.
void poll (const Mode *current_mode);
void handle_key_event (QKeyEvent *event, const Mode *current_mode,
bool is_reverse_paddles);
void handle_mouse_event (QMouseEvent *event, const Mode *current_mode,
bool is_reverse_paddles);
// CW library keying event handler.
void handle_libcw_keying_event (int key_state);
// Clear out queued data on stop, mode change, etc.
void clear ();
private:
// Display used for output.
Display *display_;
// Flag indicating if receive polling has received a character, and may need
// to augment it with a word space on a later poll, and possible receive
// errno detected in signal handler context and needing to be passed to
// the foreground.
volatile bool is_pending_space_;
volatile int libcw_receive_errno_;
// Safety flag to ensure that we keep the library in sync with keyer events.
// Without, there's a chance that of a on-off event, one half will go to one
// application instance, and the other to another instance.
volatile int tracked_key_state_;
// Poll primitives to handle receive errors, characters, and spaces.
void poll_report_receive_error ();
void poll_receive_character ();
void poll_receive_space ();
// Prevent unwanted operations.
Receiver (const Receiver &);
Receiver &operator= (const Receiver &);
};
} // cw namespace
#endif // _XCWCP_RECEIVER_H
unixcw-3.0.2/src/xcwcp/icons/ 0000755 0001750 0001750 00000000000 11663011620 015675 5 ustar acerion acerion unixcw-3.0.2/src/xcwcp/icons/icon_stop.xpm 0000644 0001750 0001750 00000001377 11662171134 020436 0 ustar acerion acerion /* XPM */
static const char * icon_stop_xpm[] = {
/* width height ncolors chars_per_pixel */
"16 16 21 1",
/* colors */
" c None",
". c #63A2C0",
"X c #6EABC7",
"o c #5998B9",
"O c #3F7FA6",
"+ c #4F8EB2",
"@ c #034367",
"# c #64A4BF",
"$ c #5A9AB8",
"% c #AEDDE9",
"& c #3B7DA3",
"* c #94CCDC",
"= c #7CB9CE",
"- c #79B5CE",
"; c #87C0D5",
": c #024266",
"> c #4F90B1",
", c #6FAEC6",
"< c #4586AA",
"1 c #30739C",
"2 c #000000",
/* pixels */
" ",
" ",
" ",
" ::: ::: ",
" :%%%: :%%%: ",
" :*==: :*==: ",
" :;,,: :;,,: ",
" :-##: :-##: ",
" :X$$: :X$$: ",
" :.>>: :.>>: ",
" :o<<: :o<<: ",
" :+&&: :+&&: ",
" :O11: :O11: ",
" @:: @:: ",
" ",
" "
};
unixcw-3.0.2/src/xcwcp/icons/icon_mini_xcwcp.xpm 0000644 0001750 0001750 00000002377 11662543404 021615 0 ustar acerion acerion /* XPM */
static const char * icon_mini_xcwcp_xpm[] = {
"32 32 4 1",
" c None",
". c #FE0000",
"+ c #FF0000",
"@ c #000000",
" ",
" ",
" ",
" ",
" ..++.. +..+++ ",
" +.++++ .++..+ ",
" .+++.+ ..+.+. ",
" .+...+ .....+ ",
" ..++++ .+++.+ ",
" .+++.+ ..++.+ ",
" ",
" ",
" @@@@@@ @@@@@@ ",
" @@@@@@ @@@@@@ ",
" @@@@@@ @@@@@@ ",
" @@@@@@ @@@@@@ ",
" @@@@@@ @@@@@@ ",
" @@@@@@ @@@@@@ ",
" @@@@@@ @@@@@@ ",
" @@@@@@ @@@@@@ ",
" @@@@@@@ @@@@@@@ ",
" @@@@@@@@ @@@@@@@@ ",
" @@@@@@@@@@@@@@@@@@@@ ",
" @@@@@@@@@@@@@@@@@@ ",
" @@@@@@@@@@@@@@@@ ",
" @@@@@@@@@@@@@@ ",
" @@@@@@@@@@@@ ",
" @@@@@@@@ ",
" ",
" ",
" ",
" "};
unixcw-3.0.2/src/xcwcp/icons/icon_start.xpm 0000644 0001750 0001750 00000001532 11662174024 020600 0 ustar acerion acerion /* XPM */
static const char * icon_start_xpm[] = {
/* width height ncolors chars_per_pixel */
"16 16 27 1",
/* colors */
" c None",
". c #266995",
"X c #34769F",
"o c #6FAEC7",
"O c #83C1D4",
"+ c #5999B8",
"@ c #79B7CD",
"# c #64A4BF",
"$ c #6AA5BE",
"% c #A1D2E0",
"& c #5A9AB8",
"* c #1B5F8E",
"= c #AEDDE9",
"- c #3B7DA3",
"; c #4C8CAD",
": c #8ECADC",
"> c #7DB4C8",
", c #024266",
"< c #6EADC6",
"1 c #4181A7",
"2 c #4F90B1",
"3 c #A9D9E5",
"4 c #93C6D6",
"5 c #5A97B5",
"6 c #4586AA",
"7 c #30739C",
"8 c #000000",
/* pixels */
" ",
" ,, ",
" ,==, ",
" ,=:=, ",
" ,3OO=, ",
" ,%@@@=, ",
" ,4o<<<=, ",
" ,>#####=, ",
" ,$+&&&&&, ",
" ,5222222, ",
" ,;66666, ",
" ,1----, ",
" ,X777, ",
" ,..., ",
" ,**, ",
" ,, "
};
unixcw-3.0.2/src/xcwcp/display.cc 0000644 0001750 0001750 00000015340 11702300314 016534 0 ustar acerion acerion // Copyright (C) 2001-2006 Simon Baldwin (simon_baldwin@yahoo.com)
// Copyright (C) 2011-2012 Kamil Ignacak (acerion@wp.pl)
//
// 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.
//
#include "../config.h"
#include
#include
#include
#include
#include
#include
#include
#include "display.h"
#include "application.h"
#include "i18n.h"
namespace cw {
const QString DISPLAY_WHATSTHIS =
_("This is the main display for Xcwcp. The random CW characters that "
"Xcwcp generates, any keyboard input you type, and the CW that you "
"key into Xcwcp all appear here.
"
"You can clear the display contents from the File menu.
"
"The status bar shows the current character being sent, any character "
"received, and other general error and Xcwcp status information.");
//-----------------------------------------------------------------------
// Class DisplayImpl
//-----------------------------------------------------------------------
// DisplayImpl class, extends QTextEdit. This class is used as the
// implementation of the simple text display. It overrides QTextEdit in
// order to gain finer control over the way text is displayed, and is local
// to this module.
class DisplayImpl : public QTextEdit {
public:
DisplayImpl (Application *application, QWidget *parent);
protected:
// Functions overridden to catch events from the parent class.
void keyPressEvent (QKeyEvent *event);
void keyReleaseEvent (QKeyEvent *event);
void mousePressEvent(QMouseEvent *event);
void mouseDoubleClickEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
// Are these necessary after adding fontPointSize() in constructor?
virtual QMenu *createPopupMenu (const QPoint &);
virtual QMenu *createPopupMenu ();
private:
// Application to forward key and mouse events to.
Application *application_;
// Prevent unwanted operations.
DisplayImpl (const DisplayImpl &);
DisplayImpl &operator= (const DisplayImpl &);
};
// DisplayImpl()
//
// Call the superclass constructor, and save the application for sending on
// key and mouse events.
DisplayImpl::DisplayImpl (Application *application, QWidget *parent)
: QTextEdit (parent), application_ (application)
{
// Block context menu in text area, this is to make right mouse
// button work as correct sending key (paddle).
// http://doc.qt.nokia.com/latest/qt.html#ContextMenuPolicy-enum
// Qt::PreventContextMenu:
// "the widget does not feature a context menu, [...] the handling
// is not deferred to the widget's parent. This means that all right
// mouse button events are guaranteed to be delivered to the widget
// itself through mousePressEvent(), and mouseReleaseEvent()."
setContextMenuPolicy(Qt::PreventContextMenu);
// Clear widget.
setPlainText("");
// These two lines just repeat the default settings.
// I'm putting them here just for fun.
setLineWrapMode(QTextEdit::WidgetWidth); // Words will be wrapped at the right edge of the text edit. Wrapping occurs at whitespace, keeping whole words intact.
setWordWrapMode(QTextOption::WordWrap); // Text is wrapped at word boundaries.
// This can be changed by user in menu Settings -> Text font
setFontWeight(QFont::Bold);
}
// keyPressEvent()
// keyReleaseEvent()
//
// Catch key events and pass them to our parent Application. Both press
// and release events are merged into one *_event() call.
void
DisplayImpl::keyPressEvent (QKeyEvent *event)
{
application_->key_event (event);
}
void
DisplayImpl::keyReleaseEvent (QKeyEvent *event)
{
application_->key_event (event);
}
// mousePressEvent()
// mouseDoubleClickEvent()
// mouseReleaseEvent()
//
// Do the same for mouse button events. We need to catch both press and
// double-click, since for keying we don't use or care about double-clicks,
// just any form of button press, any time.
void DisplayImpl::mousePressEvent(QMouseEvent *event)
{
application_->mouse_event(event);
}
void
DisplayImpl::mouseDoubleClickEvent(QMouseEvent *event)
{
application_->mouse_event(event);
}
void
DisplayImpl::mouseReleaseEvent(QMouseEvent *event)
{
application_->mouse_event (event);
}
// createPopupMenu()
//
// Override and suppress popup menus, so we can use the right mouse button
// as a keyer paddle.
QMenu *
DisplayImpl::createPopupMenu (const QPoint &)
{
return NULL;
}
QMenu *
DisplayImpl::createPopupMenu ()
{
return NULL;
}
//-----------------------------------------------------------------------
// Class Display
//-----------------------------------------------------------------------
// Display()
//
// Create a display implementation, passing the application to be informed
// when the display widget receives key or mouse events.
Display::Display(Application *application, QWidget *parent)
: application_(application), implementation_(new DisplayImpl(application, parent))
{
QWidget *display_widget = get_widget();
display_widget->setFocus();
display_widget->setWhatsThis(DISPLAY_WHATSTHIS);
application_->setCentralWidget(display_widget);
show_status(_("Ready"));
}
// get_widget()
//
// Return the underlying QWidget used to implement the display. Returning
// the widget only states that this is a QWidget, it doesn't tie us to using
// any particular type of widget.
QWidget *
Display::get_widget () const
{
return implementation_;
}
// append()
//
// Append a character at the current notional cursor position.
void
Display::append (char c)
{
implementation_->insertPlainText (QString (QChar (c)));
}
// backspace()
//
// Delete the character left of the notional cursor position (that is, the
// last one appended).
void
Display::backspace ()
{
// implementation_->doKeyboardAction (QTextEdit::ActionBackspace);
}
// clear()
//
// Clear the display area.
void
Display::clear ()
{
implementation_->clear ();
}
// show_status()
//
// Display the given string on the status line.
void
Display::show_status (const QString &status)
{
application_->statusBar ()->showMessage(status);
}
// clear_status()
//
// Clear the status line.
void
Display::clear_status ()
{
application_->statusBar ()->clearMessage();
}
} // cw namespace
unixcw-3.0.2/src/xcwcp/modeset.h 0000644 0001750 0001750 00000011413 11702300271 016370 0 ustar acerion acerion // Copyright (C) 2001-2006 Simon Baldwin (simon_baldwin@yahoo.com)
// Copyright (C) 2011-2012 Kamil Ignacak (acerion@wp.pl)
//
// 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.
//
#ifndef _CWMODESET_H
#define _CWMODESET_H
#include
#include
// Forward declaration of opaque dictionary.
typedef struct dictionary_s dictionary;
//-----------------------------------------------------------------------
// Class Mode
//-----------------------------------------------------------------------
namespace cw {
// Describes a given operating mode. All modes have a description, and
// dictionary modes add a way to generate random groups of words from the
// dictionary.
class DictionaryMode;
class KeyboardMode;
class ReceiveMode;
class Mode {
public:
Mode (const std::string &description)
: description_ (description) { }
virtual ~Mode () { }
std::string get_description () const;
bool is_same_type_as (const Mode *other) const;
virtual const DictionaryMode *is_dictionary () const;
virtual const KeyboardMode *is_keyboard () const;
virtual const ReceiveMode *is_receive () const;
private:
const std::string description_; // Mode description
// Prevent unwanted operations.
Mode (const Mode &);
Mode &operator= (const Mode &);
};
class DictionaryMode : public Mode {
public:
DictionaryMode (const std::string &description, const dictionary *dict)
: Mode (description), dictionary_ (dict) { }
std::string get_random_word_group () const;
virtual const DictionaryMode *is_dictionary () const;
private:
const dictionary *dictionary_; // Mode dictionary
// Prevent unwanted operations.
DictionaryMode (const DictionaryMode &);
DictionaryMode &operator= (const DictionaryMode &);
};
class KeyboardMode : public Mode {
public:
KeyboardMode (const std::string &description)
: Mode (description) { }
virtual const KeyboardMode *is_keyboard () const;
private:
// Prevent unwanted operations.
KeyboardMode (const KeyboardMode &);
KeyboardMode &operator= (const KeyboardMode &);
};
class ReceiveMode : public Mode {
public:
ReceiveMode (const std::string &description)
: Mode (description) { }
virtual const ReceiveMode *is_receive () const;
private:
// Prevent unwanted operations.
ReceiveMode (const ReceiveMode &);
ReceiveMode &operator= (const ReceiveMode &);
};
// Class inline functions.
inline std::string
Mode::get_description () const
{
return description_;
}
inline const DictionaryMode *
Mode::is_dictionary () const
{
return 0;
}
inline const KeyboardMode *
Mode::is_keyboard () const
{
return 0;
}
inline const ReceiveMode *
Mode::is_receive () const
{
return 0;
}
inline const DictionaryMode *
DictionaryMode::is_dictionary () const
{
return this;
}
inline const KeyboardMode *
KeyboardMode::is_keyboard () const
{
return this;
}
inline const ReceiveMode *
ReceiveMode::is_receive () const
{
return this;
}
} // cw namespace
//-----------------------------------------------------------------------
// Class ModeSet
//-----------------------------------------------------------------------
namespace cw {
// Aggregates Modes, created from dictionaries and locally, and provides a
// concept of a current mode and convenient access to modes based on the
// current mode setting.
class ModeSet {
public:
ModeSet ();
void set_current (int index);
const Mode *get_current () const;
int get_count () const;
const Mode *get (int index) const;
const DictionaryMode *is_dictionary () const;
const KeyboardMode *is_keyboard () const;
const ReceiveMode *is_receive () const;
private:
const std::vector *const modes_;
const Mode *current_;
// Prevent unwanted operations.
ModeSet (const ModeSet &);
ModeSet &operator= (const ModeSet &);
};
// Class inline functions.
inline void
ModeSet::set_current (int index)
{
current_ = modes_->at (index);
}
inline const Mode *
ModeSet::get_current () const
{
return current_;
}
inline int
ModeSet::get_count () const
{
return modes_->size ();
}
inline const Mode *
ModeSet::get (int index) const
{
return modes_->at (index);
}
} // cw namespace
#endif // _CWMODESET_H
unixcw-3.0.2/src/xcwcp/xcwcp.1 0000644 0001750 0001750 00000040060 11702300236 015766 0 ustar acerion acerion .\"
.\" UnixCW CW Tutor Package - xcwcp
.\" Copyright (C) 2001-2006 Simon Baldwin (simon_baldwin@yahoo.com)
.\" Copyright (C) 2011-2012 Kamil Ignacak (acerion@wp.pl)
.\"
.\" 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.
.\"
.\"
.TH XCWCP 1 "CW Tutor Package" "xcwcp ver. 3.0.1" \" -*- nroff -*-
.SH NAME
.\"
xcwcp \- X Window-based Morse tutor program
.\"
.\"
.\"
.SH SYNOPSIS
.\"
.B xcwcp
[\-s\ \-\-system=\fISYSTEM\fP]
[\-d\ \-\-device=\fIDEVICE\fP]
[\-w\ \-\-wpm=\fIWPM\fP]
[\-t\ \-\-tone=\fIHZ\fP]
[\-v\ \-\-volume=\fIPERCENT\fP]
[\-g\ \-\-gap=\fIGAP\fP]
[\-f, \-\-infile=\fIFILE\fP]
[\-F, \-\-outifile=\fIFILE\fP]
.BR
[\-h\ \-\-help]
[\-V\ \-\-version]
.PP
\fBxcwcp\fP installed on GNU/Linux systems understands both short form
and long form command line options. \fBxcwcp\fP installed on other
operating systems may understand only the short form options.
.PP
There are no mandatory options.
.PP
Options may be predefined in the environment variable \fBXCWCP_OPTIONS\fP.
If defined, these options are used first; command line options take
precedence.
.PP
.\"
.\"
.\"
.SH DESCRIPTION
.\"
.PP
.B xcwcp
is a X Window-based interactive Morse code tutor program. It lets you
choose from a number of options for practice, including sending random
characters, random words, and characters from the keyboard. It will
also receive Morse code that you send using the keyboard or mouse as
a Morse keyer, and display the characters it sees.
.PP
.\"
.\"
.\"
.SS COMMAND LINE OPTIONS
.\"
.B xcwcp
understands the following command line options. The long form options
may not be available in non-LINUX versions.
.TP
.I "\-s, \-\-system=SYSTEM"
Specifies the way that \fBxcwcp\fP generates tones. Valid values
are:
\fIconsole\fP for tones through the console speaker,
\fIalsa\fP for tones generated through the system sound card using ALSA
sound system,
\fIoss\fP for tones generated through system sound card using OSS sound
system,
\fIsoundcard\fP for tones generated through the system sound card, but
without explicit selection of sound system. These values can be
shortened to 'c', 'a', 'o', or 's', respectively. The default value
is 'oss'.
.TP
.I "\-d, \-\-device=DEVICE"
Specifies the device file to open for generating a sound.
\fBxcwcp\fP will use default device if none is specified. The default
devices are:
\fI/dev/console\fP for sound produced through console,
\fIdefault\fP for ALSA sound system,
\fI/dev/audio\fP for OSS sound system.
See also \fINOTES ON USING A SOUND CARD\fP below.
.TP
.I "\-w, \-\-wpm=WPM"
Sets the initial sending speed in words per minute. The value must be
between 4 and 60. The default value is 12 WPM.
.TP
.I "\-t, \-\-tone=HZ"
Sets the initial sounder pitch in Hz. This value must be between 0
and 4,000. A value of 0 selects silent operation, and can be used for
timing checks or other testing. The default value is 800Hz,
.TP
.I "\-v, \-\-volume=PERCENT"
Sets the initial sending volume, as a percentage of full scale volume.
The value must be between 0 and 100. The default value is 70 %.
Sound volumes work fully for sound card tones, but \fBxcwcp\fP cannot
control the volume of tones from the console speaker. In this case,
a volume of zero is silent, and all other volume values are simply sounded.
.TP
.I "\-g, \-\-gap=GAP"
Sets the initial extra gap, in dot lengths, between characters
(the 'Farnsworth' delay). It must be between 0 and 60. The default
is 0.
.TP
.I "\-f, \-\-infile=FILE"
Specifies a text file that \fBxcwcp\fP can read to configure its practice
text. See \fICREATING CONFIGURATION FILES\fP below.
.TP
.I "\-F, \-\-outfile=FILE"
Specifies a text file to which \fBxcwcp\fP should write its current practice
text.
.PP
.\"
.\"
.\"
.SS USER INTERFACE
.\"
.B xcwcp
offers GUI controls for changing the speed, tone frequency, 'Farnsworth'
gap, and mode of the program. All of the major controls are placed on
the application toolbar.
.PP
The main GUI window is used to display the characters that \fBxcwcp\fP
sends or receives.
.PP
To find out more about what a particular GUI control does, use the "What's
this..." icon (the '?' at the far right of the toolbar).
.PP
.\"
.\"
.\"
.SS RANDOM CHARACTERS AND WORDS
.\"
.B xcwcp
sends random characters in groups of five, with a space between each
group.
.PP
When sending random words, \fBxcwcp\fP sends the complete word, followed
by a space. Because short words are easier to copy without writing,
\fBxcwcp\fP's default dictionary contains only three, four, and five-letter
words in its random words list.
.PP
.B xcwcp
chooses at random from a list of around 3000 words in its default
dictionary. You can change this text using a configuration file, read
at startup. See \fICREATING CONFIGURATION FILES\fP below.
.PP
.\"
.\"
.\"
.SS RECEIVING MORSE
.\"
.B xcwcp
can receive Morse code, and display it in its main GUI window. To key
Morse code into the program, select the Receive Keyed CW mode, and press
the stop/start button. Now, place the mouse cursor over the central
window of the program. By pressing the middle mouse button, you should
be able to key Morse into the program as if the mouse button was a straight
Morse key.
.PP
For better keying, you can use the left and right mouse buttons as if they
were paddles on an Iambic keyer. This will send Morse code at the exact
rate set on the Speed control.
.PP
You can also use the keyboard for keying. In this case, any of the Up or
Down cursor keys, Space, Enter, or Return may be used as the straight key,
and the Left and Right cursor keys act as the two paddles of an Iambic keyer.
.PP
By default, \fBxcwcp\fP will try to follow the speed of the Morse code that
you send to it. It is possible to switch this tracking off, in which case
the program switches to receiving only at the exact speed set on the Speed
control. However, fixed speed receiving is very, very picky about receiving
only extremely accurately timed Morse code, so unless you are striving for
complete perfection, you may find that speed tracking is more comfortable.
.PP
The speed tracking in \fBxcwcp\fP can sometime be confused by very wide
and abrupt changes in speed. If it is having difficulty finding the speed
you are sending at, you can use the File pulldown menu to synchronize the
receive speed to the speed set on the Speed control.
.PP
At any time, the mode selection combowidget can get focus by using Alt+M.
You can then use the space bar or the up/down keys to change the mode.
The Tab key moves to the next widget, so you can change speed, etc.
Shift+Tab moves backwards.
.PP
.\"
.\"
.\"
.SS NOTES ON USING A SOUND CARD
.\"
By default, \fBxcwcp\fP tries to open OSS device "/dev/audio" to access
the system sound card. This is generally the correct device to use,
but for systems with special requirements, or those with multiple sound
cards, the option \fI-d\fP or \fI\-\-device\fP, combined with
\fI-s\fP or \fI\-\-system\fP can be used to specify the device
and audio system for sound card access. If the sound card device
cannot be set up, \fBxcwcp\fP prints the error message
.IP
cannot set up soundcard sound
.PP
and exits.
.PP
Sound card devices, when opened through OSS sound system, are usually
single-access devices, so that when one process has opened the device,
other processes are prevented from using it. In such cases \fBxcwcp\fP
will of course conflict with any other programs that expect exclusive
use of the system sound card (for example, MP3 players).
If \fBxcwcp\fP finds that the sound card is already busy, it prints the
error message
.IP
open /dev/audio: Device or resource busy
.PP
and exits.
.PP
.\" The main sound card device will often allow \fBxcwcp\fP to control tone
.\" volumes directly, but where this is not possible, \fBxcwcp\fP uses the
.\" mixer device instead. By default, this is "/dev/mixer", but the device
.\" can be specified with the \fI-y\fP or \fI\-\-mdevice\fP options. In
.\" general, as with the main sound card device, the default mixer device
.\" is usually the correct one to use.
.\" .PP
.\" The mixer device is only used if the sound card does not allow volume
.\" control through the main sound card device.
.PP
The sound card device is not used if \fBxcwcp\fP is only sending tones on
the console speaker.
.PP
.\"
.\"
.\"
.SS AUDIO OUTPUT \- DEFAULTS AND SELECTION
.\"
\fBxcwcp\fP first tries to access sound card using OSS audio system
and default OSS audio device name ('/dev/audio'), unless user
specifies other audio device with option \fI-d\fP or \fI\-\-device\fP.
.PP
If opening soundcard through OSS fails, \fBxcwcp\fP tries to access
the sound card using ALSA audio system, and default ALSA audio device
name ('default'), unless user specifies other audio device with option
\fI-d\fP or \fI\-\-device\fP.
.PP
If opening soundcard through ALSA also fails, \fBxcwcp\fP tries to access
system console buzzer using default buzzer device '/dev/console',
unless user specifies other audio device with option \fI-d\fP or
\fI\-\-device\fP.
.PP
It is very common that in order to access the console buzzer device
user has to have root privileges. For that reason trying to open
console buzzer almost always fails. This is not a program's bug,
this is a result of operating system's restrictions.
Making \fBxcwcp\fP an suid binary bypasses this restriction. The program
does not fork() or exec(), so making it suid should be relatively safe.
Note however that this practice is discouraged for security reasons.
.PP
As stated, user can tell \fBxcwcp\fP which device to use, using
\fI-d\fP or \fI\-\-device\fP option. Which device files are suitable
will depend on which operating system is running, which system
user ID runs \fBxcwcp\fP, and which user groups user belongs to.
.PP
.\"
.\"
.\"
.SS CREATING CONFIGURATION FILES
.\"
.B xcwcp
contains a default set of modes and practice text that should be enough to
begin with. It can however read in a file at startup that reconfigures
these to provide different character groupings, word sets, and other
practice data.
.PP
To read a configuration file, use the \fI-i\fP or \fI\-\-infile\fP command
line option. The file should introduce each \fBxcwcp\fP mode with a
section header in '[' ... ']' characters, followed by the practice text
for that mode, with elements separated by whitespace. Lines starting with
a semicolon or hash are treated as comments. For example
.IP
; Simple example mode
.br
[ A to Z ]
.br
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
.PP
.B xcwcp
will generate five character groups for modes whose elements are all single
characters, and treat other modes as having elements that are complete words.
As a starting point for customized modes, \fBxcwcp\fP will write its default
configuration to a file if given the undocumented \fI-#\fP option, for
example "xcwcp -# /tmp/xcwcp.ini".
.\"
.\"
.\"
.SH NOTES
.\"
.B xcwcp
is an X Window rewrite of \fBcwcp\fP. Both programs borrow heavily
from the the DOS Morse code tutor CP222C.EXE, by VU2ZAP.
.PP
The characters echoed in the main GUI window may be ASCII equivalents
of Morse procedural signals; see the \fBcw\fP(7,LOCAL) man page for
details.
.\"
.\"
.\"
.SS HINTS ON LEARNING MORSE CODE
.\"
Here are a few hints and tips that may help with the process of
learning Morse code.
.PP
Firstly, do \fBNOT\fP think of the elements as dots and dashes. Instead,
think of them as dits and dahs (so 'A' is di-dah). If you think of
them in this way, the process of translating sound into characters
will be learned much more easily.
.PP
Do not learn the characters from a table. Learn them by watching the
groups appear on the screen, and listening to the sounds produced as
each is sent. In the very initial stages, it may be beneficial if you
can find a person to take you through the first stages of recognising
characters.
.PP
Do not waste your time learning Morse code at 5 WPM. Set the speed to
12 or 15 WPM, but use extra spacing (the Gap window) to reduce the
effective speed to much lower - around four or five WPM \fIeffective\fP
speed. This way, you will learn the rhythm of the characters as they
are sent, but still have plenty of time between characters. As you
practice, decrease the gap to zero.
.PP
Learn in stages. Start by learning the \fIEISH5\fP group, then progress
down through the menu as each group is mastered. The groups contain
characters which are in some way related, either by sound, or by type
of character.
.PP
Once you have completed all the groups \fIEISH5\fP to \fI,?.;)/\fP
(or \fI23789\fP if you do not want to learn procedural signals yet),
use the full character set options, and the words and CW words
options, to sharpen your skill. If you have difficulties with
particular characters, return to that group and practice again with a
smaller character set.
.PP
Resist the temptation to try to learn or improve your speed by copying
off-air. You will not know what speed you are working at, and much
hand-sent Morse is not perfectly formed. What you can gain off-air
though is a general 'resilience', a tolerance for Morse code where
the timing of individual elements, or spacing between characters and
words, is not 100% accurate.
.PP
If working to attain a particular speed for a test, always set the
speed slightly higher. For example, if aiming for 12 WPM, set the
tutor speed to 14 or 15 WPM. This way, when you drop back to 12 WPM
you will feel much more relaxed about copying. Be aware that \fBxcwcp\fP
is not necessarily going to send at exactly the speed you set, due
to limitations in what can be done with UNIX timers. It often sends
at a slower speed than you set, so be very careful with this if you
have a target speed that you need to reach.
.PP
Use the program to make cassette tapes that you can take with you in a
walkman or in the car, for long journeys. You do not have to write
down everything you hear to practice Morse code. Simply listening to
the shapes of characters over a period will help to train your brain
into effortless recognition. In fact, slavishly writing everything
down becomes a barrier at speeds of 15-20 WPM and above, so if you can
begin to copy without writing each character down, you will find
progress much easier above these speeds. But do not over-use these
tapes, otherwise you will quickly memorise them. Re-record them with
new contents at very regular intervals.
.PP
Try to spend at least 15-30 minutes each day practicing. Much less
than this will make progress glacially slow. But significantly more
than an hour or so may just result in you becoming tired, but not
improving. Recognise when it is time to stop for the day.
.PP
Do not worry if you reach a speed 'plateau'. This is common, and you
will soon pass it with a little perseverance.
.PP
At higher speeds, CW operators tend to recognise the 'shape' of whole
words, rather than the individual characters within the words. The CW
words menu option can be used to help to practice and develop this
skill.
.PP
Neither the mouse buttons nor the keyboard are ideal for use a keys
or keyer paddles, for sending practice. Try to use a proper key for
sending where possible. It is hard even for experienced operators to
get good keying using the mouse or keyboard. Of the two, the mouse is
probably the better option, though, in a pinch.
.PP
.\"
.\"
.\"
.SH ERRORS AND OMISSIONS
.\"
The calibration option is a bit ropy. It simply sends PARIS
repeatedly, and relies on you to time the sending and then work out if
any adjustment to the speed is really necessary. Automatic
calibration by making measurements over a given period would be a lot
better.
.PP
.\"
.\"
.\"
.SH SEE ALSO
.\"
Man pages for \fBcw\fP(7,LOCAL), \fBlibcw\fP(3,LOCAL), \fBcw\fP(1,LOCAL),
\fBcwgen\fP(1,LOCAL), and \fBxcwcp\fP(1,LOCAL).
.\"
unixcw-3.0.2/src/xcwcp/sender.cc 0000644 0001750 0001750 00000013267 11702300252 016356 0 ustar acerion acerion // Copyright (C) 2001-2006 Simon Baldwin (simon_baldwin@yahoo.com)
// Copyright (C) 2011-2012 Kamil Ignacak (acerion@wp.pl)
//
// 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.
//
#include "../config.h"
#include
#include
#include
#include
#include
#include "sender.h"
#include "display.h"
#include "modeset.h"
#include "libcw.h"
#include "i18n.h"
namespace cw {
//-----------------------------------------------------------------------
// Class Sender
//-----------------------------------------------------------------------
// poll()
//
// Poll the CW library tone queue, and if it is getting low, arrange for
// more data to be passed in to the sender.
void
Sender::poll (const Mode *current_mode)
{
if (current_mode->is_dictionary () || current_mode->is_keyboard ())
{
if (cw_get_tone_queue_length () <= 1)
{
// Arrange more data for the sender. In dictionary modes, add more
// random data if the queue is empty. In keyboard mode, just
// dequeue anything currently on the character queue.
if (current_mode->is_dictionary () && send_queue_.empty ())
{
const DictionaryMode *dict_mode = current_mode->is_dictionary ();
enqueue_string (std::string (1, ' ')
+ dict_mode->get_random_word_group ());
}
dequeue_character ();
}
}
}
// handle_key_event()
//
// Specific handler for keyboard mode_key events. Handles presses only;
// releases are ignored.
void
Sender::handle_key_event (QKeyEvent *event, const Mode *current_mode)
{
if (current_mode->is_keyboard ())
{
if (event->type () == QEvent::KeyPress)
{
// If the key was backspace, remove the last queued character, or at
// least try, and we are done.
if (event->key () == Qt::Key_Backspace)
{
delete_character ();
event->accept ();
}
else
{
// Extract the ASCII keycode from the key event, and queue the
// character for sending, converted to uppercase.
const char *c = event->text().toAscii().data();
enqueue_string(c);
// Accept the event if the character was sendable. If not, it
// won't have queued, and so by ignoring it we can let
// characters such as Tab pass up to the parent.
if (cw_check_character (toupper (c[0])))
event->accept ();
}
}
}
}
// clear()
//
// Flush the tone queue, empty the character queue, and set to idle.
void
Sender::clear ()
{
cw_flush_tone_queue ();
send_queue_.clear ();
is_queue_idle_ = true;
}
// dequeue_character()
//
// Called when the CW send buffer is empty. If the queue is not idle, take
// the next character from the queue and send it. If there are no more queued
// characters, set the queue to idle.
void Sender::dequeue_character()
{
if (is_queue_idle_) {
return;
}
if (send_queue_.empty()) {
is_queue_idle_ = true;
display_->clear_status();
return;
}
// Take the next character off the queue and send it. We don't
// expect sending to fail as only sendable characters are queued.
const char c = toupper(send_queue_.front());
send_queue_.pop_front();
if (!cw_send_character(c)) {
perror("cw_send_character");
abort();
}
// Update the status bar with the character being sent.
// I'm sure there is a way to create QString in one line,
// without series of concatenations. For now I'll use C string.
// Put the sent char at the end to avoid "jumping" of whole
// string when width of glyph of sent char changes at variable
// font width.
const char *format = _("Sending at %d WPM: '%c'");
char c_status[100]; // TODO: dynamic array size in C99 (strlen(format) + 1 + X)
snprintf(c_status, strlen(format) + 1, format, cw_get_send_speed(), c);
QString status(c_status);
display_->show_status(status);
return;
}
// enqueue_string()
//
// Queues a string for sending by the CW sender. Rejects any unsendable
// characters found in the string. Rejection is silent.
void
Sender::enqueue_string (const std::string &word)
{
bool is_queue_notify = false;
// Add each character, and note if we need to change from idle.
for (unsigned int index = 0; index < word.size (); index++)
{
const char c = toupper (word[index]);
if (cw_check_character (c))
{
send_queue_.push_back (c);
display_->append (c);
if (is_queue_idle_)
is_queue_notify = true;
}
}
// If we queued any character, mark the queue as not idle.
if (is_queue_notify)
is_queue_idle_ = false;
}
// delete_character()
//
// Remove the most recently added character from the queue, provided that
// the dequeue hasn't yet reached it. If there's nothing available to
// delete, fail silently.
void
Sender::delete_character ()
{
if (!send_queue_.empty ())
{
send_queue_.pop_back ();
display_->backspace ();
}
}
} // cw namespace
unixcw-3.0.2/src/xcwcp/main.cc 0000644 0001750 0001750 00000011767 11702300303 016022 0 ustar acerion acerion // Copyright (C) 2001-2006 Simon Baldwin (simon_baldwin@yahoo.com)
// Copyright (C) 2011-2012 Kamil Ignacak (acerion@wp.pl)
//
// 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.
//
#include "../config.h"
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include "application.h"
#include "libcw.h"
#include "i18n.h"
#include "cmdline.h"
#include "copyright.h"
#include "dictionary.h"
//-----------------------------------------------------------------------
// Command line mechanics
//-----------------------------------------------------------------------
namespace {
/*
bool is_console = false, is_soundcard = true, is_alsa = false;
std::string console_device, soundcard_device;
*/
cw_config_t *config = NULL;
std::string argv0;
std::string all_options = "s:|sound,d:|device,"
"w:|wpm,t:|tone,v:|volume,"
"g:|gap,k:|weighting,"
// "i:|infile,F:|outfile,"
// "T:|time,"
"h|help,V|version";
// signal_handler()
//
// Signal handler, called by the CW library after its own cleanup.
void
signal_handler (int signal_number)
{
std::clog << _("Caught signal ") << signal_number
<< _(", exiting...") << std::endl;
exit (EXIT_SUCCESS);
}
} // namespace
// main()
//
// Parse the command line, initialize a few things, then instantiate the
// Application and wait.
int main(int argc, char **argv)
{
try {
argv0 = program_basename(argv[0]);
/* Set locale and message catalogs. */
i18n_initialize();
/* Parse combined environment and command line arguments. */
int combined_argc;
char **combined_argv;
// Parse combined environment and command line arguments. Arguments
// are passed to QApplication() first to allow it to extract any Qt
// or X11 options.
combine_arguments(_("XCWCP_OPTIONS"), argc, argv, &combined_argc, &combined_argv);
QApplication q_application (combined_argc, combined_argv);
config = cw_config_new();
if (!config) {
return EXIT_FAILURE;
}
config->has_practice_time = 0;
config->has_infile = false;
if (!cw_process_argv(argc, argv, all_options.c_str(), config)) {
fprintf(stderr, _("%s: failed to parse command line args\n"), argv0.c_str());
return EXIT_FAILURE;
}
if (!cw_config_is_valid(config)) {
fprintf(stderr, _("%s: inconsistent arguments\n"), argv0.c_str());
return EXIT_FAILURE;
}
if (config->input_file) {
if (!dictionary_load(config->input_file)) {
fprintf(stderr, _("%s: %s\n"), argv0.c_str(), strerror(errno));
fprintf(stderr, _("%s: can't load dictionary from input file %s\n"), argv0.c_str(), config->input_file);
return EXIT_FAILURE;
}
}
if (config->output_file) {
if (!dictionary_write(config->output_file)) {
fprintf(stderr, _("%s: %s\n"), argv0.c_str(), strerror(errno));
fprintf(stderr, _("%s: can't save dictionary to output file %s\n"), argv0.c_str(), config->input_file);
return EXIT_FAILURE;
}
}
if (!cw_generator_new_from_config(config, argv0.c_str())) {
fprintf(stderr, "%s: failed to create generator\n", argv0.c_str());
return EXIT_FAILURE;
}
cw_generator_start();
/* Set up signal handlers to clean up and exit on a range of signals. */
struct sigaction action;
action.sa_handler = signal_handler;
action.sa_flags = 0;
sigemptyset (&action.sa_mask);
static const int SIGNALS[] = { SIGHUP, SIGINT, SIGQUIT, SIGPIPE, SIGTERM, 0 };
for (int index = 0; SIGNALS[index] != 0; index++) {
if (!cw_register_signal_handler(SIGNALS[index], signal_handler)) {
perror("cw_register_signal_handler");
abort();
}
}
// Display the application's windows.
cw::Application *application = new cw::Application ();
application->setWindowTitle(_("Xcwcp"));
application->show();
q_application.connect(&q_application, SIGNAL (lastWindowClosed ()),
&q_application, SLOT (quit ()));
// Enter the application event loop.
int rv = q_application.exec();
cw_generator_stop();
cw_generator_delete();
return rv;
}
// Handle any exceptions thrown by the above.
catch (std::bad_alloc) {
std::clog << "Internal error: heap memory exhausted" << std::endl;
return EXIT_FAILURE;
}
catch (...) {
std::clog << "Internal error: unknown problem" << std::endl;
return EXIT_FAILURE;
}
}
unixcw-3.0.2/src/xcwcp/application.cc 0000644 0001750 0001750 00000064250 11702300327 017402 0 ustar acerion acerion // Copyright (C) 2001-2006 Simon Baldwin (simon_baldwin@yahoo.com)
// Copyright (C) 2011-2012 Kamil Ignacak (acerion@wp.pl)
//
// 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.
//
#include "../config.h"
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include "icons/icon_start.xpm"
#include "icons/icon_stop.xpm"
#include "icons/icon_mini_xcwcp.xpm"
#include "application.h"
#include "sender.h"
#include "receiver.h"
#include "display.h"
#include "modeset.h"
#include "cw_common.h"
#include "libcw.h"
#include "i18n.h"
#include "copyright.h"
namespace cw {
//-----------------------------------------------------------------------
// Module variables, miscellaneous other stuff
//-----------------------------------------------------------------------
// Strings displayed in 'about' dialog.
const QString ABOUT_CAPTION = QString(_("Xcwcp version "))
+ PACKAGE_VERSION;
const QString ABOUT_TEXT = QString(_("Xcwcp version "))
+ PACKAGE_VERSION + "\n" + CW_COPYRIGHT;
// Strings for whats-this dialogs.
const QString STARTSTOP_WHATSTHIS =
_("When this button shows , click it to begin "
"sending or receiving. Only one window may send at a time.
"
"When the button shows , click it to finish "
"sending or receiving.\n\n");
const QString MODE_WHATSTHIS =
_("This allows you to change what Xcwcp does. Most of the available "
"selections will probably generate random CW characters of one form or "
"another.
"
"The exceptions are Send Keyboard CW, which sends the characters "
"that you type at the keyboard, and Receive Keyed CW, which will "
"decode CW that you key in using the mouse or keyboard.
"
"To key CW into Xcwcp for receive mode, use either the mouse or the "
"keyboard. On the mouse, the left and right buttons form an Iambic "
"keyer, and the middle mouse button works as a straight key.
"
"On the keyboard, use the Left and Right cursor keys for Iambic keyer "
"control, and the Up or Down cursor keys, or the Space, Enter, or "
"Return keys, as a straight key.");
const QString SPEED_WHATSTHIS =
_("This controls the CW sending speed. If you deselect adaptive "
"receive speed, it also controls the CW receiving speed.");
const QString FREQUENCY_WHATSTHIS =
_("This sets the frequency of the CW tone on the system sound card "
"or console.
"
"It affects both sent CW and receive sidetone.");
const QString VOLUME_WHATSTHIS =
_("This sets the volume of the CW tone on the system sound card. "
"It is not possible to control console sound volume, so in this "
"case, all values other than zero produce tones.
"
"The volume control affects both sent CW and receive sidetone.");
const QString GAP_WHATSTHIS =
_("This sets the \"Farnsworth\" gap used in sending CW. This gap is an "
"extra number of dit-length silences between CW characters.");
//-----------------------------------------------------------------------
// Static variables, constructor
//-----------------------------------------------------------------------
// A pointer to the class currently actively using the CW library. As there
// is only one CW library, we need to make sure that only a single Xcwcp
// instance is using it at any one time. When NULL, no instance is currently
// using the library.
Application *Application::libcw_user_application_instance = NULL;
// Application()
//
// Class constructor. Creates the application main window an GUI frame, and
// registers everything we need to register to get the application up and
// running.
Application::Application() : QMainWindow (0)
{
make_auxiliaries_begin();
QMainWindow::setAttribute(Qt::WA_DeleteOnClose, true);
QMainWindow::setWindowTitle(_("Xcwcp"));
QMainWindow::setWindowIcon(xcwcp_icon);
QMainWindow::resize(800, 400);
make_toolbar();
make_program_menu();
make_settings_menu();
make_help_menu();
make_central_widget();
make_auxiliaries_end();
}
//-----------------------------------------------------------------------
// Libcw keying event callback
//-----------------------------------------------------------------------
// libcw_keying_event_static()
//
// This is the class-level handler for the keying callback from the CW
// library indicating that the keying state changed. This function uses the
// libcw_user_application_instance static variable to determine which class
// instance 'owns' the CW library at the moment (if any), then calls that
// instance's receiver handler function.
//
// This function is called in signal handler context.
void
Application::libcw_keying_event_static (void *, int key_state)
{
const Application *application = libcw_user_application_instance;
// Notify the receiver of a libcw keying event only if there is a user
// instance that is actively using the library and in receive mode. The
// receiver handler function cannot determine this for itself.
if (application && application->is_using_libcw_
&& application->modeset_.is_receive ())
{
application->receiver_->handle_libcw_keying_event (key_state);
}
}
//-----------------------------------------------------------------------
// Qt event and slot handlers
//-----------------------------------------------------------------------
// about()
//
// Pop up a brief dialog about the application.
void Application::about()
{
QMessageBox::about(0, ABOUT_CAPTION, ABOUT_TEXT);
}
// closeEvent()
//
// Event handler for window close. Requests a confirmation if we happen to
// be busy sending.
void
Application::closeEvent (QCloseEvent *event)
{
bool is_closing = true;
if (is_using_libcw_)
{
is_closing =
QMessageBox::warning (this, _("Xcwcp"),
_("Busy - are you sure?"),
_("&Exit"), _("&Cancel"), 0, 0, 1) == 0;
if (is_closing)
stop ();
}
is_closing ? event->accept () : event->ignore ();
}
// startstop()
//
// Call start or stop depending on the current toggle state of the toolbar
// button that calls this slot.
void Application::startstop()
{
play_ ? stop() : start();
}
// start()
//
// Start sending or receiving CW.
void Application::start()
{
if (is_using_libcw_) {
// Already playing, nothing to do.
return;
}
// If the CW library is in use by another instance, let the user stop
// that one and let this one continue.
if (libcw_user_application_instance) {
const bool is_stop = QMessageBox::warning(this, _("Xcwcp"),
_("Another Xcwcp window is busy."),
_("&Stop Other"), _("&Cancel"), 0, 0, 1) == 0;
if (is_stop) {
libcw_user_application_instance->stop();
} else {
// Restore button's proper visual appearance
// after it has been pressed, but user hasn't
// confirmed starting playing in this instance.
this->startstop_button_->setDown(false);
return;
}
}
is_using_libcw_ = true;
// Acquire the CW library sender.
libcw_user_application_instance = this;
// Synchronize the CW sender to our values of speed/tone/gap, and Curtis
// mode B. We need to do this here since updates to the GUI widgets are
// ignored if we aren't in fact active; this permits multiple instances
// of the class to interoperate with the CW library. Sort of. We can
// do it by just calling the slots for the GUI widgets directly.
speed_change();
frequency_change();
volume_change();
gap_change();
curtis_mode_b_change();
cw_start_beep();
// Call the adaptive receive change callback to synchronize the CW
// library with this instance's idea of receive tracking and speed.
adaptive_receive_change();
// Clear the sender and receiver.
sender_->clear();
receiver_->clear();
// Accessing proper action through this->startstop_
// should also work.
QAction *action = startstop_button_->defaultAction();
action->setChecked(true);
action->setIcon(stop_icon);
action->setText(_("Stop"));
action->setToolTip(_("Stop"));
startstop_button_->setDown(true);
play_ = true;
display_->clear_status();
// Start the poll timer. At 60WPM, a dot is 20ms, so polling for the
// maximum library speed needs a 10ms timeout.
poll_timer_->setSingleShot(false);
poll_timer_->start(10);
}
// stop()
//
// Empty the buffer of characters awaiting send, and halt the process of
// refilling the buffer.
void Application::stop()
{
if (!is_using_libcw_) {
// Not playing at the moment, nothing to do
return;
}
is_using_libcw_ = false;
// Stop the poll timer, and clear the sender and receiver.
poll_timer_->stop();
sender_->clear();
receiver_->clear();
// Save the receive speed, for restore on next start.
saved_receive_speed_ = cw_get_receive_speed();
cw_end_beep();
// Done with the CW library sender for now.
libcw_user_application_instance = NULL;
// Accessing proper action through this->startstop_
// should also work.
QAction *action = startstop_button_->defaultAction();
action->setChecked(false);
action->setIcon(start_icon);
action->setText(_("Start"));
action->setToolTip(_("Start"));
startstop_button_->setDown(false);
play_ = false;
display_->show_status(_("Ready"));
}
// new_instance()
//
// Creates a new instance of the Xcwcp application.
void
Application::new_instance ()
{
Application *application = new Application ();
//application->setCaption (_("Xcwcp"));
application->show ();
}
// clear()
//
// Clears the display window of this Xcwcp instance.
void
Application::clear ()
{
display_->clear ();
}
// sync_speed()
//
// Forces the tracked receive speed into synchronization with the speed
// spin box if adaptive receive is activated.
void
Application::sync_speed ()
{
if (is_using_libcw_)
{
if (adaptive_receive_->isChecked ())
{
// Force by unsetting adaptive receive, setting the receive speed,
// then resetting adaptive receive again.
cw_disable_adaptive_receive ();
if (!cw_set_receive_speed (speed_spin_->value ()))
{
perror ("cw_set_receive_speed");
abort ();
}
cw_enable_adaptive_receive ();
}
}
}
// speed_change()
// frequency_change()
// volume_change()
// gap_change()
//
// Handle changes in the spin boxes for these CW parameters. The only action
// necessary is to write the new values out to the CW library. The one thing
// we do do is to only change parameters when we are active (i.e. have
// control of the CW library).
void
Application::speed_change ()
{
if (is_using_libcw_)
{
if (!cw_set_send_speed (speed_spin_->value ()))
{
perror ("cw_set_send_speed");
abort ();
}
if (!cw_get_adaptive_receive_state ())
{
if (!cw_set_receive_speed (speed_spin_->value ()))
{
perror ("cw_set_receive_speed");
abort ();
}
}
}
}
void
Application::frequency_change ()
{
if (is_using_libcw_)
{
if (!cw_set_frequency (frequency_spin_->value ()))
{
perror ("cw_set_frequency");
abort ();
}
}
}
void
Application::volume_change ()
{
if (is_using_libcw_)
{
if (!cw_set_volume (volume_spin_->value ()))
{
perror ("cw_set_volume");
abort ();
}
}
}
void
Application::gap_change ()
{
if (is_using_libcw_)
{
if (!cw_set_gap (gap_spin_->value ()))
{
perror ("cw_set_gap");
abort ();
}
}
}
// mode_change()
//
// Handle a change of mode. Synchronize mode and receive speed if moving to
// a receive mode, then clear the sender and receiver and any pending tones.
void
Application::mode_change ()
{
// Get the mode to which mode we're changing.
const Mode *new_mode = modeset_.get (mode_combo_->currentIndex());
// If this changes mode type, set the speed synchronization menu item state
// to enabled for receive mode, disabled otherwise. And for tidiness, clear
// the display.
if (!new_mode->is_same_type_as (modeset_.get_current ()))
{
sync_speed_->setEnabled(new_mode->is_receive());
display_->clear ();
}
// If the mode changed while we're busy, clear the sender and receiver.
if (is_using_libcw_)
{
sender_->clear ();
receiver_->clear ();
}
// Keep the ModeSet synchronized to mode_combo changes.
modeset_.set_current(mode_combo_->currentIndex());
}
// curtis_mode_b_change()
//
// Called whenever the user request a change of Curtis iambic mode. The
// function simply passes the Curtis mode on to the CW library if active,
// and ignores the call if not.
void
Application::curtis_mode_b_change ()
{
if (is_using_libcw_)
{
curtis_mode_b_->isChecked () ? cw_enable_iambic_curtis_mode_b ()
: cw_disable_iambic_curtis_mode_b ();
}
}
// adaptive_receive_change()
//
// Called whenever the user request a change of adaptive receive status. The
// function passes the new receive speed tracking mode on to the CW library if
// active, and if fixed speed receive is set, also sets the hard receive speed
// to equal the send speed, otherwise, it restores the previous tracked receive
// speed.
void
Application::adaptive_receive_change ()
{
if (is_using_libcw_)
{
if (adaptive_receive_->isChecked ())
{
// If going to adaptive receive, first set the speed to the saved
// receive speed, then turn on adaptive receiving.
cw_disable_adaptive_receive ();
if (!cw_set_receive_speed (saved_receive_speed_))
{
perror ("cw_set_receive_speed");
abort ();
}
cw_enable_adaptive_receive ();
}
else
{
// If going to fixed receive, save the current adaptive receive
// speed so we can restore it later, then turn off adaptive receive,
// and set the speed to equal the send speed as shown on the speed
// spin box.
saved_receive_speed_ = cw_get_receive_speed ();
cw_disable_adaptive_receive ();
if (!cw_set_receive_speed (speed_spin_->value ()))
{
perror ("cw_set_receive_speed");
abort ();
}
}
}
}
// fonts()
//
// Use a font dialog to allow selection of display font.
void Application::fonts()
{
bool status;
QFont font = QFontDialog::getFont(&status, this);
if (status) {
QWidget *display_widget = display_->get_widget();
display_widget->setFont(font);
}
}
// colors()
//
// Use a color dialog to allow selection of display color.
void Application::colors()
{
QColor color = QColorDialog::getColor();
if (color.isValid()) {
QWidget *display_widget = display_->get_widget();
QPalette palette;
palette.setColor(QPalette::Text, color);
// display_widget->setAutoFillForeground(true);
display_widget->setPalette(palette);
}
}
//-----------------------------------------------------------------------
// Timer, keyboard and mouse events
//-----------------------------------------------------------------------
// poll_timer_event()
//
// Handle a timer event from the QTimer we set up on initialization. This
// timer is used for regular polling for sender tone queue low and completed
// receive characters.
void
Application::poll_timer_event ()
{
if (is_using_libcw_)
{
sender_->poll (modeset_.get_current ());
receiver_->poll (modeset_.get_current ());
}
}
// key_event()
//
// Handle a key press event from the display widget.
void
Application::key_event (QKeyEvent *event)
{
event->ignore ();
// Special case Alt-M as a way to acquire focus in the mode combo widget.
// This was a workround applied to earlier releases, no longer required
// now that events are propagated correctly to the parent.
//if (event->state () & AltButton && event->key () == Qt::Key_M)
// {
// mode_combo_->setFocus ();
// event->accept ();
// return;
// }
// Pass the key event to the sender and the receiver.
if (is_using_libcw_)
{
sender_->handle_key_event (event, modeset_.get_current ());
receiver_->handle_key_event (event, modeset_.get_current (),
reverse_paddles_->isChecked ());
}
}
// mouse_event()
//
// Handle a mouse event from the display widget.
void
Application::mouse_event (QMouseEvent *event)
{
event->ignore ();
// Pass the mouse event to the receiver. The sender isn't interested.
if (is_using_libcw_)
{
receiver_->handle_mouse_event (event, modeset_.get_current (),
reverse_paddles_->isChecked ());
}
}
void Application::toggle_toolbar(void)
{
if (toolbar->isVisible()) {
toolbar->hide();
toolbar_visibility_->setText("Show Toolbar");
} else {
toolbar->show();
toolbar_visibility_->setText("Hide Toolbar");
}
}
void Application::make_toolbar(void)
{
toolbar = QMainWindow::addToolBar(_("Xcwcp Operations"));
startstop_ = new QAction(_("Start/Stop"), this);
startstop_->setIcon(start_icon);
startstop_->setText(_("Start"));
startstop_->setToolTip(_("Start"));
startstop_->setWhatsThis(STARTSTOP_WHATSTHIS);
connect(startstop_, SIGNAL (triggered(bool)), this, SLOT (startstop()));
// Put a button in the toolbar, not the action.
// Button can gain focus through Tab key, whereas
// action can't. The focus for button is, for some reason,
// invisible, but it's there.
startstop_button_ = new QToolButton(toolbar);
startstop_button_->setDefaultAction(startstop_);
startstop_button_->setCheckable(true);
toolbar->addWidget(startstop_button_);
toolbar->addSeparator();
make_mode_combo();
toolbar->addWidget(mode_combo_);
toolbar->addSeparator ();
QLabel *speed_label_ = new QLabel(_("Speed:"), 0, 0);
toolbar->addWidget(speed_label_);
speed_spin_ = new QSpinBox();
speed_spin_->setMinimum(CW_SPEED_MIN);
speed_spin_->setMaximum(CW_SPEED_MAX);
speed_spin_->setSingleStep(CW_SPEED_STEP);
speed_spin_->setToolTip(_("Speed"));
speed_spin_->setWhatsThis(SPEED_WHATSTHIS);
speed_spin_->setSuffix(_(" WPM"));
speed_spin_->setValue(cw_get_send_speed());
connect(speed_spin_, SIGNAL (valueChanged(int)), SLOT (speed_change()));
toolbar->addWidget(speed_spin_);
toolbar->addSeparator();
QLabel *tone_label = new QLabel(_("Tone:"));
toolbar->addWidget(tone_label);
frequency_spin_ = new QSpinBox(0);
frequency_spin_->setMinimum(CW_FREQUENCY_MIN);
frequency_spin_->setMaximum(CW_FREQUENCY_MAX);
frequency_spin_->setSingleStep(CW_FREQUENCY_STEP);
frequency_spin_->setToolTip(_("Frequency"));
frequency_spin_->setSuffix(_(" Hz"));
frequency_spin_->setWhatsThis(FREQUENCY_WHATSTHIS);
frequency_spin_->setValue(cw_get_frequency());
connect(frequency_spin_, SIGNAL (valueChanged(int)), SLOT (frequency_change()));
toolbar->addWidget(frequency_spin_);
toolbar->addSeparator ();
QLabel *volume_label = new QLabel(_("Volume:"), 0, 0);
toolbar->addWidget(volume_label);
volume_spin_ = new QSpinBox(0);
volume_spin_->setMinimum(CW_VOLUME_MIN);
volume_spin_->setMaximum(CW_VOLUME_MAX);
volume_spin_->setSingleStep(CW_VOLUME_STEP);
volume_spin_->setToolTip(_("Volume"));
volume_spin_->setSuffix(_(" %"));
volume_spin_->setWhatsThis(VOLUME_WHATSTHIS);
volume_spin_->setValue(cw_get_volume());
connect(volume_spin_, SIGNAL (valueChanged(int)), SLOT (volume_change()));
toolbar->addWidget(volume_spin_);
toolbar->addSeparator ();
QLabel *gap_label = new QLabel(_("Gap:"), 0, 0);
toolbar->addWidget(gap_label);
gap_spin_ = new QSpinBox(0);
toolbar->addWidget(gap_spin_);
gap_spin_->setMinimum(CW_GAP_MIN);
gap_spin_->setMaximum(CW_GAP_MAX);
gap_spin_->setSingleStep(CW_GAP_STEP);
gap_spin_->setToolTip(_("Gap"));
gap_spin_->setSuffix(_(" dot(s)"));
gap_spin_->setWhatsThis(GAP_WHATSTHIS);
gap_spin_->setValue(cw_get_gap());
connect(gap_spin_, SIGNAL (valueChanged(int)), SLOT (gap_change()));
// Finally for the toolbar, add whatsthis.
//QWhatsThis::whatsThisButton (toolbar);
// This removes context menu for the toolbar. The menu made it
// possible to close a toolbar, which complicates 'show/hide'
// behavior a bit.
// Disabling the menu makes Settings->Hide toolbar the only place
// to toggle toolbar visibility. Nice and simple.
QAction *a = toolbar->toggleViewAction();
a->setVisible(false);
return;
}
void Application::make_mode_combo()
{
mode_combo_ = new QComboBox(0); //, _("Mode"));
mode_combo_->setToolTip(_("Mode"));
mode_combo_->setWhatsThis(MODE_WHATSTHIS);
connect(mode_combo_, SIGNAL (activated(int)), SLOT (mode_change()));
// Append each mode represented in the modes set to the combo box's
// contents, then synchronize the current mode.
for (int index = 0; index < modeset_.get_count(); index++) {
const QVariant data(index);
const Mode *mode = modeset_.get(index);
const QString string = QString::fromUtf8(mode->get_description().c_str());
mode_combo_->addItem(string, data);
}
modeset_.set_current(mode_combo_->currentIndex());
return;
}
void Application::make_program_menu(void)
{
program_menu_ = new QMenu (_("&Program"), this);
QMainWindow::menuBar()->addMenu(program_menu_);
new_window_ = new QAction(_("&New Window"), this);
new_window_->setShortcut(Qt::CTRL + Qt::Key_N);
connect(new_window_, SIGNAL (triggered()), SLOT (new_instance()));
program_menu_->addAction(new_window_);
program_menu_->addSeparator ();
program_menu_->addAction(startstop_);
// The action is connected in make_toolbar().
clear_display_ = new QAction(_("&Clear Text"), this);
clear_display_->setShortcut(Qt::CTRL + Qt::Key_C);
connect(clear_display_, SIGNAL (triggered()), SLOT (clear()));
program_menu_->addAction(clear_display_);
sync_speed_ = new QAction(_("Synchronize S&peed"), this);
sync_speed_->setShortcut(Qt::CTRL + Qt::Key_P);
sync_speed_->setEnabled(modeset_.is_receive());
connect(sync_speed_, SIGNAL (triggered()), SLOT (sync_speed()));
program_menu_->addAction(sync_speed_);
program_menu_->addSeparator();
close_ = new QAction(_("&Close"), this);
close_->setShortcut(Qt::CTRL + Qt::Key_W);
connect(close_, SIGNAL (triggered()), SLOT (close()));
program_menu_->addAction(close_);
quit_ = new QAction(_("&Quit"), qApp);
quit_->setShortcut(Qt::CTRL + Qt::Key_Q);
connect(quit_, SIGNAL (triggered()), qApp, SLOT (closeAllWindows()));
program_menu_->addAction(quit_);
return;
}
void Application::make_settings_menu(void)
{
QMenu *settings_ = new QMenu(_("&Settings"), this);
QMainWindow::menuBar()->addMenu(settings_);
reverse_paddles_ = new QAction(_("&Reverse Paddles"), this);
reverse_paddles_->setCheckable(true);
reverse_paddles_->setChecked(false);
settings_->addAction(reverse_paddles_);
curtis_mode_b_ = new QAction(_("&Curtis Mode B Timing"), this);
curtis_mode_b_->setCheckable(true);
curtis_mode_b_->setChecked(false);
connect(curtis_mode_b_, SIGNAL (toggled(bool)), SLOT (curtis_mode_b_change()));
settings_->addAction(curtis_mode_b_);
adaptive_receive_ = new QAction(_("&Adaptive CW Receive Speed"), this);
adaptive_receive_->setCheckable(true);
adaptive_receive_->setChecked(true);
connect(adaptive_receive_, SIGNAL (toggled(bool)), SLOT (adaptive_receive_change()));
settings_->addAction(adaptive_receive_);
settings_->addSeparator();
font_settings_ = new QAction(_("&Text font..."), this);
connect(font_settings_, SIGNAL (triggered(bool)), SLOT (fonts()));
settings_->addAction(font_settings_);
color_settings_ = new QAction(_("&Text color..."), this);
connect(color_settings_, SIGNAL (triggered(bool)), SLOT (colors()));
settings_->addAction(color_settings_);
settings_->addSeparator();
toolbar_visibility_ = new QAction(_("Hide toolbar"), this);
connect(toolbar_visibility_, SIGNAL (triggered(bool)), SLOT (toggle_toolbar()));
settings_->addAction(toolbar_visibility_);
return;
}
void Application::make_help_menu(void)
{
help_ = new QMenu(_("&Help"), this);
QMainWindow::menuBar()->addSeparator();
QMainWindow::menuBar()->addMenu(help_);
about_ = new QAction(_("&About"), this);
connect(about_, SIGNAL(triggered(bool)), SLOT(about()));
help_->addAction(about_);
}
void Application::make_central_widget(void)
{
// this constructor calls setCentralWidget()
display_ = new Display(this, this->parentWidget());
}
void Application::make_auxiliaries_begin(void)
{
start_icon = QPixmap(icon_start_xpm);
stop_icon = QPixmap(icon_stop_xpm);
xcwcp_icon = QPixmap(icon_mini_xcwcp_xpm);
is_using_libcw_ = false;
saved_receive_speed_ = cw_get_receive_speed();
play_ = false;
// Register class handler as the CW library keying event callback. It's
// important here that we register the static handler, since once we have
// been into and out of 'C', all concept of 'this' is lost. It's the job
// of the static handler to work out which class instance is using the CW
// library, and call the instance's libcw_keying_event() function.
cw_register_keying_callback(libcw_keying_event_static, NULL);
// Create a timer for polling send and receive.
poll_timer_ = new QTimer (this);
connect(poll_timer_, SIGNAL (timeout()), SLOT (poll_timer_event()));
}
void Application::make_auxiliaries_end(void)
{
// Create a sender and a receiver.
sender_ = new Sender(display_);
receiver_ = new Receiver(display_);
QString label("Output: ");
label += cw_generator_get_audio_system_label();
QLabel *sound_system = new QLabel(label);
statusBar()->addPermanentWidget(sound_system);
}
} // cw namespace
unixcw-3.0.2/src/xcwcp/display.h 0000644 0001750 0001750 00000003634 11702300307 016403 0 ustar acerion acerion // Copyright (C) 2001-2006 Simon Baldwin (simon_baldwin@yahoo.com)
// Copyright (C) 2011-2012 Kamil Ignacak (acerion@wp.pl)
//
// 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.
//
#ifndef _XCWCP_DISPLAY_H
#define _XCWCP_DISPLAY_H
#include
//-----------------------------------------------------------------------
// Class Display
//-----------------------------------------------------------------------
// Describes an extremely simply text display interface. The interface is
// minimized and abstracted like this to make changes to the underlying
// implementation easy.
namespace cw {
class Application;
class DisplayImpl;
class Display {
public:
Display (Application *application, QWidget *parent);
QWidget *get_widget() const;
// Minimal text display interface; add a character, remove a character,
// and clear the display completely.
void append (char c);
void backspace ();
void clear ();
// Minimal pass-through status bar interface.
void show_status (const QString &status);
void clear_status ();
private:
Application *application_;
DisplayImpl *implementation_;
// Prevent unwanted operations.
Display (const Display &);
Display &operator= (const Display &);
};
} // cw namespace
#endif // _XCWCP_DISPLAY_H
unixcw-3.0.2/src/xcwcp/modeset.cc 0000644 0001750 0001750 00000011014 11702300276 016530 0 ustar acerion acerion // Copyright (C) 2001-2006 Simon Baldwin (simon_baldwin@yahoo.com)
// Copyright (C) 2011-2012 Kamil Ignacak (acerion@wp.pl)
//
// 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.
//
#include "modeset.h"
#include "dictionary.h"
namespace cw {
//-----------------------------------------------------------------------
// Class Mode
//-----------------------------------------------------------------------
// is_same_type_as()
//
// Return true if the mode passed in has the same type (dictionary, keyboard,
// or receive) as this mode.
bool
Mode::is_same_type_as (const Mode *other) const
{
return (is_dictionary() && other->is_dictionary ())
|| (is_keyboard () && other->is_keyboard ())
|| (is_receive () && other->is_receive ());
}
// get_random_word_group()
//
// Return a string composed of an appropriately sized group of random elements
// from the contained dictionary.
std::string
DictionaryMode::get_random_word_group () const
{
std::string random_group;
const int group_size = get_dictionary_group_size (dictionary_);
random_group.resize (group_size);
for (int group = 0; group < group_size; group++)
{
const char *element = get_dictionary_random_word (dictionary_);
random_group += element;
}
return random_group;
}
//-----------------------------------------------------------------------
// Class ModeSetHelper
//-----------------------------------------------------------------------
// Collects and aggregates operating modes, constructing from all known
// dictionaries, then adding any local modes. This is a singleton class,
// constrained to precisely one instance, as a helper for ModeSet.
class ModeSetHelper {
public:
static const std::vector *get_modes ();
private:
ModeSetHelper ();
~ModeSetHelper ();
std::vector modes_;
// Prevent unwanted operations.
ModeSetHelper (const ModeSetHelper &);
ModeSetHelper &operator= (const ModeSetHelper &);
};
// ModeSetHelper()
//
// Initialize a mode set with dictionary and locally defined modes.
ModeSetHelper::ModeSetHelper ()
{
// Start the modes with the known dictionaries.
for (const dictionary *dict = dictionary_iterate (NULL);
dict; dict = dictionary_iterate (dict))
{
const std::string description = get_dictionary_description (dict);
modes_.push_back (new DictionaryMode (description, dict));
}
// Add keyboard send and keyer receive.
modes_.push_back (new KeyboardMode ("Send Keyboard CW"));
modes_.push_back (new ReceiveMode ("Receive Keyed CW"));
}
// ~ModeSetHelper()
//
// Delete all heap allocated modes in the modes array, and clear the array.
ModeSetHelper::~ModeSetHelper ()
{
for (unsigned int index = 0; index < modes_.size (); index++)
delete modes_[index];
modes_.clear ();
}
// get_modes()
//
// Instantiate the singleton instance of ModeSetHelper and return the Modes
// aggregated in this ModeSetHelper.
const std::vector *
ModeSetHelper::get_modes ()
{
static const ModeSetHelper *instance = NULL;
if (!instance)
instance = new ModeSetHelper ();
return &instance->modes_;
}
//-----------------------------------------------------------------------
// Class ModeSet
//-----------------------------------------------------------------------
//
// ModeSet()
//
// Set up the modes_ array to contain the singleton-created modes vector,
// and initialize the current mode to the first.
ModeSet::ModeSet ()
: modes_ (ModeSetHelper::get_modes ()), current_ (modes_->at (0))
{
}
// is_dictionary()
// is_keyboard()
// is_receive()
//
// Convenience type identification functions for the current mode.
const DictionaryMode *
ModeSet::is_dictionary () const
{
return current_->is_dictionary ();
}
const KeyboardMode *
ModeSet::is_keyboard () const
{
return current_->is_keyboard ();
}
const ReceiveMode *
ModeSet::is_receive () const
{
return current_->is_receive ();
}
} // cw namespace
unixcw-3.0.2/src/xcwcp/application.h 0000644 0001750 0001750 00000011114 11702300321 017225 0 ustar acerion acerion // Copyright (C) 2001-2006 Simon Baldwin (simon_baldwin@yahoo.com)
// Copyright (C) 2011-2012 Kamil Ignacak (acerion@wp.pl)
//
// 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.
//
#ifndef _XCWCP_APPLICATION_H
#define _XCWCP_APPLICATION_H
#include
#include
#include
#include
#include
#include
#include "modeset.h"
//-----------------------------------------------------------------------
// Class Application
//-----------------------------------------------------------------------
// Encapsulates the outermost Xcwcp Qt application. Defines slots and
// signals, as well as the usual class information.
namespace cw {
class Display;
class Sender;
class Receiver;
class Application : public QMainWindow
{
Q_OBJECT
public:
Application();
// Handle key press and mouse button press events
void key_event (QKeyEvent *event);
void mouse_event (QMouseEvent *event);
protected:
void closeEvent (QCloseEvent *event);
private slots:
// Qt widget library callback functions.
void about ();
void startstop();
void start ();
void stop ();
void new_instance ();
void clear ();
void sync_speed ();
void speed_change ();
void frequency_change ();
void volume_change ();
void gap_change ();
void mode_change ();
void curtis_mode_b_change ();
void adaptive_receive_change ();
void fonts ();
void colors ();
void toggle_toolbar(void);
void poll_timer_event ();
private:
// Class variable to enable sharing of the libcw across instances. Set to
// the 'this' of the CW user instance, or NULL if no current user.
static Application *libcw_user_application_instance;
QPixmap xcwcp_icon;
bool play_;
QPixmap start_icon;
QPixmap stop_icon;
// GUI elements used throughout the class.
QToolBar *toolbar; // main toolbar
QToolButton *startstop_button_;
QAction *startstop_; // Shared between toolbar and Progam menu
QComboBox *mode_combo_;
QSpinBox *speed_spin_;
QSpinBox *frequency_spin_;
QSpinBox *volume_spin_;
QSpinBox *gap_spin_;
QMenu *program_menu_;
QAction *new_window_;
QAction *clear_display_;
QAction *sync_speed_;
QAction *close_;
QAction *quit_;
QMenu *settings_;
QAction *reverse_paddles_;
QAction *curtis_mode_b_;
QAction *adaptive_receive_;
QAction *font_settings_;
QAction *color_settings_;
QAction *toolbar_visibility_;
QMenu *help_;
QAction *about_;
Display *display_;
int file_synchronize_speed_id_;
int file_start_id_;
int file_stop_id_;
// Set of modes used by the application; initialized from dictionaries, with
// keyboard and receive modes added.
ModeSet modeset_;
// Sender and receiver.
Sender *sender_;
Receiver *receiver_;
// Poll timer, used to ensure that all of the application processing can
// be handled in the foreground, rather than in the signal handling context
// of a libcw tone queue low callback.
QTimer *poll_timer_;
// Flag indicating if this instance is currently using the libcw.
bool is_using_libcw_;
// Saved receive speed, used to reinstate adaptive tracked speed on start.
int saved_receive_speed_;
// Keying callback function for libcw. There is a static version for
// the whole class, and an instance version for each object. The class
// version calls the relevant instance version, based on which instance is
// the current registered libcw user.
static void libcw_keying_event_static (void *, int key_state);
void libcw_keying_event (int key_state);
// Wrappers for creating UI.
void make_central_widget(void);
void make_toolbar(void);
void make_mode_combo(void);
void make_program_menu(void);
void make_settings_menu(void);
void make_help_menu(void);
void make_auxiliaries_begin(void);
void make_auxiliaries_end(void);
// Prevent unwanted operations.
Application (const Application &);
Application &operator= (const Application &);
};
} // cw namespace
#endif // _XCWCP_APPLICATION_H
unixcw-3.0.2/src/xcwcp/sender.h 0000644 0001750 0001750 00000004150 11702300244 016210 0 ustar acerion acerion // Copyright (C) 2001-2006 Simon Baldwin (simon_baldwin@yahoo.com)
// Copyright (C) 2011-2012 Kamil Ignacak (acerion@wp.pl)
//
// 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.
//
#ifndef _XCWCP_SENDER_H
#define _XCWCP_SENDER_H
#include
#include
#include
//-----------------------------------------------------------------------
// Class Sender
//-----------------------------------------------------------------------
// Encapsulates the main application sender data and functions. Sender
// abstracts the send character queue, polling, and event handling.
namespace cw {
class Display;
class Mode;
class Sender
{
public:
Sender (Display *display)
: display_ (display), is_queue_idle_ (true) { }
// Poll timeout handler, and keypress event handler.
void poll (const Mode *current_mode);
void handle_key_event (QKeyEvent *event, const Mode *current_mode);
// Clear out queued data on stop, mode change, etc.
void clear ();
private:
// Display used for output.
Display *display_;
// Deque and queue manipulation functions, used to handle and maintain the
// buffer of characters awaiting libcw send.
bool is_queue_idle_;
std::deque send_queue_;
void dequeue_character ();
void enqueue_string (const std::string &word);
void delete_character ();
// Prevent unwanted operations.
Sender (const Sender &);
Sender &operator= (const Sender &);
};
} // cw namespace
#endif // _XCWCP_SENDER_H
unixcw-3.0.2/src/xcwcp/receiver.cc 0000644 0001750 0001750 00000025012 11702300264 016674 0 ustar acerion acerion // Copyright (C) 2001-2006 Simon Baldwin (simon_baldwin@yahoo.com)
// Copyright (C) 2011-2012 Kamil Ignacak (acerion@wp.pl)
//
// 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.
//
#include "../config.h"
#include
#include
#include
#include
#include "receiver.h"
#include "display.h"
#include "modeset.h"
#include "libcw.h"
#include "i18n.h"
namespace cw {
//-----------------------------------------------------------------------
// Class Receiver
//-----------------------------------------------------------------------
// poll()
//
// Poll the CW library receive buffer for a complete character, and handle
// anything found in it.
void
Receiver::poll (const Mode *current_mode)
{
if (current_mode->is_receive ())
{
// Report and clear any receiver errors noted when handling the last
// libcw keyer event.
if (libcw_receive_errno_ != 0)
poll_report_receive_error ();
// If we are awaiting a possible space, poll that first, then go on
// to poll receive characters; otherwise just poll receive characters.
if (is_pending_space_)
{
poll_receive_space ();
// If we received a space, poll the next possible receive character
if (!is_pending_space_)
poll_receive_character ();
}
else
{
// Not awaiting a possible space, so just poll the next possible
// receive character.
poll_receive_character ();
}
}
}
// handle_key_event()
//
// Specific handler for receive mode key events. Handles both press and
// release events, but ignores autorepeat.
void
Receiver::handle_key_event (QKeyEvent *event, const Mode *current_mode,
bool is_reverse_paddles)
{
if (current_mode->is_receive ())
{
// If this is a key press that is not the first one of an autorepeating
// key, ignore the event. This prevents autorepeat from getting in the
// way of identifying the real keyboard events we are after.
if (event->isAutoRepeat ())
return;
if (event->type () == QEvent::KeyPress
|| event->type () == QEvent::KeyRelease)
{
const int is_down = event->type () == QEvent::KeyPress;
// If this is the Space, UpArrow, DownArrow, Enter, or Return key,
// use as a straight key. If one wears out, there's always the
// other ones.
if (event->key () == Qt::Key_Space
|| event->key () == Qt::Key_Up
|| event->key () == Qt::Key_Down
|| event->key () == Qt::Key_Enter
|| event->key () == Qt::Key_Return)
{
cw_notify_straight_key_event (is_down);
event->accept ();
}
// If this is the LeftArrow key, use as one of the paddles. Which
// paddle depends on the reverse_paddles state.
else if (event->key () == Qt::Key_Left)
{
is_reverse_paddles ? cw_notify_keyer_dash_paddle_event (is_down)
: cw_notify_keyer_dot_paddle_event (is_down);
event->accept ();
}
// If this is the RightArrow key, use as the other one of the paddles.
else if (event->key () == Qt::Key_Right)
{
is_reverse_paddles ? cw_notify_keyer_dot_paddle_event (is_down)
: cw_notify_keyer_dash_paddle_event (is_down);
event->accept ();
}
}
}
}
// handle_mouse_event()
//
// Specific handler for receive mode key events. Handles button press and
// release events, folds doubleclick into press, and ignores mouse moves.
void
Receiver::handle_mouse_event (QMouseEvent *event, const Mode *current_mode,
bool is_reverse_paddles)
{
if (current_mode->is_receive ())
{
if (event->type () == QEvent::MouseButtonPress
|| event->type () == QEvent::MouseButtonDblClick
|| event->type () == QEvent::MouseButtonRelease)
{
const int is_down = event->type () == QEvent::MouseButtonPress
|| event->type () == QEvent::MouseButtonDblClick;
// If this is the Middle button, use as a straight key.
if (event->button () == Qt::MidButton)
{
cw_notify_straight_key_event (is_down);
event->accept ();
}
// If this is the Left button, use as one of the paddles. Which
// paddle depends on the reverse_paddles state.
else if (event->button () == Qt::LeftButton)
{
is_reverse_paddles ? cw_notify_keyer_dash_paddle_event (is_down)
: cw_notify_keyer_dot_paddle_event (is_down);
event->accept ();
}
// If this is the Right button, use as the other one of the paddles.
else if (event->button () == Qt::RightButton)
{
is_reverse_paddles ? cw_notify_keyer_dot_paddle_event (is_down)
: cw_notify_keyer_dash_paddle_event (is_down);
event->accept ();
}
}
}
}
// handle_libcw_keying_event()
//
// Handler for the keying callback from the CW library indicating that the
// keying state changed. The function handles the receive of keyed CW,
// ignoring calls on non-receive modes.
//
// This function is called in signal handler context, and it takes care to
// call only functions that are safe within that context. In particular,
// it goes out of its way to deliver results by setting flags that are
// later handled by receive polling.
void
Receiver::handle_libcw_keying_event (int key_state)
{
// Ignore calls where the key state matches our tracked key state. This
// avoids possible problems where this event handler is redirected between
// application instances; we might receive an end of tone without seeing
// the start of tone.
if (key_state == tracked_key_state_)
return;
else
tracked_key_state_ = key_state;
// If this is a tone start and we're awaiting a space, cancel that wait and
// clear the receive buffer; the tone start means that we're seeing the next
// incoming character before a space delay.
if (key_state && is_pending_space_)
{
cw_clear_receive_buffer ();
is_pending_space_ = false;
}
// Pass tone state on to the library. For tone end, check to see if the
// library has registered any receive error.
if (key_state)
{
if (!cw_start_receive_tone (NULL))
{
perror ("cw_start_receive_tone");
abort ();
}
}
else
{
if (!cw_end_receive_tone (NULL))
{
// Handle receive error detected on tone end. For ENOMEM and ENOENT
// we set the error in a class flag, and display the appropriate
// message on the next receive poll.
switch (errno)
{
case EAGAIN:
break;
case ENOMEM:
case ENOENT:
libcw_receive_errno_ = errno;
cw_clear_receive_buffer ();
break;
default:
perror ("cw_end_receive_tone");
abort ();
}
}
}
}
// clear()
//
// Clear the library receive buffer and our own flags.
void
Receiver::clear ()
{
cw_clear_receive_buffer ();
is_pending_space_ = false;
libcw_receive_errno_ = 0;
tracked_key_state_ = FALSE;
}
// poll_report_receive_error()
//
// Handle any error registered when handling a libcw keying event.
void
Receiver::poll_report_receive_error ()
{
// Handle any receive errors detected on tone end but delayed until here.
display_->show_status (libcw_receive_errno_ == ENOENT
? _("Badly formed CW element")
: _("Receive buffer overrun"));
libcw_receive_errno_ = 0;
}
// poll_receive_character()
//
// Receive any new character from the CW library.
void Receiver::poll_receive_character()
{
char c;
if (cw_receive_character(NULL, &c, NULL, NULL)) {
// Add the character, and note that we may see a space later.
display_->append(c);
is_pending_space_ = true;
// Update the status bar to show the character received.
// I'm sure there is a way to create QString in one
// line, without series of concatenations. For now
// I'll use C string.
const char *format = _("Received '%c' at %d WPM");
char c_status[100]; // TODO: dynamic array size in C99 (strlen(format) + 1 + X)
snprintf(c_status, strlen(format) + 1, format, c, cw_get_receive_speed());
QString status(c_status);
display_->show_status(status);
} else {
// Handle receive error detected on trying to read a character.
switch (errno) {
case EAGAIN:
case ERANGE:
break;
case ENOENT:
{ // New scope to avoid gcc 3.2.2 internal compiler error
cw_clear_receive_buffer();
display_->append('?');
// I'm sure there is a way to create QString in one
// line, without series of concatenations. For now
// I'll use C string.
const char *format = _("Unknown character received at %d WPM");
char c_status[100]; // TODO: dynamic array size in C99 (strlen(format) + 1 + X)
snprintf(c_status, strlen(format) + 1, format, c, cw_get_receive_speed());
QString status(c_status);
display_->show_status(status);
}
break;
default:
perror("cw_receive_character");
abort();
}
}
}
// poll_receive_space()
//
// If we received a character on an earlier poll, check again to see if we
// need to revise the decision about whether it is the end of a word too.
void
Receiver::poll_receive_space ()
{
// Recheck the receive buffer for end of word.
bool is_end_of_word;
cw_receive_character (NULL, NULL, &is_end_of_word, NULL);
if (is_end_of_word)
{
display_->append (' ');
cw_clear_receive_buffer ();
is_pending_space_ = false;
}
}
} // cw namespace
unixcw-3.0.2/src/config.h.in 0000644 0001750 0001750 00000013342 11700152471 015466 0 ustar acerion acerion /* src/config.h.in. Generated from configure.ac by autoheader. */
/* 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_FCNTL_H
/* Define to 1 if you have the `floor' function. */
#undef HAVE_FLOOR
/* Define to 1 if you have the header file. */
#undef HAVE_GETOPT_H
/* Define to 1 if you have the `getopt_long' function. */
#undef HAVE_GETOPT_LONG
/* Define to 1 if you have the `gettimeofday' function. */
#undef HAVE_GETTIMEOFDAY
/* Define to 1 if you have the header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the `asound' library (-lasound). */
#undef HAVE_LIBASOUND
/* Define to 1 if you have the `curses' library (-lcurses). */
#undef HAVE_LIBCURSES
/* Define to 1 if you have the header file. */
#undef HAVE_LIBINTL_H
/* Define to 1 if you have the `m' library (-lm). */
#undef HAVE_LIBM
/* Define to 1 if you have the `pthread' library (-lpthread). */
#undef HAVE_LIBPTHREAD
/* Define to 1 if you have the header file. */
#undef HAVE_LIMITS_H
/* Define to 1 if you have the