From 99b5396e8e9cdef2dbe6bf5250f47a87e5eef52d Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Sat, 19 Apr 2008 12:42:50 +0000 Subject: [PATCH] * Remove #include etc. from "common.h". Instead, make sure that will provide the C99 types, even if libcaca has been installed. * Rename what's left of "common.h" to "stubs.h". * Remove all references to erroneous from source files. --- Makefile.am | 2 +- build-dos | 4 ++-- build-kernel | 2 +- build-win32 | 2 +- caca/Makefile.am | 3 ++- caca/caca.c | 1 - caca/caca0.c | 1 - caca/caca_internals.h | 4 +--- caca/driver_conio.c | 1 - caca/driver_gl.c | 1 - caca/driver_ncurses.c | 1 - caca/driver_raw.c | 1 - caca/driver_slang.c | 1 - caca/driver_vga.c | 1 - caca/driver_win32.c | 1 - caca/driver_x11.c | 1 - caca/event.c | 1 - caca/graphics.c | 1 - caca/time.c | 1 - configure.ac | 16 ++++++++++++- cucul/.gitignore | 1 + cucul/Makefile.am | 9 ++++---- cucul/attr.c | 1 - cucul/box.c | 1 - cucul/canvas.c | 1 - cucul/charset.c | 1 - cucul/conic.c | 1 - cucul/cucul.c | 1 - cucul/cucul.h | 2 ++ cucul/cucul_internals.h | 4 +--- cucul/cucul_types.h.in | 51 +++++++++++++++++++++++++++++++++++++++++ cucul/dither.c | 1 - cucul/export.c | 1 - cucul/figfont.c | 1 - cucul/file.c | 1 - cucul/font.c | 1 - cucul/frame.c | 1 - cucul/import.c | 1 - cucul/legacy.c | 1 - cucul/line.c | 1 - cucul/transform.c | 1 - cucul/triangle.c | 1 - cxx/Makefile.am | 3 ++- examples/Makefile.am | 3 ++- examples/blit.c | 2 +- examples/colors.c | 1 - examples/cucul.c | 1 - examples/demo.c | 4 +++- examples/dithering.c | 1 - examples/driver.c | 1 - examples/event.c | 2 +- examples/export.c | 4 ---- examples/figfont.c | 1 - examples/font.c | 5 ---- examples/font2tga.c | 4 ---- examples/frames.c | 7 ++---- examples/fullwidth.c | 4 ---- examples/gamma.c | 4 ---- examples/hsv.c | 4 ---- examples/import.c | 6 ----- examples/input.c | 4 ---- examples/spritedit.c | 1 - examples/swallow.c | 2 +- examples/text.c | 6 ++--- examples/transform.c | 5 +--- examples/truecolor.c | 4 ---- examples/unicode.c | 4 ---- kernel/kernel.c | 3 ++- msvc/Makefile.am | 2 +- msvc/common.h | 1 - msvc/cucul_types.h | 2 ++ ruby/Makefile.am | 5 ++-- src/Makefile.am | 3 ++- src/aafire.c | 2 +- src/cacademo.c | 1 - src/cacadraw.c | 1 - src/cacaplay.c | 1 - src/cacaserver.c | 1 - src/cacaview.c | 2 +- src/common-image.c | 2 +- src/img2txt.c | 2 +- src/mygetopt.c | 9 ++------ common.h => stubs.h | 19 ++++----------- tests/Makefile.am | 2 +- tests/simple.c | 5 ---- tools/Makefile.am | 3 ++- tools/makefont.c | 13 +++++------ tools/optipal.c | 1 - tools/sortchars.c | 6 ++--- 89 files changed, 129 insertions(+), 170 deletions(-) create mode 100644 cucul/.gitignore create mode 100644 cucul/cucul_types.h.in delete mode 100644 msvc/common.h create mode 100644 msvc/cucul_types.h rename common.h => stubs.h (87%) diff --git a/Makefile.am b/Makefile.am index ff1b516..3ce558c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3,7 +3,7 @@ SUBDIRS = kernel cucul caca src examples tests tools csharp cxx python ruby doc DIST_SUBDIRS = $(SUBDIRS) msvc -EXTRA_DIST = NOTES COPYING.GPL COPYING.LGPL bootstrap build-dos build-kernel build-win32 caca-config.in common.h libcaca.spec +EXTRA_DIST = NOTES COPYING.GPL COPYING.LGPL bootstrap build-dos build-kernel build-win32 caca-config.in stubs.h libcaca.spec AUTOMAKE_OPTIONS = dist-bzip2 bin_SCRIPTS = caca-config diff --git a/build-dos b/build-dos index 08a7e32..fac150f 100755 --- a/build-dos +++ b/build-dos @@ -18,7 +18,7 @@ mkdir "${BUILDDIR}" cd "${BUILDDIR}" # Build for DOS -"${SRCDIR}/configure" --host=i386-pc-msdosdjgpp --prefix=/ --bindir=/ --libdir=/ --disable-imlib2 --disable-doc +"${SRCDIR}/configure" --host=i386-pc-msdosdjgpp --prefix=/ --bindir=/ --libdir=/ --disable-imlib2 --disable-doc --disable-ruby --disable-csharp --disable-cxx make pkglibdir=/lib pkgdatadir=/data # Install into our private directory make install DESTDIR="${INSTALLDIR}" pkglibdir=/lib pkgdatadir=/ @@ -28,7 +28,7 @@ rm -Rf "${BUILDDIR}" i386-pc-msdosdjgpp-strip "${INSTALLDIR}/"*.exe mkdir "${INSTALLDIR}/doc" -for f in COPYING COPYING.LGPL COPYING.GPL README AUTHORS NEWS NOTES THANKS TODO; do +for f in COPYING COPYING.LGPL COPYING.GPL README AUTHORS NEWS NOTES THANKS; do sed -e 's/$/^M/' < "${SRCDIR}/${f}" > "${INSTALLDIR}/doc/${f}.txt" done diff --git a/build-kernel b/build-kernel index 8a45276..caca205 100755 --- a/build-kernel +++ b/build-kernel @@ -6,7 +6,7 @@ set -x set -e -CFLAGS="-fno-builtin -O2 -I. -I.. -Wall" +CFLAGS="-fno-builtin -O2 -I. -I.. -I../cucul/ -Wall" CPPFLAGS="-D__KERNEL__ -nostdinc -include kernel/kernel.h" LDFLAGS="-nostdlib -Wl,-N -Wl,-Ttext -Wl,100000" diff --git a/build-win32 b/build-win32 index 9ca1e48..90d95c7 100755 --- a/build-win32 +++ b/build-win32 @@ -34,7 +34,7 @@ rmdir "${INSTALLDIR}/bin" rmdir "${INSTALLDIR}/lib" mkdir "${INSTALLDIR}/doc" -for f in COPYING COPYING.LGPL COPYING.GPL README AUTHORS NEWS NOTES THANKS TODO; do +for f in COPYING COPYING.LGPL COPYING.GPL README AUTHORS NEWS NOTES THANKS; do sed -e 's/$/ /' < "${SRCDIR}/${f}" > "${INSTALLDIR}/doc/${f}.txt" done rm -Rf "${INSTALLDIR}/share" diff --git a/caca/Makefile.am b/caca/Makefile.am index 6c3aeb2..adbc274 100644 --- a/caca/Makefile.am +++ b/caca/Makefile.am @@ -3,7 +3,8 @@ EXTRA_DIST = caca.pc.in DISTCLEANFILES = caca.pc -AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/cucul -DPLUGINDIR=\"$(plugindir)\" +AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/cucul -I../cucul \ + -DPLUGINDIR=\"$(plugindir)\" pkgconfig_DATA = caca.pc pkgconfigdir = $(libdir)/pkgconfig diff --git a/caca/caca.c b/caca/caca.c index a92a344..deac3f2 100644 --- a/caca/caca.c +++ b/caca/caca.c @@ -19,7 +19,6 @@ */ #include "config.h" -#include "common.h" #if !defined(__KERNEL__) # include diff --git a/caca/caca0.c b/caca/caca0.c index aea9284..7c5ceaf 100644 --- a/caca/caca0.c +++ b/caca/caca0.c @@ -18,7 +18,6 @@ */ #include "config.h" -#include "common.h" #if !defined(__KERNEL__) # include diff --git a/caca/caca_internals.h b/caca/caca_internals.h index 34bece9..4248018 100644 --- a/caca/caca_internals.h +++ b/caca/caca_internals.h @@ -15,9 +15,7 @@ #ifndef __CACA_INTERNALS_H__ #define __CACA_INTERNALS_H__ -#if defined(HAVE_INTTYPES_H) && !defined(__KERNEL__) -# include -#endif +#include "stubs.h" typedef struct caca_timer caca_timer_t; typedef struct caca_privevent caca_privevent_t; diff --git a/caca/driver_conio.c b/caca/driver_conio.c index 5527c04..c98fe69 100644 --- a/caca/driver_conio.c +++ b/caca/driver_conio.c @@ -17,7 +17,6 @@ */ #include "config.h" -#include "common.h" #if defined(USE_CONIO) diff --git a/caca/driver_gl.c b/caca/driver_gl.c index 88e337a..55d995d 100644 --- a/caca/driver_gl.c +++ b/caca/driver_gl.c @@ -19,7 +19,6 @@ */ #include "config.h" -#include "common.h" #if defined(USE_GL) diff --git a/caca/driver_ncurses.c b/caca/driver_ncurses.c index 1fced5c..6b67dd0 100644 --- a/caca/driver_ncurses.c +++ b/caca/driver_ncurses.c @@ -18,7 +18,6 @@ */ #include "config.h" -#include "common.h" #if defined USE_NCURSES diff --git a/caca/driver_raw.c b/caca/driver_raw.c index 5777edc..7938464 100644 --- a/caca/driver_raw.c +++ b/caca/driver_raw.c @@ -17,7 +17,6 @@ */ #include "config.h" -#include "common.h" #if !defined(__KERNEL__) diff --git a/caca/driver_slang.c b/caca/driver_slang.c index 7bb1d3d..d5d7438 100644 --- a/caca/driver_slang.c +++ b/caca/driver_slang.c @@ -17,7 +17,6 @@ */ #include "config.h" -#include "common.h" #if defined(USE_SLANG) diff --git a/caca/driver_vga.c b/caca/driver_vga.c index 0e6d27b..c604629 100644 --- a/caca/driver_vga.c +++ b/caca/driver_vga.c @@ -17,7 +17,6 @@ */ #include "config.h" -#include "common.h" #if defined(USE_VGA) diff --git a/caca/driver_win32.c b/caca/driver_win32.c index 30442f4..14a9f77 100644 --- a/caca/driver_win32.c +++ b/caca/driver_win32.c @@ -17,7 +17,6 @@ */ #include "config.h" -#include "common.h" #if defined(USE_WIN32) diff --git a/caca/driver_x11.c b/caca/driver_x11.c index 007874a..6d70850 100644 --- a/caca/driver_x11.c +++ b/caca/driver_x11.c @@ -18,7 +18,6 @@ */ #include "config.h" -#include "common.h" #if defined(USE_X11) diff --git a/caca/event.c b/caca/event.c index b601d12..b26d7dc 100644 --- a/caca/event.c +++ b/caca/event.c @@ -17,7 +17,6 @@ */ #include "config.h" -#include "common.h" #if !defined(__KERNEL__) # include diff --git a/caca/graphics.c b/caca/graphics.c index a3bf479..458fc34 100644 --- a/caca/graphics.c +++ b/caca/graphics.c @@ -17,7 +17,6 @@ */ #include "config.h" -#include "common.h" #if !defined(__KERNEL__) # include diff --git a/caca/time.c b/caca/time.c index 275b244..23639ea 100644 --- a/caca/time.c +++ b/caca/time.c @@ -17,7 +17,6 @@ */ #include "config.h" -#include "common.h" #if !defined(__KERNEL__) # include diff --git a/configure.ac b/configure.ac index 4f1c763..882d829 100644 --- a/configure.ac +++ b/configure.ac @@ -87,7 +87,7 @@ AC_ARG_ENABLE(doc, AC_ARG_ENABLE(zzuf, [ --enable-zzuf use zzuf for fuzzing tests (autodetected)]) -AC_CHECK_HEADERS(stdio.h stdarg.h signal.h sys/ioctl.h sys/time.h inttypes.h endian.h unistd.h arpa/inet.h netinet/in.h winsock2.h errno.h locale.h getopt.h dlfcn.h termios.h) +AC_CHECK_HEADERS(stdio.h stdarg.h signal.h sys/ioctl.h sys/time.h endian.h unistd.h arpa/inet.h netinet/in.h winsock2.h errno.h locale.h getopt.h dlfcn.h termios.h) AC_CHECK_FUNCS(signal ioctl snprintf vsnprintf getenv putenv strcasecmp htons) AC_CHECK_FUNCS(usleep gettimeofday) @@ -323,6 +323,19 @@ AC_SUBST(CACA_LIBS) AC_SUBST(X11_LIBS) AC_SUBST(GL_LIBS) +# How to get the C99 types. See cucul/cucul_types.h.in for details about +# the CUCUL_TYPES variable +if test "${ac_cv_my_have_vga}" = "yes"; then + CUCUL_TYPES=0 +else + AC_CHECK_HEADERS(stdint.h, + [CUCUL_TYPES=1], + [AC_CHECK_HEADERS(inttypes.h, + [CUCUL_TYPES=2], + [CUCUL_TYPES=0])]) +fi +AC_SUBST(CUCUL_TYPES) + # Optimizations CFLAGS="${CFLAGS} -g -O2 -fno-strength-reduce -fomit-frame-pointer" # Code qui fait des warnings == code de porc == deux baffes dans ta gueule @@ -462,6 +475,7 @@ AC_CONFIG_FILES([ msvc/Makefile ]) AC_CONFIG_FILES([ + cucul/cucul_types.h cucul/cucul.pc caca/caca.pc csharp/cucul-sharp.dll.config diff --git a/cucul/.gitignore b/cucul/.gitignore new file mode 100644 index 0000000..58daffa --- /dev/null +++ b/cucul/.gitignore @@ -0,0 +1 @@ +cucul_types.h diff --git a/cucul/Makefile.am b/cucul/Makefile.am index 30ef40f..14e01e4 100644 --- a/cucul/Makefile.am +++ b/cucul/Makefile.am @@ -1,18 +1,19 @@ # $Id$ -EXTRA_DIST = cucul.pc.in mono9.data monobold12.data -DISTCLEANFILES = cucul.pc +EXTRA_DIST = cucul_types.h.in cucul.pc.in mono9.data monobold12.data +DISTCLEANFILES = cucul_types.h cucul.pc pkgconfig_DATA = cucul.pc pkgconfigdir = $(libdir)/pkgconfig -include_HEADERS = cucul.h +include_HEADERS = cucul.h cucul_types.h lib_LTLIBRARIES = libcucul.la libcucul_la_SOURCES = \ cucul.c \ cucul.h \ + cucul_types.h \ cucul_internals.h \ legacy.c \ canvas.c \ @@ -35,7 +36,7 @@ libcucul_la_DEPENDENCIES = \ mono9.data \ monobold12.data \ $(NULL) -AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/cucul +AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/cucul -I../cucul libcucul_la_LDFLAGS = -no-undefined -version-number @LT_VERSION@ libcucul_la_LIBADD = $(ZLIB_LIBS) diff --git a/cucul/attr.c b/cucul/attr.c index 221c52b..1ff8b6b 100644 --- a/cucul/attr.c +++ b/cucul/attr.c @@ -18,7 +18,6 @@ */ #include "config.h" -#include "common.h" #include "cucul.h" #include "cucul_internals.h" diff --git a/cucul/box.c b/cucul/box.c index 54a067f..9e6126b 100644 --- a/cucul/box.c +++ b/cucul/box.c @@ -17,7 +17,6 @@ */ #include "config.h" -#include "common.h" #if !defined(__KERNEL__) # include diff --git a/cucul/canvas.c b/cucul/canvas.c index 64eff80..6b3fe6e 100644 --- a/cucul/canvas.c +++ b/cucul/canvas.c @@ -18,7 +18,6 @@ */ #include "config.h" -#include "common.h" #if !defined(__KERNEL__) # include /* BUFSIZ */ diff --git a/cucul/charset.c b/cucul/charset.c index b9c3a8e..65e0c5f 100644 --- a/cucul/charset.c +++ b/cucul/charset.c @@ -19,7 +19,6 @@ */ #include "config.h" -#include "common.h" #if !defined(__KERNEL__) # include diff --git a/cucul/conic.c b/cucul/conic.c index d59fadc..f015e03 100644 --- a/cucul/conic.c +++ b/cucul/conic.c @@ -18,7 +18,6 @@ */ #include "config.h" -#include "common.h" #if !defined(__KERNEL__) # include diff --git a/cucul/cucul.c b/cucul/cucul.c index 8d97a81..3554eef 100644 --- a/cucul/cucul.c +++ b/cucul/cucul.c @@ -18,7 +18,6 @@ */ #include "config.h" -#include "common.h" #if !defined(__KERNEL__) # include diff --git a/cucul/cucul.h b/cucul/cucul.h index 1e059ca..7f52398 100644 --- a/cucul/cucul.h +++ b/cucul/cucul.h @@ -24,6 +24,8 @@ #ifndef __CUCUL_H__ #define __CUCUL_H__ +#include + #undef __extern #if defined(_WIN32) && defined(__LIBCUCUL__) # define __extern extern __declspec(dllexport) diff --git a/cucul/cucul_internals.h b/cucul/cucul_internals.h index d4f7a1d..2413db4 100644 --- a/cucul/cucul_internals.h +++ b/cucul/cucul_internals.h @@ -15,9 +15,7 @@ #ifndef __CUCUL_INTERNALS_H__ #define __CUCUL_INTERNALS_H__ -#if defined(HAVE_INTTYPES_H) && !defined(__KERNEL__) -# include -#endif +#include "stubs.h" typedef struct cucul_figfont cucul_figfont_t; diff --git a/cucul/cucul_types.h.in b/cucul/cucul_types.h.in new file mode 100644 index 0000000..e6bd31f --- /dev/null +++ b/cucul/cucul_types.h.in @@ -0,0 +1,51 @@ +/* + * libcucul Canvas for ultrafast compositing of Unicode letters + * libcaca Colour ASCII-Art library + * Copyright (c) 2008 Sam Hocevar + * All Rights Reserved + * + * $Id$ + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the Do What The Fuck You Want To + * Public License, Version 2, as published by Sam Hocevar. See + * http://sam.zoy.org/wtfpl/COPYING for more details. + */ + +/* + * This file contains definitions for the C99 integer types. + */ + +#ifndef __CUCUL_TYPES_H__ +#define __CUCUL_TYPES_H__ + +#ifndef CUCUL_TYPES +# define CUCUL_TYPES @CUCUL_TYPES@ +#endif + +/* mode 1: standard header is present, just include it */ +#if CUCUL_TYPES == 1 +# include + +/* mode 2: standard header is present, just include it */ +#elif CUCUL_TYPES == 2 +# include + +/* fallback: nothing is available, we assume the platform is 32-bit and + * sizeof(long) == sizeof(void *) */ +#else +typedef signed char int8_t; +typedef signed short int16_t; +typedef signed long int int32_t; + +typedef unsigned char uint8_t; +typedef unsigned short uint16_t; +typedef unsigned long int uint32_t; + +typedef long int intptr_t; +typedef unsigned long int uintptr_t; + +#endif + +#endif /* __CUCUL_TYPES_H__ */ + diff --git a/cucul/dither.c b/cucul/dither.c index 1e47888..b4d5f83 100644 --- a/cucul/dither.c +++ b/cucul/dither.c @@ -17,7 +17,6 @@ */ #include "config.h" -#include "common.h" #if !defined(__KERNEL__) # if defined(HAVE_ENDIAN_H) diff --git a/cucul/export.c b/cucul/export.c index 88270a5..34c5e74 100644 --- a/cucul/export.c +++ b/cucul/export.c @@ -18,7 +18,6 @@ */ #include "config.h" -#include "common.h" #if !defined(__KERNEL__) # include diff --git a/cucul/figfont.c b/cucul/figfont.c index c743f50..92fe371 100644 --- a/cucul/figfont.c +++ b/cucul/figfont.c @@ -21,7 +21,6 @@ */ #include "config.h" -#include "common.h" #if !defined(__KERNEL__) # include diff --git a/cucul/file.c b/cucul/file.c index c621342..91601a2 100644 --- a/cucul/file.c +++ b/cucul/file.c @@ -17,7 +17,6 @@ */ #include "config.h" -#include "common.h" #if !defined __KERNEL__ # include diff --git a/cucul/font.c b/cucul/font.c index feb9136..7ea2719 100644 --- a/cucul/font.c +++ b/cucul/font.c @@ -17,7 +17,6 @@ */ #include "config.h" -#include "common.h" #if !defined(__KERNEL__) # if defined(HAVE_ENDIAN_H) diff --git a/cucul/frame.c b/cucul/frame.c index 3d3548c..3b3141d 100644 --- a/cucul/frame.c +++ b/cucul/frame.c @@ -17,7 +17,6 @@ */ #include "config.h" -#include "common.h" #if !defined(__KERNEL__) # include diff --git a/cucul/import.c b/cucul/import.c index da04d62..f04aea6 100644 --- a/cucul/import.c +++ b/cucul/import.c @@ -17,7 +17,6 @@ */ #include "config.h" -#include "common.h" #if !defined __KERNEL__ # include diff --git a/cucul/legacy.c b/cucul/legacy.c index 76130d9..321f142 100644 --- a/cucul/legacy.c +++ b/cucul/legacy.c @@ -18,7 +18,6 @@ */ #include "config.h" -#include "common.h" #if !defined(__KERNEL__) # include diff --git a/cucul/line.c b/cucul/line.c index 25fff46..2f64ae1 100644 --- a/cucul/line.c +++ b/cucul/line.c @@ -18,7 +18,6 @@ */ #include "config.h" -#include "common.h" #if !defined(__KERNEL__) # include diff --git a/cucul/transform.c b/cucul/transform.c index 3db476b..69ccb77 100644 --- a/cucul/transform.c +++ b/cucul/transform.c @@ -17,7 +17,6 @@ */ #include "config.h" -#include "common.h" #if !defined(__KERNEL__) # include diff --git a/cucul/triangle.c b/cucul/triangle.c index 3dc1a06..1efe9d5 100644 --- a/cucul/triangle.c +++ b/cucul/triangle.c @@ -17,7 +17,6 @@ */ #include "config.h" -#include "common.h" #if !defined(__KERNEL__) # include diff --git a/cxx/Makefile.am b/cxx/Makefile.am index 2b97dbf..02855c3 100644 --- a/cxx/Makefile.am +++ b/cxx/Makefile.am @@ -1,6 +1,7 @@ # $Id: Makefile.am 552 2006-04-13 16:10:16Z jylam $ -AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/cucul -I$(top_srcdir)/caca +AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/cucul -I../cucul \ + -I$(top_srcdir)/caca if USE_CXX include_HEADERS = cucul++.h caca++.h diff --git a/examples/Makefile.am b/examples/Makefile.am index f931a24..084281e 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -1,6 +1,7 @@ # $Id$ -AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/cucul -I$(top_srcdir)/caca -DDATADIR=\"$(pkgdatadir)\" +AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/cucul -I../cucul \ + -I$(top_srcdir)/caca -DDATADIR=\"$(pkgdatadir)\" noinst_PROGRAMS = blit colors cucul demo demo0 dithering driver event export figfont font font2tga frames fullwidth gamma hsv input spritedit swallow text transform truecolor unicode import diff --git a/examples/blit.c b/examples/blit.c index 8e2a6f7..5fc55be 100644 --- a/examples/blit.c +++ b/examples/blit.c @@ -13,7 +13,7 @@ */ #include "config.h" -#include "common.h" + #if !defined(__KERNEL__) # include # include diff --git a/examples/colors.c b/examples/colors.c index 62912f9..db0f6b8 100644 --- a/examples/colors.c +++ b/examples/colors.c @@ -13,7 +13,6 @@ */ #include "config.h" -#include "common.h" #if !defined(__KERNEL__) # include diff --git a/examples/cucul.c b/examples/cucul.c index a2ad770..e4df2cb 100644 --- a/examples/cucul.c +++ b/examples/cucul.c @@ -13,7 +13,6 @@ */ #include "config.h" -#include "common.h" #if !defined(__KERNEL__) # include diff --git a/examples/demo.c b/examples/demo.c index f8bffd5..ba5d8e9 100644 --- a/examples/demo.c +++ b/examples/demo.c @@ -13,12 +13,14 @@ */ #include "config.h" -#include "common.h" + #if !defined(__KERNEL__) # include # include # include #endif + +#include "cucul.h" #include "caca.h" static void display_menu(void); diff --git a/examples/dithering.c b/examples/dithering.c index 3b92a6f..b269032 100644 --- a/examples/dithering.c +++ b/examples/dithering.c @@ -13,7 +13,6 @@ */ #include "config.h" -#include "common.h" #if !defined(__KERNEL__) # include diff --git a/examples/driver.c b/examples/driver.c index 572e624..910a089 100644 --- a/examples/driver.c +++ b/examples/driver.c @@ -13,7 +13,6 @@ */ #include "config.h" -#include "common.h" #if !defined(__KERNEL__) # include diff --git a/examples/event.c b/examples/event.c index e9da747..6284b56 100644 --- a/examples/event.c +++ b/examples/event.c @@ -13,7 +13,7 @@ */ #include "config.h" -#include "common.h" + #if !defined(__KERNEL__) # include # include diff --git a/examples/export.c b/examples/export.c index b58005e..f5e6afc 100644 --- a/examples/export.c +++ b/examples/export.c @@ -13,12 +13,8 @@ */ #include "config.h" -#include "common.h" #if !defined(__KERNEL__) -# if defined(HAVE_INTTYPES_H) -# include -# endif # include # include # include diff --git a/examples/figfont.c b/examples/figfont.c index 31cf063..e143dd1 100644 --- a/examples/figfont.c +++ b/examples/figfont.c @@ -13,7 +13,6 @@ */ #include "config.h" -#include "common.h" #if !defined(__KERNEL__) # include diff --git a/examples/font.c b/examples/font.c index c4fcdd6..71184a2 100644 --- a/examples/font.c +++ b/examples/font.c @@ -13,13 +13,8 @@ */ #include "config.h" -#include "common.h" #if !defined(__KERNEL__) -# if defined(HAVE_INTTYPES_H) -# include -# endif - # if defined(HAVE_ENDIAN_H) # include # endif diff --git a/examples/font2tga.c b/examples/font2tga.c index 43f6fc9..ce74f45 100644 --- a/examples/font2tga.c +++ b/examples/font2tga.c @@ -13,12 +13,8 @@ */ #include "config.h" -#include "common.h" #if !defined(__KERNEL__) -# if defined(HAVE_INTTYPES_H) -# include -# endif # include # include #endif diff --git a/examples/frames.c b/examples/frames.c index 6167bd7..302950c 100644 --- a/examples/frames.c +++ b/examples/frames.c @@ -13,14 +13,11 @@ */ #include "config.h" -#include "common.h" -#if !defined(__KERNEL__) -# if defined(HAVE_INTTYPES_H) -# include -# endif +#if !defined(__KERNEL__) # include #endif + #include "cucul.h" #include "caca.h" diff --git a/examples/fullwidth.c b/examples/fullwidth.c index e6b64f2..dfff4fb 100644 --- a/examples/fullwidth.c +++ b/examples/fullwidth.c @@ -13,12 +13,8 @@ */ #include "config.h" -#include "common.h" #if !defined(__KERNEL__) -# if defined(HAVE_INTTYPES_H) -# include -# endif # include #endif diff --git a/examples/gamma.c b/examples/gamma.c index c9cb357..4cf912e 100644 --- a/examples/gamma.c +++ b/examples/gamma.c @@ -13,12 +13,8 @@ */ #include "config.h" -#include "common.h" #if !defined(__KERNEL__) -# if defined(HAVE_INTTYPES_H) -# include -# endif # include # include #endif diff --git a/examples/hsv.c b/examples/hsv.c index 435ec04..d835df9 100644 --- a/examples/hsv.c +++ b/examples/hsv.c @@ -13,12 +13,8 @@ */ #include "config.h" -#include "common.h" #if !defined(__KERNEL__) -# if defined(HAVE_INTTYPES_H) -# include -# endif # include #endif diff --git a/examples/import.c b/examples/import.c index 83bcf37..9658ee2 100644 --- a/examples/import.c +++ b/examples/import.c @@ -13,18 +13,12 @@ */ #include "config.h" -#include "common.h" - #if !defined(__KERNEL__) -# if defined(HAVE_INTTYPES_H) -# include -# endif # include # include #endif - #include "cucul.h" #include "caca.h" diff --git a/examples/input.c b/examples/input.c index 4fa8957..0e1aec3 100644 --- a/examples/input.c +++ b/examples/input.c @@ -13,12 +13,8 @@ */ #include "config.h" -#include "common.h" #if !defined(__KERNEL__) -# if defined(HAVE_INTTYPES_H) -# include -# endif # include # include #endif diff --git a/examples/spritedit.c b/examples/spritedit.c index 68cf97e..28d829a 100644 --- a/examples/spritedit.c +++ b/examples/spritedit.c @@ -13,7 +13,6 @@ */ #include "config.h" -#include "common.h" #if !defined(__KERNEL__) # include diff --git a/examples/swallow.c b/examples/swallow.c index a554ca6..be993cf 100644 --- a/examples/swallow.c +++ b/examples/swallow.c @@ -13,7 +13,7 @@ */ #include "config.h" -#include "common.h" + #if !defined(__KERNEL__) # include # include diff --git a/examples/text.c b/examples/text.c index 5df2ea3..0f763b2 100644 --- a/examples/text.c +++ b/examples/text.c @@ -13,15 +13,13 @@ */ #include "config.h" -#include "common.h" + #if !defined(__KERNEL__) -# if defined(HAVE_INTTYPES_H) -# include -# endif # include # include # include #endif + #include "cucul.h" #define STRING \ diff --git a/examples/transform.c b/examples/transform.c index 278567c..e676315 100644 --- a/examples/transform.c +++ b/examples/transform.c @@ -13,11 +13,8 @@ */ #include "config.h" -#include "common.h" + #if !defined(__KERNEL__) -# if defined(HAVE_INTTYPES_H) -# include -# endif # include # include #endif diff --git a/examples/truecolor.c b/examples/truecolor.c index 0483557..8e700bc 100644 --- a/examples/truecolor.c +++ b/examples/truecolor.c @@ -13,12 +13,8 @@ */ #include "config.h" -#include "common.h" #if !defined(__KERNEL__) -# if defined(HAVE_INTTYPES_H) -# include -# endif # include #endif diff --git a/examples/unicode.c b/examples/unicode.c index cae9e92..673082a 100644 --- a/examples/unicode.c +++ b/examples/unicode.c @@ -13,12 +13,8 @@ */ #include "config.h" -#include "common.h" #if !defined(__KERNEL__) -# if defined(HAVE_INTTYPES_H) -# include -# endif # include #endif diff --git a/kernel/kernel.c b/kernel/kernel.c index e2cc8c6..a737904 100644 --- a/kernel/kernel.c +++ b/kernel/kernel.c @@ -20,7 +20,8 @@ */ #include "config.h" -#include "common.h" + +#include "cucul_types.h" #ifdef __KERNEL__ diff --git a/msvc/Makefile.am b/msvc/Makefile.am index 2c077ce..ea3068d 100644 --- a/msvc/Makefile.am +++ b/msvc/Makefile.am @@ -4,7 +4,7 @@ NULL = EXTRA_DIST = libcaca.sln \ config.h \ - common.h \ + cucul_types.h \ libcucul.vcproj \ libcaca.vcproj \ cacafire.vcproj \ diff --git a/msvc/common.h b/msvc/common.h deleted file mode 100644 index 1898d06..0000000 --- a/msvc/common.h +++ /dev/null @@ -1 +0,0 @@ -#include "../common.h" diff --git a/msvc/cucul_types.h b/msvc/cucul_types.h new file mode 100644 index 0000000..7c1df4c --- /dev/null +++ b/msvc/cucul_types.h @@ -0,0 +1,2 @@ +#define CUCUL_TYPES 0 +#include "../cucul/cucul_types.h.in" diff --git a/ruby/Makefile.am b/ruby/Makefile.am index 219d2b7..118604c 100644 --- a/ruby/Makefile.am +++ b/ruby/Makefile.am @@ -11,7 +11,7 @@ endif CFLAGS += -Wno-strict-prototypes -Wno-missing-prototypes -cucul_la_CPPFLAGS = -I$(top_srcdir)/cucul $(RUBY_CFLAGS) +cucul_la_CPPFLAGS = -I$(top_srcdir)/cucul -I../cucul $(RUBY_CFLAGS) cucul_la_SOURCES = cucul.c \ common.h \ cucul-canvas.c \ @@ -24,7 +24,8 @@ cucul_la_SOURCES = cucul.c \ cucul_la_LDFLAGS = -module -avoid-version -shared $(RUBY_LIBS) cucul_la_LIBADD = ../cucul/libcucul.la -caca_la_CPPFLAGS = -I$(top_srcdir)/caca -I$(top_srcdir)/cucul $(RUBY_CFLAGS) +caca_la_CPPFLAGS = -I$(top_srcdir)/caca -I$(top_srcdir)/cucul -I../cucul \ + $(RUBY_CFLAGS) caca_la_SOURCES = caca.c \ common.h \ caca-display.c \ diff --git a/src/Makefile.am b/src/Makefile.am index b81e204..2e3706f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -3,7 +3,8 @@ pkgdata_DATA = caca.txt EXTRA_DIST = caca.txt -AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/cucul -I$(top_srcdir)/caca -DLIBCACA=1 -DX_DISPLAY_MISSING=1 +AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/cucul -I../cucul \ + -I$(top_srcdir)/caca -DLIBCACA=1 -DX_DISPLAY_MISSING=1 bin_PROGRAMS = cacademo cacafire cacaplay cacaview img2txt $(fcntl_programs) noinst_PROGRAMS = cacadraw diff --git a/src/aafire.c b/src/aafire.c index bbfc800..a7edbd8 100644 --- a/src/aafire.c +++ b/src/aafire.c @@ -24,12 +24,12 @@ #ifdef LIBCACA #include "config.h" -#include "common.h" #if !defined(__KERNEL__) # include # include # include #endif +#include "cucul.h" #include "caca.h" #else #include diff --git a/src/cacademo.c b/src/cacademo.c index a6f5379..3748845 100644 --- a/src/cacademo.c +++ b/src/cacademo.c @@ -15,7 +15,6 @@ */ #include "config.h" -#include "common.h" #if !defined(__KERNEL__) # include diff --git a/src/cacadraw.c b/src/cacadraw.c index 451db02..2f03d45 100644 --- a/src/cacadraw.c +++ b/src/cacadraw.c @@ -13,7 +13,6 @@ */ #include "config.h" -#include "common.h" #if !defined(__KERNEL__) # include diff --git a/src/cacaplay.c b/src/cacaplay.c index 59fa115..38fea93 100644 --- a/src/cacaplay.c +++ b/src/cacaplay.c @@ -13,7 +13,6 @@ */ #include "config.h" -#include "common.h" #if !defined(__KERNEL__) # include diff --git a/src/cacaserver.c b/src/cacaserver.c index 8ab12ec..51100f7 100644 --- a/src/cacaserver.c +++ b/src/cacaserver.c @@ -14,7 +14,6 @@ */ #include "config.h" -#include "common.h" #include #include diff --git a/src/cacaview.c b/src/cacaview.c index b40f02c..c051d87 100644 --- a/src/cacaview.c +++ b/src/cacaview.c @@ -13,7 +13,6 @@ */ #include "config.h" -#include "common.h" #if !defined(__KERNEL__) # include @@ -27,6 +26,7 @@ #include "cucul.h" #include "caca.h" + #include "common-image.h" /* Local macros */ diff --git a/src/common-image.c b/src/common-image.c index b80e452..53a74a1 100644 --- a/src/common-image.c +++ b/src/common-image.c @@ -13,7 +13,6 @@ */ #include "config.h" -#include "common.h" #if !defined(__KERNEL__) # include @@ -30,6 +29,7 @@ #endif #include "cucul.h" + #include "common-image.h" #if !defined(USE_IMLIB2) diff --git a/src/img2txt.c b/src/img2txt.c index 5810c34..cc3dc0f 100644 --- a/src/img2txt.c +++ b/src/img2txt.c @@ -14,7 +14,6 @@ */ #include "config.h" -#include "common.h" #if !defined(__KERNEL__) # include @@ -35,6 +34,7 @@ #endif #include "cucul.h" + #include "common-image.h" #define IMG2TXTVERSION "0.1" diff --git a/src/mygetopt.c b/src/mygetopt.c index 5068fb6..2201c2b 100644 --- a/src/mygetopt.c +++ b/src/mygetopt.c @@ -17,17 +17,12 @@ */ #include "config.h" -#include "common.h" - -#if defined HAVE_STDINT_H -# include -#elif defined HAVE_INTTYPES_H -# include -#endif #include #include +#include "cucul_types.h" + #include "mygetopt.h" int myoptind = 1; diff --git a/common.h b/stubs.h similarity index 87% rename from common.h rename to stubs.h index b8f5c57..e2695fd 100644 --- a/common.h +++ b/stubs.h @@ -17,21 +17,8 @@ * function prototypes that are sometimes missing. */ -/* C99 types */ -#if defined HAVE_INTTYPES_H && !defined __KERNEL__ -# include -#else -typedef signed char int8_t; -typedef signed short int16_t; -typedef signed long int int32_t; - -typedef unsigned char uint8_t; -typedef unsigned short uint16_t; -typedef unsigned long int uint32_t; - -typedef long int intptr_t; -typedef unsigned long int uintptr_t; -#endif +#ifndef __STUBS_H__ +#define __STUBS_H__ /* errno handling */ #if defined HAVE_ERRNO_H && !defined __KERNEL__ @@ -107,3 +94,5 @@ static inline uint32_t hton32(uint32_t x) } #endif +#endif /* __STUBS_H__ */ + diff --git a/tests/Makefile.am b/tests/Makefile.am index 0438caa..ba50116 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,6 +1,6 @@ # $Id$ -AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/cucul +AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/cucul -I../cucul TESTS = simple diff --git a/tests/simple.c b/tests/simple.c index 0076d3b..d4a88ee 100644 --- a/tests/simple.c +++ b/tests/simple.c @@ -13,13 +13,8 @@ */ #include "config.h" -#include "common.h" - #if !defined(__KERNEL__) -# if defined(HAVE_INTTYPES_H) -# include -# endif # include # include #endif diff --git a/tools/Makefile.am b/tools/Makefile.am index 8be961d..c58eb65 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -1,6 +1,7 @@ # $Id$ -AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/cucul -I$(top_srcdir)/caca -DDATADIR=\"$(pkgdatadir)\" +AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/cucul -I../cucul \ + -I$(top_srcdir)/caca -DDATADIR=\"$(pkgdatadir)\" noinst_PROGRAMS = optipal sortchars $(pango_programs) diff --git a/tools/makefont.c b/tools/makefont.c index c198061..2ecb9ab 100644 --- a/tools/makefont.c +++ b/tools/makefont.c @@ -16,23 +16,22 @@ */ #include "config.h" -#include "common.h" #include #include #include -#if defined(HAVE_ARPA_INET_H) +#if defined HAVE_ARPA_INET_H # include -#elif defined(HAVE_NETINET_IN_H) +#elif defined HAVE_NETINET_IN_H # include #endif -#include "cucul.h" - #include #include +#include "cucul.h" + /* Split our big strings into chunks of 480 characters, because it is * the multiple of 32 directly below 509, which is the maximum allowed * string size in C89. */ @@ -437,13 +436,13 @@ static int printf_unicode(struct glyph *g) static int printf_u32(char const *fmt, uint32_t i) { - uint32_t ni = hton32(i); + uint32_t ni = htonl(i); return printf_hex(fmt, (uint8_t *)&ni, 4); } static int printf_u16(char const *fmt, uint16_t i) { - uint16_t ni = hton16(i); + uint16_t ni = htons(i); return printf_hex(fmt, (uint8_t *)&ni, 2); } diff --git a/tools/optipal.c b/tools/optipal.c index 23bcc14..82a9b97 100644 --- a/tools/optipal.c +++ b/tools/optipal.c @@ -13,7 +13,6 @@ */ #include "config.h" -#include "common.h" #if !defined(__KERNEL__) # include diff --git a/tools/sortchars.c b/tools/sortchars.c index a1b9755..59a59da 100644 --- a/tools/sortchars.c +++ b/tools/sortchars.c @@ -13,15 +13,13 @@ */ #include "config.h" -#include "common.h" + #if !defined(__KERNEL__) -# if defined(HAVE_INTTYPES_H) -# include -# endif # include # include # include #endif + #include "cucul.h" #define GLYPHS 0x7f