From 5692f32bcfa049fc2b5555b5a883045b217349b9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C5=99emysl=20Janouch?=
Date: Thu, 9 Oct 2014 23:47:24 +0200
Subject: [PATCH] CMake-ify, rename to termkey2 for the time being
---
.gitignore | 2 +
CMakeLists.txt | 151 ++++++++++++++++++
Makefile | 178 ----------------------
README | 60 ++++++++
config-version.cmake.in | 10 ++
config.cmake.in | 8 +
demo-async.c | 2 +-
demo-glib.c | 2 +-
demo.c | 2 +-
driver-csi.c | 4 +-
driver-ti.c | 6 +-
termkey.pc.in | 8 -
termkey2-config.h.in | 8 +
termkey-internal.h => termkey2-internal.h | 8 +-
termkey.c => termkey2.c | 6 +-
termkey.h.in => termkey2.h | 9 +-
{t => tests}/01base.c | 0
{t => tests}/02getkey.c | 0
{t => tests}/03utf8.c | 0
{t => tests}/04flags.c | 0
{t => tests}/05read.c | 0
{t => tests}/06buffer.c | 0
{t => tests}/10keyname.c | 0
{t => tests}/11strfkey.c | 0
{t => tests}/12strpkey.c | 0
{t => tests}/13cmpkey.c | 0
{t => tests}/20canon.c | 0
{t => tests}/30mouse.c | 0
{t => tests}/31position.c | 0
{t => tests}/32modereport.c | 0
{t => tests}/39csi.c | 0
{t => tests}/taplib.c | 0
{t => tests}/taplib.h | 0
33 files changed, 258 insertions(+), 206 deletions(-)
create mode 100644 .gitignore
create mode 100644 CMakeLists.txt
delete mode 100644 Makefile
create mode 100644 README
create mode 100644 config-version.cmake.in
create mode 100644 config.cmake.in
delete mode 100644 termkey.pc.in
create mode 100644 termkey2-config.h.in
rename termkey-internal.h => termkey2-internal.h (95%)
rename termkey.c => termkey2.c (99%)
rename termkey.h.in => termkey2.h (97%)
rename {t => tests}/01base.c (100%)
rename {t => tests}/02getkey.c (100%)
rename {t => tests}/03utf8.c (100%)
rename {t => tests}/04flags.c (100%)
rename {t => tests}/05read.c (100%)
rename {t => tests}/06buffer.c (100%)
rename {t => tests}/10keyname.c (100%)
rename {t => tests}/11strfkey.c (100%)
rename {t => tests}/12strpkey.c (100%)
rename {t => tests}/13cmpkey.c (100%)
rename {t => tests}/20canon.c (100%)
rename {t => tests}/30mouse.c (100%)
rename {t => tests}/31position.c (100%)
rename {t => tests}/32modereport.c (100%)
rename {t => tests}/39csi.c (100%)
rename {t => tests}/taplib.c (100%)
rename {t => tests}/taplib.h (100%)
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..e5148b8
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+# Qt Creator
+/CMakeLists.txt.user*
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..81dbb2c
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,151 @@
+project (termkey2 C)
+cmake_minimum_required (VERSION 2.8.5)
+
+if ("${CMAKE_C_COMPILER_ID}" MATCHES "GNU" OR CMAKE_COMPILER_IS_GNUC)
+ set (CMAKE_C_FLAGS "-std=c99")
+ set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall -Wextra")
+endif ("${CMAKE_C_COMPILER_ID}" MATCHES "GNU" OR CMAKE_COMPILER_IS_GNUC)
+
+# Version
+set (project_VERSION_MAJOR 0)
+set (project_VERSION_MINOR 1)
+set (project_VERSION_PATCH 0)
+
+set (project_VERSION ${project_VERSION_MAJOR})
+set (project_VERSION ${project_VERSION}.${project_VERSION_MINOR})
+set (project_VERSION ${project_VERSION}.${project_VERSION_PATCH})
+
+set (project_API_VERSION ${project_VERSION_MAJOR})
+
+# Names
+set (project_LIB_NAME "termkey2-${project_API_VERSION}")
+set (project_INCLUDE_NAME "termkey2-${project_API_VERSION}")
+set (project_CMAKE_NAME "TermKey2")
+
+# Dependecies
+find_package (Curses)
+find_package (PkgConfig REQUIRED)
+pkg_check_modules (glib glib-2.0 gio-2.0)
+pkg_check_modules (unibilium unibilium>=0.1.0)
+
+# Header files with configuration
+configure_file (${PROJECT_SOURCE_DIR}/termkey2-config.h.in
+ ${PROJECT_BINARY_DIR}/termkey2-config.h)
+include_directories (${PROJECT_SOURCE_DIR} ${PROJECT_BINARY_DIR})
+
+# Project source files
+set (lib_sources
+ termkey2.c
+ driver-csi.c
+ driver-ti.c)
+set (lib_headers
+ termkey2.h
+ termkey2-internal.h
+ ${PROJECT_BINARY_DIR}/termkey2-config.h)
+
+# Project libraries
+if (unibilium_FOUND)
+ include_directories (${unibilium_INCLUDE_DIRS})
+ set (lib_libraries ${unibilium_LIBRARIES})
+ add_definitions (-DHAVE_UNIBILIUM)
+elseif (CURSES_FOUND)
+ include_directories (${CURSES_INCLUDE_DIR})
+ set (lib_libraries ${CURSES_LIBRARY})
+else (CURSES_FOUND)
+ message (SEND_ERROR "Unibilium not found, Curses not found")
+endif (unibilium_FOUND)
+
+# Create the library targets
+add_library (termkey2 SHARED ${lib_sources} ${lib_headers})
+target_link_libraries (termkey2 ${lib_libraries})
+set_target_properties (termkey2 PROPERTIES
+ OUTPUT_NAME ${project_LIB_NAME}
+ VERSION ${project_VERSION}
+ SOVERSION ${project_API_VERSION})
+
+add_library (termkey2-static STATIC ${lib_sources} ${lib_headers})
+target_link_libraries (termkey2-static ${lib_libraries})
+set_target_properties (termkey2-static PROPERTIES
+ OUTPUT_NAME ${project_LIB_NAME}
+ VERSION ${project_VERSION}
+ SOVERSION ${project_API_VERSION})
+
+# Demos
+add_executable (demo-async EXCLUDE_FROM_ALL demo-async.c)
+target_link_libraries (demo-async termkey2-static ${lib_libraries})
+
+add_executable (demo EXCLUDE_FROM_ALL demo.c)
+target_link_libraries (demo termkey2-static ${lib_libraries})
+
+set (demos demo demo-async)
+if (glib_FOUND)
+ include_directories (${glib_INCLUDE_DIRS})
+ add_executable (demo-glib EXCLUDE_FROM_ALL demo-glib.c)
+ target_link_libraries (demo
+ termkey2-static ${lib_libraries} ${glib_LIBRARIES})
+ list (APPEND demos demo-glib)
+endif (glib_FOUND)
+
+add_custom_target (demos DEPENDS ${demos})
+
+# The files to be installed
+include (GNUInstallDirs)
+install (TARGETS termkey2 termkey2-static DESTINATION ${CMAKE_INSTALL_LIBDIR})
+install (FILES LICENSE DESTINATION ${CMAKE_INSTALL_DOCDIR})
+install (FILES termkey2.h ${PROJECT_BINARY_DIR}/termkey2-config.h
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${project_INCLUDE_NAME})
+
+# Configuration for other CMake projects
+configure_file (config.cmake.in
+ ${PROJECT_BINARY_DIR}/${PROJECT_NAME}-config.cmake @ONLY)
+configure_file (config-version.cmake.in
+ ${PROJECT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake @ONLY)
+
+install (FILES ${PROJECT_BINARY_DIR}/${PROJECT_NAME}-config.cmake
+ ${PROJECT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}-${project_VERSION})
+
+# Do some unit tests
+option (BUILD_TESTING "Build tests" OFF)
+# TODO: glob, port the tests to CTest
+set (project_tests)
+
+if (BUILD_TESTING)
+ enable_testing ()
+ set (test_common_sources t/taplib.c t/taplib.h)
+
+ foreach (name ${project_tests})
+ add_executable (test-${name} t/${name}.c ${test_common_sources})
+ target_link_libraries (test-${name} ${lib_libraries})
+ add_test (test-${name} test-${name})
+ endforeach (name)
+endif (BUILD_TESTING)
+
+# pkg-config
+file (WRITE "${PROJECT_BINARY_DIR}/${PROJECT_NAME}.pc"
+ "Name: ${PROJECT_NAME}\n"
+ "Description: Terminal key input library\n"
+ "Version: ${project_VERSION}\n"
+ "Libs: -L${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR} -l${project_LIB_NAME}\n"
+ "Libs.private: ${lib_libraries}\n"
+ "Cflags: -I${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/${project_INCLUDE_NAME}\n")
+install (FILES "${PROJECT_BINARY_DIR}/${PROJECT_NAME}.pc"
+ DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
+
+# CPack
+set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "Terminal key input library")
+set (CPACK_PACKAGE_VENDOR "Premysl Janouch")
+set (CPACK_PACKAGE_CONTACT "Přemysl Janouch ")
+set (CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
+set (CPACK_PACKAGE_VERSION_MAJOR ${project_VERSION_MAJOR})
+set (CPACK_PACKAGE_VERSION_MINOR ${project_VERSION_MINOR})
+set (CPACK_PACKAGE_VERSION_PATCH ${project_VERSION_PATCH})
+set (CPACK_GENERATOR "TGZ;ZIP")
+set (CPACK_PACKAGE_FILE_NAME
+ "${CMAKE_PROJECT_NAME}-${project_VERSION}-${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}")
+set (CPACK_PACKAGE_INSTALL_DIRECTORY "${CMAKE_PROJECT_NAME}-${project_VERSION}")
+set (CPACK_SOURCE_GENERATOR "TGZ;ZIP")
+set (CPACK_SOURCE_IGNORE_FILES "/\\\\.git;/build;/CMakeLists.txt.user")
+set (CPACK_SOURCE_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${project_VERSION}")
+
+include (CPack)
diff --git a/Makefile b/Makefile
deleted file mode 100644
index b96a1d6..0000000
--- a/Makefile
+++ /dev/null
@@ -1,178 +0,0 @@
-ifeq ($(shell uname),Darwin)
- LIBTOOL ?= glibtool
-else
- LIBTOOL ?= libtool
-endif
-
-ifneq ($(VERBOSE),1)
- LIBTOOL +=--quiet
-endif
-
-CFLAGS +=-Wall -Wextra -std=c99
-
-ifeq ($(DEBUG),1)
- CFLAGS +=-ggdb -DDEBUG
-endif
-
-ifeq ($(PROFILE),1)
- CFLAGS +=-pg
- LDFLAGS+=-pg
-endif
-
-ifeq ($(shell pkg-config --atleast-version=0.1.0 unibilium && echo 1),1)
- CFLAGS +=$(shell pkg-config --cflags unibilium) -DHAVE_UNIBILIUM
- LDFLAGS+=$(shell pkg-config --libs unibilium)
-else ifeq ($(shell pkg-config tinfo && echo 1),1)
- CFLAGS +=$(shell pkg-config --cflags tinfo)
- LDFLAGS+=$(shell pkg-config --libs tinfo)
-else ifeq ($(shell pkg-config ncursesw && echo 1),1)
- CFLAGS +=$(shell pkg-config --cflags ncursesw)
- LDFLAGS+=$(shell pkg-config --libs ncursesw)
-else
- LDFLAGS+=-lncurses
-endif
-
-OBJECTS=termkey.lo driver-csi.lo driver-ti.lo
-LIBRARY=libtermkey.la
-
-DEMOS=demo demo-async
-
-ifeq ($(shell pkg-config glib-2.0 && echo 1),1)
- DEMOS+=demo-glib
-endif
-
-DEMO_OBJECTS=$(DEMOS:=.lo)
-
-TESTSOURCES=$(wildcard t/[0-9]*.c)
-TESTFILES=$(TESTSOURCES:.c=.t)
-
-VERSION_MAJOR=0
-VERSION_MINOR=17
-
-VERSION_CURRENT=12
-VERSION_REVISION=0
-VERSION_AGE=11
-
-PREFIX=/usr/local
-LIBDIR=$(PREFIX)/lib
-INCDIR=$(PREFIX)/include
-MANDIR=$(PREFIX)/share/man
-MAN3DIR=$(MANDIR)/man3
-MAN7DIR=$(MANDIR)/man7
-
-all: $(LIBRARY) $(DEMOS)
-
-%.lo: %.c termkey.h termkey-internal.h
- $(LIBTOOL) --mode=compile --tag=CC $(CC) $(CFLAGS) -o $@ -c $<
-
-$(LIBRARY): $(OBJECTS)
- $(LIBTOOL) --mode=link --tag=CC $(CC) -rpath $(LIBDIR) -version-info $(VERSION_CURRENT):$(VERSION_REVISION):$(VERSION_AGE) $(LDFLAGS) -o $@ $^
-
-demo: $(LIBRARY) demo.lo
- $(LIBTOOL) --mode=link --tag=CC $(CC) -o $@ $^
-
-demo-async: $(LIBRARY) demo-async.lo
- $(LIBTOOL) --mode=link --tag=CC $(CC) -o $@ $^
-
-demo-glib.lo: demo-glib.c termkey.h
- $(LIBTOOL) --mode=compile --tag=CC $(CC) -o $@ -c $< $(shell pkg-config glib-2.0 --cflags)
-
-demo-glib: $(LIBRARY) demo-glib.lo
- $(LIBTOOL) --mode=link --tag=CC $(CC) -o $@ $^ $(shell pkg-config glib-2.0 --libs)
-
-t/%.t: t/%.c $(LIBRARY) t/taplib.lo
- $(LIBTOOL) --mode=link --tag=CC $(CC) -o $@ $^
-
-t/taplib.lo: t/taplib.c
- $(LIBTOOL) --mode=compile --tag=CC $(CC) $(CFLAGS) -o $@ -c $^
-
-.PHONY: test
-test: $(TESTFILES)
- prove -e ""
-
-.PHONY: clean-test
-clean-test:
- $(LIBTOOL) --mode=clean rm -f $(TESTFILES) t/taplib.lo
-
-.PHONY: clean
-clean: clean-test
- $(LIBTOOL) --mode=clean rm -f $(OBJECTS) $(DEMO_OBJECTS)
- $(LIBTOOL) --mode=clean rm -f $(LIBRARY)
- $(LIBTOOL) --mode=clean rm -rf $(DEMOS)
-
-.PHONY: install
-install: install-inc install-lib install-man
- $(LIBTOOL) --mode=finish $(DESTDIR)$(LIBDIR)
-
-install-inc: termkey.h
- install -d $(DESTDIR)$(INCDIR)
- install -m644 termkey.h $(DESTDIR)$(INCDIR)
- install -d $(DESTDIR)$(LIBDIR)/pkgconfig
- sed "s,@LIBDIR@,$(LIBDIR),;s,@INCDIR@,$(INCDIR)," $(DESTDIR)$(LIBDIR)/pkgconfig/termkey.pc
-
-install-lib: $(LIBRARY)
- install -d $(DESTDIR)$(LIBDIR)
- $(LIBTOOL) --mode=install install libtermkey.la $(DESTDIR)$(LIBDIR)/libtermkey.la
-
-install-man:
- install -d $(DESTDIR)$(MAN3DIR)
- install -d $(DESTDIR)$(MAN7DIR)
- for F in man/*.3; do \
- gzip <$$F >$(DESTDIR)$(MAN3DIR)/$${F#man/}.gz; \
- done
- for F in man/*.7; do \
- gzip <$$F >$(DESTDIR)$(MAN7DIR)/$${F#man/}.gz; \
- done
- while read FROM EQ TO; do \
- echo ln -sf $$TO.gz $(DESTDIR)$(MAN3DIR)/$$FROM.gz; \
- done < man/also
-
-# DIST CUT
-
-MANSOURCE=$(wildcard man/*.3.sh)
-BUILTMAN=$(MANSOURCE:.3.sh=.3)
-
-VERSION=$(VERSION_MAJOR).$(VERSION_MINOR)
-
-all: doc
-
-doc: $(BUILTMAN)
-
-%.3: %.3.sh
- sh $< >$@
-
-clean: clean-built
-
-clean-built:
- rm -f $(BUILTMAN) termkey.h
-
-termkey.h: termkey.h.in Makefile
- rm -f $@
- sed -e 's/@@VERSION_MAJOR@@/$(VERSION_MAJOR)/g' \
- -e 's/@@VERSION_MINOR@@/$(VERSION_MINOR)/g' \
- $< >$@
- chmod a-w $@
-
-DISTDIR=libtermkey-$(VERSION)
-
-distdir: all
- mkdir __distdir
- cp *.c *.h LICENSE __distdir
- mkdir __distdir/t
- cp t/*.c t/*.h __distdir/t
- mkdir __distdir/man
- cp man/*.[37] man/also __distdir/man
- sed "s,@VERSION@,$(VERSION)," __distdir/termkey.pc.in
- sed "/^# DIST CUT/Q" __distdir/Makefile
- mv __distdir $(DISTDIR)
-
-TARBALL=$(DISTDIR).tar.gz
-
-dist: distdir
- tar -czf $(TARBALL) $(DISTDIR)
- rm -rf $(DISTDIR)
-
-HTMLDIR=html
-
-htmldocs: $(BUILTMAN)
- perl $(HOME)/src/perl/Parse-Man/examples/man-to-html.pl -O $(HTMLDIR) --file-extension tmpl --link-extension html --template home_lou.tt2 --also man/also man/*.3 man/*.7 --index index.tmpl
diff --git a/README b/README
new file mode 100644
index 0000000..3a1c2ee
--- /dev/null
+++ b/README
@@ -0,0 +1,60 @@
+termkey2
+========
+
+`termkey2' is a library providing an alternative to ncurses' handling of
+terminal input. ncurses does a really terrible job at that, mainly wrt. mouse
+support which seems to be utterly broken. If you can drag things in a terminal
+application, such as in VIM, I can assure you it's not using ncurses for that.
+
+Since terminal I/O is really complicated and full of special cases, this project
+doesn't aspire to also replace the output part of ncurses, but is rather
+complementary to it. In the end it makes use of its terminfo library.
+
+The API isn't stable yet. Tell me what needs to be done so I can fix it first.
+
+Building and Installing
+-----------------------
+Build dependencies: GCC/Clang, pkg-config, cmake >= 2.8.5
+Optional dependencies: Unibilium (alternative for curses), GLib (for the demos)
+
+ $ git clone https://github.com/pjanouch/termkey2.git
+ $ mkdir build
+ $ cd build
+ $ cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local
+
+To install the library, you can do either the usual:
+ $ make install
+
+Or you can try telling CMake to make a package for you. For Debian it is:
+ $ cpack -G DEB
+ # dpkg -i termkey2-*.deb
+
+To see the library in action, you can try running the demos, which are
+statically linked against the library, and hence they can be run as they are:
+
+ $ make demos
+
+What's Different From the Original termkey?
+-------------------------------------------
+The main change is throwing away any UTF-8 dependent code, making the library
+capable of handling all unibyte and multibyte encodings supported by iconv on
+your system. The characters are still presented as Unicode at the end, however,
+as the other sensible option is wchar_t and that doesn't really work well, see
+http://gnu.org/software/libunistring/manual/libunistring.html#The-wchar_005ft-mess
+
+Another change worth mentioning is the usage of CMake instead of the problematic
+libtool-based Makefile. Now you can include this project in your other CMake-
+-based projects and simply import the target. No package maintainer action is
+needed for you to enjoy the benefits of proper terminal input.
+
+The rest is just me going silly over formatting and various unimportant stuff.
+Oh, and I've deleted the manpages. It needs more Doxygen. :) TBD
+
+License
+-------
+`termkey2' is based on the `termkey' library originally written by Paul Evans
+, with additional changes made by Přemysl Janouch
+.
+
+You may use the software under the terms of the MIT license, the text of which
+is included within the package, see the file LICENSE.
diff --git a/config-version.cmake.in b/config-version.cmake.in
new file mode 100644
index 0000000..dbd7077
--- /dev/null
+++ b/config-version.cmake.in
@@ -0,0 +1,10 @@
+set (PACKAGE_VERSION "@project_VERSION@")
+
+if ("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
+ set (PACKAGE_VERSION_COMPATIBLE FALSE)
+else ("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
+ set (PACKAGE_VERSION_COMPATIBLE TRUE)
+ if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}")
+ set (PACKAGE_VERSION_EXACT TRUE)
+ endif ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}")
+endif ("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
diff --git a/config.cmake.in b/config.cmake.in
new file mode 100644
index 0000000..9a19a6f
--- /dev/null
+++ b/config.cmake.in
@@ -0,0 +1,8 @@
+# - Config file for @project_CMAKE_NAME@
+# It defines the following variables:
+# @project_CMAKE_NAME@_INCLUDE_DIRS
+# @project_CMAKE_NAME@_LIBRARIES
+
+set (@project_CMAKE_NAME@_INCLUDE_DIRS @CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@/@project_INCLUDE_NAME@)
+set (@project_CMAKE_NAME@_LIBRARIES termkey2)
+
diff --git a/demo-async.c b/demo-async.c
index 6efcf28..88d68a5 100644
--- a/demo-async.c
+++ b/demo-async.c
@@ -6,7 +6,7 @@
#include
#include
-#include "termkey.h"
+#include "termkey2.h"
static void
on_key (termkey_t *tk, termkey_key_t *key)
diff --git a/demo-glib.c b/demo-glib.c
index 0162042..dfe5cd4 100644
--- a/demo-glib.c
+++ b/demo-glib.c
@@ -3,7 +3,7 @@
#include
#include
-#include "termkey.h"
+#include "termkey2.h"
static termkey_t *tk;
static int timeout_id;
diff --git a/demo.c b/demo.c
index 1f89ea0..5bb9fc2 100644
--- a/demo.c
+++ b/demo.c
@@ -6,7 +6,7 @@
#include
#include
-#include "termkey.h"
+#include "termkey2.h"
int
main(int argc, char *argv[])
diff --git a/driver-csi.c b/driver-csi.c
index 4e1f275..23f38e7 100644
--- a/driver-csi.c
+++ b/driver-csi.c
@@ -1,5 +1,5 @@
-#include "termkey.h"
-#include "termkey-internal.h"
+#include "termkey2.h"
+#include "termkey2-internal.h"
#include
#include
diff --git a/driver-ti.c b/driver-ti.c
index ed0e9df..93fda30 100644
--- a/driver-ti.c
+++ b/driver-ti.c
@@ -1,8 +1,8 @@
// we want strdup()
#define _XOPEN_SOURCE 600
-#include "termkey.h"
-#include "termkey-internal.h"
+#include "termkey2.h"
+#include "termkey2-internal.h"
#ifdef HAVE_UNIBILIUM
# include
@@ -240,7 +240,7 @@ load_terminfo (termkey_ti_t *ti, const char *term)
if (node && !insert_seq (ti, value, node))
{
- free(node);
+ free (node);
return 0;
}
}
diff --git a/termkey.pc.in b/termkey.pc.in
deleted file mode 100644
index 31113be..0000000
--- a/termkey.pc.in
+++ /dev/null
@@ -1,8 +0,0 @@
-libdir=@LIBDIR@
-includedir=@INCDIR@
-
-Name: termkey
-Description: Abstract terminal key input library
-Version: @VERSION@
-Libs: -L${libdir} -ltermkey
-Cflags: -I${includedir}
diff --git a/termkey2-config.h.in b/termkey2-config.h.in
new file mode 100644
index 0000000..676a2c0
--- /dev/null
+++ b/termkey2-config.h.in
@@ -0,0 +1,8 @@
+#ifndef TERMKEY2_CONFIG_H
+#define TERMKEY2_CONFIG_H
+
+#define TERMKEY_VERSION_MAJOR @project_VERSION_MAJOR@
+#define TERMKEY_VERSION_MINOR @project_VERSION_MINOR@
+
+#endif // ! TERMKEY2_CONFIG_H
+
diff --git a/termkey-internal.h b/termkey2-internal.h
similarity index 95%
rename from termkey-internal.h
rename to termkey2-internal.h
index 7282454..b76ba79 100644
--- a/termkey-internal.h
+++ b/termkey2-internal.h
@@ -1,7 +1,7 @@
-#ifndef TERMKEY_INTERNAL_H
-#define TERMKEY_INTERNAL_H
+#ifndef TERMKEY2_INTERNAL_H
+#define TERMKEY2_INTERNAL_H
-#include "termkey.h"
+#include "termkey2.h"
#include
#include
@@ -111,5 +111,5 @@ termkey_key_set_linecol (termkey_key_t *key, int line, int col)
extern termkey_driver_t termkey_driver_csi;
extern termkey_driver_t termkey_driver_ti;
-#endif // ! TERMKEY_INTERNAL_H
+#endif // ! TERMKEY2_INTERNAL_H
diff --git a/termkey.c b/termkey2.c
similarity index 99%
rename from termkey.c
rename to termkey2.c
index ad80657..e9b574c 100644
--- a/termkey.c
+++ b/termkey2.c
@@ -1,5 +1,5 @@
-#include "termkey.h"
-#include "termkey-internal.h"
+#include "termkey2.h"
+#include "termkey2-internal.h"
#include
#include
@@ -739,7 +739,7 @@ emit_codepoint (termkey_t *tk, uint32_t codepoint, termkey_key_t *key)
* lowercase
*/
if (codepoint + 0x40 >= 'A' && codepoint + 0x40 <= 'Z')
- // It's a letter - use lowecase instead
+ // It's a letter - use lowercase instead
key->code.codepoint = codepoint + 0x60;
else
key->code.codepoint = codepoint + 0x40;
diff --git a/termkey.h.in b/termkey2.h
similarity index 97%
rename from termkey.h.in
rename to termkey2.h
index 2a4fa8d..9362215 100644
--- a/termkey.h.in
+++ b/termkey2.h
@@ -1,12 +1,11 @@
-#ifndef TERMKEY_H
-#define TERMKEY_H
+#ifndef TERMKEY2_H
+#define TERMKEY2_H
#include
#include
#include
-#define TERMKEY_VERSION_MAJOR @@VERSION_MAJOR@@
-#define TERMKEY_VERSION_MINOR @@VERSION_MINOR@@
+#include "termkey2-config.h"
#define TERMKEY_CHECK_VERSION \
termkey_check_version (TERMKEY_VERSION_MAJOR, TERMKEY_VERSION_MINOR)
@@ -268,5 +267,5 @@ const char *termkey_strpkey (termkey_t *tk, const char *str,
int termkey_keycmp (termkey_t *tk,
const termkey_key_t *key1, const termkey_key_t *key2);
-#endif // ! TERMKEY_H
+#endif // ! TERMKEY2_H
diff --git a/t/01base.c b/tests/01base.c
similarity index 100%
rename from t/01base.c
rename to tests/01base.c
diff --git a/t/02getkey.c b/tests/02getkey.c
similarity index 100%
rename from t/02getkey.c
rename to tests/02getkey.c
diff --git a/t/03utf8.c b/tests/03utf8.c
similarity index 100%
rename from t/03utf8.c
rename to tests/03utf8.c
diff --git a/t/04flags.c b/tests/04flags.c
similarity index 100%
rename from t/04flags.c
rename to tests/04flags.c
diff --git a/t/05read.c b/tests/05read.c
similarity index 100%
rename from t/05read.c
rename to tests/05read.c
diff --git a/t/06buffer.c b/tests/06buffer.c
similarity index 100%
rename from t/06buffer.c
rename to tests/06buffer.c
diff --git a/t/10keyname.c b/tests/10keyname.c
similarity index 100%
rename from t/10keyname.c
rename to tests/10keyname.c
diff --git a/t/11strfkey.c b/tests/11strfkey.c
similarity index 100%
rename from t/11strfkey.c
rename to tests/11strfkey.c
diff --git a/t/12strpkey.c b/tests/12strpkey.c
similarity index 100%
rename from t/12strpkey.c
rename to tests/12strpkey.c
diff --git a/t/13cmpkey.c b/tests/13cmpkey.c
similarity index 100%
rename from t/13cmpkey.c
rename to tests/13cmpkey.c
diff --git a/t/20canon.c b/tests/20canon.c
similarity index 100%
rename from t/20canon.c
rename to tests/20canon.c
diff --git a/t/30mouse.c b/tests/30mouse.c
similarity index 100%
rename from t/30mouse.c
rename to tests/30mouse.c
diff --git a/t/31position.c b/tests/31position.c
similarity index 100%
rename from t/31position.c
rename to tests/31position.c
diff --git a/t/32modereport.c b/tests/32modereport.c
similarity index 100%
rename from t/32modereport.c
rename to tests/32modereport.c
diff --git a/t/39csi.c b/tests/39csi.c
similarity index 100%
rename from t/39csi.c
rename to tests/39csi.c
diff --git a/t/taplib.c b/tests/taplib.c
similarity index 100%
rename from t/taplib.c
rename to tests/taplib.c
diff --git a/t/taplib.h b/tests/taplib.h
similarity index 100%
rename from t/taplib.h
rename to tests/taplib.h