]> git.mdlowis.com Git - proto/labwc.git/commitdiff
Remove tools/ and tests/
authorJohan Malm <jgm323@gmail.com>
Mon, 28 Sep 2020 20:06:13 +0000 (21:06 +0100)
committerJohan Malm <jgm323@gmail.com>
Mon, 28 Sep 2020 20:06:13 +0000 (21:06 +0100)
34 files changed:
meson.build
tests/meson.build [deleted file]
tests/t1000-rcxml-simple-parse.c [deleted file]
tests/t1001-rcxml-nodenames-simple.c [deleted file]
tests/tap.c [deleted file]
tests/tap.h [deleted file]
tools/asan_suppressions.txt [deleted file]
tools/build [deleted file]
tools/check [deleted file]
tools/dirs/.gitignore [deleted file]
tools/dirs/Makefile [deleted file]
tools/dirs/dir-list.c [deleted file]
tools/hex/.gitignore [deleted file]
tools/hex/Makefile [deleted file]
tools/hex/hex-color-average.c [deleted file]
tools/pango/.gitignore [deleted file]
tools/pango/Makefile [deleted file]
tools/pango/font-height.c [deleted file]
tools/rcxml/.gitignore [deleted file]
tools/rcxml/Makefile [deleted file]
tools/rcxml/README.md [deleted file]
tools/rcxml/rcxml-print-nodenames.c [deleted file]
tools/run [deleted file]
tools/theme/.gitignore [deleted file]
tools/theme/Makefile [deleted file]
tools/theme/list-themes.sh [deleted file]
tools/theme/theme-helper.c [deleted file]
tools/xbm/.gitignore [deleted file]
tools/xbm/5x5.xbm [deleted file]
tools/xbm/8x8.xbm [deleted file]
tools/xbm/9x9.xbm [deleted file]
tools/xbm/Makefile [deleted file]
tools/xbm/xbm-parse.c [deleted file]
tools/xbm/xbm-tokenize.c [deleted file]

index 5a9ce048ac1f77be9977389a95b332c4708bf9bb..59f6d8c57ee31dbe25ddf091f6453b84360ade39 100644 (file)
@@ -54,7 +54,6 @@ labwc_deps      = [
 ]
 
 subdir('src')
-subdir('tests')
 subdir('docs')
 
 executable(
diff --git a/tests/meson.build b/tests/meson.build
deleted file mode 100644 (file)
index 3175a90..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-rcxml_lib = static_library(
-  'rcxml',
-  sources: files(
-    '../src/config/rcxml.c',
-    '../src/config/keybind.c',
-    '../src/common/dir.c',
-    '../src/common/buf.c',
-    '../src/common/font.c',
-    '../src/common/log.c',
-  ),
-  dependencies: labwc_deps,
-  include_directories: [labwc_inc],
-)
-
-rcxml_tests = [
-  't1000-rcxml-simple-parse.c',
-  't1001-rcxml-nodenames-simple.c',
-]
-
-foreach t : rcxml_tests
-  testname = t.split('.')[0].underscorify()
-  exe = executable(
-    testname,
-    sources: [t, 'tap.c'],
-    dependencies: [wlroots, cairo, pangocairo],
-    include_directories: [labwc_inc],
-    link_with: [rcxml_lib],
-  )
-  test(testname, exe)
-endforeach
-
diff --git a/tests/t1000-rcxml-simple-parse.c b/tests/t1000-rcxml-simple-parse.c
deleted file mode 100644 (file)
index 7495b4d..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-#define _POSIX_C_SOURCE 200809L
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <stdbool.h>
-#include <cairo.h>
-#include <pango/pangocairo.h>
-
-#include "config/rcxml.h"
-#include "tap.h"
-
-struct rcxml rc = { 0 };
-
-static char src[] =
-"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
-"<openbox_config>\n"
-"<lab>\n"
-"  <csd>yes</csd>\n"
-"</lab>\n"
-"</openbox_config>\n";
-
-int main(int argc, char **argv)
-{
-       plan(1);
-
-       char template[] = "temp_file_XXXXXX";
-       int fd = mkstemp(template);
-       if (fd < 0)
-               exit(1);
-       write(fd, src, sizeof(src) - 1);
-
-       rcxml_read(template);
-       unlink(template);
-
-       diag("Simple parse rc.xml");
-       ok1(rc.xdg_shell_server_side_deco);
-
-       rcxml_finish();
-       pango_cairo_font_map_set_default(NULL);
-       return exit_status();
-}
diff --git a/tests/t1001-rcxml-nodenames-simple.c b/tests/t1001-rcxml-nodenames-simple.c
deleted file mode 100644 (file)
index c9aee4c..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-#define _POSIX_C_SOURCE 200809L
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <stdbool.h>
-#include <string.h>
-#include <cairo.h>
-#include <pango/pangocairo.h>
-
-#include "config/rcxml.h"
-#include "tap.h"
-
-struct rcxml rc = { 0 };
-
-static char src[] =
-"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
-"<openbox_config>\n"
-"<lab>\n"
-"  <csd>yes</csd>\n"
-"</lab>\n"
-"</openbox_config>\n";
-
-static char expect[] =
-"openbox_config\n"
-"lab\n"
-"csd.lab\n"
-"csd.lab: yes\n";
-
-int main(int argc, char **argv)
-{
-       struct buf actual, source;
-
-       buf_init(&actual);
-       buf_init(&source);
-       buf_add(&source, src);
-
-       plan(1);
-       diag("Parse simple rc.xml and read nodenames");
-
-       rcxml_get_nodenames(&actual);
-       rcxml_parse_xml(&source);
-       printf("%s\n", actual.buf);
-       printf("%s\n", expect);
-
-       ok1(!strcmp(expect, actual.buf));
-       free(actual.buf);
-       free(source.buf);
-       pango_cairo_font_map_set_default(NULL);
-       return exit_status();
-}
diff --git a/tests/tap.c b/tests/tap.c
deleted file mode 100644 (file)
index 7b0c341..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <ctype.h>
-#include <unistd.h>
-#include <stdbool.h>
-
-#include "tap.h"
-
-static int nr_tests_run;
-static int nr_tests_expected;
-static int nr_tests_failed;
-
-void plan(int nr_tests)
-{
-       static bool run_once;
-
-       if (run_once)
-               return;
-       run_once = true;
-       printf("1..%d\n", nr_tests);
-       nr_tests_expected = nr_tests;
-}
-
-void diag(const char *fmt, ...)
-{
-       va_list params;
-
-       fprintf(stdout, "# ");
-       va_start(params, fmt);
-       vfprintf(stdout, fmt, params);
-       va_end(params);
-       fprintf(stdout, "\n");
-}
-
-int ok(int result, const char *testname, ...)
-{
-       va_list params;
-
-       ++nr_tests_run;
-       if (!result) {
-               printf("not ");
-               nr_tests_failed++;
-       }
-       printf("ok %d", nr_tests_run);
-       if (testname) {
-               printf(" - ");
-               va_start(params, testname);
-               vfprintf(stdout, testname, params);
-               va_end(params);
-       }
-       printf("\n");
-       if (!result)
-               diag("    Failed test");
-       return result ? 1 : 0;
-}
-
-int exit_status(void)
-{
-       int ret;
-
-       if (nr_tests_expected != nr_tests_run) {
-               diag("expected=%d; run=%d; failed=%d", nr_tests_expected,
-                    nr_tests_run, nr_tests_failed);
-       }
-       if (nr_tests_expected < nr_tests_run)
-               ret = nr_tests_run - nr_tests_expected;
-       else
-               ret = nr_tests_failed + nr_tests_expected - nr_tests_run;
-       if (ret > 255)
-               ret = 255;
-       return ret;
-}
diff --git a/tests/tap.h b/tests/tap.h
deleted file mode 100644 (file)
index 0f59d58..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- * Minimalist, partial TAP implementation
- *
- * Copyright Johan Malm 2020
- */
-
-#ifndef TAP_H
-#define TAP_H
-
-#define ok1(__x__) (ok(__x__, "%s", #__x__))
-
-void plan(int nr_tests);
-void diag(const char *fmt, ...);
-int ok(int result, const char *test_name, ...);
-int exit_status(void);
-
-#endif /* TAP_H */
diff --git a/tools/asan_suppressions.txt b/tools/asan_suppressions.txt
deleted file mode 100644 (file)
index 49c9e58..0000000
+++ /dev/null
@@ -1 +0,0 @@
-leak:libxcb*
diff --git a/tools/build b/tools/build
deleted file mode 100755 (executable)
index 97c081f..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/bin/sh
-#
-# Automatically build labwc
-#
-
-builddir=build
-g_asan=
-g_wlroots=
-
-die () { printf '\033[31mfatal:\033[m %b\n' "$@" >&2 ; exit 1 ; }
-warn () { printf '\033[31mwarn:\033[m %b\n' "$@" >&2 ; }
-say () { printf '\033[32m%s\033[m' "$@" ; }
-
-usage () {
-       printf "%s\n" \
-"Usage: ./tools/build [<options>]
-Options:
--w             install wlroots as subproject
---asan         run with ASAN and UBSAN
---clang        run with clang
--h, --help     show help"
-       exit 0
-}
-
-wlroots_subproject () {
-       if ! [ -e subprojects/wlroots ]; then
-               git clone https://github.com/swaywm/wlroots subprojects/wlroots
-       fi
-}
-
-main () {
-       [[ -e src/main.c ]] || die "must be run from top-level directory"
-
-       for arg
-       do
-               opt=${arg%%=*}
-               var=${arg#*=}
-               case "$opt" in
-               -w)
-                       wlroots_subproject
-                       g_wlroots="-Dwlroots:default_library=static"
-                       ;;
-               --asan)
-                       g_asan="-Db_sanitize=address,undefined" ;;
-               --clang)
-                       export CC=clang
-                       ;;
-               -h|--help)
-                       usage ;;
-               esac
-       done
-
-       [ -e ${builddir} ] && die "build directory already exists - delete and run again"
-       meson ${g_asan} ${g_wlroots} ${builddir}
-       ninja -C ${builddir}
-       LSAN_OPTIONS=suppressions=../tools/asan_suppressions.txt ninja -C ${builddir} test
-}
-
-main "$@"
diff --git a/tools/check b/tools/check
deleted file mode 100755 (executable)
index 1fcd7b2..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/bash
-
-options="\
-       --enable=all \
-       --suppress=missingInclude \
-       --suppress=unusedFunction \
-       --suppress=unmatchedSuppression \
-"
-
-for f in  $(find src/ -name "*.c"); do
-       cppcheck ${options} "${f}"
-done
-
diff --git a/tools/dirs/.gitignore b/tools/dirs/.gitignore
deleted file mode 100644 (file)
index 0cfcbd2..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-*.o
-dir-list
diff --git a/tools/dirs/Makefile b/tools/dirs/Makefile
deleted file mode 100644 (file)
index 7d8a9c6..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-CFLAGS  += -g -Wall -I../../include
-CFLAGS  += `pkg-config --cflags glib-2.0`
-LDFLAGS += `pkg-config --libs glib-2.0`
-
-all:
-       $(CC) $(CFLAGS) -o dir-list dir-list.c ../../src/common/dir.c ../../src/common/log.c $(LDFLAGS)
-
-clean:
-       rm -f *.o dir-list
diff --git a/tools/dirs/dir-list.c b/tools/dirs/dir-list.c
deleted file mode 100644 (file)
index eb7eb00..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "common/dir.h"
-
-int main()
-{
-       setenv("LABWC_DEBUG_DIR_CONFIG_AND_THEME", "1", 1);
-       setenv("XDG_CONFIG_HOME", "/a:/bbb:/ccccc:/etc/foo", 1);
-       printf("%s\n", config_dir());   
-       printf("%s\n", theme_dir("Numix"));
-}
diff --git a/tools/hex/.gitignore b/tools/hex/.gitignore
deleted file mode 100644 (file)
index ccf9afa..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-hex-color-average
-hex-color-average.o
diff --git a/tools/hex/Makefile b/tools/hex/Makefile
deleted file mode 100644 (file)
index bd60aae..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-hex-color-average: hex-color-average.o
-
-clean:
-       rm -f hex-color-average *.o
diff --git a/tools/hex/hex-color-average.c b/tools/hex/hex-color-average.c
deleted file mode 100644 (file)
index 28877f6..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-static int hexval(int c)
-{
-       int ret = -1;
-       switch (c) {
-       case '0'...'9':
-               ret = c - '0';
-               break;
-       case 'a'...'f':
-               ret = c - 'a' + 10;
-               break;
-       case 'A'...'F':
-               ret = c - 'A' + 10;
-               break;
-       }
-       return ret;
-}
-
-int hex2dec(const char *hexstring)
-{
-       int value = 0, pos = 0, hex;
-       while ((hex = hexval(hexstring[pos++])) != -1)
-               value = (value << 4) + hex;
-       return value;
-}
-
-void usage(const char *command)
-{
-       printf("Usage: %s <rrggbb> <rrggbb>\n", command);
-       exit(1);
-}
-int main(int argc, char **argv)
-{
-       double col[6] = { 0 };
-
-       if (argc < 3)
-               usage(argv[0]);
-
-       for (int j = 1; j < argc; j++) {
-               int len = strlen(argv[j]);
-               for (int i = 0; i < len / 2; i++) {
-                       char buf[3] = { 0 };
-                       buf[0] = argv[j][i * 2];
-                       buf[1] = argv[j][i * 2 + 1];
-                       col[(j - 1) * 3 + i] = hex2dec(buf) / 255.0;
-               }
-       }
-       printf("[%s] { %.2f, %.2f, %.2f }\n", argv[1], col[0], col[1], col[2]);
-       printf("[%s] { %.2f, %.2f, %.2f }\n", argv[2], col[3], col[4], col[5]);
-       printf("[ mean ] { %.2f, %.2f, %.2f }\n",
-              (col[0] + col[3]) / 2.0,
-              (col[1] + col[4]) / 2.0,
-              (col[2] + col[5]) / 2.0);
-       printf("[ mean ] #%x%x%x\n",
-              (int)((col[0] + col[3]) / 2.0 * 255),
-              (int)((col[1] + col[4]) / 2.0 * 255),
-              (int)((col[2] + col[5]) / 2.0 * 255));
-}
-
diff --git a/tools/pango/.gitignore b/tools/pango/.gitignore
deleted file mode 100644 (file)
index 583e383..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-*.o
-font-height
diff --git a/tools/pango/Makefile b/tools/pango/Makefile
deleted file mode 100644 (file)
index 88ab215..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-CFLAGS += -g -Wall -O0 -std=c11
-CFLAGS += `pkg-config cairo pango pangocairo --cflags`
-CFLAGS += -I../../include
-LIBS   += `pkg-config cairo pango pangocairo --libs`
-LDFLAGS += $(LIBS)
-
-PROGS = font-height
-
-all: $(PROGS)
-
-font-height: font-height.c ../../src/common/font.c
-       $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
-
-clean:
-       rm -f $(PROGS) *.o
diff --git a/tools/pango/font-height.c b/tools/pango/font-height.c
deleted file mode 100644 (file)
index 24690f5..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "common/font.h"
-
-int main(int argc, char **argv)
-{
-       if (argc < 2) {
-               printf("Usage: %s <font-description> (e.g. 'sans 10')\n", argv[0]);
-               exit(1);
-       }
-       printf("height=%d\n", font_height(argv[1]));
-}
diff --git a/tools/rcxml/.gitignore b/tools/rcxml/.gitignore
deleted file mode 100644 (file)
index 55cbe8c..0000000
+++ /dev/null
@@ -1 +0,0 @@
-rcxml-print-nodenames
diff --git a/tools/rcxml/Makefile b/tools/rcxml/Makefile
deleted file mode 100644 (file)
index 1b4dbf2..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-CFLAGS  = -g -O0 -Wall -Wextra -std=c11 -pedantic `xml2-config --cflags`
-CFLAGS += -Wno-unused-parameter
-CFLAGS += -I../../include
-CFLAGS += -DWLR_USE_UNSTABLE
-ASAN_FLAGS = -O0 -fsanitize=address -fno-common -fno-omit-frame-pointer -rdynamic
-CFLAGS    += $(ASAN_FLAGS)
-LDFLAGS   += $(ASAN_FLAGS) -fuse-ld=gold
-LDFLAGS   += `xml2-config --libs`
-LDFLAGS   += `pkg-config --cflags --libs glib-2.0 cairo pangocairo wayland-server xkbcommon`
-
-PROGS = rcxml-print-nodenames
-SRC = \
-       rcxml-print-nodenames.c \
-       ../../src/config/rcxml.c \
-       ../../src/common/dir.c \
-       ../../src/common/buf.c \
-       ../../src/common/font.c \
-       ../../src/common/log.c \
-       ../../src/config/keybind.c
-
-
-all: $(PROGS)
-
-rcxml-print-nodenames: $(SRC)
-       $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
-
-clean:
-       rm -f $(PROGS)
diff --git a/tools/rcxml/README.md b/tools/rcxml/README.md
deleted file mode 100644 (file)
index bd4a582..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-Try
-
-    ./rcxml-print-nodenames /etc/xdg/openbox/rc.xml
-    ./rcxml-print-nodenames ../../data/rc.xml
-
diff --git a/tools/rcxml/rcxml-print-nodenames.c b/tools/rcxml/rcxml-print-nodenames.c
deleted file mode 100644 (file)
index 9e6b03a..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <cairo.h>
-#include <pango/pangocairo.h>
-
-#include "config/rcxml.h"
-#include "common/buf.h"
-#include "common/log.h"
-
-struct rcxml rc = { 0 };
-
-int main(int argc, char **argv)
-{
-       struct buf b;
-
-       if (argc != 2) {
-               fprintf(stderr, "usage: %s <rc.xml file>\n", argv[0]);
-               exit(EXIT_FAILURE);
-       }
-       buf_init(&b);
-       rcxml_get_nodenames(&b);
-       rcxml_read(argv[1]);
-       printf("%s", b.buf);
-       free(b.buf);
-       pango_cairo_font_map_set_default(NULL);
-}
diff --git a/tools/run b/tools/run
deleted file mode 100755 (executable)
index 5506632..0000000
--- a/tools/run
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/sh
-
-LSAN_OPTIONS=suppressions=tools/asan_suppressions.txt ./build/labwc
-
-
diff --git a/tools/theme/.gitignore b/tools/theme/.gitignore
deleted file mode 100644 (file)
index c493802..0000000
+++ /dev/null
@@ -1 +0,0 @@
-theme-helper
diff --git a/tools/theme/Makefile b/tools/theme/Makefile
deleted file mode 100644 (file)
index 643d154..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-CFLAGS  = -g -Wall -Wextra -pedantic -std=c11
-CFLAGS += -I../../include/
-CFLAGS += `pkg-config --cflags glib-2.0`
-ASAN_FLAGS = -O0 -fsanitize=address -fno-common -fno-omit-frame-pointer -rdynamic
-CFLAGS    += $(ASAN_FLAGS)
-LDFLAGS   += $(ASAN_FLAGS) -fuse-ld=gold
-LDFLAGS   += `pkg-config --cflags --libs glib-2.0 wlroots wayland-server`
-LDFLAGS   += -DWLR_USE_UNSTABLE
-
-SRCS = \
-       theme-helper.c \
-       ../../src/theme/theme.c \
-       ../../src/common/dir.c \
-       ../../src/common/log.c
-
-all:
-       gcc $(CFLAGS) -o theme-helper $(SRCS) $(LDFLAGS)
-
-
-test:
-       XDG_DATA_HOME=../../data ./theme-helper labwc-default
-
-clean:
-       rm -f theme-helper *.o
diff --git a/tools/theme/list-themes.sh b/tools/theme/list-themes.sh
deleted file mode 100755 (executable)
index 4f4b46b..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/sh
-#
-# List available openbox themes
-#
-
-printf '%b\n' "#icons\ttheme name"
-printf '%b\n' "-------------------"
-
-for d in $HOME/.themes/* /usr/share/themes/*; do
-       if [ -d "$d/openbox-3" ]; then
-               icon_count=0
-               for f in $d/openbox-3/*; do
-                       case $f in
-                               *xbm) : $(( icon_count++ )) ;;
-                       esac
-               done
-               printf '%b\n' "$icon_count\t$(basename $d)"
-       fi
-done
diff --git a/tools/theme/theme-helper.c b/tools/theme/theme-helper.c
deleted file mode 100644 (file)
index 0bf3700..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "theme/theme.h"
-
-struct theme theme = { 0 };
-
-static void usage(const char *application)
-{
-       printf("Usage: %s <theme-name>\n", application);
-       exit(1);
-}
-
-int main(int argc, char **argv)
-{
-       if (argc < 2)
-               usage(argv[0]);
-       theme_read(argv[1]);
-
-       printf("window_active_title_bg_color = ");
-       for (int i=0; i < 4; i++)
-               printf("%.2f; ", theme.window_active_title_bg_color[i]);
-       printf("\n");
-}
diff --git a/tools/xbm/.gitignore b/tools/xbm/.gitignore
deleted file mode 100644 (file)
index 84e99e1..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-xbm-tokenize
-xbm-parse
-*.png
diff --git a/tools/xbm/5x5.xbm b/tools/xbm/5x5.xbm
deleted file mode 100644 (file)
index 0d2e083..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-#define max_width 5
-#define max_height 5
-static unsigned char max_bits[] = {
- 0x1F, 0x1B, 0x15, 0x1B, 0x1F };
diff --git a/tools/xbm/8x8.xbm b/tools/xbm/8x8.xbm
deleted file mode 100644 (file)
index efbf07c..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-#define close_width 8
-#define close_height 8
-static unsigned char close_bits[] = {
- 0xFF, 0xC3, 0xA5, 0x99, 0x99, 0xA5, 0xC3, 0xFF };
diff --git a/tools/xbm/9x9.xbm b/tools/xbm/9x9.xbm
deleted file mode 100644 (file)
index 238df09..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#define x9_width 9
-#define x9_height 9
-static unsigned char x9_bits[] = {
- 0xFF, 0x01, 0x83, 0x01, 0x45, 0x01, 0x29, 0x01, 0x11, 0x01, 0x29, 0x01,
- 0x45, 0x01, 0x83, 0x01, 0xFF, 0x01 };
diff --git a/tools/xbm/Makefile b/tools/xbm/Makefile
deleted file mode 100644 (file)
index 6810ef3..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-CFLAGS      += -g -Wall -O0 -std=c11
-CFLAGS      += -I../../include
-LDFLAGS     += `pkg-config --cflags --libs cairo`
-ASAN        += -fsanitize=address
-
-PROGS        = xbm-tokenize xbm-parse
-
-DEP_TOKENIZE = \
-              ../../src/common/buf.c \
-              ../../src/xbm/tokenize.c
-
-DEP_PARSE    = $(DEP_TOKENIZE) \
-              ../../src/xbm/parse.c \
-              ../../src/common/grab-file.c
-
-all: $(PROGS)
-
-xbm-tokenize: xbm-tokenize.c $(DEP_TOKENIZE)
-       $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(ASAN)
-
-xbm-parse: xbm-parse.c $(DEP_PARSE)
-       $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(ASAN)
-
-clean :
-       $(RM) $(PROGS)
diff --git a/tools/xbm/xbm-parse.c b/tools/xbm/xbm-parse.c
deleted file mode 100644 (file)
index 84a7c4a..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <cairo.h>
-
-#include "xbm/parse.h"
-#include "common/grab-file.h"
-
-static float red[] = { 1.0, 0.0, 0.0, 1.0 };
-
-int main(int argc, char **argv)
-{
-       struct token *tokens;
-
-       if (argc != 2) {
-               fprintf(stderr, "usage: %s <xbm-file>\n", argv[0]);
-               return 1;
-       }
-
-       char *buffer = grab_file(argv[1]);
-       if (!buffer)
-               exit(EXIT_FAILURE);
-       tokens = tokenize_xbm(buffer);
-       free(buffer);
-       parse_set_color(red);
-       struct pixmap pixmap = parse_xbm_tokens(tokens);
-       free(tokens);
-
-       cairo_surface_t *g_surface;
-       g_surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32,
-                                              pixmap.width, pixmap.height);
-       if (!g_surface) {
-               fprintf(stderr, "no surface\n");
-               exit(EXIT_FAILURE);
-       }
-       unsigned char *surface_data = cairo_image_surface_get_data(g_surface);
-       cairo_surface_flush(g_surface);
-       memcpy(surface_data, pixmap.data, pixmap.width * pixmap.height * 4);
-       if (pixmap.data)
-               free(pixmap.data);
-       cairo_surface_mark_dirty(g_surface);
-
-       char png_name[1024];
-       snprintf(png_name, sizeof(png_name), "%s.png", argv[1]);
-       if (cairo_surface_write_to_png(g_surface, png_name)) {
-               fprintf(stderr, "cannot save png\n");
-               exit(EXIT_FAILURE);
-       }
-       cairo_surface_destroy(g_surface);
-       exit(EXIT_SUCCESS);
-}
diff --git a/tools/xbm/xbm-tokenize.c b/tools/xbm/xbm-tokenize.c
deleted file mode 100644 (file)
index a5bc4f6..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-#define _POSIX_C_SOURCE 200809L
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "common/buf.h"
-#include "xbm/tokenize.h"
-
-/* Read file into buffer, because it's easier to tokenize that way */
-char *read_file(const char *filename)
-{
-       char *line = NULL;
-       size_t len = 0;
-       FILE *stream = fopen(filename, "r");
-       if (!stream) {
-               fprintf(stderr, "warn: cannot read '%s'\n", filename);
-               return NULL;
-       }
-       struct buf buffer;
-       buf_init(&buffer);
-       while ((getline(&line, &len, stream) != -1)) {
-               char *p = strrchr(line, '\n');
-               if (p)
-                       *p = '\0';
-               buf_add(&buffer, line);
-       }
-       free(line);
-       fclose(stream);
-       return (buffer.buf);
-}
-
-int main(int argc, char **argv)
-{
-       struct token *tokens;
-
-       if (argc != 2) {
-               fprintf(stderr, "usage: %s <xbm-file>\n", argv[0]);
-               return 1;
-       }
-
-       char *buffer = read_file(argv[1]);
-       if (!buffer)
-               exit(EXIT_FAILURE);
-       tokens = tokenize_xbm(buffer);
-       free(buffer);
-       for (struct token *t = tokens; t->type; t++)
-               printf("%s\n", t->name);
-}