Commit 1372635e authored by Christoph Berg's avatar Christoph Berg

Import Upstream version 3.4.2

parent 7af96175
2015-06-14 Kamil Ignacak
* pre-release: updating information in selected files before
release (updating version numbers, adding notes new releases etc.)
2015-03-19 Kamil Ignacak
* fixes: Few minor changes in main code and test code that solve
problems found during tests on FreeBSD 10.
2015-03-13 Kamil Ignacak
* generator: fixing one possible cause of segfaults: limiting
number of executions of cw_gen_silence_internal() function that
somewhere down in call stack also called pthread_kill(). On some
occasions (during library cleanup) the thread id passed to
pthread_kill becomes invalid, and any subsequent calls to
cw_gen_silence_internal() resulted in segfault.
I have discovered this problem when testing src/cw/cw on Alpine
Linux. Other parts of unixcw package may have been affected by
this problem as well. I don't know how old the problem was (since
when it was possible to create segfaults when exiting from cw on
Alpine Linux). The fix was tested on Alpine Linux and on Debian
GNU/Linux.
2015-03-10 Kamil Ignacak
* tests: testing unixcw on Alpine Linux (with musl libc). Fixing
problems in cw_oss and cw_gen modules.
One important change in libcw made during tests on Alpine Linux:
generator's thread function is now a joinable thread (it was a
detached thread until now). I don't think that it will have any
impact on libcw's client code, but I thought that I should mention
this in ChangeLog.
Also adding one (unit ?) test function to libcw_test_internal.
2015-03-05 Kamil Ignacak
* cw_gen: today I've added second and third brand new unit test
function for cw_gen module in libcw_gen.c file. At the beginning
of this development cycle there were zero functions defined in
libcw_gen.c (there were, and still are, functions testing cw_gen
module in libcw_test_public.c). I think that's a progress :)
During creation of these functions I had an opportunity to improve
code and comments of generator's base functions.
2015-03-04 Kamil Ignacak
* asserts: base libcw is now compiled with -DNDEBUG flag by
default (asserts are "off"). The asserts are still "on" by default
in "unit tests" libcw. Asserts are switched "on" in base libcw
with "./configure --enable-dev".
2015-03-02 Kamil Ignacak
* generator: First unit test intended to be executed on building
"make check" target. The unit test function uncovered one error:
when a generator is created, then is *not* started, and then is
deleted, libcw called pthread_kill(&id, ...) on uninitialized id
in cw_gen_delete(). This caused a program to crash. This has been
fixed by adding a flag to cw_gen_t and additional code in
cw_gen.c.
2015-02-25 Kamil Ignacak
* tq: improving handling of tones in general, and "forever" tones
in particular.
I have created CW_TONE_INIT and CW_TONE_COPY macros that
(re-)initialize a tone variable (all of its fields), and that copy
values of fields from one cw_tone_t variable to other. There are
so many places where I need to set values of fields of cw_tone_t,
that I thought it would be beneficial to have some sort of
constructor/initializer. A full constructor that mallocs() tone
would be too much, but simple macro doing assignments is quite ok.
Until now the tone queue manager and generator used special value
CW_AUDIO_FOREVER_USECS assigned to cw_tone_t.usecs to indicate
that a tone is "forever" tone. This had one downside: a regular,
plain variable had special value that I had to constantly be aware
of. Now the "usecs" is again a regular variable - nothing more
than the length of tone. Information whether or not a tone is
"forever" tone is now conveyed by new field in cw_tone_t:
cw_tone_t.forever.
2015-02-23 Kamil Ignacak
* cw_gen: Lots of small updates. Mostly in comments, but I have
also removed few unused (commented out) lines of code and renamed
some internal functions. One noticeable change was in
cw_generator_set_tone_slope() - some corner cases of handling
function's arguments were cleared in function's top level
comments, and implementation has been updated accordingly.
2015-02-22 Kamil Ignacak
* key, generator, tone queue: Small improvements at intersection
of these modules. One example: after changing third argument to
cw_key_ik_enqueue_symbol_internal(), the function no longer has to
explicitly refer to length of Space/Dot/Dash stored in
generator. Enqueueing symbols with proper length is now
exclusively job of generator (at least in case of this function
call).
Also modifying names of some variables (so that they follow a
convention used already in receiver) and functions (so that their
purpose is more obvious).
So in a nutshell: small improvements in key, generator and tone
queue.
2015-02-22 Kamil Ignacak
* libcw.c: after populating the file with "global" functions for
generator, tone queue and receiver modules, I have also moved here
the "global" functions from cw_key module.
At this point the file contains definitions of global variables
cw_receiver, cw_generator and cw_key (cw_key is static in this
file).
2015-02-19 Kamil Ignacak
* libcw.c: I have (re)created the file. It will contain all the
functions that use global variables cw_generator, cw_receiver and
maybe cw_key as implicit arguments. After moving such functions
from other modules into libcw.c, other modules major should be
completely free of global variables, and should only contain
functions that operate on generators, receivers and keys as
explicit function arguments.
Then the function will have the old interface, and the new
interface. And it will be easy to have multiple generators (or
receivers) in the same application.
2014-12-30 Kamil Ignacak
* valgrind: running valgrind on libcw_test_internal reveals few
small problems in test code, and one small problem in "production"
......
......@@ -83,4 +83,13 @@ unixcw on:
Version 3.4.1 focused on internal changes in libcw. All library code
is now split between separate module files. Some test code from
libcw_test_public.c has been moved to respective modules.
\ No newline at end of file
libcw_test_public.c has been moved to respective modules.
Version 3.4.2 focused on internal changes in libcw. Improving
separation of modules in the library. Taking steps to separate
library's global variables (generator, receiver, key) and functions
implicitly operating on these variables from functions taking a
generator, receiver, or key as an argument.
Improving unit tests code.
Testing unixcw on Alpine Linux (because of musl libc) and FreeBSD 10.0
(because this is *unix*cw).
This is INSTALL file for unixcw 3.4.1.
This is INSTALL file for unixcw 3.4.2.
......@@ -72,6 +72,11 @@ Build-time requirements for unixcw:
unixcw 3.4.2 (or at least parts of it) was successfully compiled on
following platforms:
- Debian GNU/Linux 8 jessie/sid, x86_64, gcc 4.9.2;
- Alpine Linux 3.1, x86_64, gcc 4.8.3, musl 1.1.5;
- FreeBSD 10.0, x86_64, clang 3.3;
unixcw 3.4.1 (or at least parts of it) was successfully compiled on
following platforms:
......
......@@ -2,7 +2,7 @@ SUBDIRS=src
EXTRA_DIST = \
icon_unixcw.svg icon_unixcw.xpm \
unixcw-2.3.spec unixcw-3.4.1.lsm \
unixcw-2.3.spec unixcw-3.4.2.lsm \
po/UnixCW.po \
THANKS HISTORY \
debian
This diff is collapsed.
version 3.4.2 / 2015-06-17
libcw:
- fixing one possible cause of segfaults in generator code
(segfaults occurred when pthread_kill() was called with invalid
thread ID in some specific circumstances).
- fixing another problem with libcw: when a generator is created,
then is *not* started, and then is deleted, libcw called
pthread_kill(&id, ...) on uninitialized id in
cw_gen_delete(). This caused a program to crash.
- fixing problems with OSS and generator modules that surfaced
during tests on Alpine Linux.
- expanding unit tests.
- libcw is now compiled with -DNDEBUG flag by default (asserts are
"off"). The asserts are still "on" by default in "unit tests"
libcw. Asserts are switched "on" in base libcw with "./configure
--enable-dev".
- cw_generator_set_tone_slope(): some corner cases of handling
function's arguments were cleared in function's top level
comments, and implementation has been updated accordingly.
- Library soname/version changed from 6.3.1 to 6.4.1.
----------------------------------------------------------------------------
version 3.4.1 / 2015-01-02
libcw:
......
......@@ -116,28 +116,29 @@ In addition to libcw, the package comes with four basic applications:
Relationship between version of unixcw package and version of libcw is
following:
unixcw libcw
3.0 3.0.0
3.0.1 3.0.1
3.0.2 3.0.1
3.1.0 4.0.0
3.1.1 4.1.1
3.2.0 5.0.0
3.3.0 6.0.1
3.3.1 6.1.1
3.4.0 6.2.1
3.4.1 6.3.1
unixcw libcw release date
3.0 3.0.0 2011.12.13
3.0.1 3.0.1 2012.01.08
3.0.2 3.0.1 2012.06.18
3.1.0 4.0.0 2012.06.30
3.1.1 4.1.1 2012.07.04
3.2.0 5.0.0 2013.01.11
3.3.0 6.0.1 2013.12.10
3.3.1 6.1.1 2014-04-23
3.4.0 6.2.1 2014-11-11
3.4.1 6.3.1 2015-01-02
3.4.2 6.4.1 2015-06-XX
Primary development platform for unixcw is Debian GNU/Linux. An effort
has been made to compile and test at least parts of unixcw package on
following platforms:
has been made to compile and test at least parts of some versions of
unixcw package on following platforms:
- FreeBSD 9.3
- FreeBSD 10.0
- OpenBSD 5.5
- Alpine Linux 3.1
See INSTALL file for more information about compilation on different
OSes.
......
This diff is collapsed.
This diff is collapsed.
......@@ -19,7 +19,7 @@
# General initializations.
AC_PREREQ(2.57)
AC_INIT([unixcw], [3.4.1])
AC_INIT([unixcw], [3.4.2])
AC_CONFIG_SRCDIR([src/libcw/libcw_gen.c])
AM_INIT_AUTOMAKE
......@@ -136,7 +136,7 @@ fi
# I'm defining it here so that it's available in config.h and can be
# used in libcw's cw_version() function that should return the
# numbers.
LIBCW_VERSION=\"6:3:1\"
LIBCW_VERSION=\"6:4:1\"
AC_DEFINE_UNQUOTED([LIBCW_VERSION], $LIBCW_VERSION, [Library version, libtool notation])
AC_SUBST(LIBCW_VERSION)
......@@ -386,6 +386,9 @@ else
fi
# Development support tools.
AM_CONDITIONAL(LIBCW_WITH_DEV, test "$enable_dev" = "yes")
if test "$enable_dev" = "yes" ; then
......@@ -396,6 +399,17 @@ else
fi
if test "$WITH_DEV" = 'yes' ; then
LIBCW_NDEBUG=""
else
LIBCW_NDEBUG="-DNDEBUG"
fi
AC_SUBST(LIBCW_NDEBUG)
# #####
# end
# #####
......@@ -472,7 +486,9 @@ else
fi
fi
if test "`basename $CXX`" = "g++" ; then
CXXFLAGS="$CXXFLAGS -Wall -W -pedantic -Wno-long-long"
# -Wno-variadic-macros is to silence g++'s warnings about C99
# variadic macros from libcw_debug.h
CXXFLAGS="$CXXFLAGS -Wall -W -pedantic -Wno-long-long -Wno-variadic-macros"
else
if test "`basename $CXX`" = "icpc" ; then
CXXFLAGS="$CXXFLAGS -Wall -wd181,188,279,383,593,810,981,1469"
......@@ -595,18 +611,20 @@ AC_MSG_NOTICE([----------------------------------------------])
AC_MSG_NOTICE([------ $PACKAGE_NAME $PACKAGE_VERSION build configuration ------])
AC_MSG_NOTICE([operating system: ...................... $host_os])
AC_MSG_NOTICE([build libcw: ........................... yes])
AC_MSG_NOTICE([build cw & cwgen: ...................... yes])
AC_MSG_NOTICE([ libcw soname version: .............. $LIBCW_VERSION])
AC_MSG_NOTICE([ include console buzzer support: .... $WITH_CONSOLE])
AC_MSG_NOTICE([ include OSS support: ............... $WITH_OSS])
AC_MSG_NOTICE([ include ALSA support: .............. $WITH_ALSA])
AC_MSG_NOTICE([ include PulseAudio support: ........ $WITH_PULSEAUDIO])
AC_MSG_NOTICE([build cw: .............................. yes])
AC_MSG_NOTICE([build cwgen: ........................... yes])
AC_MSG_NOTICE([build cwcp: ............................ $WITH_CWCP])
AC_MSG_NOTICE([build xcwcp: ........................... $WITH_XCWCP])
if test "$WITH_XCWCP" = 'yes' ; then
AC_MSG_NOTICE([ Qt4 CFLAGS is $QT4_CFLAGS])
AC_MSG_NOTICE([ Qt4 LIBS is $QT4_LIBS])
AC_MSG_NOTICE([ Qt4 MOC is $MOC])
fi
AC_MSG_NOTICE([include console buzzer support: ........ $WITH_CONSOLE])
AC_MSG_NOTICE([include OSS support: ................... $WITH_OSS])
AC_MSG_NOTICE([include ALSA support: .................. $WITH_ALSA])
AC_MSG_NOTICE([include PulseAudio support: ............ $WITH_PULSEAUDIO])
AC_MSG_NOTICE([ Qt4 CFLAGS: $QT4_CFLAGS])
AC_MSG_NOTICE([ Qt4 LIBS: $QT4_LIBS])
AC_MSG_NOTICE([ Qt4 MOC: $MOC])
fi
if test "$WITH_DEV" = 'yes' ; then
AC_MSG_NOTICE([enable dev support: ..................... yes])
fi
......
This diff is collapsed.
......@@ -185,9 +185,6 @@
*/
#undef LT_OBJDIR
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
#undef NO_MINUS_C_MINUS_O
/* Name of package */
#undef PACKAGE
......
This diff is collapsed.
......@@ -18,7 +18,7 @@
.\" 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
.\"
.\"
.TH CW 1 "CW Tutor Package" "cw ver. 3.4.1" \" -*- nroff -*-
.TH CW 1 "CW Tutor Package" "cw ver. 3.4.2" \" -*- nroff -*-
.SH NAME
.\"
cw \- sound characters as Morse code on the soundcard or console speaker
......
......@@ -643,8 +643,8 @@ int main (int argc, char *const argv[])
void cw_atexit(void)
{
if (generator) {
cw_complete_reset();
cw_generator_stop();
//cw_complete_reset();
cw_generator_delete();
}
......
This diff is collapsed.
......@@ -18,7 +18,7 @@
.\" 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
.\"
.\"
.TH CWCP 1 "CW Tutor Package" "cwcp ver. 3.4.1" \" -*- nroff -*-
.TH CWCP 1 "CW Tutor Package" "cwcp ver. 3.4.2" \" -*- nroff -*-
.SH NAME
.\"
cwcp \- curses-based Morse tutor program
......
......@@ -925,7 +925,7 @@ bool mode_is_sending_active(void)
* character limit imposed by ISO C89 on string literal lengths.
*/
static const char *const INTRODUCTION = N_(
"UNIX/Linux Morse Tutor v3.4.1\n"
"UNIX/Linux Morse Tutor v3.4.2\n"
"Copyright (C) 1997-2006 Simon Baldwin\n"
"Copyright (C) 2011-2015 Kamil Ignacak\n"
"---------------------------------------------------------\n"
......
This diff is collapsed.
......@@ -18,7 +18,7 @@
.\" 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
.\"
.\"
.TH CWGEN 1 "CW Tutor Package" "cwgen ver. 3.4.1" \" -*- nroff -*-
.TH CWGEN 1 "CW Tutor Package" "cwgen ver. 3.4.2" \" -*- nroff -*-
.SH NAME
.\"
cwgen \- generate groups of random characters for Morse code practice
......
This diff is collapsed.
......@@ -38,6 +38,7 @@ EXTRA_DIST=include.awk libdoc.awk libfuncs.awk libpc.awk libsigs.awk \
# once. I can't compile these files into an utility library because
# the two targets are compiled with different CPPFLAGS.
LIBCW_BASE_C_FILES = \
libcw.c \
libcw_gen.c libcw_rec.c \
libcw_tq.c libcw_data.c libcw_key.c libcw_utils.c libcw_signal.c \
libcw_null.c libcw_console.c libcw_oss.c libcw_alsa.c libcw_pa.c \
......@@ -63,6 +64,14 @@ libcw_la_LDFLAGS = -version-number $(LIBCW_VERSION)
# target-specific compiler flags
libcw_la_CFLAGS = -rdynamic
# target-specific preprocessor flags (#defs and include dirs)
#
# $(LIBCW_NDEBUG) activates asserts in base libcw for dev builds, and
# deactivates asserts in base libcw for regular builds.
libcw_la_CPPFLAGS = $(AM_CPPFLAGS) $(LIBCW_NDEBUG)
libcw_includedir=$(includedir)
libcw_include_HEADERS = libcw.h libcw_debug.h
......@@ -77,10 +86,13 @@ libcw_include_HEADERS = libcw.h libcw_debug.h
# a regular shared library file found in build directory. It shouldn't
# compile all *.c files that are used to create library, it should
# compile only test files and "link" them with this library file.
libcw_test_public_SOURCES = libcw_test_public.c libcw_test.c
libcw_test_public_SOURCES = $(LIBCW_BASE_C_FILES) libcw_test_public.c libcw_test.c
# target-specific preprocessor flags (#defs and include dirs)
libcw_test_public_CPPFLAGS = $(AM_CPPFLAGS) -DLIBCW_UNIT_TESTS
# target-specific linker flags (objects to link)
libcw_test_public_LDADD = -L./.libs -lcw
libcw_test_public_LDADD = -lm -lpthread $(DL_LIB) -L./.libs -lcw
......
This diff is collapsed.
......@@ -18,7 +18,7 @@
.\" 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
.\"
.\"
.TH LIBCW 3 "CW Tutor Package" "libcw ver. 6.3.1" \" -*- nroff -*-
.TH LIBCW 3 "CW Tutor Package" "libcw ver. 6.4.1" \" -*- nroff -*-
.SH NAME
.\"
libcw \- general purpose Morse code functions library
......
This diff is collapsed.
......@@ -5,6 +5,6 @@ includedir=@includedir@
Name: libcw
Description: CW (Morse code) library
Version: 6.3.1
Version: 6.4.1
Libs: -L${libdir} -lcw
Cflags: -I${includedir}
......@@ -239,17 +239,10 @@ int cw_console_write(cw_gen_t *gen, cw_tone_t *tone)
{
assert (gen);
assert (gen->audio_system == CW_AUDIO_CONSOLE);
int usecs = tone->usecs;
if (usecs == CW_AUDIO_FOREVER_USECS) {
/* CW_AUDIO_FOREVER_USECS is a negative value, serving as
a hint for generator. We can't forward negative value to
cw_console_write_low_level_internal(). */
usecs = CW_AUDIO_QUANTUM_USECS;
}
assert (tone->len >= 0); /* TODO: shouldn't the condition be "tone->len > 0"? */
struct timespec n = { .tv_sec = 0, .tv_nsec = 0 };
cw_usecs_to_timespec_internal(&n, usecs);
cw_usecs_to_timespec_internal(&n, tone->len);
int rv = cw_console_write_low_level_internal(gen, (bool) tone->frequency);
cw_nanosleep_internal(&n);
......
......@@ -1308,6 +1308,31 @@ unsigned int test_cw_representation_to_hash_internal(void)
int p = fprintf(stdout, "libcw/data: cw_representation_to_hash_internal():");
/* Intended contents of input[] is something like that:
input[0] = "."
input[1] = "-"
input[2] = ".."
input[3] = "-."
input[4] = ".-"
input[5] = "--"
input[6] = "..."
input[7] = "-.."
input[8] = ".-."
input[9] = "--."
input[10] = "..-"
input[11] = "-.-"
input[12] = ".--"
input[13] = "---"
.
.
.
input[248] = ".-.----"
input[249] = "--.----"
input[250] = "..-----"
input[251] = "-.-----"
input[252] = ".------"
input[253] = "-------"
*/
char input[REPRESENTATION_TABLE_SIZE][REPRESENTATION_LEN + 1];
/* build table of all valid representations ("valid" as in "build
......@@ -1319,21 +1344,22 @@ unsigned int test_cw_representation_to_hash_internal(void)
shortest (single dot or dash) and ending with the
longest representations. */
for (unsigned int binary_representation = 0; binary_representation < (2 << (len - 1)); binary_representation++) {
unsigned int bit_vector_len = 2 << (len - 1);
/* A representation of length "len" can have
2^len distinct forms/values. The "for" loop
that we are in iterates over these 2^len
forms. */
/* A representation of length "len" can have 2^len
distinct values. The "for" loop that we are in
iterates over these 2^len forms. */
for (unsigned int bit_vector = 0; bit_vector < bit_vector_len; bit_vector++) {
/* Turn every '0' into dot, and every '1' into dash. */
for (unsigned int bit_pos = 0; bit_pos < len; bit_pos++) {
unsigned int bit = binary_representation & (1 << bit_pos);
unsigned int bit = bit_vector & (1 << bit_pos);
input[rep][bit_pos] = bit ? '-' : '.';
// fprintf(stderr, "rep = %x, bit pos = %d, bit = %d\n", binary_representation, bit_pos, bit);
// fprintf(stderr, "rep = %x, bit pos = %d, bit = %d\n", bit_vector, bit_pos, bit);
}
input[rep][len] = '\0';
// fprintf(stderr, "\ninput[%ld] = \"%s\"", rep, input[rep]);
//fprintf(stderr, "\ninput[%ld] = \"%s\"", rep, input[rep]);
rep++;
}
}
......
......@@ -21,12 +21,18 @@
#ifndef H_LIBCW_DEBUG
#define H_LIBCW_DEBUG
#include <stdio.h>
#include <assert.h>
#include <stdbool.h>
#if defined(__cplusplus)
extern "C"
{
......@@ -153,7 +159,9 @@ enum {
assert (expr); \
}
#else
#define cdw_assert(expr, ...)
/* "if ()" expression prevents compiler warnings about unused
variables. */
#define cw_assert(expr, ...) { if (expr) {} }
#endif
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -105,14 +105,10 @@ void cw_null_write(__attribute__((unused)) cw_gen_t *gen, cw_tone_t *tone)
{
assert (gen);
assert (gen->audio_system == CW_AUDIO_NULL);
int usecs = tone->usecs;
if (usecs == CW_AUDIO_FOREVER_USECS) {
usecs = CW_AUDIO_QUANTUM_USECS;
}
assert (tone->len >= 0); /* TODO: shouldn't the condition be "tone->len > 0"? */
struct timespec n = { .tv_sec = 0, .tv_nsec = 0 };
cw_usecs_to_timespec_internal(&n, usecs);
cw_usecs_to_timespec_internal(&n, tone->len);
cw_nanosleep_internal(&n);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment