Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src/include
diff options
context:
space:
mode:
authorBernie Innocenti <bernie@codewiz.org>2010-05-03 21:53:47 (GMT)
committer Bernie Innocenti <bernie@codewiz.org>2010-05-03 21:53:47 (GMT)
commit1030dc837b10a03a02a85d5504cbeec168ce49e2 (patch)
tree698eefa87ac437deaf36a4141b326f8ce7986692 /src/include
Import XaoS r489 (trunk after version 3.5)
Diffstat (limited to 'src/include')
-rw-r--r--src/include/aconfig.h.in60
-rw-r--r--src/include/archaccel.h14
-rw-r--r--src/include/btrace.h12
-rw-r--r--src/include/c256.h12
-rw-r--r--src/include/catalog.h27
-rw-r--r--src/include/complex.h63
-rw-r--r--src/include/config/aconfig.std28
-rw-r--r--src/include/config/config.autoconf141
-rw-r--r--src/include/config/config.std28
-rw-r--r--src/include/cursor.h56
-rw-r--r--src/include/fconfig.h63
-rw-r--r--src/include/filter.h335
-rw-r--r--src/include/formulas.h64
-rw-r--r--src/include/fractal.h170
-rw-r--r--src/include/gccaccel.h40
-rw-r--r--src/include/gccbuild.h65
-rw-r--r--src/include/generic.h15
-rw-r--r--src/include/grlib.h40
-rw-r--r--src/include/hicolor.h16
-rw-r--r--src/include/i386/__math.h586
-rw-r--r--src/include/i386/ctrl87.h120
-rw-r--r--src/include/i386/sstring.h414
-rw-r--r--src/include/include.pri38
-rw-r--r--src/include/misc-f.h17
-rw-r--r--src/include/param.h48
-rw-r--r--src/include/pixel_t.h21
-rw-r--r--src/include/plane.h58
-rw-r--r--src/include/sffe.h139
-rw-r--r--src/include/sffe_cmplx_asm.h140
-rw-r--r--src/include/sffe_cmplx_gsl.h82
-rw-r--r--src/include/timers.h67
-rw-r--r--src/include/true24.h31
-rw-r--r--src/include/truecolor.h13
-rw-r--r--src/include/ui.h160
-rw-r--r--src/include/ui_helper.h550
-rw-r--r--src/include/version.h.in23
-rw-r--r--src/include/xerror.h12
-rw-r--r--src/include/xio.h107
-rw-r--r--src/include/xldio.h14
-rw-r--r--src/include/xmenu.h377
-rw-r--r--src/include/xshl.h50
-rw-r--r--src/include/xthread.h208
-rw-r--r--src/include/zoom.h40
43 files changed, 4564 insertions, 0 deletions
diff --git a/src/include/aconfig.h.in b/src/include/aconfig.h.in
new file mode 100644
index 0000000..40d0f7e
--- /dev/null
+++ b/src/include/aconfig.h.in
@@ -0,0 +1,60 @@
+#ifndef ACONFIG_H
+#define ACONFIG_H
+#undef HAVE_PTHREAD_SIGHANDLER
+#undef DATAPATH
+#undef C_ALLOCA
+#undef const
+#undef USE_PTHREAD
+/*Avoid stack frame explosion on Windoze*/
+#ifndef _WIN32
+/*BeOS crashes badly when large amounts of stack are consumed */
+#ifndef __BEOS__
+#undef HAVE_ALLOCA
+#undef HAVE_ALLOCA_H
+#endif
+#endif
+#undef HAVE_FABSL
+#undef HAVE__FABSL
+#undef HAVE___FABSL
+#undef HAVE_FTIME
+#undef USE_PNG
+#undef HAVE_FINITE
+#undef HAVE_SELECT
+#undef HAVE_LONG_DOUBLE
+#undef HAVE_REDRAWWIN
+#undef HAVE_WREDRAWLN
+#undef USE_NCURSES
+#undef inline
+#undef _POSIX_SOURCE
+#undef STDC_HEADERS
+/* Define if you can safely include both <sys/time.h> and <time.h>. */
+#undef TIME_WITH_SYS_TIME
+#undef HAVE_GETTIMEOFDAY
+#undef HAVE_USLEEP
+#undef HAVE_TERMATTRS
+#undef HAVE_MOUSEMASK
+#undef HAVE_SETITIMER
+/* Define if you have the <limits.h> header file. */
+#undef HAVE_LIMITS_H
+/* Define if you have the <sys/time.h> header file. */
+#undef HAVE_SYS_TIME_H
+/* Define if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+#undef MITSHM
+#undef CURSES_DRIVER
+#undef BEOS_DRIVER
+#undef AA_DRIVER
+#undef GTK_DRIVER
+#undef GGI_DRIVER
+#undef X11_DRIVER
+#undef DGA_DRIVER
+#undef SVGA_DRIVER
+#undef WIN32_DRIVER
+#undef DDRAW_DRIVER
+#undef HTML_HELP
+#undef SIZEOF_SHORT
+#undef SIZEOF_INT
+#undef SIZEOF_LONG
+#undef HAVE_GETTEXT
+#undef NO_MALLOC_H
+#endif
diff --git a/src/include/archaccel.h b/src/include/archaccel.h
new file mode 100644
index 0000000..498f028
--- /dev/null
+++ b/src/include/archaccel.h
@@ -0,0 +1,14 @@
+#ifndef ACCEL_H
+#define ACCEL_H
+#ifdef __GNUC__
+#ifdef __i386__
+#ifdef __OPTIMIZE__
+#include <i386/sstring.h>
+#endif
+#endif
+#endif
+#endif
+
+#ifndef memset_long
+#define memset_long(x,y,z) memset(x,y,z)
+#endif
diff --git a/src/include/btrace.h b/src/include/btrace.h
new file mode 100644
index 0000000..a014934
--- /dev/null
+++ b/src/include/btrace.h
@@ -0,0 +1,12 @@
+#ifndef BTRACE_H
+#define BTRACE_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+ int boundarytrace(int x1, int y1, int x2, int y2, number_t * xpos,
+ number_t * ypos);
+ int boundarytraceall(number_t * xpos, number_t * ypos);
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/src/include/c256.h b/src/include/c256.h
new file mode 100644
index 0000000..5854ba1
--- /dev/null
+++ b/src/include/c256.h
@@ -0,0 +1,12 @@
+#ifdef cpixel_t
+#undef cpixel_t
+#undef cpixeldata_t
+#undef cppixel_t
+#undef bpp
+#endif
+#define cpixel_t pixel8_t
+#define cppixel_t ppixel8_t
+#define cpixeldata_t pixel8_t
+#define bpp 1
+#include <generic.h>
+#define bpp1
diff --git a/src/include/catalog.h b/src/include/catalog.h
new file mode 100644
index 0000000..ba33f84
--- /dev/null
+++ b/src/include/catalog.h
@@ -0,0 +1,27 @@
+/* Small library to handle catalog files
+ */
+#ifndef CATALOG_H
+#define CATALOG_H
+#define CHASHMAX 31 /*Just small hash table. Should be OK */
+#include <xio.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+ struct varnames {
+ struct varnames *left, *right;
+ char *name;
+ char *value;
+ };
+ typedef struct catalog {
+ struct varnames *root[CHASHMAX];
+ } catalog_t;
+/*Find text in catalog */
+ extern char *find_text(catalog_t * catalog, CONST char *name);
+/*Load catalog from file */
+ extern catalog_t *load_catalog(xio_file f, CONST char **error);
+/*Free memory used by catalog */
+ extern void free_catalog(catalog_t *);
+#ifdef __cplusplus
+}
+#endif
+#endif /*VARIABLE_H */
diff --git a/src/include/complex.h b/src/include/complex.h
new file mode 100644
index 0000000..75b31e6
--- /dev/null
+++ b/src/include/complex.h
@@ -0,0 +1,63 @@
+/*
+ * XaoS, a fast portable realtime fractal zoomer
+ * Copyright (C) 1996,1997 by
+ *
+ * Jan Hubicka (hubicka@paru.cas.cz)
+ * Thomas Marsh (tmarsh@austin.ibm.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+/* Simplified version. See XaoS2.2 for full version of this library.
+ * It caused problems (overflows) at certain preprocesors
+ */
+#ifndef COMPLEX_H
+#define COMPLEX_H
+#include <config.h>
+
+#define c_add(ar,ai,br,bi,or,oi) ((or)=(ar)+(br),(oi)=(ai)+(bi))
+#define c_mul(ar,ai,br,bi,or,oi) ((or)=(ar)*(br)-(ai)*(bi),(oi)=((ar)*(bi))+((ai)*(br)))
+
+#define c_sub(ar,ai,br,bi,or,oi) ((or)=(ar)-(br),(oi)=(ai)-(bi))
+
+#define c_div_rp(ar,ai,br,bi) (((ar) * (br) + (ai) * (bi))/ ((bi) * (bi) + (br) * (br)))
+#define c_div_ip(ar,ai,br,bi) ((-(ar) * (bi) + (ai) * (br)) / ((br) * (br) + (bi) * (bi)))
+#define c_div(ar,ai,br,bi,or,oi) ((or)=c_div_rp(ar,ai,br,bi),(oi)=c_div_ip(ar,ai,br,bi))
+
+#define c_pow2_rp(ar,ai) ((ar)*(ar)-(ai)*(ai))
+#define c_pow2_ip(ar,ai) (2*(ar)*(ai))
+#define c_pow2(ar,ai,or,oi) ((or)=c_pow2_rp(ar,ai),(oi)=c_pow2_ip(ar,ai))
+
+
+#define c_pow3_rp(ar,ai) ((ar)*(ar)*(ar)-3*(ar)*(ai)*(ai))
+#define c_pow3_ip(ar,ai) (3*(ar)*(ar)*(ai)-(ai)*(ai)*(ai))
+#define c_pow3(ar,ai,or,oi) ((or)=c_pow3_rp(ar,ai),(oi)=c_pow3_ip(ar,ai))
+
+#define c_pow4_rp(ar,ai) ((ar)*(ar)*(ar)*(ar)-6*(ar)*(ar)*(ai)*(ai)+(ai)*(ai)*(ai)*(ai))
+#define c_pow4_ip(ar,ai) (4*(ar)*(ar)*(ar)*(ai)-4*(ar)*(ai)*(ai)*(ai))
+#define c_pow4(ar,ai,or,oi) ((or)=c_pow4_rp(ar,ai),(oi)=c_pow4_ip(ar,ai))
+
+
+#ifndef __GNUC__
+#ifdef INLINEFABS
+#define myabs(x) INLINEFABS(x)
+#else
+#define myabs(x) ((x)>0?(x):-(x))
+#endif
+#else
+#include <gccbuild.h>
+#endif
+
+#endif /* COMPLEX_H */
diff --git a/src/include/config/aconfig.std b/src/include/config/aconfig.std
new file mode 100644
index 0000000..9c10eed
--- /dev/null
+++ b/src/include/config/aconfig.std
@@ -0,0 +1,28 @@
+/* aconfig.h. Generated automatically by configure. */
+#ifndef ACONFIG_H
+#define DATAPATH "./"
+#define ACONFIG_H
+#define HAVE_LONG_DOUBLE 1
+#define USE_PNG
+#define SIZEOF_INT 4
+#define HAVE_FINITE
+#define USE_STDIO
+#define SIZEOF_SHORT 2
+#define SIZEOF_LONG 4
+/* #undef inline */
+/* #undef _POSIX_SOURCE */
+#define STDC_HEADERS 1
+/* Define if you can safely include both <sys/time.h> and <time.h>. */
+#define TIME_WITH_SYS_TIME 1
+#define HAVE_GETTIMEOFDAY 1
+#define HAVE_MOUSEMASK 1
+#define HAVE_USLEEP 1
+#define USE_ALLEGRO 1
+#define HAVE_UCLOCK 1
+#define HAVE_TERMATTRS 1
+#define HAVE_SETITIMER 1
+#define HAVE_LIMITS_H 1
+#define HAVE_SYS_TIME_H 1
+#define HAVE_UNISTD_H 1
+#define AA_DRIVER 1
+#endif
diff --git a/src/include/config/config.autoconf b/src/include/config/config.autoconf
new file mode 100644
index 0000000..8553574
--- /dev/null
+++ b/src/include/config/config.autoconf
@@ -0,0 +1,141 @@
+#ifndef CONFIG_H
+#define CONFIG_H
+#define HOMEDIR
+
+#ifdef __BEOS__
+#define MAIN_FUNCTION be_main
+#ifdef __POWERPC__
+# define SLOWCACHESYNC
+# ifdef __MWERKS__
+# define INLINEFABS(x) __fabs(x)
+# endif
+#endif
+#endif
+
+#ifdef _WIN32
+#define CONFIGFILE "XaoS.cfg"
+#else
+#define CONFIGFILE ".XaoSrc"
+#endif
+
+/*For compilers that don't support nameless unions, do a
+#define NONAMELESSUNION
+before #include <ddraw.h>*/
+#ifdef _WIN32
+#define NONAMELESSUNION
+#endif
+
+/*#define I_WAS_HERE */ /*uncoment this to disable changing of parameters by atoconf */
+
+#define FPOINT_TYPE long double
+ /*floating point math type on computers
+ with medium speed floating point math should
+ use float instead */
+#include <aconfig.h>
+#define USE_STDIO
+#if !defined(HAVE_LONG_DOUBLE)&&!defined(I_WAS_HERE)
+#undef FPOINT_TYPE
+#define FPOINT_TYPE double
+#endif
+#define CONST const
+#define INLINE inline
+
+/* BeOS have broken long double IO routines on i386. Use our replacements */
+#ifdef __BEOS__
+#ifdef __i386__
+#define USE_XLDIO
+#endif
+#endif
+
+/* Win32 don't support long double IO. Use our replacements if possible */
+#ifdef _WIN32
+#ifndef __GNUC__
+1
+/* You need to solve long double IO problems to compile XaoS on non-gcc
+ * compiler */
+#endif
+#define USE_XLDIO
+#endif
+
+#include "gccaccel.h"
+#ifdef HAVE_MOUSEMASK
+#define NCURSESMOUSE
+#endif
+#ifndef HAVE_LIMITS_H
+#define INT_MAX 2127423647
+#endif
+#ifdef SVGA_DRIVER
+#define DESTICKY
+#endif
+#ifdef COCOA_DRIVER
+#define SFIXEDCOLOR
+#define STRUECOLOR
+#define STRUECOLOR16
+#define STRUECOLOR24
+#define SMBITMAPS
+#define SLBITMAPS
+#endif
+#ifdef GTK_DRIVER
+#define SFIXEDCOLOR
+#define STRUECOLOR
+#define STRUECOLOR16
+#define STRUECOLOR24
+#define SMBITMAPS
+#define SLBITMAPS
+#endif
+#ifdef X11_DRIVER
+#define SFIXEDCOLOR
+#define STRUECOLOR
+#define STRUECOLOR16
+#define STRUECOLOR24
+#define SMBITMAPS
+#define SLBITMAPS
+#endif
+#ifdef SVGA_DRIVER
+#undef STRUECOLOR16
+#define STRUECOLOR16
+#undef STRUECOLOR24
+#define STRUECOLOR24
+#endif
+#ifdef GGI_DRIVER
+#undef STRUECOLOR16
+#define STRUECOLOR16
+#undef STRUECOLOR24
+#define STRUECOLOR24
+#undef SLBITMAPS
+#define SLBITMAPS
+#endif
+#ifdef BEOS_DRIVER
+#ifdef __cplusplus
+extern "C" {
+#endif
+#ifdef __GNUC__
+void be_exit_xaos(int i) __attribute__ ((__noreturn__));
+#else
+void be_exit_xaos(int i);
+#endif
+#ifdef __cplusplus
+}
+#endif
+#define exit_xaos(i) be_exit_xaos(i)
+#undef STRUECOLOR16
+#define STRUECOLOR16
+#undef SFIXEDCOLOR
+#define SFIXEDCOLOR
+#undef SMBITMAPS
+#define SMBITMAPS
+#undef SLBITMAPS
+#define SLBITMAPS
+#endif
+#ifdef WIN32_DRIVER
+#define MAIN_FUNCTION XaoS_main
+#undef STRUECOLOR16
+#define STRUECOLOR16
+#undef STRUECOLOR24
+#define STRUECOLOR24
+#endif
+#ifdef HAVE_SELECT
+#define COMPILE_PIPE
+#endif
+#endif /*CONFIG_H */
+
diff --git a/src/include/config/config.std b/src/include/config/config.std
new file mode 100644
index 0000000..c5313e9
--- /dev/null
+++ b/src/include/config/config.std
@@ -0,0 +1,28 @@
+#ifndef CONFIG_H
+#define CONFIG_H
+#define CONFIGFILE "xaos.cfg"
+#define FPOINT_TYPE long double
+ /*floating point math type on computers
+ with medium speed floating point math should
+ use float instead */
+#define USE_LONG /*for autoconf..undefine if
+ fpoint_type is set to other than
+ long_double */
+/*#define MITSHM */
+ /*undefine this if you system does not
+ support shared memory */
+/* You don't need to change these lines unless you now what you are doing */
+
+#include <aconfig.h>
+#define USE_STDIO
+#include <gccaccel.h>
+#define HAVE_GETTIMEOFDAY
+#define TIME_WITH_SYS_TIME
+#define HAVE_LIMITS_H
+#define HAVE_UNISTH_H
+#define HAVE_SYS_TIME_H
+#define
+#define STRUECOLOR24
+#define STRUECOLOR
+#define STRUECOLOR16
+#endif /*CONFIG_H */
diff --git a/src/include/cursor.h b/src/include/cursor.h
new file mode 100644
index 0000000..45859fc
--- /dev/null
+++ b/src/include/cursor.h
@@ -0,0 +1,56 @@
+CONST static unsigned char wait_pointer_data[256] = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 2, 1, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 2, 2, 1, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 2, 2, 2, 2, 1, 0,
+ 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 1,
+ 0, 0, 0, 1, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 1,
+ 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1,
+ 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 0,
+ 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1,
+ 0, 0, 0, 1, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 1,
+ 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 1,
+ 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 2, 2, 2, 2, 1, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 2, 2, 1, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 2, 1, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, 0, 0, 0,
+};
+
+CONST static unsigned char mouse_pointer_data[256] = {
+ 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 2, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 2, 2, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 2, 2, 2, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 2, 2, 2, 2, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 2, 2, 2, 2, 2, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 2, 2, 2, 2, 2, 2, 2, 1, 0, 0, 0, 0, 0, 0, 0,
+ 1, 2, 2, 2, 2, 2, 2, 2, 2, 1, 0, 0, 0, 0, 0, 0,
+ 1, 2, 2, 2, 2, 2, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,
+ 1, 2, 2, 1, 2, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 2, 1, 0, 1, 2, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 0, 1, 2, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 1, 2, 2, 1, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 1, 2, 2, 1, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0
+};
+
+static unsigned char replay_pointer_data[256] = {
+ 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 2, 2, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 2, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+};
diff --git a/src/include/fconfig.h b/src/include/fconfig.h
new file mode 100644
index 0000000..bd007b3
--- /dev/null
+++ b/src/include/fconfig.h
@@ -0,0 +1,63 @@
+#ifndef FCONFIG_H
+#define FCONFIG_H
+#include <config.h>
+#define TUTORIALPATH DATAPATH"/tutorial/"
+#define EXAMPLESPATH DATAPATH"/examples/"
+#define CATALOGSPATH DATAPATH"/catalogs/"
+#define HELPPATH DATAPATH"/help/xaos.hlp"
+
+#define DEFAULT_MAX_ITER 170
+ /*default number of iterations should be set
+ lower for slow computers */
+#define DEFAULT_BAILOUT 4
+#define MAXSTEP (0.008*3)
+ /*zooming step. For slow computer should
+ be set lower. Longer steps takes more time
+ and invoke yet longer ones etc.. */
+#define STEP (0.0006*3)
+ /*speedup */
+#define XSIZE 640
+ /*default sizes of window */
+#define YSIZE 480
+#define ROTATIONSPEED 30
+
+
+
+ /*some constatnts used by various parts of XaoS */
+#ifndef DEBUG
+#define NDEBUG
+#endif
+#ifndef FRAMERATE /*plan9 seems to require this */
+#define FRAMERATE 20
+#define LOOKSIZE 2
+ /*size explored by autopilot */
+#define RANGE1 30
+#define NGUESSES (RANGE1*RANGE1/2)
+#define MAXTIME 10
+ /*maximum zooming time to one direction */
+#define NGUESSES1 10
+ /*maximum number of guesses using first
+ method */
+#define NGUESSES2 1000
+ /*maximum number of guesses using second
+ method */
+#define SPEEDUP 1.05
+ /*speedup of speedup */
+#endif
+/*#define SLOWFUNCPTR*/
+
+#ifdef _plan9_
+#undef number_t
+#define number_t double
+#else
+typedef FPOINT_TYPE number_t;
+#endif
+
+#undef STAT
+#ifdef STATISTICS
+#define STAT(x) x
+#else
+#define STAT(x)
+#endif
+#define NUMBER_BIG ((number_t)INT_MAX)
+#endif /*FCONFIG_H */
diff --git a/src/include/filter.h b/src/include/filter.h
new file mode 100644
index 0000000..be27bd5
--- /dev/null
+++ b/src/include/filter.h
@@ -0,0 +1,335 @@
+#ifndef IMAGE_H
+#define IMAGE_H
+#include "fconfig.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ typedef unsigned char pixel_t;
+ typedef unsigned char rgb_t[4]; /*4 is better than 3 - makes multiplying easier */
+ struct truec {
+ int rshift, gshift, bshift; /*the shift ammounts */
+ int rprec, gprec, bprec; /*precisity - 0=8bit, 1=7bit, -1=9bit etc... */
+ unsigned int rmask, gmask, bmask; /*masks */
+ unsigned int mask1, mask2, allmask; /*Mask1 and mask2 are distinc color masks
+ allmask are mask for all colors */
+ int byteexact; /*When every colors is at one byte */
+ int missingbyte; /*for 32bit truecolor and exact byte places one byte is
+ unused... */
+ };
+ union paletteinfo {
+ struct truec truec;
+ };
+ struct palette {
+ int start;
+ int end;
+ int maxentries;
+ int version;
+ int type;
+ unsigned int *pixels;
+ int npreallocated;
+ rgb_t *rgb;
+ int flags;
+ int (*alloccolor) (struct palette * pal, int init, int r, int g,
+ int b);
+ void (*setpalette) (struct palette * pal, int start, int end,
+ rgb_t * rgb);
+ void (*allocfinished) (struct palette * pal);
+ void (*cyclecolors) (struct palette * pal, int direction);
+ int size; /*number of allocated color entries */
+ void *data; /*userdata */
+ /*Preallocated palette cells */
+ int ncells;
+ unsigned int *index;
+ CONST rgb_t *prergb;
+ union paletteinfo info;
+ };
+ struct image {
+ float pixelwidth, pixelheight;
+ pixel_t **oldlines;
+ pixel_t **currlines;
+ void (*flip) (struct image * img);
+ int width, height, nimages;
+ int bytesperpixel;
+ int currimage;
+ int flags;
+ int scanline;
+ int version;
+ struct palette *palette;
+ void *data; /*userdata */
+ };
+#define interpol1(i1,i2,n,mask) ((((i1)&(mask))*(n)+((i2)&(mask))*(256-(n)))&((mask)<<8))
+#define interpol(i1,i2,n,mr,mg,mb) ((interpol1(i1,i2,n,mr)+interpol1(i1,i2,n,mg)+interpol1(i1,i2,n,mb))>>8)
+#define intergray(i1,i2,n) (((i1)*n+(i2)*(256-(n)))>>8)
+ /*
+ * J.B. Langston 3/13/2008
+ *
+ * The Mac OS X driver requires a 32-bit rgb mask where the most significant
+ * byte is on (e.g., 0xffffff00). This exposed a bug in the interpol macro
+ * that resulted in distorted colors for the smooth coloring modes.
+ * If the interpol macro is applied to such a mask, it causes an overflow
+ * of the 32-bit int, and the left-most color byte is lost.
+ *
+ * I added shiftinterpol macro to handle such masks. It shifts everything 1
+ * byte to the right, performs the calculation, and then shifts everything
+ * back 1 byte to the left when it is done.
+ *
+ * I also created the safeinterpol macro which detects if the most
+ * signficant byte in the mask is on, and uses the shiftinterpol macro if
+ * so, or the orignal interpol macro if not.
+ *
+ * I then modified the interpoltype macro to use the safeinterpol macro
+ * instead of the interpol macro directly.
+ */
+#define shiftinterpol(i1,i2,n,mr,mg,mb) (interpol((i1)>>8,(i2)>>8,n,(mr)>>8,(mg)>>8,(mb)>>8)<<8)
+#define safeinterpol(i1,i2,n,mr,mg,mb) ((((mr)|(mg)|(mb))&0xff000000)?shiftinterpol(i1,i2,n,mr,mg,mb):interpol(i1,i2,n,mr,mg,mb))
+#define interpoltype(palette,i1,i2,n) ((palette).type==GRAYSCALE || (palette).type == LARGEITER?intergray(i1,i2,n):safeinterpol(i1,i2,n,(palette).info.truec.rmask,(palette).info.truec.gmask,(palette).info.truec.bmask))
+/*palette flags */
+#define UNKNOWNENTRIES 1
+#define DONOTCHANGE 2
+#define FINISHLATER 4
+#define UNFINISHED 8
+/*image flags */
+#define FREELINES 1
+#define FREEDATA 2
+#define AAIMAGE 4
+#define PROTECTBUFFERS 8
+/*palette types supported by most of engine*/
+#define C256 1
+#define GRAYSCALE 2
+#define TRUECOLOR16 4
+#define TRUECOLOR24 8
+#define TRUECOLOR 16
+/*special mage types used internaly by XaoS */
+#define LARGEITER 32
+#define SMALLITER 64
+
+/*palette types handled by the dithering filter*/
+#define LBITMAP 256
+#define MBITMAP 512
+#define LIBITMAP 1024
+#define MIBITMAP 2048
+#define FIXEDCOLOR 4096
+
+#define ALLMASK (C256|TRUECOLOR16|TRUECOLOR24|LARGEITER|GRAYSCALE)
+#define BITMAPS (LBITMAP|MBITMAP|LIBITMAP|MIBITMAP)
+#define MASK1BPP (SMALLITER|C256|GRAYSCALE)
+#define MASK2BPP (TRUECOLOR16|LARGEITER)
+#define MASK3BPP (TRUECOLOR24)
+#define MASK4BPP (TRUECOLOR)
+
+/*flags for requirements */
+#define IMAGEDATA 1
+#define TOUCHIMAGE 2
+#define NEWIMAGE 4
+/*flags for initdata */
+#define DATALOST 1
+/*flags for doit */
+#define INTERRUPTIBLE 1
+#define PALETTEONLY 2
+/*return flags */
+#define INEXACT 1
+#define CHANGED 2
+#define ANIMATION 4
+#define UNCOMPLETTE (1<<29)
+/*flags for filters */
+#define ALLOCEDIMAGE 1 /*used by inherimage mechanizm */
+#define SHAREDDATA 2
+
+#define PALGORITHMS 3
+#ifdef _plan9_
+#undef pixel32_t
+#undef pixel8_t
+#undef pixel16_t
+#define pixel32_t unsigned int
+#define pixel16_t unsigned short
+#define pixel8_t unsigned char
+#undef ppixel8_t
+#undef ppixel16_t
+#undef ppixel24_t
+#undef ppixel32_t
+#define ppixel8_t pixel8_t *
+#define ppixel16_t pixel16_t *
+#define ppixel24_t unsigned char *
+#define ppixel32_t pixel32_t *
+#else
+#include <pixel_t.h> /*avoid problems with plan9-it ignores #if
+ So code must be separated into another file */
+#endif
+#define imgetpixel(image,x,y) ((image)->bytesperpixel==1?(image)->currlines[y][x]:((image)->bytesperpixel==4?((pixel32_t*)(image)->currlines[y])[x]:(image)->bytesperpixel==3?(((pixel16_t *)(image)->currlines[y])[x]+((image)->currlines[y][3*(x)+2]<<16)):(((pixel16_t*)(image)->currlines[y])[x])))
+ struct requirements {
+ int nimages;
+ int supportedmask;
+ int flags;
+ };
+ struct filter {
+ struct filter *next, *previous;
+ struct queue *queue;
+ CONST struct filteraction *action;
+ struct image *image, *childimage;
+ struct requirements req;
+ struct fractal_context *fractalc;
+ void *data;
+ CONST char *name;
+ int flags;
+ int imageversion; /*For detection whether image changed or not */
+ void (*wait_function) (struct filter * f);
+ /*stuff for wait_function */
+ int pos, max, incalculation, readyforinterrupt, interrupt;
+ CONST char *pass;
+ };
+ struct initdata {
+ void (*wait_function) (struct filter * f);
+ struct image *image;
+ struct fractal_context *fractalc;
+ int flags;
+ };
+ struct filteraction {
+ CONST char *name;
+ CONST char *shortname;
+ int flags;
+ struct filter *(*getinstance) (CONST struct filteraction * a);
+ void (*destroyinstance) (struct filter * f);
+ int (*doit) (struct filter * f, int flags, int time);
+ int (*requirement) (struct filter * f, struct requirements * r);
+ int (*initialize) (struct filter * f, struct initdata * i);
+ void (*convertup) (struct filter * f, int *x, int *y);
+ void (*convertdown) (struct filter * f, int *x, int *y);
+ void (*removefilter) (struct filter * f);
+ };
+ struct queue {
+ struct filter *first, *last;
+ int isinitialized;
+ struct filter *palettechg;
+ struct image *saveimage;
+ };
+
+
+#define datalost(f,i) (((i)->flags&DATALOST)||((f)->imageversion&&(f)->imageversion!=(i)->image->version))
+/*filter actions */
+
+ extern unsigned int col_diff[3][512];
+ struct filter *createfilter(CONST struct filteraction *fa);
+ struct queue *create_queue(struct filter *f);
+ void insertfilter(struct filter *f1, struct filter *f2);
+ void removefilter(struct filter *f);
+ void addfilter(struct filter *f1, struct filter *f2);
+ int initqueue(struct queue *q);
+
+/*Filter utility functions */
+ int reqimage(struct filter *f, struct requirements *req,
+ int supportedmask, int flags);
+ int inherimage(struct filter *f, struct initdata *data, int flags,
+ int width, int height, struct palette *palette,
+ float pixelwidth, float pixelheight);
+ void destroyinheredimage(struct filter *f);
+ void updateinheredimage(struct filter *f);
+
+ void inhermisc(struct filter *f, CONST struct initdata *i);
+
+/*image actions */
+
+ void flipgeneric(struct image *img);
+ struct image *create_image_lines(int width, int height,
+ int nimages, pixel_t ** lines1,
+ pixel_t ** lines2,
+ struct palette *palette,
+ void (*flip) (struct image * img),
+ int flags, float pixelwidth,
+ float pixelheight);
+ struct image *create_image_cont(int width, int height,
+ int scanlinesize, int nimages,
+ pixel_t * buf1, pixel_t * buf2,
+ struct palette *palette,
+ void (*flip) (struct image * img),
+ int flags, float pixelwidth,
+ float pixelheight);
+ struct image *create_image_mem(int width, int height, int nimages,
+ struct palette *palette,
+ float pixelwidth, float pixelheight);
+ struct image *create_subimage(struct image *simg, int width,
+ int height, int nimages,
+ struct palette *palette,
+ float pixelwidth, float pixelheight);
+
+ void destroy_image(struct image *img);
+ void clear_image(struct image *img);
+
+/*palette */
+
+ int bytesperpixel(int type) CONSTF;
+ void bestfit_init(void);
+ struct palette *createpalette(int start, int end, int type, int flags,
+ int maxentries,
+ int (*alloccolor) (struct palette * pal,
+ int init, int r,
+ int g, int b),
+ void (*setcolor) (struct palette * pal,
+ int start, int end,
+ rgb_t * rgb),
+ void (*allocfinished) (struct palette *
+ pal),
+ void (*cyclecolors) (struct palette *
+ pal, int direction),
+ union paletteinfo *info);
+ void destroypalette(struct palette *palette);
+ int mkdefaultpalette(struct palette *palette);
+ int mkstereogrampalette(struct palette *palette);
+ int mkstarfieldpalette(struct palette *palette);
+ int mkblurpalette(struct palette *palette);
+ int mkgraypalette(struct palette *palette);
+ int mkrgb(struct palette *palette);
+ int mkpalette(struct palette *palette, int seed, int algorithm);
+ int shiftpalette(struct palette *palette, int n);
+ void preallocpalette(struct palette *pal);
+ struct palette *clonepalette(struct palette *palette);
+ void restorepalette(struct palette *dest, struct palette *src);
+ void convertupgeneric(struct filter *f, int *x, int *y);
+ void convertdowngeneric(struct filter *f, int *x, int *y);
+ int fixedalloccolor(struct palette *palette, int init, int r, int g,
+ int b) CONSTF;
+
+#define setfractalpalette(f,p) if((f)->fractalc->palette==(f)->image->palette) (f)->fractalc->palette=(p)
+
+#ifdef STRUECOLOR24
+#define TRUECOLOR24CASE(x) case 3:x;break;
+#else
+#define TRUECOLOR24CASE(x)
+#endif
+
+#ifdef STRUECOLOR16
+#define SUPPORT16
+#endif
+#ifdef SUPPORT16
+#define TRUECOLOR16CASE(x) case 2:x;break;
+#else
+#define TRUECOLOR16CASE(x)
+#endif
+
+#define drivercall(i,x1,x2,x3,x4) switch((i).bytesperpixel) { \
+ TRUECOLOR24CASE(x3); \
+ TRUECOLOR16CASE(x2); \
+ case 1:x1;break; \
+ case 4:x4; \
+}
+#ifdef SMBITMAPS
+#define SBITMAPS
+#else
+#ifdef SLBITMAPS
+#define SBITMAPS
+#endif
+#endif
+
+#ifdef SBITMAPS
+#define SCONVERTORS
+#else
+#ifdef SFIXEDCOLOR
+#define SCONVERTORS
+#endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#include "formulas.h"
+#endif
diff --git a/src/include/formulas.h b/src/include/formulas.h
new file mode 100644
index 0000000..4a061cc
--- /dev/null
+++ b/src/include/formulas.h
@@ -0,0 +1,64 @@
+/*
+ * XaoS, a fast portable realtime fractal zoomer
+ * Copyright (C) 1996,1997 by
+ *
+ * Jan Hubicka (hubicka@paru.cas.cz)
+ * Thomas Marsh (tmarsh@austin.ibm.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+#ifndef FORMULAS_H
+#define FORMULAS_H
+
+#include <config.h>
+#include <fractal.h>
+
+#ifdef SFFE_USING
+#include "sffe.h"
+#ifdef SFFE_CMPLX_ASM
+#include "sffe_cmplx_asm.h"
+#elif SFFE_CMPLX_GSL
+#include "sffe_cmplx_gsl.h"
+#endif
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef SFFE_USING
+ /*extern sffe* parser;
+ extern sffe* pinit; */
+ extern cmplx Z;
+ extern cmplx pZ;
+ extern cmplx C;
+#endif
+
+#define MAX_LAMBDA 2
+
+
+#define FORMULAMAGIC 1121
+
+ extern CONST char *CONST incolorname[];
+ extern CONST struct formula formulas[];
+ extern CONST char *CONST outcolorname[];
+ extern CONST char *CONST tcolorname[];
+ extern CONST int nformulas;
+ extern CONST int nmformulas;
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* FORMULAS_H */
diff --git a/src/include/fractal.h b/src/include/fractal.h
new file mode 100644
index 0000000..188ac8d
--- /dev/null
+++ b/src/include/fractal.h
@@ -0,0 +1,170 @@
+/*
+ * XaoS, a fast portable realtime fractal zoomer
+ * Copyright (C) 1996,1997 by
+ *
+ * Jan Hubicka (hubicka@paru.cas.cz)
+ * Thomas Marsh (tmarsh@austin.ibm.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+#ifndef FRACTAL1_H
+#define FRACTAL1_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "config.h"
+#include "fconfig.h"
+#define INCOLORING 11
+#define OUTCOLORING 11
+#define TCOLOR 15
+
+ typedef struct {
+ number_t y0, k;
+ } symetrytype;
+
+ struct symetryinfo {
+ number_t xsym, ysym;
+ int nsymetries;
+ CONST symetrytype *symetry;
+ };
+ typedef struct {
+ number_t mc, nc;
+ number_t mi, ni;
+ } vrect;
+ typedef struct {
+ number_t cr, ci;
+ number_t rr, ri;
+ } vinfo;
+ typedef unsigned int (*iterationfunc) (number_t, number_t, number_t,
+ number_t) CONSTF REGISTERS(3);
+ struct formula {
+ int magic;
+#ifndef SLOWFUNCPTR
+ iterationfunc calculate, calculate_periodicity, smooth_calculate,
+ smooth_calculate_periodicity;
+#endif
+ void (*calculate_julia) (struct image * img, register number_t pre,
+ register number_t pim);
+ CONST char *name[2];
+ CONST char *shortname;
+ vinfo v;
+ int hasperiodicity;
+ int mandelbrot;
+ number_t pre, pim;
+ struct symetryinfo (out[OUTCOLORING + 1]);
+ struct symetryinfo (in[INCOLORING + 1]);
+ int flags;
+ };
+
+ struct fractal_context {
+ number_t pre, pim;
+ number_t bre, bim;
+ CONST struct formula *currentformula;
+ number_t angle;
+ int periodicity;
+ unsigned int maxiter;
+ number_t bailout;
+ int coloringmode, incoloringmode;
+ int intcolor, outtcolor;
+ int mandelbrot;
+ int plane;
+ int version;
+ int range;
+ float windowwidth, windowheight;
+ vinfo s;
+ vrect rs;
+ number_t sin, cos;
+ int slowmode; /* 1 in case we want to be exact, not fast */
+ /*values temporary filled by set_fractal_context */
+ iterationfunc calculate[2];
+ number_t periodicity_limit;
+ struct palette *palette; /*fractal's palette */
+ };
+ typedef struct fractal_context fractal_context;
+ typedef struct {
+ double y0, k, kk, y0k;
+ } symetry2;
+
+ struct symetryinfo2 {
+ number_t xsym, ysym;
+ int nsymetries;
+ symetry2 *symetry;
+ number_t xmul, ymul, xdist, ydist;
+ };
+#define STARTZERO 1
+#define JULIA_BTRACE 2
+#define MANDEL_BTRACE 4
+
+#ifdef SFFE_USING
+#define SFFE_FRACTAL 8
+#endif
+
+#define BTRACEOK ((cformula.flags&(2<<cfractalc.mandelbrot))&&!cfractalc.incoloringmode&&cfractalc.coloringmode!=7)
+#define rotate(f,x,y) { \
+ number_t tmp; \
+ tmp=(x)*(f).cos-(y)*(f).sin; \
+ y=(x)*(f).sin+(y)*(f).cos; \
+ x=tmp; \
+}
+#define rotateback(f,x,y) { \
+ number_t tmp; \
+ tmp=(x)*(f).cos+(y)*(f).sin; \
+ y=-(x)*(f).sin+(y)*(f).cos; \
+ x=tmp; \
+}
+
+ extern struct symetryinfo2 cursymetry;
+ extern struct fractal_context cfractalc;
+ extern struct formula cformula;
+ extern struct palette cpalette;
+ extern struct image cimage;
+
+#ifdef STATISTICS
+/*This is an statistics variables printed from various parts
+ *of XaoS.
+ */
+ extern int nadded2, nsymetry2, nskipped2;
+ extern int tocalculate2, avoided2, frames2;
+ extern int ncalculated2, ninside2;
+ extern int niter2, niter1;
+ extern int nperi;
+
+
+ extern int iters2, guessed2, unguessed2, total2;
+
+#endif
+
+ void set_formula(fractal_context *, int);
+ void set_fractalc(fractal_context *, struct image *img);
+ void fractalc_resize_to(fractal_context *, float, float);
+ void update_view(fractal_context *);
+ void free_fractalc(fractal_context *);
+ fractal_context *make_fractalc(CONST int, float, float);
+ void speed_test(fractal_context *, struct image *img);
+ unsigned int calculateswitch(register number_t x1,
+ register number_t y1,
+ register number_t x2,
+ register number_t y2,
+ int periodicity) REGISTERS(3);
+
+/* needs struct formula */
+#include <formulas.h>
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* FRACTAL_H */
diff --git a/src/include/gccaccel.h b/src/include/gccaccel.h
new file mode 100644
index 0000000..cd08fb4
--- /dev/null
+++ b/src/include/gccaccel.h
@@ -0,0 +1,40 @@
+/* GNU C accelerators */
+#if defined (__GNUC__)
+#define myfabs(x) fabs(x)
+#if __GNUC__ >= 2 && (__GNUC__ > 2 || __GNUC_MINOR__ >= 95)
+#define __GNUC__EGCS
+#endif
+#if __GNUC__ >= 2 && (__GNUC__ > 2 || __GNUC_MINOR__ > 7)
+#if __GNUC__ >= 2 && (__GNUC__ > 2 || __GNUC_MINOR__ >= 95)
+#define RESTRICT __restrict__
+#endif
+#define CONSTF __attribute__ ((__const__))
+#if __GNUC__ >= 3
+#define PUREF __attribute__ ((__pure__))
+#endif
+#define NORETURN __attribute__ ((__noreturn__))
+#ifdef __i386__
+#ifndef NOREGISTERS
+#define REGISTERS(n) __attribute__ ((__regparm__(n)))
+#endif /*NOREGISTERS*/
+#endif /*__i386__ */
+#endif /*version */
+#endif /*__GNUC__*/
+#ifndef RESTRICT
+#define RESTRICT
+#endif
+#ifndef CONSTF
+#define CONSTF
+#endif
+#ifndef PUREF
+#define PUREF
+#endif
+#ifndef NORETURN
+#define NORETURN
+#endif
+#ifndef REGISTERS
+#define REGISTERS(n)
+#endif
+#ifndef myfabs
+#define myfabs(x) ((x)>0?(x):-(x))
+#endif
diff --git a/src/include/gccbuild.h b/src/include/gccbuild.h
new file mode 100644
index 0000000..11601c9
--- /dev/null
+++ b/src/include/gccbuild.h
@@ -0,0 +1,65 @@
+/* BUGS:
+ * bellow gcc 2.7.2 builtins are not supported
+ * gcc 2.7.2.x don't inline long doubles
+ * egcc 1.0.1 crash in constant propagation when certain builtins are enabled
+ */
+
+
+#ifndef __GCCBUILD
+#define __GCCBUILD
+#if defined(__GLIBC__)
+#include "math.h"
+#else
+#if defined(__GNUC__) && defined(__i386__) && defined(__OPTIMIZE__)
+#if 0
+#include "i386/__math.h"
+#endif
+#endif
+#endif
+
+/* We really want to use builtins. Avoid any defines */
+#if defined __GNUC__ && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7))
+#define __HAVE_FABSL
+#define __fabsl(x) __builtin_fabsl(x)
+#define __fabs(x) __builtin_fabsl(x)
+#define __fabsf(x) __builtin_fabsf(x)
+#define sin(x) __builtin_sin(x)
+#define cos(x) __builtin_cos(x)
+#endif
+
+
+#include "aconfig.h"
+
+#ifndef __HAVE_FABSL
+#ifdef HAVE_FABSL
+#define __fabsl fabsl
+#define __HAVE_FABSL
+#else
+#ifdef HAVE__FABSL
+#define __fabsl _fabsl
+#define __HAVE_FABSL
+#else
+#ifdef HAVE___FABSL
+#define __HAVE___FABSL
+#endif
+#endif
+#endif
+#endif
+
+/* GCC 2.7.x have problems with long double inlines. Disable them! */
+#if defined __GNUC__ && (__GNUC__ == 2 && __GNUC_MINOR__ <= 7)
+#undef __HAVE_FABSL
+#endif
+
+#ifdef HAVE_LONG_DOUBLE
+#ifndef __HAVE_FABSL
+#define myabs(x) ((x)>0?(x):-(x))
+#else
+#define myabs(x) __fabsl((number_t)(x))
+#endif
+#else
+#define myabs(x) fabs((number_t)(x))
+#endif
+
+
+#endif /*gccbuild */
diff --git a/src/include/generic.h b/src/include/generic.h
new file mode 100644
index 0000000..b4f1cee
--- /dev/null
+++ b/src/include/generic.h
@@ -0,0 +1,15 @@
+#undef p_set
+#undef p_get
+#undef p_setp
+#undef bpp1
+#undef p_getp
+#undef p_add
+#undef p_inc
+#undef p_copy
+#define p_set(ptr,val) (*(ptr)=(val))
+#define p_get(ptr) (*(ptr))
+#define p_setp(ptr,pos,val) ((ptr)[(pos)]=(val))
+#define p_getp(ptr,pos) ((ptr)[(pos)])
+#define p_add(ptr,val) ((ptr)+(val))
+#define p_inc(ptr,val) ((ptr)+=(val))
+#define p_copy(ptr1,val1,ptr2,val2) ((ptr1)[val1]=(ptr2)[val2])
diff --git a/src/include/grlib.h b/src/include/grlib.h
new file mode 100644
index 0000000..288b0dd
--- /dev/null
+++ b/src/include/grlib.h
@@ -0,0 +1,40 @@
+#ifndef _TEXT_H
+#define _TEXT_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+ extern CONST struct xfont {
+ CONST unsigned char *data;
+ int width, height, realwidth, encoding;
+ } xsmallfont, xbigfont, xbigfont2, xaafont, xsmallfontil1, xbigfontil1,
+ xmedfontil1, xbigfont3;
+ int xiconv(int encoding, char *out, int *outlen, const char *in,
+ int *inlen);
+ int xprint(struct image *image, CONST struct xfont *current, int x,
+ int y, CONST char *text, int fgcolor,
+ int bgcolor, int mode);
+#define TEXT_PRESSED 1
+/*
+#define xtextheight(font) ((font)->height+1)
+#define xtextcharw(font,c) ((font)->width)
+ */
+ int xtextwidth(CONST struct xfont *font, CONST char *text);
+ int xtextheight(CONST struct xfont *font);
+ int xtextcharw(CONST struct xfont *font, CONST char c);
+ void xrectangle(struct image *image, int x, int y, int width,
+ int height, int fgcolor);
+ void xvline(struct image *image, int x, int y, int height,
+ int fgcolor);
+ void xhline(struct image *image, int x, int y, int width, int fgcolor);
+ char *xsaveline(struct image *img, int x1, int y1, int x2, int y2);
+ void xrestoreline(struct image *img, char *data, int x1, int y1,
+ int x2, int y2);
+ void xline(struct image *img, int x1, int y1, int x2, int y2,
+ int color);
+ void xprepareimage(struct image *img);
+ void xdrawcursor(struct image *img, int x, int y, int color,
+ int height);
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/src/include/hicolor.h b/src/include/hicolor.h
new file mode 100644
index 0000000..4807190
--- /dev/null
+++ b/src/include/hicolor.h
@@ -0,0 +1,16 @@
+#ifdef cpixel_t
+#undef cpixel_t
+#undef cpixeldata_t
+#undef cppixel_t
+#undef bpp
+#undef UNSUPPORTED
+#undef bpp1
+#endif
+#ifndef SUPPORT16
+#define UNSUPPORTED
+#endif
+#define cpixel_t pixel16_t
+#define cpixeldata_t pixel16_t
+#define cppixel_t ppixel16_t
+#define bpp 4
+#include <generic.h>
diff --git a/src/include/i386/__math.h b/src/include/i386/__math.h
new file mode 100644
index 0000000..0274d52
--- /dev/null
+++ b/src/include/i386/__math.h
@@ -0,0 +1,586 @@
+/* Inline math functions for i387.
+ Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by John C. Bowman <bowman@math.ualberta.ca>, 1995.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+
+#ifndef __GLIBC__
+#ifdef __cplusplus
+# define __MATH_INLINE __inline
+#else
+# define __MATH_INLINE extern __inline
+#endif
+
+#ifndef ____MATH_H
+#define ____MATH_H
+
+
+#if defined __USE_ISOC9X && defined __GNUC__ && __GNUC__ >= 2
+/* ISO C 9X defines some macros to perform unordered comparisons. The
+ ix87 FPU supports this with special opcodes and we should use them.
+ These must not be inline functions since we have to be able to handle
+ all floating-point types. */
+# ifdef __i686__
+/* For the PentiumPro and more recent processors we can provide
+ better code. */
+# define isgreater(x, y) \
+ ({ register char __result; \
+ __asm__ ("fucomip %%st(1), %%st; seta %%al" \
+ : "=a" (__result) : "u" (y), "t" (x) : "cc", "st"); \
+ __result; })
+# define isgreaterequal(x, y) \
+ ({ register char __result; \
+ __asm__ ("fucomip %%st(1), %%st; setae %%al" \
+ : "=a" (__result) : "u" (y), "t" (x) : "cc", "st"); \
+ __result; })
+
+# define isless(x, y) \
+ ({ register char __result; \
+ __asm__ ("fucomip %%st(1), %%st; seta %%al" \
+ : "=a" (__result) : "u" (x), "t" (y) : "cc", "st"); \
+ __result; })
+
+# define islessequal(x, y) \
+ ({ register char __result; \
+ __asm__ ("fucomip %%st(1), %%st; setae %%al" \
+ : "=a" (__result) : "u" (x), "t" (y) : "cc", "st"); \
+ __result; })
+
+# define islessgreater(x, y) \
+ ({ register char __result; \
+ __asm__ ("fucomip %%st(1), %%st; setne %%al" \
+ : "=a" (__result) : "u" (y), "t" (x) : "cc", "st"); \
+ __result; })
+
+# define isunordered(x, y) \
+ ({ register char __result; \
+ __asm__ ("fucomip %%st(1), %%st; setp %%al" \
+ : "=a" (__result) : "u" (y), "t" (x) : "cc", "st"); \
+ __result; })
+# else
+/* This is the dumb, portable code for i386 and above. */
+# define isgreater(x, y) \
+ ({ register char __result; \
+ __asm__ ("fucompp; fnstsw; testb $0x45, %%ah; setz %%al" \
+ : "=a" (__result) : "u" (y), "t" (x) : "cc", "st", "st(1)"); \
+ __result; })
+
+# define isgreaterequal(x, y) \
+ ({ register char __result; \
+ __asm__ ("fucompp; fnstsw; testb $0x05, %%ah; setz %%al" \
+ : "=a" (__result) : "u" (y), "t" (x) : "cc", "st", "st(1)"); \
+ __result; })
+
+# define isless(x, y) \
+ ({ register char __result; \
+ __asm__ ("fucompp; fnstsw; testb $0x45, %%ah; setz %%al" \
+ : "=a" (__result) : "u" (x), "t" (y) : "cc", "st", "st(1)"); \
+ __result; })
+
+# define islessequal(x, y) \
+ ({ register char __result; \
+ __asm__ ("fucompp; fnstsw; testb $0x05, %%ah; setz %%al" \
+ : "=a" (__result) : "u" (x), "t" (y) : "cc", "st", "st(1)"); \
+ __result; })
+
+# define islessgreater(x, y) \
+ ({ register char __result; \
+ __asm__ ("fucompp; fnstsw; testb $0x44, %%ah; setz %%al" \
+ : "=a" (__result) : "u" (y), "t" (x) : "cc", "st", "st(1)"); \
+ __result; })
+
+# define isunordered(x, y) \
+ ({ register char __result; \
+ __asm__ ("fucompp; fnstsw; sahf; setp %%al" \
+ : "=a" (__result) : "u" (y), "t" (x) : "cc", "st", "st(1)"); \
+ __result; })
+# endif /* __i686__ */
+
+/* Test for negative number. Used in the signbit() macro. */
+__MATH_INLINE int __signbitf(float __x)
+{
+ union {
+ float __f;
+ int __i;
+ } __u = {
+ __f:__x};
+ return __u.__i < 0;
+}
+
+__MATH_INLINE int __signbit(double __x)
+{
+ union {
+ double __d;
+ int __i[2];
+ } __u = {
+ __d:__x};
+ return __u.__i[1] < 0;
+}
+
+__MATH_INLINE int __signbitl(long double __x)
+{
+ union {
+ long double __l;
+ int __i[3];
+ } __u = {
+ __l:__x};
+ return (__u.__i[2] & 0x8000) != 0;
+}
+#endif
+
+
+/* The gcc, version 2.7 or below, has problems with all this inlining
+ code. So disable it for this version of the compiler. */
+#if defined __GNUC__ && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 7))
+
+#if ((!defined __NO_MATH_INLINES || defined __LIBC_INTERNAL_MATH_INLINES) \
+ && defined __OPTIMIZE__)
+
+/* A macro to define float, double, and long double versions of various
+ math functions for the ix87 FPU. FUNC is the function name (which will
+ be suffixed with f and l for the float and long double version,
+ respectively). OP is the name of the FPU operation. */
+
+#if defined __USE_MISC || defined __USE_ISOC9X
+# define __inline_mathop(func, op) \
+ __inline_mathop_ (double, func, op) \
+ __inline_mathop_ (float, __CONCAT(func,f), op) \
+ __inline_mathop_ (long double, __CONCAT(func,l), op)
+#else
+# define __inline_mathop(func, op) \
+ __inline_mathop_ (double, func, op)
+#endif
+
+#define __inline_mathop_(float_type, func, op) \
+ __inline_mathop_decl_ (float_type, func, op, "0" (__x))
+
+
+#if defined __USE_MISC || defined __USE_ISOC9X
+# define __inline_mathop_decl(func, op, params...) \
+ __inline_mathop_decl_ (double, func, op, params) \
+ __inline_mathop_decl_ (float, __CONCAT(func,f), op, params) \
+ __inline_mathop_decl_ (long double, __CONCAT(func,l), op, params)
+#else
+# define __inline_mathop_decl(func, op, params...) \
+ __inline_mathop_decl_ (double, func, op, params)
+#endif
+
+#define __inline_mathop_decl_(float_type, func, op, params...) \
+ __MATH_INLINE float_type func (float_type); \
+ __MATH_INLINE float_type func (float_type __x) \
+ { \
+ register float_type __result; \
+ __asm __volatile__ (op : "=t" (__result) : params); \
+ return __result; \
+ }
+
+
+#if defined __USE_MISC || defined __USE_ISOC9X
+# define __inline_mathcode(func, arg, code) \
+ __inline_mathcode_ (double, func, arg, code) \
+ __inline_mathcode_ (float, __CONCAT(func,f), arg, code) \
+ __inline_mathcode_ (long double, __CONCAT(func,l), arg, code)
+# define __inline_mathcode2(func, arg1, arg2, code) \
+ __inline_mathcode2_ (double, func, arg1, arg2, code) \
+ __inline_mathcode2_ (float, __CONCAT(func,f), arg1, arg2, code) \
+ __inline_mathcode2_ (long double, __CONCAT(func,l), arg1, arg2, code)
+# define __inline_mathcode3(func, arg1, arg2, arg3, code) \
+ __inline_mathcode3_ (double, func, arg1, arg2, arg3, code) \
+ __inline_mathcode3_ (float, __CONCAT(func,f), arg1, arg2, arg3, code) \
+ __inline_mathcode3_ (long double, __CONCAT(func,l), arg1, arg2, arg3, code)
+#else
+# define __inline_mathcode(func, arg, code) \
+ __inline_mathcode_ (double, func, (arg), code)
+# define __inline_mathcode2(func, arg1, arg2, code) \
+ __inline_mathcode2_ (double, func, arg1, arg2, code)
+# define __inline_mathcode3(func, arg1, arg2, arg3, code) \
+ __inline_mathcode3_ (double, func, arg1, arg2, arg3, code)
+#endif
+
+#define __inline_mathcode_(float_type, func, arg, code) \
+ __MATH_INLINE float_type func (float_type); \
+ __MATH_INLINE float_type func (float_type arg) \
+ { \
+ code; \
+ }
+
+#define __inline_mathcode2_(float_type, func, arg1, arg2, code) \
+ __MATH_INLINE float_type func (float_type, float_type); \
+ __MATH_INLINE float_type func (float_type arg1, float_type arg2) \
+ { \
+ code; \
+ }
+
+#define __inline_mathcode3_(float_type, func, arg1, arg2, arg3, code) \
+ __MATH_INLINE float_type func (float_type, float_type, float_type); \
+ __MATH_INLINE float_type func (float_type arg1, float_type arg2, \
+ float_type arg3) \
+ { \
+ code; \
+ }
+#endif
+
+
+#if !defined __NO_MATH_INLINES && defined __OPTIMIZE__
+/* Miscellaneous functions */
+
+__inline_mathcode(__sgn, __x,
+ return __x == 0.0 ? 0.0 : (__x > 0.0 ? 1.0 : -1.0))
+ __inline_mathcode(__pow2, __x,
+ register long double __value;
+ register long double __exponent;
+ __extension__ long long int __p = (long long int)__x;
+ if (__x == (long double) __p)
+ {
+__asm __volatile__("fscale": "=t"(__value):"0"(1.0), "u"(__x));
+ return
+ __value;}
+__asm __volatile__("fld %%st(0)\n\t" "frndint # int(x)\n\t" "fxch\n\t" "fsub %%st(1) # fract(x)\n\t" "f2xm1 # 2^(fract(x)) - 1\n\t": "=t"(__value), "=u"(__exponent): "0"(__x)); __value += 1.0; __asm __volatile__("fscale": "=t"(__value):"0"(__value), "u"(__exponent));
+ return
+ __value)
+#define __sincos_code \
+ register long double __cosr; \
+ register long double __sinr; \
+ __asm __volatile__ \
+ ("fsincos\n\t" \
+ "fnstsw %%ax\n\t" \
+ "testl $0x400, %%eax\n\t" \
+ "jz 1f\n\t" \
+ "fldpi\n\t" \
+ "fadd %%st(0)\n\t" \
+ "fxch %%st(1)\n\t" \
+ "2: fprem1\n\t" \
+ "fnstsw %%ax\n\t" \
+ "testl $0x400, %%eax\n\t" \
+ "jnz 2b\n\t" \
+ "fstp %%st(1)\n\t" \
+ "fsincos\n\t" \
+ "1:" \
+ : "=t" (__cosr), "=u" (__sinr) : "0" (__x)); \
+ *__sinx = __sinr; \
+ *__cosx = __cosr
+
+ __MATH_INLINE void __sincos(double __x, double *__sinx,
+ double *__cosx);
+__MATH_INLINE void __sincos(double __x, double *__sinx, double *__cosx)
+{
+ __sincos_code;
+}
+
+__MATH_INLINE void __sincosf(float __x, float *__sinx, float *__cosx);
+__MATH_INLINE void __sincosf(float __x, float *__sinx, float *__cosx)
+{
+ __sincos_code;
+}
+
+__MATH_INLINE void __sincosl(long double __x, long double *__sinx,
+ long double *__cosx);
+__MATH_INLINE void
+__sincosl(long double __x, long double *__sinx, long double *__cosx)
+{
+ __sincos_code;
+}
+
+
+/* Optimized inline implementation, sometimes with reduced precision
+ and/or argument range. */
+
+#define __expm1_code \
+ register long double __value; \
+ register long double __exponent; \
+ register long double __temp; \
+ __asm __volatile__ \
+ ("fldl2e # e^x - 1 = 2^(x * log2(e)) - 1\n\t" \
+ "fmul %%st(1) # x * log2(e)\n\t" \
+ "fst %%st(1)\n\t" \
+ "frndint # int(x * log2(e))\n\t" \
+ "fxch\n\t" \
+ "fsub %%st(1) # fract(x * log2(e))\n\t" \
+ "f2xm1 # 2^(fract(x * log2(e))) - 1\n\t" \
+ "fscale # 2^(x * log2(e)) - 2^(int(x * log2(e)))\n\t" \
+ : "=t" (__value), "=u" (__exponent) : "0" (__x)); \
+ __asm __volatile__ \
+ ("fscale # 2^int(x * log2(e))\n\t" \
+ : "=t" (__temp) : "0" (1.0), "u" (__exponent)); \
+ __temp -= 1.0; \
+ return __temp + __value
+__inline_mathcode_(long double, __expm1l, __x, __expm1_code)
+#define __exp_code \
+ register long double __value; \
+ register long double __exponent; \
+ __asm __volatile__ \
+ ("fldl2e # e^x = 2^(x * log2(e))\n\t" \
+ "fmul %%st(1) # x * log2(e)\n\t" \
+ "fst %%st(1)\n\t" \
+ "frndint # int(x * log2(e))\n\t" \
+ "fxch\n\t" \
+ "fsub %%st(1) # fract(x * log2(e))\n\t" \
+ "f2xm1 # 2^(fract(x * log2(e))) - 1\n\t" \
+ : "=t" (__value), "=u" (__exponent) : "0" (__x)); \
+ __value += 1.0; \
+ __asm __volatile__ \
+ ("fscale" \
+ : "=t" (__value) : "0" (__value), "u" (__exponent)); \
+ return __value
+__inline_mathcode(exp, __x, __exp_code) __inline_mathcode_(long double, __expl, __x, __exp_code) __inline_mathcode(tan, __x, register long double __value; register long double __value2 __attribute__ ((__unused__)); __asm __volatile__("fptan": "=t"(__value2), "=u"(__value):"0"(__x)); return __value)
+#define __atan2_code \
+ register long double __value; \
+ __asm __volatile__ \
+ ("fpatan\n\t" \
+ : "=t" (__value) : "0" (__x), "u" (__y) : "st(1)"); \
+ return __value
+ __inline_mathcode2(atan2, __y, __x,
+ __atan2_code) __inline_mathcode2_(long double, __atan2l,
+ __y, __x,
+ __atan2_code)
+__inline_mathcode2(fmod, __x, __y, register long double __value; __asm __volatile__("1: fprem\n\t" "fnstsw %%ax\n\t" "sahf\n\t" "jp 1b": "=t"(__value): "0"(__x), "u"(__y):"ax", "cc"); return __value)
+ __inline_mathcode2(pow, __x, __y,
+ register long double __value;
+ register long double __exponent;
+ __extension__ long long int __p =
+ (long long int)__y; if (__x == 0.0 && __y > 0.0)
+ return 0.0; if (__y == (double) __p)
+ {
+ long double __r = 1.0;
+ if (__p == 0) return 1.0; if (__p < 0) {
+ __p = -__p; __x = 1.0 / __x;}
+ while (1) {
+ if (__p & 1)
+ __r *= __x;
+ __p >>= 1; if (__p == 0) return __r; __x *= __x;}
+ /* NOTREACHED */
+ }
+
+__asm __volatile__("fyl2x": "=t"(__value): "0"(__x), "u"(1.0): "st(1)"); __asm __volatile__("fmul %%st(1) # y * log2(x)\n\t" "fst %%st(1)\n\t" "frndint # int(y * log2(x))\n\t" "fxch\n\t" "fsub %%st(1) # fract(y * log2(x))\n\t" "f2xm1 # 2^(fract(y * log2(x))) - 1\n\t": "=t"(__value), "=u"(__exponent): "0"(__y), "1"(__value)); __value += 1.0; __asm __volatile__("fscale": "=t"(__value):"0"(__value), "u"(__exponent));
+ return
+ __value)
+
+
+ __inline_mathop(sqrt, "fsqrt")
+ __inline_mathop_(long double, __sqrtl, "fsqrt")
+#if defined __GNUC__ && (__GNUC__ > 2 || __GNUC__ == 2 && __GNUC_MINOR__ >= 8)
+ __inline_mathcode_(double, fabs, __x, return __builtin_fabs(__x))
+ __inline_mathcode_(float, fabsf, __x, return __builtin_fabsf(__x))
+ __inline_mathcode_(long double, fabsl, __x,
+ return __builtin_fabsl(__x))
+ __inline_mathcode_(long double, __fabsl, __x,
+ return __builtin_fabsl(__x))
+#else
+ __inline_mathop(fabs, "fabs")
+ __inline_mathop_(long double, __fabsl, "fabs")
+#endif
+/* The argument range of this inline version is reduced. */
+ __inline_mathop(sin, "fsin")
+/* The argument range of this inline version is reduced. */
+ __inline_mathop(cos, "fcos")
+ __inline_mathop(atan, "fld1; fpatan")
+ __inline_mathop(log, "fldln2; fxch; fyl2x")
+ __inline_mathop(log10, "fldlg2; fxch; fyl2x")
+ __inline_mathcode(asin, __x,
+ return __atan2l(__x,
+ __sqrtl(1.0 -
+ __x *
+ __x)))
+ __inline_mathcode(acos, __x,
+ return __atan2l(__sqrtl(1.0 - __x * __x),
+ __x)) __inline_mathcode_(long
+ double,
+ __sgn1l,
+ __x,
+ return
+ __x >=
+ 0.0 ?
+ 1.0 :
+ -1.0)
+/* The argument range of the inline version of sinhl is slightly reduced. */
+ __inline_mathcode(sinh, __x, register long double __exm1 =
+ __expm1l(__fabsl(__x));
+ return 0.5 * (__exm1 / (__exm1 + 1.0) +
+ __exm1) *
+ __sgn1l(__x)) __inline_mathcode(cosh, __x,
+ register long double
+ __ex = __expl(__x);
+ return 0.5 * (__ex +
+ 1.0 /
+ __ex))
+__inline_mathcode(tanh, __x, register long double __exm1 = __expm1l(-__fabsl(__x + __x)); return __exm1 / (__exm1 + 2.0) * __sgn1l(-__x)) __inline_mathcode(floor, __x, register long double __value; __volatile unsigned short int __cw; __volatile unsigned short int __cwtmp; __asm __volatile("fnstcw %0":"=m"(__cw)); __cwtmp = (__cw & 0xf3ff) | 0x0400;
+ /* rounding down */
+__asm __volatile("fldcw %0": : "m"(__cwtmp)); __asm __volatile("frndint": "=t"(__value): "0"(__x)); __asm __volatile("fldcw %0": : "m"(__cw)); return __value)
+__inline_mathcode(ceil, __x, register long double __value; __volatile unsigned short int __cw; __volatile unsigned short int __cwtmp; __asm __volatile("fnstcw %0":"=m"(__cw)); __cwtmp = (__cw & 0xf3ff) | 0x0800;
+ /* rounding up */
+__asm __volatile("fldcw %0": : "m"(__cwtmp)); __asm __volatile("frndint": "=t"(__value): "0"(__x)); __asm __volatile("fldcw %0": :"m"(__cw));
+ return
+ __value)
+#define __ldexp_code \
+ register long double __value; \
+ __asm __volatile__ \
+ ("fscale" \
+ : "=t" (__value) : "0" (__x), "u" ((long double) __y)); \
+ return __value
+__MATH_INLINE double ldexp(double __x, int __y);
+__MATH_INLINE double ldexp(double __x, int __y)
+{
+ __ldexp_code;
+}
+
+
+/* Optimized versions for some non-standardized functions. */
+#if defined __USE_ISOC9X || defined __USE_MISC
+
+__inline_mathcode(expm1, __x, __expm1_code)
+/* We cannot rely on M_SQRT being defined. So we do it for ourself
+ here. */
+# define __M_SQRT2 1.41421356237309504880L /* sqrt(2) */
+ __inline_mathcode(log1p, __x,
+ register long double __value;
+ if (__fabsl(__x) >= 1.0 - 0.5 * __M_SQRT2)
+ __value = logl(1.0 + __x);
+ else
+__asm __volatile__("fldln2\n\t" "fxch\n\t" "fyl2xp1": "=t"(__value):"0"(__x));
+ return
+ __value)
+
+
+/* The argument range of the inline version of asinhl is slightly reduced. */
+ __inline_mathcode(asinh, __x,
+ register long double __y = __fabsl(__x);
+ return (log1pl
+ (__y * __y /
+ (__sqrtl(__y * __y + 1.0) + 1.0) +
+ __y) *
+ __sgn1l(__x))) __inline_mathcode(acosh, __x,
+ return
+ logl(__x +
+ __sqrtl
+ (__x -
+ 1.0)
+ *
+ __sqrtl
+ (__x +
+ 1.0)))
+ __inline_mathcode(atanh, __x, register long double __y = __fabsl(__x);
+ return -0.5 * log1pl(-(__y + __y) / (1.0 + __y)) *
+ __sgn1l(__x))
+/* The argument range of the inline version of hypotl is slightly reduced. */
+__inline_mathcode2(hypot, __x, __y, return __sqrtl(__x * __x + __y * __y)) __inline_mathcode(logb, __x, register long double __value; register long double __junk; __asm __volatile__("fxtract\n\t": "=t"(__junk), "=u"(__value):"0"(__x)); return __value)
+#endif
+#ifdef __USE_ISOC9X
+ __inline_mathop(log2, "fld1; fxch; fyl2x")
+__MATH_INLINE float ldexpf(float __x, int __y);
+__MATH_INLINE float ldexpf(float __x, int __y)
+{
+ __ldexp_code;
+}
+
+__MATH_INLINE long double ldexpl(long double __x, int __y);
+__MATH_INLINE long double ldexpl(long double __x, int __y)
+{
+ __ldexp_code;
+}
+
+__inline_mathcode3(fma, __x, __y, __z, return (__x * __y) + __z)
+ __inline_mathop(rint, "frndint")
+#define __lrint_code \
+ long int __lrintres; \
+ __asm__ __volatile__ \
+ ("fistpl %0" \
+ : "=m" (__lrintres) : "t" (__x) : "st"); \
+ return __lrintres
+__MATH_INLINE long int lrintf(float __x)
+{
+ __lrint_code;
+}
+
+__MATH_INLINE long int lrint(double __x)
+{
+ __lrint_code;
+}
+
+__MATH_INLINE long int lrintl(long double __x)
+{
+ __lrint_code;
+}
+
+#undef __lrint_code
+
+#define __llrint_code \
+ long long int __llrintres; \
+ __asm__ __volatile__ \
+ ("fistpll %0" \
+ : "=m" (__llrintres) : "t" (__x) : "st"); \
+ return __llrintres
+__MATH_INLINE long long int llrintf(float __x)
+{
+ __llrint_code;
+}
+
+__MATH_INLINE long long int llrint(double __x)
+{
+ __llrint_code;
+}
+
+__MATH_INLINE long long int llrintl(long double __x)
+{
+ __llrint_code;
+}
+
+#undef __llrint_code
+
+#endif
+
+
+#ifdef __USE_MISC
+
+__inline_mathcode2(drem, __x, __y, register double __value; register int __clobbered; __asm __volatile__("1: fprem1\n\t" "fstsw %%ax\n\t" "sahf\n\t" "jp 1b": "=t"(__value), "=&a"(__clobbered): "0"(__x), "u"(__y):"cc"); return __value)
+/* This function is used in the `isfinite' macro. */
+#if 0
+__MATH_INLINE int __finite(double __x) __attribute__ ((__const__));
+__MATH_INLINE int __finite(double __x)
+{
+ return (__extension__(((((union {
+ double __d;
+ int __i[2];
+ }
+ ) {
+ __d: __x}
+ ).__i[1] | 0x800fffff) + 1) >> 31));
+}
+#endif
+
+/* Miscellaneous functions */
+
+__inline_mathcode(__coshm1, __x,
+ register long double __exm1 = __expm1l(__fabsl(__x));
+ return 0.5 * (__exm1 / (__exm1 + 1.0)) * __exm1)
+ __inline_mathcode(__acosh1p, __x,
+ return log1pl(__x + __sqrtl(__x) * __sqrtl(__x + 2.0)))
+#endif /* __USE_MISC */
+/* Undefine some of the large macros which are not used anymore. */
+#undef __expm1_code
+#undef __exp_code
+#undef __atan2_code
+#undef __sincos_code
+#endif /* __NO_MATH_INLINES */
+/* This code is used internally in the GNU libc. */
+#ifdef __LIBC_INTERNAL_MATH_INLINES
+__inline_mathop(__ieee754_sqrt, "fsqrt") __inline_mathcode2(__ieee754_atan2, __y, __x, register long double __value; __asm __volatile__("fpatan\n\t": "=t"(__value): "0"(__x), "u"(__y):"st(1)"); return __value;
+ )
+#endif
+#endif /* __GNUC__ */
+#endif
+#endif
diff --git a/src/include/i386/ctrl87.h b/src/include/i386/ctrl87.h
new file mode 100644
index 0000000..02b4490
--- /dev/null
+++ b/src/include/i386/ctrl87.h
@@ -0,0 +1,120 @@
+/*
+ * This file is part of ms-dos port for XaoS
+ * ctrl87.h
+ *
+ */
+
+
+#ifndef __CONTROL87_H__
+
+
+#define __CONTROL87_H__
+
+
+#ifdef __CONTROL87_C__
+#define EXTERN
+#else
+#define EXTERN extern
+#endif
+
+
+/* 8087/80287 Status Word format */
+
+#define SW_INVALID 0x0001 /* Invalid operation */
+#define SW_DENORMAL 0x0002 /* Denormalized operand */
+#define SW_ZERODIVIDE 0x0004 /* Zero divide */
+#define SW_OVERFLOW 0x0008 /* Overflow */
+#define SW_UNDERFLOW 0x0010 /* Underflow */
+#define SW_INEXACT 0x0020 /* Precision (Inexact result) */
+
+/* 8087/80287 Control Word format */
+
+#define MCW_EM 0x003f /* interrupt Exception Masks */
+#define EM_INVALID 0x0001 /* invalid */
+#define EM_DENORMAL 0x0002 /* denormal */
+#define EM_ZERODIVIDE 0x0004 /* zero divide */
+#define EM_OVERFLOW 0x0008 /* overflow */
+#define EM_UNDERFLOW 0x0010 /* underflow */
+#define EM_INEXACT 0x0020 /* inexact (precision) */
+
+#define MCW_IC 0x1000 /* Infinity Control */
+#define IC_AFFINE 0x1000 /* affine */
+#define IC_PROJECTIVE 0x0000 /* projective */
+
+#define MCW_RC 0x0c00 /* Rounding Control */
+#define RC_CHOP 0x0c00 /* chop */
+#define RC_UP 0x0800 /* up */
+#define RC_DOWN 0x0400 /* down */
+#define RC_NEAR 0x0000 /* near */
+
+#define MCW_PC 0x0300 /* Precision Control */
+#define PC_24 0x0000 /* 24 bits */
+#define PC_53 0x0200 /* 53 bits */
+#define PC_64 0x0300 /* 64 bits */
+
+/**************************************************************************/
+/************************* Type declarations **************************/
+/**************************************************************************/
+
+/**************************************************************************/
+/************************ Function declarations ***********************/
+/**************************************************************************/
+
+/*
+ _control87 changes floating-point control word.
+
+ Declaration:
+ ------------
+ unsigned short _control87(unsigned short newcw, unsigned short mask);
+
+ Remarks:
+ --------
+ _control87 retrieves or changes the floating-point control word.
+
+ The floating-point control word is an unsigned short that specifies the
+ following modes in the 80x87 FPU:
+ o allowed exceptions
+ o infinity mode
+ o rounding mode
+ o precision mode
+
+ Changing these modes allows you to mask or unmask floating-point exceptions.
+
+ _control87 matches the bits in mask to the bits in newcw.
+
+ If any mask bit = 1, the corresponding bit in newcw contains the new value
+ for the same bit in the floating-point control word.
+
+ If mask = 0000, _control87 returns the floating-point control word without
+ altering it.
+
+ Examples:
+ ---------
+ Switching to projective infinity mode:
+ _control87(IC_PROJECTIVE, MCW_IC);
+
+ Disabling all exceptions:
+ _control87(MCW_EM, MCW_EM);
+
+ Return Value:
+ -------------
+ The bits in the value returned reflect the new floating-point control word.
+*/
+EXTERN unsigned short _control87(unsigned short, unsigned short);
+
+
+/**************************************************************************/
+/************************** Global variables **************************/
+/**************************************************************************/
+
+
+
+#ifdef __CONTROL87_C__
+#else
+#endif
+
+
+#undef EXTERN
+
+
+#endif
diff --git a/src/include/i386/sstring.h b/src/include/i386/sstring.h
new file mode 100644
index 0000000..bd2dd2d
--- /dev/null
+++ b/src/include/i386/sstring.h
@@ -0,0 +1,414 @@
+#if 0
+#ifndef _I386_STRING_I486_H_
+#define _I386_STRING_I486_H_
+#if defined(__OPTIMIZE__) && defined(__GNUC__) && defined(__i386__)
+/*
+ * This string-include defines all string functions as inline
+ * functions. Use gcc. It also assumes ds=es=data space, this should be
+ * normal. Most of the string-functions are rather heavily hand-optimized,
+ * see especially strtok,strstr,str[c]spn. They should work, but are not
+ * very easy to understand. Everything is done entirely within the register
+ * set, making the functions fast and clean.
+ *
+ * Copyright (C) 1991, 1992 Linus Torvalds
+ * Revised and optimized for i486/pentium
+ * 1994/03/15 by Alberto Vignani/Davide Parodi @crf.it
+ *
+ * Split into 2 CPU specific files by Alan Cox to keep #ifdef noise down.
+ *
+ * Revised and optimized again by Jan Hubicka (1997/11/16)
+ * (please report bugs to hubicka@paru.cas.cz)
+ *
+ * memset and memcpy routines seems to be always faster at 486 and
+ * pentium but at pentium MMX they are sometimes bit slower (5-10%)..
+ * because of less strict register allocation they produces better code.
+ */
+
+
+#define __HAVE_ARCH_MEMCPY
+#define memcpy(d,s,count) \
+(__builtin_constant_p(count) ? \
+ __memcpy_c((d),(s),(count)) : \
+ __memcpy_g((d),(s),(count)))
+
+/*
+ * These ought to get tweaked to do some cache priming.
+ */
+
+
+/* This implementation of the memcpy is designed for moveoldpoints from
+ * mkrealloctables. It is expected to work well for both small and large
+ * sizes.
+ *
+ * Small (1-10) and meduim (300) sizes seems to be important for XaoS.
+ * So implementation is not super fast for large sizes, but my experiemnts
+ * don't show large improvements in speed anyway.
+ *
+ * We use rep movsX operations (they works well on PPro and don't seems to be
+ * so bad on Pentium) and expect cld operation to be set. Hope that it will
+ * not make problems.
+ *
+ * My attempt was to use c code where possible to let GCC do the
+ */
+extern inline void *__memcpy_g(void *to, const register void *from,
+ register size_t n);
+extern inline void *__memcpy_g(void *to, const register void *from,
+ register size_t n)
+{
+ register void *tmp = (void *) to;
+ if (n >= 7) {
+ register int c = (-(int) to) & 3;
+ n -= c;
+ __asm__ __volatile__( /*Align the destination */
+ "rep\n\tmovsb":"=c"(c), "=D"(tmp),
+ "=S"(from):"c"(c), "D"((long) tmp),
+ "S"((long) from):"memory");
+ c = n >> 2;
+ __asm__ __volatile__( /*Copy the main body */
+ "rep\n\tmovsl":"=c"(c), "=D"(tmp),
+ "=S"(from):"c"(c), "D"((long) tmp),
+ "S"((long) from):"memory");
+ n &= 3;
+ }
+ __asm__ __volatile__("rep\n\tmovsb":"=c"(n), "=D"(tmp),
+ "=S"(from):"c"(n), "D"((long) tmp),
+ "S"((long) from):"memory");
+ return (to);
+}
+
+/*
+ * This looks horribly ugly, but the compiler can optimize it totally,
+ * as the count is constant.
+ */
+
+#define COMMON(x) \
+__asm__ __volatile__ ( \
+ "\n.align 4\n" \
+ "1:\tmovl (%2),%0\n\t" \
+ "addl $4,%2\n\t" \
+ "movl %0,(%1)\n\t" \
+ "addl $4,%1\n\t" \
+ "decl %3\n\t" \
+ "jnz 1b\n" \
+ x \
+ :"=r" (dummy1), "=r" (tmp), "=r" (from), "=r" (dummy2) \
+ :"1" (tmp), "2" (from), "3" (n/4) \
+ :"memory"); \
+return (to); \
+
+extern inline void *__memcpy_c(void *to, const void *from, size_t n);
+extern inline void *__memcpy_c(void *to, const void *from, size_t n)
+{
+ if (n < 24) {
+ if (n >= 4)
+ ((unsigned long *) to)[0] = ((const unsigned long *) from)[0];
+ if (n >= 8)
+ ((unsigned long *) to)[1] = ((const unsigned long *) from)[1];
+ if (n >= 12)
+ ((unsigned long *) to)[2] = ((const unsigned long *) from)[2];
+ if (n >= 16)
+ ((unsigned long *) to)[3] = ((const unsigned long *) from)[3];
+ if (n >= 20)
+ ((unsigned long *) to)[4] = ((const unsigned long *) from)[4];
+ switch ((unsigned int) (n % 4)) {
+ case 3:
+ ((unsigned short *) to)[n / 2 - 1] =
+ ((const unsigned short *) from)[n / 2 - 1];
+ ((unsigned char *) to)[n - 1] =
+ ((const unsigned char *) from)[n - 1];
+ return to;
+ case 2:
+ ((unsigned short *) to)[n / 2 - 1] =
+ ((const unsigned short *) from)[n / 2 - 1];
+ return to;
+ case 1:
+ ((unsigned char *) to)[n - 1] =
+ ((const unsigned char *) from)[n - 1];
+ case 0:
+ return to;
+ }
+ }
+ {
+ register void *tmp = (void *) to;
+ register int dummy1, dummy2;
+ switch ((unsigned int) (n % 4)) {
+ case 0:
+ COMMON("");
+ case 1:
+ COMMON("movb (%2),%b0 ; movb %b0,(%1)");
+ case 2:
+ COMMON("movw (%2),%w0 ; movw %w0,(%1)");
+ case 3:
+ COMMON("movw (%2),%w0 ; movw %w0,(%1)\n\t"
+ "movb 2(%2),%b0 ; movb %b0,2(%1)");
+ }
+ }
+ return to;
+}
+
+#undef COMMON
+
+
+#define __HAVE_ARCH_MEMMOVE
+extern inline void *memmove(void *dest, const void *src, size_t n);
+extern inline void *memmove(void *dest, const void *src, size_t n)
+{
+ register void *tmp = (void *) dest;
+ if (dest < src)
+ __asm__ __volatile__("cld\n\t" "rep\n\t" "movsb": /* no output */
+ :"c"(n), "S"(src), "D"(tmp):"cx", "si", "di",
+ "memory");
+ else
+ __asm__ __volatile__("std\n\t" "rep\n\t" "movsb\n\t" "cld": /* no output */
+ : "c"(n), "S"(n - 1 + (const char *) src), "D"(n - 1 + (char *) tmp):"cx", "si", "di", "memory");
+ return dest;
+}
+
+#define memcmp __builtin_memcmp
+
+#define __HAVE_ARCH_MEMCHR
+extern inline void *memchr(const void *cs, int c, size_t count);
+extern inline void *memchr(const void *cs, int c, size_t count)
+{
+ register void *__res;
+ if (!count)
+ return NULL;
+ __asm__ __volatile__("cld\n\t"
+ "repne\n\t"
+ "scasb\n\t"
+ "je 1f\n\t"
+ "movl $1,%0\n"
+ "1:\tdecl %0":"=D"(__res):"a"(c), "D"(cs),
+ "c"(count):"cx");
+ return __res;
+}
+
+
+
+#define __HAVE_ARCH_MEMSET
+#define memset(s,c,count) \
+(__builtin_constant_p(c) ? \
+ (__builtin_constant_p(count) ? \
+ __memset_cc((s),(c),(count)) : \
+ __memset_cg((s),(c),(count))) : \
+ (__builtin_constant_p(count) ? \
+ __memset_gc((s),(c),(count)) : \
+ __memset_gg((s),(c),(count))))
+
+
+
+
+extern inline void *__memset_cg(void *s, char c, size_t count);
+extern inline void *__memset_cg(void *s, char c, size_t count)
+{
+ int tmp2;
+ register void *tmp = (void *) s;
+ __asm__ __volatile__("shrl $1,%%ecx\n\t"
+ "rep\n\t"
+ "stosw\n\t"
+ "jnc 1f\n\t"
+ "movb %%al,(%%edi)\n"
+ "1:":"=c"(tmp2), "=D"(tmp):"c"(count), "D"(tmp),
+ "a"(0x0101U * (unsigned char) c):"memory");
+ return s;
+}
+
+extern inline void *__memset_gg(void *s, char c, size_t count);
+extern inline void *__memset_gg(void *s, char c, size_t count)
+{
+ register void *tmp = (void *) s;
+ int tmp2;
+ __asm__ __volatile__("movb %%al,%%ah\n\t"
+ "shrl $1,%%ecx\n\t"
+ "rep\n\t"
+ "stosw\n\t"
+ "jnc 1f\n\t"
+ "movb %%al,(%%edi)\n"
+ "1:":"=c"(tmp2), "=D"(tmp):"c"(count), "D"(tmp),
+ "a"(c):"memory");
+ return s;
+}
+
+/*
+ * This non-rep routines are not much faster (slower for small strings)
+ * but they allows better register allocation
+ */
+#define COMMON(x) \
+__asm__ __volatile__ ( \
+ "\n.align 4\n" \
+ "1:\tmovl %k2,(%k0)\n\t" \
+ "addl $4,%k0\n\t" \
+ "decl %k1\n\t" \
+ "jnz 1b\n" \
+ x \
+ :"=r" (tmp), "=r" (dummy) \
+ :"q" ((unsigned) pattern), "0" (tmp), "1" (count/4) \
+ :"memory"); \
+return s;
+
+extern inline void *__memset_cc(void *s, unsigned long pattern,
+ size_t count);
+extern inline void *__memset_cc(void *s, unsigned long pattern,
+ size_t count)
+{
+ pattern = ((unsigned char) pattern) * 0x01010101UL;
+ if (count < 24) {
+ /*Handle small values manualy since they are incredibly slow */
+
+ if (count >= 4)
+ *(unsigned long *) s = pattern;
+ if (count >= 8)
+ ((unsigned long *) s)[1] = pattern;
+ if (count >= 12)
+ ((unsigned long *) s)[2] = pattern;
+ if (count >= 16)
+ ((unsigned long *) s)[3] = pattern;
+ if (count >= 20)
+ ((unsigned long *) s)[4] = pattern;
+ switch ((unsigned int) (count % 4)) {
+ case 3:
+ ((unsigned short *) s)[count / 2 - 1] = pattern;
+ ((unsigned char *) s)[count - 1] = pattern;
+ return s;
+ case 2:
+ ((unsigned short *) s)[count / 2 - 1] = pattern;
+ return s;
+ case 1:
+ ((unsigned char *) s)[count - 1] = pattern;
+ case 0:
+ return s;
+ }
+ } else {
+ register void *tmp = (void *) s;
+ register int dummy;
+ switch ((unsigned int) (count % 4)) {
+ case 0:
+ COMMON("");
+ case 1:
+ COMMON("movb %b2,(%0)");
+ case 2:
+ COMMON("movw %w2,(%0)");
+ case 3:
+ COMMON("movw %w2,(%0)\n\tmovb %b2,2(%0)");
+ }
+ }
+ return s;
+}
+
+extern inline void *__memset_gc(void *s, unsigned long pattern,
+ size_t count);
+extern inline void *__memset_gc(void *s, unsigned long pattern,
+ size_t count)
+{
+ if (count < 4) {
+ if (count > 1)
+ __asm__("movb %b0,%h0\n\t": "=q"(pattern):"0"((unsigned)
+ pattern));
+ switch ((unsigned int) (count)) {
+ case 3:
+ ((unsigned short *) s)[0] = pattern;
+ ((unsigned char *) s)[2] = pattern;
+ return s;
+ case 2:
+ *((unsigned short *) s) = pattern;
+ return s;
+ case 1:
+ *(unsigned char *) s = pattern;
+ case 0:
+ return s;
+ }
+ }
+
+ __asm__("movb %b0,%h0\n\t" "pushw %w0\n\t" "shll $16,%k0\n\t" "popw %w0\n": "=q"(pattern):"0"((unsigned)
+ pattern));
+
+ if (count < 24) {
+ /*Handle small values manualy since they are incredibly slow */
+
+ *(unsigned long *) s = pattern;
+ if (count >= 8)
+ ((unsigned long *) s)[1] = pattern;
+ if (count >= 12)
+ ((unsigned long *) s)[2] = pattern;
+ if (count >= 16)
+ ((unsigned long *) s)[3] = pattern;
+ if (count >= 20)
+ ((unsigned long *) s)[4] = pattern;
+ switch ((unsigned int) (count % 4)) {
+ case 3:
+ ((unsigned short *) s)[count / 2 - 1] = pattern;
+ ((unsigned char *) s)[count - 1] = pattern;
+ return s;
+ case 2:
+ ((unsigned short *) s)[count / 2 - 1] = pattern;
+ return s;
+ case 1:
+ ((unsigned char *) s)[count - 1] = pattern;
+ case 0:
+ return s;
+ }
+ } else {
+ register void *tmp = (void *) s;
+ register int dummy;
+ switch ((unsigned int) (count % 4)) {
+ case 0:
+ COMMON("");
+ case 1:
+ COMMON("movb %b2,(%0)");
+ case 2:
+ COMMON("movw %w2,(%0)");
+ case 3:
+ COMMON("movw %w2,(%0)\n\tmovb %b2,2(%0)");
+ }
+ }
+ return s;
+}
+
+#undef COMMON
+
+
+/*
+ * find the first occurrence of byte 'c', or 1 past the area if none
+ */
+#define __HAVE_ARCH_MEMSCAN
+extern inline void *memscan(void *addr, int c, size_t size);
+extern inline void *memscan(void *addr, int c, size_t size)
+{
+ if (!size)
+ return addr;
+ __asm__ __volatile__("cld\n\t"
+ "repnz; scasb\n\t"
+ "jnz 1f\n\t"
+ "dec %%edi\n\t"
+ "1:":"=D"(addr), "=c"(size):"0"(addr), "1"(size),
+ "a"(c));
+ return addr;
+}
+
+#define memset_long(x,y,z) __memset_long(x,y,z)
+
+extern inline void *__memset_long(void *s, char c, size_t count);
+extern inline void *__memset_long(void *s, char c, size_t count)
+{
+ register unsigned int fill = c;
+ register void *tmp = (void *) s;
+ if (count >= 7) {
+ register int c = (-(int) s) & 3;
+/*__asm__ __volatile__ ("movb %b0,%h0":"=r"(fill):"r"(fill));*/
+ fill |= fill << 8;
+ count -= c;
+ fill |= fill << 16;
+ __asm__ __volatile__("rep\n\tstosb":"=c"(c), "=D"(tmp):"c"(c),
+ "D"(tmp), "a"(fill):"memory");
+ c = count >> 2;
+ __asm__ __volatile__("rep\n\tstosl":"=c"(c), "=D"(tmp):"c"(c),
+ "D"(tmp), "a"(fill):"memory");
+ count &= 3;
+ }
+ __asm__ __volatile__("rep\n\tstosb":"=c"(count), "=D"(tmp):"c"(count),
+ "D"(tmp), "a"((char) fill):"memory");
+ return s;
+}
+#endif
+#endif
+#endif
diff --git a/src/include/include.pri b/src/include/include.pri
new file mode 100644
index 0000000..22a4996
--- /dev/null
+++ b/src/include/include.pri
@@ -0,0 +1,38 @@
+HEADERS += \
+ $$PWD/archaccel.h \
+ $$PWD/btrace.h \
+ $$PWD/c256.h \
+ $$PWD/catalog.h \
+ $$PWD/complex.h \
+ $$PWD/cursor.h \
+ $$PWD/fconfig.h \
+ $$PWD/filter.h \
+ $$PWD/formulas.h \
+ $$PWD/fractal.h \
+ $$PWD/gccaccel.h \
+ $$PWD/gccbuild.h \
+ $$PWD/generic.h \
+ $$PWD/grlib.h \
+ $$PWD/hicolor.h \
+ $$PWD/misc-f.h \
+ $$PWD/param.h \
+ $$PWD/pixel_t.h \
+ $$PWD/plane.h \
+ $$PWD/sffe.h \
+ $$PWD/sffe_cmplx_asm.h \
+ $$PWD/sffe_cmplx_gsl.h \
+ $$PWD/timers.h \
+ $$PWD/true24.h \
+ $$PWD/truecolor.h \
+ $$PWD/ui.h \
+ $$PWD/ui_helper.h \
+ $$PWD/xerror.h \
+ $$PWD/xio.h \
+ $$PWD/xldio.h \
+ $$PWD/xmenu.h \
+ $$PWD/xshl.h \
+ $$PWD/xthread.h \
+ $$PWD/zoom.h \
+ $$PWD/i386/ctrl87.h \
+ $$PWD/i386/sstring.h \
+ $$PWD/i386/__math.h
diff --git a/src/include/misc-f.h b/src/include/misc-f.h
new file mode 100644
index 0000000..64ed054
--- /dev/null
+++ b/src/include/misc-f.h
@@ -0,0 +1,17 @@
+#ifndef IUTIL_H
+#define IUTIL_H
+#include <xio.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+ struct image;
+
+ CONST char *writepng(xio_constpath filename, CONST struct image *image);
+ void XaoS_srandom(unsigned int x);
+ long int XaoS_random(void);
+ char *mystrdup(CONST char *);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/src/include/param.h b/src/include/param.h
new file mode 100644
index 0000000..c9ac6f1
--- /dev/null
+++ b/src/include/param.h
@@ -0,0 +1,48 @@
+/*
+ * XaoS, a fast portable realtime fractal zoomer
+ * Copyright (C) 1996,1997 by
+ *
+ * Jan Hubicka (hubicka@paru.cas.cz)
+ * Thomas Marsh (tmarsh@austin.ibm.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+#ifndef PARAMS_H
+#define PARAMS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ struct params {
+ CONST char *name;
+ int type;
+ void *value;
+ CONST char *help;
+ };
+
+#define P_SWITCH 0
+#define P_NUMBER 1
+#define P_STRING 2
+#define P_FLOAT 3
+#define P_HELP 4
+
+ int params_parser(int, char **);
+ void params_register(CONST struct params *par);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/src/include/pixel_t.h b/src/include/pixel_t.h
new file mode 100644
index 0000000..9b9555c
--- /dev/null
+++ b/src/include/pixel_t.h
@@ -0,0 +1,21 @@
+#if SIZEOF_INT==4
+typedef unsigned int pixel32_t;
+#elif SIZEOF_LONG==4
+typedef unsigned long pixel32_t;
+#else
+/*#error define size for pixel32 please */
+00
+#endif
+#if SIZEOF_SHORT==2
+typedef unsigned short pixel16_t;
+#elif SIZEOF_INT==2
+typedef unsigned int pixel16_t;
+#else
+/*#error define size for pixel16 please */
+ 00
+#endif
+typedef unsigned char pixel8_t;
+typedef unsigned char ppixel24_t[3];
+typedef pixel8_t *ppixel8_t;
+typedef pixel16_t *ppixel16_t;
+typedef pixel32_t *ppixel32_t;
diff --git a/src/include/plane.h b/src/include/plane.h
new file mode 100644
index 0000000..a37b16a
--- /dev/null
+++ b/src/include/plane.h
@@ -0,0 +1,58 @@
+/*
+ * XaoS, a fast portable realtime fractal zoomer
+ * Copyright (C) 1996,1997 by
+ *
+ * Jan Hubicka (hubicka@paru.cas.cz)
+ * Thomas Marsh (tmarsh@austin.ibm.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+#ifndef PLANE_H
+#define PLANE_H
+
+#include <config.h>
+#include <zoom.h>
+
+#ifdef SFFE_USING
+#include "sffe.h"
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/*#define PLANES 7*/
+#define P_MU 0
+#define P_INVERSE 1
+#define P_PARABOL 2
+#define P_LAMBDA 3
+#define P_INVLAMBDA 4
+#define P_TRANLAMBDA 5
+#define P_MEREBERG 6
+#define P_USER 7
+ extern void recalculate(int plane, number_t *,
+ number_t *) REGISTERS(3);
+
+ extern CONST char *CONST planename[];
+
+#ifdef SFFE_USING
+ extern CONST sffe *planec;
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* PLANE_H */
diff --git a/src/include/sffe.h b/src/include/sffe.h
new file mode 100644
index 0000000..3f21869
--- /dev/null
+++ b/src/include/sffe.h
@@ -0,0 +1,139 @@
+/*/////////////////////////////////////////////////////////////////////////////////////
+// project : sFFe ( SegFault (or Segmentation Fault :) ) formula evalutaor )
+// author : Mateusz Malczak ( mateusz@malczak.info )
+// wpage : www.segfaultlabs.com/projects/sffe
+///////////////////////////////////////////////////////////////////////////////////////
+// possible config definitions
+// general
+// SFFE_DEVEL - print extra info to stdout
+// SFFE_DLL - Windows DLL
+// complex numbers
+// SFFE_CMPLX_GSL - uses GSL complex number routines
+// SFFE_CMPLX_ASM - uses my asm complex unit (compile it with NASM)
+///////////////////////////////////////////////////////////////////////////////////////
+// special build for XaoS, for more info visit
+// http://www.segfaultlabs.com/projects/sfXaos
+/////////////////////////////////////////////////////////////////////////////////////*/
+
+#ifndef SFFE_H
+#define SFFE_H
+#include <config.h>
+#include <stdlib.h>
+
+/* dont udef next line. removing this definitions can lead to compile and/or runtime errors */
+#define SFFE_COMPLEX 1
+
+/* --- */
+/*TODO long double needed*/
+#ifdef SFFE_CMPLX_ASM
+typedef struct cmpx__ {
+ double r, i;
+} cmplx;
+#define sfNumber cmplx
+#elif SFFE_CMPLX_GSL
+#include <gsl/gsl_complex.h>
+typedef gsl_complex cmplx;
+#define sfNumber gsl_complex
+#endif
+
+/* basic sffe argument 'stack' */
+typedef struct sfargument__ {
+ struct sfargument__ *parg;
+ sfNumber *value;
+} sfarg;
+
+/* sffe function prototype, parameters order is right-to-left (cdecl) */
+typedef sfarg *(*sffptr) (sfarg * const a);
+
+/* constats eval functions */
+typedef void (*cfptr) (sfNumber * cnst);
+
+/* function type structure */
+typedef struct sffunction__ {
+ sffptr fptr;
+ unsigned char parcnt;
+ /*FIXME changed from char* to char[20] to get rid of warnings during compilation */
+ char name[20];
+} sffunction;
+
+/* basic sffe 'stack' operation ( function + result slot ) */
+typedef struct sfoperation__ {
+ sfarg *arg;
+ sffptr f;
+} sfopr;
+
+/* SFFE main structure */
+typedef struct sffe__ {
+/*public*/
+ char *expression; /* parsed expression (read-only) */
+ char *errormsg; /* parser errors (read-only) */
+ sfNumber *result; /* evaluation result (read-only) */
+/* protected/private */
+ unsigned int argCount; /* number of argument in use */
+ sfarg *args;
+ unsigned int oprCount; /* number of operations in use */
+ sfopr *oprs;
+ unsigned int varCount; /* number of used variables */
+ char *varChars;
+ sfNumber **varPtrs;
+ unsigned int userfCount; /* number of user functions */
+ sffunction *userf;
+/* not used
+ unsigned int stCount;
+ sfNumber* statics;
+*/
+} sffe;
+
+#define SFFE sffe
+#define sffeparser sffe
+#define sfparser sffe
+#define SFFEPARSER sffe
+
+/* 'stack' slot value */
+#define sfvalue(p) (*((p)->value))
+
+/* function parameters */
+#define sfaram1(p) ((p)->parg)
+#define sfaram2(p) ((p)->parg->parg)
+#define sfaram3(p) ((p)->parg->parg->parg)
+#define sfaram4(p) ((p)->parg->parg->parg->parg)
+#define sfaram5(p) ((p)->parg->parg->parg->parg->parg)
+/* and so on */
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* create formula evaluator structure */
+ sffe *sffe_alloc(void);
+/* free fe structure */
+ void sffe_free(sffe ** parser);
+/* parse expression 'expression' and strore result in 'parser' struct, error (if any) returned */
+ int sffe_parse(sffe ** parser, char *expression);
+/* evaulate function and return evaluation result */
+ sfNumber sffe_eval(sffe * const parser);
+/* evaluate without returnig result */
+//void sffe_eval2(sffe *const parser);
+/* register user function with name 'vname', with 'parcnt' parameters and defined with function pointed by 'funptr'*/
+ void *sffe_regfunc(sffe ** parser, char *vname, unsigned int parcnt,
+ sffptr funptr);
+/* register single variable 'vptrs' identified by name 'vchars' */
+ void *sffe_regvar(sffe ** parser, sfNumber * vptrs, char vchars);
+/* register multiple variables */
+ void *sffe_regvars(sffe ** parser, unsigned int cN, sfNumber ** vptrs,
+ char *vchars);
+/* get variable 'vchar' pointer */
+ sfNumber *sffe_varptr(sffe * const parser, char vchar);
+/* set 'vptrs' as 'vchars' variable */
+ sfNumber *sffe_setvar(sffe ** parser, sfNumber * vptrs, char vchars);
+
+#ifdef __cplusplus
+}
+#endif
+#ifdef SFFE_CMPLX_ASM
+#include "sffe_cmplx_asm.h"
+#elif SFFE_CMPLX_GSL
+#include "sffe_cmplx_gsl.h"
+#endif
+#endif
diff --git a/src/include/sffe_cmplx_asm.h b/src/include/sffe_cmplx_asm.h
new file mode 100644
index 0000000..f14aae8
--- /dev/null
+++ b/src/include/sffe_cmplx_asm.h
@@ -0,0 +1,140 @@
+/*/////////////////////////////////////////////////////////////////////////////////////
+// project : sFFe ( SegFault (or Segmentation Fault :) ) formula evalutaor )
+// author : Mateusz Malczak ( mateusz@malczak.info )
+// wpage : www.segfaultlabs.com/projects/sffe
+///////////////////////////////////////////////////////////////////////////////////////
+// special build for XaoS, for more info visit
+// http://www.segfaultlabs.com/projects/sfXaos
+/////////////////////////////////////////////////////////////////////////////////////*/
+#ifndef SFFE_CMPLX_ASM_H
+#define SFFE_CMPLX_ASM_H
+
+#include <config.h>
+#ifdef SFFE_CMPLX_ASM
+
+#include "sffe.h"
+
+#define sffnctscount 43
+#define sfvarscount 6
+#define cmplxset(c,r,i) ( c = cset(r,i) )
+#define real(c) (c).r
+#define imag(c) (c).i
+
+#ifdef __ELF__
+#define sffecabs _sffecabs
+#define sffecarg _sffecarg
+#define sffecargs _sffecargs
+#define sffecargc _sffecargc
+#define sffecinv _sffecinv
+#define sffecexp _sffecexp
+#define sffecln _sffecln
+#define sffeclog2 _sffeclog2
+#define sffeclog _sffeclog
+#define sffecsin _sffecsin
+#define sffeccos _sffeccos
+#define sffectan _sffectan
+#define sffeccot _sffeccot
+#define sffecsinh _sffecsinh
+#define sffeccosh _sffeccosh
+#define sffectanh _sffectanh
+#define sffeccoth _sffeccoth
+#define sffeccpow _sffeccpow
+#define sffecpowd _sffecpowd
+#define sffecpowi _sffecpowi
+#define sffecpowc _sffecpowc
+#define sffecsqrt _sffecsqrt
+#define sffecrtni _sffecrtni
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ /* written with asm in file cmplx.asm, compile with NASM */
+ extern double sffecabs(const cmplx c);
+ extern double sffecarg(const cmplx c);
+ extern double sffecargs(const cmplx c);
+ extern double sffecargc(const cmplx c);
+ extern cmplx sffecinv(const cmplx c);
+ extern cmplx sffecexp(const cmplx c);
+ extern cmplx sffecln(const cmplx c);
+ extern cmplx sffeclog2(const cmplx c);
+ extern cmplx sffeclog(const cmplx c, unsigned int base);
+ extern cmplx sffecsin(const cmplx c);
+ extern cmplx sffeccos(const cmplx c);
+ extern cmplx sffectan(const cmplx c);
+ extern cmplx sffeccot(const cmplx c);
+ extern cmplx sffecsinh(const cmplx c);
+ extern cmplx sffeccosh(const cmplx c);
+ extern cmplx sffectanh(const cmplx c);
+ extern cmplx sffeccoth(const cmplx c);
+ /* power functions */
+ extern cmplx sffeccpow(const cmplx b, const cmplx exp);
+ extern cmplx sffecpowd(const cmplx b, double exp);
+ extern cmplx sffecpowi(const cmplx b, int exp);
+ extern cmplx sffecpowc(double b, const cmplx exp);
+ extern cmplx sffecsqrt(const cmplx b); /* square root */
+ extern cmplx sffecrtni(const cmplx b, int n, int i); /* i-th solution of N-th order root of a CN */
+/*complex numbers for mparser*/
+ cmplx cset(double r, double i);
+ cmplx cadd(const cmplx c1, const cmplx c2);
+ cmplx csub(const cmplx c1, const cmplx c2);
+ cmplx cmul(const cmplx c1, const cmplx c2);
+ cmplx cdiv(const cmplx c1, const cmplx c2);
+ sfarg *sfadd(sfarg * const p); /* + */
+ sfarg *sfsub(sfarg * const p); /* - */
+ sfarg *sfmul(sfarg * const p); /* * */
+ sfarg *sfdiv(sfarg * const p); /* / */
+ sfarg *sfsin(sfarg * const p); /* sin */
+ sfarg *sfcos(sfarg * const p); /* cos */
+ sfarg *sftan(sfarg * const p); /* tan */
+ sfarg *sfcot(sfarg * const p); /* ctan */
+ sfarg *sfasin(sfarg * const p); /* asin */
+ sfarg *sfacos(sfarg * const p); /* acos */
+ sfarg *sfatan(sfarg * const p); /* atan */
+ sfarg *sfacot(sfarg * const p); /* actan */
+ sfarg *sfatan2(sfarg * const p); /* atan2 */
+ sfarg *sfsinh(sfarg * const p); /* sinh */
+ sfarg *sfcosh(sfarg * const p); /* cosh */
+ sfarg *sftanh(sfarg * const p); /* tanh */
+ sfarg *sfcoth(sfarg * const p); /* ctanh */
+ sfarg *sfexp(sfarg * const p); /* exp */
+ sfarg *sflog(sfarg * const p); /* log */
+ sfarg *sflog2(sfarg * const p); /* log2 */
+ sfarg *sflog10(sfarg * const p); /* log2 */
+ sfarg *sflogN(sfarg * const p); /* logN */
+ sfarg *sflogCN(sfarg * const p); /* logCN */
+ sfarg *sfpow(sfarg * const p); /* csflx pow */
+ sfarg *sfpowi(sfarg * const p); /* int pow */
+ sfarg *sfpowd(sfarg * const p); /* double pow */
+ sfarg *sfpowdc(sfarg * const p); /* double to csflx pow */
+ sfarg *sfsqr(sfarg * const p); /* sqr */
+ sfarg *sfsqrt(sfarg * const p); /* sqrt */
+ sfarg *sfrtni(sfarg * const p); /* rtni *//*cos tu nie tak jak powinno byc ;( */
+ sfarg *sfinv(sfarg * const p); /* cinv */
+ sfarg *sfceil(sfarg * const p); /* ceil */
+ sfarg *sffloor(sfarg * const p); /* floor */
+ sfarg *sfabs(sfarg * const p); /* abs - |z| */
+ sfarg *sfre(sfarg * const p); /* RE */
+ sfarg *sfim(sfarg * const p); /* IM */
+ sfarg *sfrabs(sfarg * const p); /* abs - real numbers */
+ sfarg *sfrand(sfarg * const p); /* rand */
+/*const eval*/
+ void sfcPI(sfNumber * cnst);
+ void sfcPI2(sfNumber * cnst);
+ void sfc2PI(sfNumber * cnst);
+ void sfcE(sfNumber * cnst);
+ void sfcI(sfNumber * cnst);
+ void sfcRND(sfNumber * cnst);
+#ifdef __cplusplus
+}
+#endif
+/* all available function (function pointer, number of parameters, name )*/
+ extern const sffunction sfcmplxfunc[sffnctscount];
+/* all available buildin variables */
+extern const char sfcnames[sfvarscount][5];
+/* available variables function pointers */
+extern const cfptr sfcvals[sfvarscount];
+
+#endif
+#endif
diff --git a/src/include/sffe_cmplx_gsl.h b/src/include/sffe_cmplx_gsl.h
new file mode 100644
index 0000000..7bc5b66
--- /dev/null
+++ b/src/include/sffe_cmplx_gsl.h
@@ -0,0 +1,82 @@
+/*/////////////////////////////////////////////////////////////////////////////////////
+// project : sFFe ( SegFault (or Segmentation Fault :) ) formula evalutaor )
+// author : Mateusz Malczak ( mateusz@malczak.info )
+// wpage : www.segfaultlabs.com/projects/sffe
+///////////////////////////////////////////////////////////////////////////////////////
+// special build for XaoS, for more info visit
+// http://www.segfaultlabs.com/projects/sfXaos
+/////////////////////////////////////////////////////////////////////////////////////*/
+#ifndef SFFE_CMPLX_GSL_H
+#define SFFE_CMPLX_GSL_H
+
+#include <config.h>
+#ifdef SFFE_CMPLX_GSL
+
+#include "sffe.h"
+
+#include <gsl/gsl_complex.h>
+#include <gsl/gsl_complex_math.h>
+
+#define sffnctscount 43
+#define sfvarscount 6
+#define cmplxset(c,r,i) GSL_SET_COMPLEX(&c,r,i)
+#define real(c) GSL_REAL((c))
+#define imag(c) GSL_IMAG((c))
+
+sfarg *sfadd(sfarg * const p); /* + */
+sfarg *sfsub(sfarg * const p); /* - */
+sfarg *sfmul(sfarg * const p); /* * */
+sfarg *sfdiv(sfarg * const p); /* / */
+sfarg *sfsin(sfarg * const p); /* sin */
+sfarg *sfcos(sfarg * const p); /* cos */
+sfarg *sftan(sfarg * const p); /* tan */
+sfarg *sfcot(sfarg * const p); /* ctan */
+sfarg *sfasin(sfarg * const p); /* asin */
+sfarg *sfacos(sfarg * const p); /* acos */
+sfarg *sfatan(sfarg * const p); /* atan */
+sfarg *sfacot(sfarg * const p); /* actan */
+sfarg *sfatan2(sfarg * const p); /* atan2 */
+sfarg *sfsinh(sfarg * const p); /* sinh */
+sfarg *sfcosh(sfarg * const p); /* cosh */
+sfarg *sftanh(sfarg * const p); /* tanh */
+sfarg *sfcoth(sfarg * const p); /* ctanh */
+sfarg *sfexp(sfarg * const p); /* exp */
+sfarg *sflog(sfarg * const p); /* log */
+sfarg *sflog10(sfarg * const p); /* log10 */
+sfarg *sflog2(sfarg * const p); /* log2 */
+sfarg *sflogN(sfarg * const p); /* logN */
+sfarg *sfpow(sfarg * const p); /* csflx pow */
+sfarg *sfpowd(sfarg * const p); /* double pow */
+sfarg *sfpowi(sfarg * const p); /* double pow */
+sfarg *sfpowdc(sfarg * const p); /* double to csflx pow */
+sfarg *sfsqr(sfarg * const p); /* sqr */
+sfarg *sfsqrt(sfarg * const p); /* sqrt */
+sfarg *sfrtni(sfarg * const p); /* rtni */
+sfarg *sfinv(sfarg * const p); /* cinv */
+sfarg *sfceil(sfarg * const p); /* ceil */
+sfarg *sffloor(sfarg * const p); /* floor */
+sfarg *sfabs(sfarg * const p); /* abs - |z| */
+sfarg *sfre(sfarg * const p); /* RE */
+sfarg *sfim(sfarg * const p); /* IM */
+sfarg *sfrabs(sfarg * const p); /* abs - real numbers */
+sfarg *sfrand(sfarg * const p); /* rand */
+/*const eval*/
+void sfcPI(sfNumber * cnst);
+void sfcPI2(sfNumber * cnst);
+void sfc2PI(sfNumber * cnst);
+void sfcE(sfNumber * cnst);
+void sfcI(sfNumber * cnst);
+void sfcRND(sfNumber * cnst);
+#ifdef __cplusplus
+}
+#endif
+
+/* all available function (function pointer, number of parameters, name )*/
+extern const sffunction sfcmplxfunc[sffnctscount];
+/* all available buildin variables */
+extern const char sfcnames[sfvarscount][5];
+/* available variables function pointers */
+extern const cfptr sfcvals[sfvarscount];
+
+#endif
+#endif
diff --git a/src/include/timers.h b/src/include/timers.h
new file mode 100644
index 0000000..140151f
--- /dev/null
+++ b/src/include/timers.h
@@ -0,0 +1,67 @@
+/*
+ * XaoS, a fast portable realtime fractal zoomer
+ * Copyright (C) 1996,1997 by
+ *
+ * Jan Hubicka (hubicka@paru.cas.cz)
+ * Thomas Marsh (tmarsh@austin.ibm.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef TIMERS_H
+#define TIMERS_H
+#include "config.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ struct timer;
+ struct timeemulator;
+ typedef struct timer tl_timer;
+ typedef struct timer tl_group;
+
+ void tl_update_time(void);
+ tl_timer *tl_create_timer(void);
+ tl_group *tl_create_group(void);
+ void tl_set_interval(tl_timer * timer, int interval);
+ void tl_set_handler(tl_timer * timer, void (*handler) (void *),
+ void *userdata);
+ void tl_set_multihandler(tl_timer * timer,
+ void (*handler) (void *, int),
+ void *userdata);
+ void tl_add_timer(tl_group * group, tl_timer * timer);
+ void tl_remove_timer(tl_timer * timer);
+ void tl_free_timer(tl_timer * timer);
+ void tl_free_group(tl_group * timer);
+ void tl_stop_timer(tl_timer * t);
+ void tl_resume_timer(tl_timer * t);
+ void tl_slowdown_timer(tl_timer * t, int time);
+ int tl_process_group(tl_group * group, int *activated);
+ extern tl_group *syncgroup, *asyncgroup;
+ void tl_sleep(int);
+ void tl_allegromode(int mode); /*Just for djgpp */
+ int tl_lookup_timer(tl_timer * t) REGISTERS(3);
+ void tl_reset_timer(tl_timer * t) REGISTERS(3);
+
+ struct timeemulator *tl_create_emulator(void);
+ void tl_free_emulator(struct timeemulator *t);
+ void tl_elpased(struct timeemulator *t, int elpased);
+ void tl_emulate_timer(struct timer *t, struct timeemulator *e);
+ void tl_unemulate_timer(struct timer *t);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* TIMER_H */
diff --git a/src/include/true24.h b/src/include/true24.h
new file mode 100644
index 0000000..de626a3
--- /dev/null
+++ b/src/include/true24.h
@@ -0,0 +1,31 @@
+#ifdef cpixel_t
+#undef cpixel_t
+#undef cpixeldata_t
+#undef cppixel_t
+#undef cpixeldata_t
+#undef bpp
+#undef bpp1
+#undef p_add
+#undef p_inc
+#undef p_set
+#undef p_get
+#undef p_setp
+#undef UNSUPPORTED
+#undef p_getp
+#undef p_copy
+#endif
+#ifndef STRUECOLOR24
+#define UNSUPPORTED
+#endif
+#define cpixel_t pixel8_t
+#define cppixel_t ppixel8_t
+#define cpixeldata_t pixel32_t
+#define bpp 3
+/*FIXME this should make problems at small edian machines? */
+#define p_set(ptr,val) ((*(pixel16_t *)(ptr))=(pixel16_t)(val),((ptr)[2])=(pixel8_t)((val)>>16))
+#define p_get(ptr) (((pixel32_t)*(pixel16_t *)(ptr)+(pixel32_t)(*((ptr)+2)<<16)))
+#define p_copy(ptr1,pos1,ptr2,pos2) (*((pixel16_t *)((ptr1)+(pos1)*3))=*(pixel16_t *)((ptr2)+(pos2)*3),(ptr1)[(pos1)*3+2]=(ptr2)[(pos2)*3+2])
+#define p_setp(ptr,pos,val) p_set((ptr)+(pos)*3,val)
+#define p_getp(ptr,pos) p_get((ptr)+(pos)*3)
+#define p_add(ptr,pos) ((ptr)+(pos)*3)
+#define p_inc(ptr,pos) ((ptr)+=(pos)*3)
diff --git a/src/include/truecolor.h b/src/include/truecolor.h
new file mode 100644
index 0000000..9025318
--- /dev/null
+++ b/src/include/truecolor.h
@@ -0,0 +1,13 @@
+#ifdef cpixel_t
+#undef UNSUPPORTED
+#undef cpixel_t
+#undef cpixeldata_t
+#undef cppixel_t
+#undef bpp
+#undef bpp1
+#endif
+#define cpixel_t pixel32_t
+#define cpixeldata_t pixel32_t
+#define cppixel_t ppixel32_t
+#define bpp 4
+#include <generic.h>
diff --git a/src/include/ui.h b/src/include/ui.h
new file mode 100644
index 0000000..8bdf783
--- /dev/null
+++ b/src/include/ui.h
@@ -0,0 +1,160 @@
+/*
+ * XaoS, a fast portable realtime fractal zoomer
+ * Copyright (C) 1996,1997 by
+ *
+ * Jan Hubicka (hubicka@paru.cas.cz)
+ * Thomas Marsh (tmarsh@austin.ibm.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+#ifndef UI_H
+#define UI_H
+/*
+#include "xio.h"
+#include "zoom.h"
+*/
+#include "config.h"
+#include "param.h"
+#include "xmenu.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#undef BUTTON1
+#undef BUTTON2
+#undef BUTTON3
+#define BUTTON1 256
+#define BUTTON2 512
+#define BUTTON3 1024
+#define UI_C256 1
+#define UI_GRAYSCALE 2
+#define UI_TRUECOLOR16 4
+#define UI_TRUECOLOR24 8
+#define UI_TRUECOLOR 16
+#define UI_PROTECTIMAGES 32
+#define UI_LBITMAP 256
+#define UI_MBITMAP 512
+#define UI_LIBITMAP 1024
+#define UI_MIBITMAP 2048
+#define UI_FIXEDCOLOR 4096
+
+
+#define NORMALMOUSE 0
+#define WAITMOUSE 1
+#define REPLAYMOUSE 2
+#define VJMOUSE 3
+
+#define UIKEY_UP 257
+#define UIKEY_DOWN 258
+#define UIKEY_LEFT 259
+#define UIKEY_RIGHT 260
+#define UIKEY_ESC 261
+#define UIKEY_BACKSPACE 8
+#define UIKEY_TAB '\t'
+#define UIKEY_HOME 262
+#define UIKEY_END 263
+#define UIKEY_PGUP 264
+#define UIKEY_PGDOWN 265
+
+ typedef unsigned char ui_rgb[4];
+ typedef ui_rgb *ui_palette;
+ struct uih_context;
+ struct gui_driver {
+ void (*setrootmenu) (struct uih_context * c, CONST char *name);
+ void (*enabledisable) (struct uih_context * c, CONST char *name);
+ void (*menu) (struct uih_context * c, CONST char *name);
+ void (*dialog) (struct uih_context * c, CONST char *name);
+ void (*help) (struct uih_context * c, CONST char *name);
+ };
+ struct ui_driver {
+ CONST char *name;
+ int (*init) (void); /*initializing function. recturns 0 if fail */
+ void (*getsize) (int *, int *); /*get current size..in fullscreen versions
+ i.e svga and dos asks user for it */
+ void (*processevents) (int, int *, int *, int *, int *);
+ /*processevents..calls ui_resize,ui_key
+ laso returns possitions of mouse..
+ waits for event if first parameter is
+ 1 */
+ void (*getmouse) (int *, int *, int *);
+ /*returns current mouse possitions */
+ void (*uninit) (void);
+ /*called before exit */
+ int (*set_color) (int, int, int, int);
+ void (*set_range) (ui_palette palette, int, int);
+ /*sets palette color and returns number */
+ void (*print) (int, int, CONST char *); /*prints text */
+ void (*display) (void); /*displays bitmap */
+ int (*alloc_buffers) (char **buffer1, char **buffer2); /*makes buffers */
+ void (*free_buffers) (char *buffer1, char *buffer2); /*frees buffers */
+ void (*flip_buffers) (void); /*prints text */
+ void (*mousetype) (int type);
+ void (*flush) (void);
+ int textwidth;
+ int textheight; /*width of text */
+ /*int helpsize; */
+ CONST struct params *params;
+ int flags;
+ float width, height;
+ int maxwidth, maxheight;
+ int imagetype;
+ int palettestart, paletteend, maxentries;
+ int rmask, gmask, bmask;
+ CONST struct gui_driver *gui_driver;
+ };
+
+ extern struct uih_context *globaluih;
+
+#ifdef USE_LOCALEPATH
+ extern char *localepath;
+#endif
+
+ number_t ui_getfloat(CONST char *text);
+ void ui_resize(void);
+ void ui_call_resize(void);
+ void ui_quit(void) NORETURN;
+ void ui_menu(CONST char *text);
+ void ui_menuactivate(CONST menuitem * item, dialogparam * d);
+ int ui_key(int);
+ void ui_loadstr(CONST char *data);
+ xio_path ui_getfile(CONST char *basename, CONST char *extension);
+ void ui_help(CONST char *name);
+ char *ui_getpos(void);
+ int MAIN_FUNCTION(int argc, char **argv);
+
+
+
+#ifndef RANDOM_PALETTE_SIZE
+#define RANDOM_PALETTE_SIZE 1 /*FIXME currently ignored */
+#define FULLSCREEN 2
+#define UPDATE_AFTER_PALETTE 4
+#define UPDATE_AFTER_RESIZE 8
+#define PALETTE_ROTATION 16
+#define ASYNC_PALETTE 32
+#define ROTATE_INSIDE_CALCULATION 64
+#define PALETTE_REDISPLAYS 128
+#define SCREENSIZE 256
+#define PIXELSIZE 512
+#define RESOLUTION 1024
+#endif
+#define NOFLUSHDISPLAY 2048
+#define AALIB (4096*2)
+#define RESIZE_COMMAND (4096*4)
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* UI_H */
diff --git a/src/include/ui_helper.h b/src/include/ui_helper.h
new file mode 100644
index 0000000..73ead16
--- /dev/null
+++ b/src/include/ui_helper.h
@@ -0,0 +1,550 @@
+#ifndef UI_HELPER_H
+#define UI_HELPER_H
+#include "timers.h"
+#include "xio.h"
+
+#ifdef SFFE_USING
+#include "sffe.h"
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#define MAXFILTERS 20
+#define AVRGSIZE 50
+#define NMESSAGES 5
+#define BGCOLOR(uih) uih->palette->index[0]
+#define FGCOLOR(uih) uih->palette->index[1]
+#define SELCOLOR(uih) uih->palette->index[2]
+#define DARKGRAYCOLOR(uih) uih->palette->index[3]
+#define LIGHTGRAYCOLOR(uih) uih->palette->index[4]
+#define LIGHTGRAYCOLOR2(uih) uih->palette->index[5]
+#define NONTRANSPARENTW 1
+#define DRAWBORDER 2
+#define BORDER_PRESSED 4
+#define BORDER_TRANSPARENT 8
+#define BORDER_LIGHT 16
+
+ struct uih_message {
+ char *message[NMESSAGES];
+ tl_timer *messagetimer[NMESSAGES];
+ int messagetype[NMESSAGES];
+ struct uih_window *w[NMESSAGES];
+ int pid[NMESSAGES];
+ int messagestart;
+ };
+ struct uih_line {
+ int key;
+ int morph;
+ int color;
+ int posmode;
+ number_t x1, y1, x2, y2;
+ int mposmode;
+ number_t mx1, my1, mx2, my2;
+ struct uih_line *next, *prev;
+ struct uih_window *w;
+ };
+ struct uih_lines {
+ struct uih_line *first;
+ int morphing;
+ int currkey;
+ };
+
+ struct uih_savedcontext {
+ xio_file file;
+ int mode;
+ number_t speedup, maxstep;
+ number_t xcenter, ycenter;
+ tl_timer *timer;
+ tl_timer *synctimer;
+ struct fractal_context *fcontext;
+ int clearscreen;
+ int fastmode, juliamode, fastrotate, autorotate;
+ number_t rotationspeed;
+ int firsttime;
+ int filter[MAXFILTERS];
+ int pressed;
+ int rotatepressed;
+ int cycling;
+ int shifted;
+ int manualpaletteshift;
+ int direction;
+ int cyclingspeed;
+ int zoomactive;
+ int xtextpos, ytextpos;
+ int writefailed;
+ int nonfractalscreen;
+ int color;
+ };
+#define MAXLEVEL 10 /*Maximal include level */
+ struct uih_playcontext {
+ xio_file file;
+ xio_file prevfiles[MAXLEVEL + 1];
+ int level;
+ xio_path directory;
+ tl_timer *timer;
+ int waittime;
+ int playframe;
+ int timerin;
+ int frametime, starttime;
+ int morph;
+ int morphtimes[2];
+ int morphjulia;
+ int morphjuliatimes[2];
+ int morphangle;
+ int morphangletimes[2];
+ vinfo destination;
+ vinfo source;
+ number_t srcangle, destangle;
+ number_t sr, si, dr, di;
+ int readfailed;
+ int line;
+ struct uih_lines lines;
+ int morphlinetimes[2];
+ };
+#define SQR(val) (((double)(val))*(val))
+#define MORPHVALUE(time,len,starttime,endtime) \
+ (time)<0?0.0 \
+ :(time)>=(len)?1.0 \
+ :(time)<(starttime) && (starttime)?(SQR((time)/(double)(starttime))/2*(starttime)/((len)-(starttime)/2-(endtime)/2))\
+ :((len)-(time)<(endtime)) && (endtime)?1-(SQR(((len)-(time))/(double)(endtime))/2*(endtime)/((len)-(starttime)/2-(endtime)/2)) \
+ :((time)-(starttime)/2)/((double)(len)-(starttime)/2-(endtime)/2)
+#ifdef _NEVER_
+#define MORPHVALUE(time,len,starttime,endtime) \
+ (((time))/((double)(len)))
+#endif
+#define DOMORPH(time,len,starttime,endtime,startval,endval) \
+ ((startval)+((endval)-(startval))*MORPHVALUE(time,len, starttime,endtime))
+
+#define UNDOLEVEL 256
+ struct uih_undocontext {
+ int last;
+ char *undos[256];
+ };
+ struct uih_context {
+ void (*updatemenus) (struct uih_context *, CONST char *);
+ /*stuff that should be visible from outside */
+ number_t speedup, maxstep; /*zooming speed */
+
+ /* Informations provided to the user interface: */
+ CONST char *menuroot;
+ int display; /*1 when ui wants to display something */
+ int save; /*1 if save animation is enabled */
+ int play; /*1 if animation replay is active */
+ int cycling; /*1 if cycling is enabled */
+ int incalculation; /*1 if calulcation is currently in process */
+ int flags;
+ int interrupt; /*set to interrupt current calculation */
+
+ /*server's callbacks */
+ int (*passfunc) (struct uih_context *, int, CONST char *, float);
+ void (*longwait) (struct uih_context *);
+
+ struct uih_undocontext undo;
+ /*Filter system state */
+ struct image *image;
+ struct palette *palette;
+ struct fractal_context *fcontext; /*fractal informations */
+ struct queue *queue;
+ struct filter *uifilter; /*user interface layer */
+ struct filter *rotatef; /* Special filters handler by ui_helper: */
+ struct filter *zengine;
+ struct filter *fixedcolor;
+ /*Julia/filter mechanizm */
+ struct filter *subwindow, *julia, *smalliter;
+ struct filter *filter[MAXFILTERS];
+
+ /*General status variables */
+ double mul; /*speed of last iteration */
+ int rotatemode; /*ROTATE_NONE, ROTATE_CONTINUOUS or ROTATE_NONE */
+ number_t rotationspeed; /*speed of continuous rotation */
+ int fastmode; /*when draw in fast mode */
+ int juliamode;
+ int fastrotate;
+ int uncomplette; /*1 if image is not complettly caluclated or in animation */
+ int dirty; /*1 if image is inexact */
+ int inanimation; /*1 if uih_update wants to be called soon */
+ int fastanimation; /*1 if animation needs to be fast */
+ int palettetype, paletteseed; /*0 for default palette,1,2 for random */
+ int clearscreen; /*1 when ui want to clear screen */
+ int indofractal; /*1 when caluclation is in the process */
+ int xtextpos, ytextpos; /*possitioning of text */
+ int color; /*Color of text */
+ int recalculatemode; /*informations for user interface */
+ int stoppedtimers; /*1 when timers are stopped */
+ int nletters; /*Number of letters displayed at screen */
+ int letterspersec; /*Number of letters per second user should read */
+ char *text[3]; /*Currently displayed text informations: */
+ struct uih_window *textwindow[3], *cscreenwindow;
+ int textpos[3], textcolor[3];
+ CONST char *errstring; /*String of last unprocessed error */
+
+ CONST struct xfont *font; /*Font used by UI */
+ struct uih_window *wtop;
+ int wflipped;
+ int wdisplayed;
+
+ /*Save variables */
+ int todisplayletters;
+ struct uih_savedcontext *savec;
+ int viewchanged; /*When to generate setview commands */
+ int palettechanged; /*When to generate setpalette commands */
+ int displaytext; /*When text was displayed in this frame */
+ int nonfractalscreen;
+ /*waiting variables */
+ void (*complettehandler) (void *); /*Handler to be activated when calculation is complette */
+ void *handlerdata;
+ /*replay variables */
+ struct uih_playcontext *playc;
+ int playpos;
+ CONST char *playstring;
+
+ /*For constant framerate */
+ struct timeemulator *emulator;
+ int emulatedframetime;
+ int aliasnum;
+ int fixedstep;
+
+ /*zoom/unzoom */
+ number_t speed, step;
+ number_t xcenter, ycenter;
+ int xcenterm, ycenterm;
+ int zoomactive;
+
+ /*drag&drop move */
+ int pressed;
+ number_t oldx, oldy;
+ int moved;
+
+ /*drag&drop rotate */
+ int rotatepressed;
+ number_t oldangle;
+
+ int ddatalost;
+ int tbreak;
+
+ int autopilot; /*for uih side of autopilot */
+ int autopilotx, autopiloty, autopilotbuttons;
+
+ /*calculation time variables */
+ int interruptiblemode;
+ int starttime, endtime;
+ int maxtime;
+
+ /*dynamical timeout measuring */
+ int times[2][AVRGSIZE]; /*for statistics */
+ int timespos, count[2];
+ double lastspeed, lasttime;
+
+ /*number_t xsize, ysize; */
+ tl_timer *maintimer, *cyclingtimer, *autopilottimer,
+ *calculatetimer, *doittimer;
+ tl_group *autopilotgroup;
+
+ /*color cycling values */
+ int direction;
+ int cyclingdirection;
+ int stopped;
+ int cyclingspeed;
+
+ /*autopilot internal values */
+ int x1, y1, c1;
+ number_t minsize;
+ number_t maxsize;
+ int autopilotversion;
+ int autime;
+ int minlong;
+ int interlevel;
+
+ /*saved palettes */
+ struct palette *palette2;
+
+ int paletteshift;
+ int manualpaletteshift;
+
+ struct uih_message messg;
+
+ /*Used by uih_update to figure out when save undo */
+ int lastbuttons;
+
+ int encoding;
+
+ /* performers really don't want text echoed to the screen */
+ int inhibittextoutput;
+
+ /* user data */
+ void *data;
+
+#ifdef SFFE_USING
+ /*User formulas (used in sffe parser) */
+ /*sffe *cparser; user define c evaluation formula, not used now, not used yet */
+ sffe *parser; /* fractal formula */
+ sffe *pinit;
+#endif
+
+ };
+ typedef void (*uih_getposfunc) (struct uih_context * c, int *x, int *y,
+ int *width, int *height, void *data);
+ typedef void (*uih_drawfunc) (struct uih_context * c, void *data);
+ struct uih_window {
+ int x, y, width, height;
+ uih_getposfunc getpos;
+ uih_drawfunc draw;
+ struct uih_window *next;
+ struct uih_window *previous;
+ int savedline, savedpos;
+ char *saveddata;
+ void *data;
+ int flags;
+ };
+ typedef struct uih_context uih_context;
+
+#define UIH_SAVEALL 2
+#define UIH_SAVEANIMATION 1
+#define UIH_SAVEPOS 0
+
+#define UIH_PALETTEDRAW -2
+#define UIH_FILTERANIMATION -1
+#define UIH_INTERRUPTIBLE 0
+#define UIH_ANIMATION 1
+#define UIH_NEW_IMAGE 2
+#define UIH_UNINTERRUPTIBLE 3
+#define FRAMETIME (1000000/FRAMERATE)
+
+#define UIH_TEXTTOP 0
+#define UIH_TEXTMIDDLE 1
+#define UIH_TEXTBOTTOM 2
+
+#define UIH_TEXTLEFT 0
+#define UIH_TEXTCENTER 1
+#define UIH_TEXTRIGHT 2
+
+#define RANDOM_PALETTE_SIZE 1
+#define FULLSCREEN 2
+#define UPDATE_AFTER_PALETTE 4
+#define UPDATE_AFTER_RESIZE 8
+#define PALETTE_ROTATION 16
+#define ASYNC_PALETTE 32
+#define ROTATE_INSIDE_CALCULATION 64
+#define PALETTE_REDISPLAYS 128
+#define SCREENSIZE 256
+#define PIXELSIZE 512
+#define RESOLUTION 1024
+
+#define BUTTON1 256
+#define BUTTON2 512
+#define BUTTON3 1024
+
+#define ROTATE_NONE 0
+#define ROTATE_MOUSE 1
+#define ROTATE_CONTINUOUS 2
+
+#define uih_needrecalculate(context) ((context)->recalculatemode)
+#define uih_needdisplay(context) ((context)->display)
+#define GETMAX(a,b) ((a)>(b)?(a):(b))
+#define uih_newimage(c) ((c)->display=1,((c)->recalculatemode=GETMAX((c)->recalculatemode,UIH_NEW_IMAGE)))
+#define uih_animate_image(c) ((c)->display=1,(c)->recalculatemode=GETMAX((c)->recalculatemode,UIH_ANIMATION))
+
+#define uih_updatemenus(uih,c) if(uih->updatemenus!=NULL) uih->updatemenus(uih,c);
+
+ extern CONST struct filteraction *CONST uih_filters[MAXFILTERS];
+ extern CONST int uih_nfilters;
+
+ struct uih_context *uih_mkcontext(int flags, struct image *image,
+ int (*passfunc) (struct uih_context
+ *, int,
+ CONST char *,
+ float),
+ void (*longwait) (struct uih_context
+ *),
+ void (*updatemenus) (struct
+ uih_context * c,
+ CONST char *));
+ int uih_updateimage(uih_context * c, struct image *img);
+ void uih_freecontext(uih_context * c);
+
+
+ void uih_callcomplette(uih_context * c);
+/*palette functions */
+ void uih_mkdefaultpalette(uih_context * c);
+ void uih_mkpalette(uih_context * c);
+ void uih_savepalette(uih_context * c);
+ void uih_restorepalette(uih_context * c);
+ void uih_loadpalette(uih_context * c, struct palette *palette);
+
+/*autopilot handling */
+ void uih_autopilot_on(uih_context * c);
+ void uih_autopilot_off(uih_context * c);
+
+/*misc functions */
+ int uih_update(uih_context * c, int mousex, int mousey,
+ int mousebuttons);
+ CONST char *uih_save(struct uih_context *c, xio_constpath filename);
+ void uih_tbreak(uih_context * c);
+ double uih_displayed(uih_context * c);
+ void uih_do_fractal(uih_context * c);
+ void uih_prepare_image(uih_context * c);
+ void uih_interrupt(uih_context * c);
+ void uih_stopzooming(uih_context * c);
+ void uih_setspeedup(uih_context * c, number_t speed);
+ void uih_setmaxstep(uih_context * c, number_t speed);
+ void uih_setcomplettehandler(uih_context * c, void (h) (void *),
+ void *d);
+ void uih_recalculate(struct uih_context *c);
+ void uih_initstate(struct uih_context *uih);
+ void uih_screentofractalcoord(uih_context * c, int mousex, int mousey,
+ number_t * re, number_t * im);
+
+
+/*cycling functions */
+ void uih_cycling_off(struct uih_context *c);
+ void uih_cycling_stop(struct uih_context *c);
+ void uih_cycling_continue(struct uih_context *c);
+ void uih_setcycling(struct uih_context *c, int speed);
+ int uih_cycling_on(struct uih_context *c);
+ int uih_cycling(struct uih_context *c, int mode);
+
+/*fractal context manipulation routines */
+ void uih_setformula(uih_context * c, int formula);
+ void uih_setperbutation(uih_context * c, number_t re, number_t im);
+ void uih_perbutation(uih_context * c, int mousex, int mousey);
+ void uih_setmaxiter(uih_context * c, int maxiter);
+ void uih_setbailout(uih_context * c, number_t bailout);
+ void uih_setincoloringmode(uih_context * c, int mode);
+ void uih_setoutcoloringmode(uih_context * c, int mode);
+ void uih_setintcolor(uih_context * c, int mode);
+ void uih_setouttcolor(uih_context * c, int mode);
+ void uih_setplane(uih_context * c, int mode);
+ void uih_setmandelbrot(uih_context * c, int mode, int mousex,
+ int mousey);
+ void uih_setfastmode(uih_context * c, int mode);
+ void uih_setguessing(uih_context * c, int range);
+ void uih_setperiodicity(uih_context * c, int periodicity);
+ void uih_display(uih_context * c);
+ void uih_disablejulia(uih_context * c);
+ int uih_enablejulia(uih_context * c);
+ int uih_setjuliamode(uih_context * c, int mode);
+ void uih_setjuliaseed(uih_context * c, number_t zre, number_t zim);
+
+/*filter manipulation */
+ int uih_enablefilter(uih_context * c, int n);
+ void uih_disablefilter(uih_context * c, int n);
+
+/*Animation save routines */
+ int uih_save_enable(struct uih_context *uih, xio_file f, int mode);
+ void uih_save_disable(struct uih_context *uih);
+ void uih_saveframe(struct uih_context *uih);
+ void uih_save_possition(struct uih_context *uih, xio_file f, int mode);
+
+ void uih_load(struct uih_context *uih, xio_file f, xio_constpath name);
+ void uih_loadstr(struct uih_context *uih, CONST char *data);
+ void uih_playstr(struct uih_context *uih, CONST char *data);
+ void uih_playupdate(struct uih_context *uih);
+ void uih_replaydisable(struct uih_context *uih);
+ void uih_skipframe(struct uih_context *uih);
+ int uih_replayenable(struct uih_context *uih, xio_file f,
+ xio_constpath filename, int animroot);
+ void uih_command(struct uih_context *uih, CONST char *command);
+ void uih_playtutorial(struct uih_context *c, CONST char *name);
+
+/* Easy to use functions for handling save/load*/
+ void uih_loadfile(struct uih_context *uih, xio_constpath d);
+ void uih_playfile(struct uih_context *c, xio_constpath d);
+ void uih_loadexample(struct uih_context *c);
+ void uih_savepngfile(struct uih_context *c, xio_constpath d);
+ void uih_saveposfile(struct uih_context *c, xio_constpath d);
+ char *uih_savepostostr(struct uih_context *c);
+ void uih_savecfg(struct uih_context *c);
+ void uih_saveanimfile(struct uih_context *c, xio_constpath d);
+ void uih_update_lines(uih_context * c);
+
+
+/*timer functions */
+ void uih_stoptimers(uih_context * c);
+ void uih_resumetimers(uih_context * c);
+ void uih_slowdowntimers(uih_context * c, int time);
+
+/*text output functions */
+ void uih_clearscreen(uih_context * c);
+ void uih_settextpos(uih_context * c, int x, int y);
+ void uih_text(uih_context * c, CONST char *text);
+ void uih_letterspersec(uih_context * c, int n);
+
+/*image rotation functions */
+ int uih_fastrotate(uih_context * c, int mode);
+ int uih_fastrotateenable(uih_context * c);
+ void uih_fastrotatedisable(uih_context * c);
+ void uih_angle(uih_context * c, number_t angle);
+ void uih_rotatemode(uih_context * c, int mode);
+ void uih_rotate(uih_context * c, int mode);
+ void uih_rotationspeed(uih_context * c, number_t speed);
+
+/*Catalog functions */
+ int uih_loadcatalog(uih_context * c, CONST char *name);
+ void uih_freecatalog(uih_context * c);
+
+ void uih_registermenus(void);
+ void uih_registermenus_i18n(void);
+ void uih_registermenudialogs_i18n(void);
+ void uih_unregistermenus(void);
+
+/*Windows :)*/
+ struct uih_window *uih_registerw(struct uih_context *uih,
+ uih_getposfunc getpos,
+ uih_drawfunc draw, void *data,
+ int flags);
+ void uih_removew(struct uih_context *uih, struct uih_window *w);
+ void uih_clearwindows(struct uih_context *uih);
+ void uih_drawwindows(struct uih_context *uih);
+ void uih_drawborder(struct uih_context *uih, int x, int y, int width,
+ int height, int flags);
+ void uih_setline(struct uih_context *uih, struct uih_window *w,
+ int color, int x1, int y1, int x2, int y2);
+ struct uih_window *uih_registerline(struct uih_context *uih, int color,
+ int x1, int y1, int x2, int y2);
+
+
+/*Messages*/
+ void uih_scrollup(uih_context * c);
+ void uih_clearmessages(uih_context * c);
+ int uih_message(uih_context * c, CONST char *message);
+ int uih_error(uih_context * c, CONST char *error);
+ void uih_rmmessage(uih_context * c, int pid);
+ void uih_printmessages(uih_context * c);
+
+/*Constant framerate functions*/
+ void uih_emulatetimers(uih_context * c);
+ void uih_constantframetime(uih_context * c, int time);
+ void uih_noconstantframetime(uih_context * c);
+
+/*undo and redo*/
+ void uih_saveundo(uih_context * c);
+ void uih_undo(uih_context * c);
+ void uih_redo(uih_context * c);
+
+ void uih_setfont(uih_context * c);
+
+/*animation rendering*/
+ int uih_renderanimation(struct uih_context *gc, CONST char *basename,
+ CONST xio_constpath animation, int width,
+ int height, float pixelwidth,
+ float pixelheight, int frametime, int type,
+ int antialiasing, int slowmode,
+ int letterspersec, CONST char *catalog,
+ int motionvectors, int iframedist2);
+ int uih_renderimage(struct uih_context *gc1, xio_file af,
+ xio_constpath path, struct image *img,
+ int antialias, CONST char *catalog, int noise);
+
+ void uih_initmessages(uih_context * c);
+ void uih_destroymessages(uih_context * c);
+ void uih_inittext(uih_context * c);
+ void uih_destroytext(uih_context * c);
+
+ void uih_inhibittextsw(uih_context * c);
+ int uih_inhibittextselected(uih_context * c);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/src/include/version.h.in b/src/include/version.h.in
new file mode 100644
index 0000000..8b80450
--- /dev/null
+++ b/src/include/version.h.in
@@ -0,0 +1,23 @@
+/*
+ * XaoS, a fast portable realtime fractal zoomer
+ * Copyright (C) 1996,1997 by
+ *
+ * Jan Hubicka (hubicka@paru.cas.cz)
+ * Thomas Marsh (tmarsh@austin.ibm.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+#undef PACKAGE_VERSION
+#define XaoS_VERSION PACKAGE_VERSION
diff --git a/src/include/xerror.h b/src/include/xerror.h
new file mode 100644
index 0000000..2ae5638
--- /dev/null
+++ b/src/include/xerror.h
@@ -0,0 +1,12 @@
+#ifndef XERROR_H
+#define XERROR_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+ void x_message(CONST char *text, ...);
+ void x_error(CONST char *text, ...);
+ void x_fatalerror(CONST char *text, ...) NORETURN;
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/src/include/xio.h b/src/include/xio.h
new file mode 100644
index 0000000..2395302
--- /dev/null
+++ b/src/include/xio.h
@@ -0,0 +1,107 @@
+/* This is implementation of input/output routines similar to stdio.
+ purpose of this library is to hide differences between OSes (Mac OS don't
+ have stdio!) and allow general streams to strings etc. */
+#ifndef XIO1_H
+#define XIO1_H 1
+#include <config.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#define XIO_FAILED NULL
+ struct xio_filestruct {
+ void *data;
+ int (*fputc) (int c, struct xio_filestruct * f);
+ int (*fputs) (const char *s, struct xio_filestruct * f);
+ int (*fgetc) (struct xio_filestruct * f);
+ int (*fungetc) (int c, struct xio_filestruct * f);
+ int (*xeof) (struct xio_filestruct * f);
+ int (*fclose) (struct xio_filestruct * f);
+ int (*flush) (struct xio_filestruct * f);
+ };
+
+ typedef struct xio_filestruct *xio_file;
+
+#define xio_puts(s,f) (f)->fputs((s),(f))
+#define xio_putc(s,f) (f)->fputc((s),(f))
+#define xio_getc(f) (f)->fgetc((f))
+#define xio_ungetc(s,f) (f)->fungetc((s),(f))
+#define xio_feof(f) (f)->xeof((f))
+#define xio_close(f) (f)->fclose((f))
+#define xio_flush(f) if ((f)->flush!=NULL) (f)->flush((f))
+
+/* Standard stdio maps. These defines says, that filenames are strings and
+ path is separated by slash or backslash (windoze, dog)
+ the main I/O routines are in the xstdio file
+*/
+
+#ifdef USE_STDIO
+/* Ugly hack because of unknown problems w/ va_list in v*print* in plan9 */
+#ifdef _plan9_
+#define va_list char *
+#endif
+#include <stdio.h>
+
+ typedef char *xio_path;
+ typedef CONST char *xio_constpath;
+ typedef char xio_pathdata[4096];
+ extern char *xio_appdir; /*Where application binary is */
+ extern char *xio_homedir;
+
+
+#ifdef _WIN32
+#define XIO_PATHSEP '\\'
+#define XIO_PATHSEPSTR "\\"
+#define XIO_EMPTYPATH ".\\" /*Should be also call to currentdir function */
+#else
+#ifdef DJGPP
+#define XIO_PATHSEP '\\'
+#define XIO_PATHSEPSTR "\\"
+#define XIO_EMPTYPATH ".\\" /*Should be also call to currentdir function */
+#else
+#define XIO_PATHSEP '/'
+#define XIO_PATHSEPSTR "/"
+#define XIO_EMPTYPATH "./" /*Should be also call to currentdir function */
+#endif
+#endif
+#define XIO_EOF EOF
+
+#define xio_addfname(destination, dirrectory, filename) \
+{strcpy(destination,dirrectory);if (strlen(dirrectory)&&destination[strlen(destination)-1]!=XIO_PATHSEP) strcat(destination,XIO_PATHSEPSTR);strcat(destination,filename);}
+#define xio_addextension(destination,extension) strcat(destination,extension)
+
+#ifdef _plan9_
+#define xio_errorstring() errstr
+#else
+#define xio_errorstring() strerror(errno)
+#endif /*plan9 */
+
+ char *xio_fixpath(CONST char *name);
+#endif /*USE_STDIO */
+
+ xio_file xio_ropen(xio_constpath name);
+ xio_file xio_wopen(xio_constpath name);
+ xio_file xio_strropen(CONST char *c);
+ xio_file xio_strwopen(void);
+ char *xio_getstring(xio_file f);
+ xio_path xio_getdirectory(xio_constpath name);
+ xio_path xio_getfilename(CONST char *base, CONST char *extension);
+ xio_file xio_getrandomexample(xio_path name);
+ xio_file xio_getcatalog(CONST char *name);
+ xio_file xio_gethelp(void);
+ xio_file xio_gettutorial(CONST char *name, xio_path result);
+
+ /*look trought directory with examples, choose one file, open it (and return
+ *descriptor+put name into name parameter*/
+ int xio_exist(xio_constpath name);
+ int xio_getfiles(xio_constpath path, char ***names, char ***dirs,
+ int *nnames, int *ndirs);
+ void xio_init(CONST char *c);
+ void xio_uninit(void);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/src/include/xldio.h b/src/include/xldio.h
new file mode 100644
index 0000000..b17a993
--- /dev/null
+++ b/src/include/xldio.h
@@ -0,0 +1,14 @@
+#ifndef X_LDIO_H
+#define X_LDIO_H
+#ifdef USE_XLDIO
+#include "xio.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+ void x_ldout(long double param, int prec, xio_file stream);
+ long double x_strtold(CONST char *s, CONST char **sret);
+#ifdef __cplusplus
+}
+#endif
+#endif /*USE_XLDIO */
+#endif /*X_LDIO_H */
diff --git a/src/include/xmenu.h b/src/include/xmenu.h
new file mode 100644
index 0000000..70d3ccc
--- /dev/null
+++ b/src/include/xmenu.h
@@ -0,0 +1,377 @@
+#ifndef XMENU_H
+#define XMENU_H
+#include <xio.h>
+#include <fconfig.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ struct uih_context;
+ typedef union {
+ char *dstring;
+ int dint;
+ number_t number;
+ number_t dcoord[2];
+ xio_path dpath;
+ void *dummy;
+ } dialogparam;
+ typedef struct dialog {
+ CONST char *question;
+ int type;
+ int defint;
+ CONST char *defstr;
+ number_t deffloat;
+ number_t deffloat2;
+ } menudialog;
+
+ typedef char *(*tokenfunc) (struct uih_context * c);
+#define DIALOG_INT 1
+#define DIALOG_FLOAT 2
+#define DIALOG_STRING 3
+#define DIALOG_KEYSTRING 4
+#define DIALOG_IFILE 5
+#define DIALOG_OFILE 6
+#define DIALOG_CHOICE 7
+#define DIALOG_ONOFF 8
+#define DIALOG_COORD 9
+
+#define DIALOGIFILE(question,filename) {question, DIALOG_IFILE, 0,filename}
+#define DIALOGOFILE(question,filename) {question, DIALOG_OFILE, 0,filename}
+#define DIALOGSTR(question,default) {question, DIALOG_STRING, 0, default}
+#define DIALOGKEYSTR(question,default) {question, DIALOG_KEYSTRING, 0, default}
+#define DIALOGINT(question,default) {question, DIALOG_INT, default}
+#define DIALOGONOFF(question,default) {question, DIALOG_ONOFF, default}
+#define DIALOGFLOAT(question,default) {question, DIALOG_FLOAT, 0, NULL, default}
+#define DIALOGCHOICE(question,table,default) {question, DIALOG_CHOICE, default,(CONST char *)table}
+#define DIALOGCOORD(question,default1,default2) {question, DIALOG_COORD,0, NULL, default1,default2}
+
+#define DIALOGIFILE_I(_question,_filename) \
+ menudialogs_i18n[no_menudialogs_i18n].question=_question; \
+ menudialogs_i18n[no_menudialogs_i18n].type=DIALOG_IFILE; \
+ menudialogs_i18n[no_menudialogs_i18n].defint=0; \
+ menudialogs_i18n[no_menudialogs_i18n].defstr=_filename; \
+ menudialogs_i18n[no_menudialogs_i18n].deffloat=0; \
+ menudialogs_i18n[no_menudialogs_i18n].deffloat2=0; \
+ ++no_menudialogs_i18n;
+#define DIALOGOFILE_I(_question,_filename) \
+ menudialogs_i18n[no_menudialogs_i18n].question=_question; \
+ menudialogs_i18n[no_menudialogs_i18n].type=DIALOG_OFILE; \
+ menudialogs_i18n[no_menudialogs_i18n].defint=0; \
+ menudialogs_i18n[no_menudialogs_i18n].defstr=_filename; \
+ ++no_menudialogs_i18n;
+#define DIALOGKEYSTR_I(_question,_default) \
+ menudialogs_i18n[no_menudialogs_i18n].question=_question; \
+ menudialogs_i18n[no_menudialogs_i18n].type=DIALOG_KEYSTRING; \
+ menudialogs_i18n[no_menudialogs_i18n].defint=0; \
+ menudialogs_i18n[no_menudialogs_i18n].defstr=_default; \
+ ++no_menudialogs_i18n;
+#define DIALOGSTR_I(_question,_default) \
+ menudialogs_i18n[no_menudialogs_i18n].question=_question; \
+ menudialogs_i18n[no_menudialogs_i18n].type=DIALOG_STRING; \
+ menudialogs_i18n[no_menudialogs_i18n].defint=0; \
+ menudialogs_i18n[no_menudialogs_i18n].defstr=_default; \
+ ++no_menudialogs_i18n;
+#define DIALOGINT_I(_question,_default) \
+ menudialogs_i18n[no_menudialogs_i18n].question=_question; \
+ menudialogs_i18n[no_menudialogs_i18n].type=DIALOG_INT; \
+ menudialogs_i18n[no_menudialogs_i18n].defint=_default; \
+ ++no_menudialogs_i18n;
+#define DIALOGONOFF_I(_question,_default) \
+ menudialogs_i18n[no_menudialogs_i18n].question=_question; \
+ menudialogs_i18n[no_menudialogs_i18n].type=DIALOG_ONOFF; \
+ menudialogs_i18n[no_menudialogs_i18n].defint=_default; \
+ ++no_menudialogs_i18n;
+#define DIALOGFLOAT_I(_question,_default) \
+ menudialogs_i18n[no_menudialogs_i18n].question=_question; \
+ menudialogs_i18n[no_menudialogs_i18n].type=DIALOG_FLOAT; \
+ menudialogs_i18n[no_menudialogs_i18n].defint=0; \
+ menudialogs_i18n[no_menudialogs_i18n].defstr=NULL; \
+ menudialogs_i18n[no_menudialogs_i18n].deffloat=_default; \
+ ++no_menudialogs_i18n;
+#define DIALOGCHOICE_I(_question,_table,_default) \
+ menudialogs_i18n[no_menudialogs_i18n].question=_question; \
+ menudialogs_i18n[no_menudialogs_i18n].type=DIALOG_CHOICE; \
+ menudialogs_i18n[no_menudialogs_i18n].defint=_default; \
+ menudialogs_i18n[no_menudialogs_i18n].defstr=(CONST char *)_table; \
+ ++no_menudialogs_i18n;
+#define DIALOGCOORD_I(_question,_default1,_default2) \
+ menudialogs_i18n[no_menudialogs_i18n].question=_question; \
+ menudialogs_i18n[no_menudialogs_i18n].type=DIALOG_COORD; \
+ menudialogs_i18n[no_menudialogs_i18n].defint=0; \
+ menudialogs_i18n[no_menudialogs_i18n].defstr=NULL; \
+ menudialogs_i18n[no_menudialogs_i18n].deffloat=_default1; \
+ menudialogs_i18n[no_menudialogs_i18n].deffloat2=_default2; \
+ ++no_menudialogs_i18n;
+
+#define NULL_I() \
+ menudialogs_i18n[no_menudialogs_i18n].question=NULL; \
+ menudialogs_i18n[no_menudialogs_i18n].type=0; \
+ menudialogs_i18n[no_menudialogs_i18n].defint=0; \
+ menudialogs_i18n[no_menudialogs_i18n].defstr=NULL; \
+ menudialogs_i18n[no_menudialogs_i18n].deffloat=0; \
+ menudialogs_i18n[no_menudialogs_i18n].deffloat2=0; \
+ ++no_menudialogs_i18n;
+
+ typedef struct menuitem {
+ CONST char *menuname;
+ CONST char *key;
+ CONST char *name;
+ CONST char *shortname;
+ int type;
+ int flags;
+ void (*function) (void);
+ int iparam;
+ CONST void *pparam;
+ int (*control) (void);
+ CONST menudialog *(*dialog) (struct uih_context *);
+ } menuitem;
+
+#define MENU_NOPARAM 1
+#define MENU_SUBMENU 2
+#define MENU_INT 3
+#define MENU_STRING 4
+#define MENU_DIALOG 6
+#define MENU_CUSTOMDIALOG 7
+#define MENU_SEPARATOR 8
+
+/* Definitions for static menuitems. These items cannot be internationalized.
+ All of these definitions will become obsolete soon: */
+
+#define MENUNOP(menuname,key,name,shortname,flags,function) {menuname, key,name,shortname, MENU_NOPARAM, flags, (void (*)(void))function}
+#define MENUNOPCB(menuname,key,name,shortname,flags,function,checkbutton) {menuname, key, name,shortname, MENU_NOPARAM, (flags)|MENUFLAG_CHECKBOX, (void (*)(void))function,0,NULL,(int (*)(void))checkbutton}
+#define MENUCOORDCB(menuname,key,name,shortname,flags,function,checkbutton) {menuname, key, name,shortname, MENU_COORD, (flags)|MENUFLAG_CHECKBOX, (void (*)(void))function,0,NULL,(int (*)(void))checkbutton}
+#define MENUCOORD(menuname,key,name,shortname,flags,function) {menuname, key, name,shortname, MENU_COORD, flags, (void (*)(void))function}
+
+#define MENUINT(menuname,key,name,shortname,flags,function,param) {menuname, key, name,shortname, MENU_INT, flags, (void (*)(void))function,param}
+#define MENUINTRB(menuname,key,name,shortname,flags,function,param,checkbutton) {menuname, key, name,shortname, MENU_INT, (flags)|MENUFLAG_RADIO, (void (*)(void))function,param,NULL,(int (*)(void))checkbutton}
+#define SUBMENU(menuname,key,name,param) {menuname, key, name,param, MENU_SUBMENU, 0, NULL,0,NULL}
+
+#define MENUSEPARATOR(menuname) {menuname, 0, "", NULL, MENU_SEPARATOR, 0, NULL,0,NULL}
+#define SUBMENUNOOPT(menuname,key,name,param) {menuname, key, name,param, MENU_SUBMENU, MENUFLAG_NOOPTION, NULL,0,NULL}
+#define MENUDIALOG(menuname,key,name,shortname,flags,function,param) {menuname, key, name,shortname, MENU_DIALOG, flags, (void (*)(void))function,0,param}
+#define MENUDIALOGCB(menuname,key,name,shortname,flags,function,param,check) {menuname, key, name,shortname, MENU_DIALOG, flags|MENUFLAG_CHECKBOX, (void (*)(void))function,0,param,(int (*)(void))check}
+#define MENUCDIALOG(menuname,key,name,shortname,flags,function,param) {menuname, key, name,shortname, MENU_CUSTOMDIALOG, flags, (void (*)(void))function,0,NULL,NULL,(CONST menudialog *(*)(struct uih_context *))param}
+#define MENUCDIALOGCB(menuname,key,name,shortname,flags,function,param,check) {menuname, key, name,shortname, MENU_CUSTOMDIALOG, flags|MENUFLAG_CHECKBOX,(void (*)(void))function,0,NULL,(int (*)(void))check,(CONST menudialog *(*)(struct uih_context *))param}
+#define MENUSTRING(menuname,key,name,shortname,flags,function,param) {menuname, key, name,shortname, MENU_STRING, flags, (void (*)(void))function,0,param}
+
+
+/* Definitions for internationalized menus. All of them must be defined
+ dynamically because gettext() cannot be used within a static
+ variable. Usage (example):
+
+ SUBMENU_I("file", "q", "Quit", "quitmenu")
+
+ See ui/ui.c, ui_registermenus_i18n() for further details. */
+
+#define MENUNOP_I(_menuname,_key,_name,_shortname,_flags,_function)\
+ menuitems_i18n[no_menuitems_i18n].menuname = _menuname; \
+ menuitems_i18n[no_menuitems_i18n].shortname = _shortname; \
+ menuitems_i18n[no_menuitems_i18n].key = _key; \
+ menuitems_i18n[no_menuitems_i18n].type = MENU_NOPARAM; \
+ menuitems_i18n[no_menuitems_i18n].flags = _flags; \
+ menuitems_i18n[no_menuitems_i18n].iparam = 0; \
+ menuitems_i18n[no_menuitems_i18n].name = _name; \
+ menuitems_i18n[no_menuitems_i18n].pparam = NULL; \
+ menuitems_i18n[no_menuitems_i18n].function = (void (*)(void))_function; \
+ ++no_menuitems_i18n;
+
+#define MENUNOPCB_I(_menuname,_key,_name,_shortname,_flags,_function,_checkbutton) \
+ menuitems_i18n[no_menuitems_i18n].menuname = _menuname; \
+ menuitems_i18n[no_menuitems_i18n].shortname = _shortname; \
+ menuitems_i18n[no_menuitems_i18n].key = _key; \
+ menuitems_i18n[no_menuitems_i18n].type = MENU_NOPARAM; \
+ menuitems_i18n[no_menuitems_i18n].flags = (_flags)|MENUFLAG_CHECKBOX; \
+ menuitems_i18n[no_menuitems_i18n].iparam = 0; \
+ menuitems_i18n[no_menuitems_i18n].name = _name; \
+ menuitems_i18n[no_menuitems_i18n].pparam = NULL; \
+ menuitems_i18n[no_menuitems_i18n].function = (void (*)(void))_function; \
+ menuitems_i18n[no_menuitems_i18n].control = (int (*)(void))_checkbutton; \
+ ++no_menuitems_i18n;
+
+#define MENUINT_I(_menuname,_key,_name,_shortname,_flags,_function,_param) \
+ menuitems_i18n[no_menuitems_i18n].menuname = _menuname; \
+ menuitems_i18n[no_menuitems_i18n].shortname = _shortname; \
+ menuitems_i18n[no_menuitems_i18n].key = _key; \
+ menuitems_i18n[no_menuitems_i18n].type = MENU_INT; \
+ menuitems_i18n[no_menuitems_i18n].flags = _flags; \
+ menuitems_i18n[no_menuitems_i18n].iparam = _param; \
+ menuitems_i18n[no_menuitems_i18n].name = _name; \
+ menuitems_i18n[no_menuitems_i18n].function = (void (*)(void))_function; \
+ ++no_menuitems_i18n;
+
+#define MENUINTRB_I(_menuname,_key,_name,_shortname,_flags,_function,_param,_checkbutton) \
+ menuitems_i18n[no_menuitems_i18n].menuname = _menuname; \
+ menuitems_i18n[no_menuitems_i18n].shortname = _shortname; \
+ menuitems_i18n[no_menuitems_i18n].key = _key; \
+ menuitems_i18n[no_menuitems_i18n].type = MENU_INT; \
+ menuitems_i18n[no_menuitems_i18n].flags = (_flags)|MENUFLAG_RADIO; \
+ menuitems_i18n[no_menuitems_i18n].iparam = _param; \
+ menuitems_i18n[no_menuitems_i18n].pparam = NULL; \
+ menuitems_i18n[no_menuitems_i18n].name = _name; \
+ menuitems_i18n[no_menuitems_i18n].function = (void (*)(void))_function; \
+ menuitems_i18n[no_menuitems_i18n].control = (int (*)(void))_checkbutton; \
+ ++no_menuitems_i18n;
+
+#define SUBMENU_I(_menuname,_key,_name,_param) \
+ menuitems_i18n[no_menuitems_i18n].menuname = _menuname; \
+ menuitems_i18n[no_menuitems_i18n].shortname = _param; \
+ menuitems_i18n[no_menuitems_i18n].key = _key; \
+ menuitems_i18n[no_menuitems_i18n].type = MENU_SUBMENU; \
+ menuitems_i18n[no_menuitems_i18n].flags = 0; \
+ menuitems_i18n[no_menuitems_i18n].iparam = 0; \
+ menuitems_i18n[no_menuitems_i18n].name = _name; \
+ menuitems_i18n[no_menuitems_i18n].pparam = NULL; \
+ menuitems_i18n[no_menuitems_i18n].function = NULL; \
+ ++no_menuitems_i18n;
+
+#define MENUDIALOG_I(_menuname,_key,_name,_shortname,_flags,_function,_param) \
+ menuitems_i18n[no_menuitems_i18n].menuname = _menuname; \
+ menuitems_i18n[no_menuitems_i18n].shortname = _shortname; \
+ menuitems_i18n[no_menuitems_i18n].key = _key; \
+ menuitems_i18n[no_menuitems_i18n].type = MENU_DIALOG; \
+ menuitems_i18n[no_menuitems_i18n].flags = _flags; \
+ menuitems_i18n[no_menuitems_i18n].iparam = 0; \
+ menuitems_i18n[no_menuitems_i18n].name = _name; \
+ menuitems_i18n[no_menuitems_i18n].pparam = _param; \
+ menuitems_i18n[no_menuitems_i18n].function = (void (*)(void))_function; \
+ ++no_menuitems_i18n;
+
+#define MENUDIALOGCB_I(_menuname,_key,_name,_shortname,_flags,_function,_param,_check) \
+ menuitems_i18n[no_menuitems_i18n].menuname = _menuname; \
+ menuitems_i18n[no_menuitems_i18n].shortname = _shortname; \
+ menuitems_i18n[no_menuitems_i18n].key = _key; \
+ menuitems_i18n[no_menuitems_i18n].type = MENU_DIALOG; \
+ menuitems_i18n[no_menuitems_i18n].flags = (_flags)|MENUFLAG_CHECKBOX; \
+ menuitems_i18n[no_menuitems_i18n].iparam = 0; \
+ menuitems_i18n[no_menuitems_i18n].name = _name; \
+ menuitems_i18n[no_menuitems_i18n].pparam = _param; \
+ menuitems_i18n[no_menuitems_i18n].function = (void (*)(void))_function; \
+ menuitems_i18n[no_menuitems_i18n].control = (int (*)(void))_check; \
+ ++no_menuitems_i18n;
+
+#define MENUCDIALOG_I(_menuname,_key,_name,_shortname,_flags,_function,_param) \
+ menuitems_i18n[no_menuitems_i18n].menuname = _menuname; \
+ menuitems_i18n[no_menuitems_i18n].shortname = _shortname; \
+ menuitems_i18n[no_menuitems_i18n].key = _key; \
+ menuitems_i18n[no_menuitems_i18n].type = MENU_CUSTOMDIALOG; \
+ menuitems_i18n[no_menuitems_i18n].flags = _flags; \
+ menuitems_i18n[no_menuitems_i18n].iparam = 0; \
+ menuitems_i18n[no_menuitems_i18n].name = _name; \
+ menuitems_i18n[no_menuitems_i18n].pparam = NULL; \
+ menuitems_i18n[no_menuitems_i18n].control = NULL; \
+ menuitems_i18n[no_menuitems_i18n].function = (void (*)(void))_function; \
+ menuitems_i18n[no_menuitems_i18n].dialog = (CONST menudialog *(*)(struct uih_context *))_param; \
+ ++no_menuitems_i18n;
+
+#define MENUCDIALOGCB_I(_menuname,_key,_name,_shortname,_flags,_function,_param,_check)\
+ menuitems_i18n[no_menuitems_i18n].menuname = _menuname; \
+ menuitems_i18n[no_menuitems_i18n].shortname = _shortname; \
+ menuitems_i18n[no_menuitems_i18n].key = _key; \
+ menuitems_i18n[no_menuitems_i18n].type = MENU_CUSTOMDIALOG; \
+ menuitems_i18n[no_menuitems_i18n].flags = (_flags)|MENUFLAG_CHECKBOX; \
+ menuitems_i18n[no_menuitems_i18n].iparam = 0; \
+ menuitems_i18n[no_menuitems_i18n].name = _name; \
+ menuitems_i18n[no_menuitems_i18n].pparam = _param; \
+ menuitems_i18n[no_menuitems_i18n].function = (void (*)(void))_function; \
+ menuitems_i18n[no_menuitems_i18n].control = (int (*)(void))_check; \
+ menuitems_i18n[no_menuitems_i18n].dialog = (CONST menudialog *(*)(struct uih_context *))_param; \
+ ++no_menuitems_i18n;
+
+#define MENUSEPARATOR_I(_menuname) \
+ menuitems_i18n[no_menuitems_i18n].menuname = _menuname; \
+ menuitems_i18n[no_menuitems_i18n].shortname = NULL; \
+ menuitems_i18n[no_menuitems_i18n].key = 0; \
+ menuitems_i18n[no_menuitems_i18n].type = MENU_SEPARATOR; \
+ menuitems_i18n[no_menuitems_i18n].flags = 0; \
+ menuitems_i18n[no_menuitems_i18n].iparam = 0; \
+ menuitems_i18n[no_menuitems_i18n].name = ""; \
+ menuitems_i18n[no_menuitems_i18n].pparam = NULL; \
+ menuitems_i18n[no_menuitems_i18n].function = NULL; \
+ ++no_menuitems_i18n;
+
+#define SUBMENUNOOPT_I(_menuname,_key,_name,_param) \
+ menuitems_i18n[no_menuitems_i18n].menuname = _menuname; \
+ menuitems_i18n[no_menuitems_i18n].shortname = _param; \
+ menuitems_i18n[no_menuitems_i18n].key = _key; \
+ menuitems_i18n[no_menuitems_i18n].type = MENU_SUBMENU; \
+ menuitems_i18n[no_menuitems_i18n].flags = MENUFLAG_NOOPTION; \
+ menuitems_i18n[no_menuitems_i18n].iparam = 0; \
+ menuitems_i18n[no_menuitems_i18n].name = _name; \
+ menuitems_i18n[no_menuitems_i18n].pparam = NULL; \
+ menuitems_i18n[no_menuitems_i18n].function = NULL; \
+ ++no_menuitems_i18n;
+
+#define MENUSTRING_I(_menuname,_key,_name,_shortname,_flags,_function,_param) \
+ menuitems_i18n[no_menuitems_i18n].menuname = _menuname; \
+ menuitems_i18n[no_menuitems_i18n].shortname = _shortname; \
+ menuitems_i18n[no_menuitems_i18n].key = _key; \
+ menuitems_i18n[no_menuitems_i18n].type = MENU_STRING; \
+ menuitems_i18n[no_menuitems_i18n].flags = _flags; \
+ menuitems_i18n[no_menuitems_i18n].iparam = 0; \
+ menuitems_i18n[no_menuitems_i18n].name = _name; \
+ menuitems_i18n[no_menuitems_i18n].pparam = _param; \
+ menuitems_i18n[no_menuitems_i18n].function = (void (*)(void))_function; \
+ ++no_menuitems_i18n;
+
+/* End of i18n definitions. */
+
+
+#define MENUFLAG_CHECKBOX 1
+#define MENUFLAG_RADIO 2
+#define MENUFLAG_INTERRUPT 4
+#define MENUFLAG_INCALC 8
+#define MENUFLAG_NOMENU 16
+#define MENUFLAG_NOOPTION 32
+#define MENUFLAG_NOPLAY 64
+#define MENUFLAG_ATSTARTUP 128
+#define MENUFLAG_DIALOGATDISABLE 256
+
+#define NITEMS(n) (sizeof(n)/sizeof(menuitem))
+#define menu_getdialog(context, m) \
+ ((m)->type==MENU_DIALOG?(CONST menudialog *)(m)->pparam:(m)->dialog(context))
+
+ void menu_add(CONST menuitem * item, int n);
+ void menu_insert(CONST menuitem * item, CONST char *before, int n);
+ CONST menuitem *menu_findkey(CONST char *key, CONST char *root);
+ CONST menuitem *menu_findcommand(CONST char *name);
+ CONST char *menu_fullname(CONST char *menu);
+ CONST menuitem *menu_item(CONST char *menu, int n);
+ void menu_delete(CONST menuitem * items, int n);
+ int menu_enabled(CONST menuitem * item, struct uih_context *c);
+ void menu_activate(CONST menuitem * item, struct uih_context *c,
+ dialogparam * d);
+ CONST menuitem *menu_genernumbered(int n, CONST char *menuname,
+ CONST char *CONST * CONST names,
+ CONST char *keys, int type,
+ int flags,
+ void (*fint) (struct uih_context *
+ context, int),
+ int (*cint) (struct uih_context *
+ context, int),
+ CONST char *prefix);
+ void menu_delnumbered(int n, CONST char *name);
+ void menu_addqueue(CONST menuitem * item, dialogparam * d);
+ CONST menuitem *menu_delqueue(dialogparam ** d);
+ void menu_destroydialog(CONST menuitem * item, dialogparam * d,
+ struct uih_context *uih);
+ int menu_havedialog(CONST menuitem * item, struct uih_context *c);
+ int menu_available(CONST menuitem * item, CONST char *root);
+ CONST char *menu_processcommand(struct uih_context *uih, tokenfunc f,
+ int scheme, int mask,
+ CONST char *root);
+ void menu_printhelp(void);
+
+ number_t menu_getfloat(CONST char *s, CONST char **error);
+ CONST char *menu_fillparam(struct uih_context *uih, tokenfunc f,
+ CONST menudialog * d, dialogparam * p);
+ int menu_processargs(int n, int argc, char **argv);
+ void uih_xshlprintmenu(struct uih_context *c, CONST char *name);
+ void uih_xshlprintmenus(struct uih_context *c);
+ void menu_forall(struct uih_context *c,
+ void (*callback) (struct uih_context * c,
+ CONST menuitem * item));
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/src/include/xshl.h b/src/include/xshl.h
new file mode 100644
index 0000000..05631f8
--- /dev/null
+++ b/src/include/xshl.h
@@ -0,0 +1,50 @@
+#ifndef XSHL_H
+#define XSHL_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define XSHL_BIG 1
+#define XSHL_EMPH 2
+#define XSHL_WHITE 4
+#define XSHL_RED 8
+#define XSHL_BLACK 16
+#define XSHL_COLORMASK (XSHL_BLACK|XSHL_RED|XSHL_WHITE)
+#define XSHL_RIGHTALIGN 32
+#define XSHL_CENTERALIGN 64
+#define XSHL_MONOSPACE 128
+#define XSHL_LINK 256
+ struct xshl_context {
+ int flags;
+ char *linktext;
+ };
+ struct xshl_item {
+ struct xshl_context c;
+ char *text;
+ int x;
+ int width;
+ struct xshl_item *next;
+ };
+ struct xshl_line {
+ int y;
+ struct xshl_item *first;
+ };
+ extern char *xshl_error;
+ struct xshl_line *xshl_interpret(void *userdata, int (*get) (void *),
+ int width, int getwidth(void *,
+ int flags,
+ CONST char
+ *text),
+ int startflags, int smallheight,
+ int bigheight);
+ void xshl_free(struct xshl_line *);
+ int xshl_textlen(void *data, int flags, CONST char *text);
+ void xshl_print(int startskip, struct xshl_line *lines);
+ struct xshl_line *help_make(CONST char *command,
+ int getwidth(void *, int flags,
+ CONST char *text), int width,
+ int smallheight, int bigheight);
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/src/include/xthread.h b/src/include/xthread.h
new file mode 100644
index 0000000..01f210c
--- /dev/null
+++ b/src/include/xthread.h
@@ -0,0 +1,208 @@
+/*
+ * An XaoS thread API implementation
+ * Many functions are implemented as macros that maps simple
+ * XaoS thread API into architecture depended API.
+ * I tried avoid functions because of speed issues
+ * So this header will be quite messy soon :)
+ *
+ * Supported API for now:
+ * pthread (POSIX) enabled using USE_PTHREAD
+ * nothread (my own) enabled by default
+ */
+#ifndef THREAD_H
+#define THREAD_H 1
+#include <fconfig.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+#define MAXTHREADS 32
+ /*You might increase this constant if needed
+ (xaos on connection machine? :) */
+
+#define NSEMAPHORS 2
+#define MAXSEMAPHORS 2
+#define NSLEEPS 2
+#define MAXCONDS 2
+
+#ifdef USE_PTHREAD
+#include <pthread.h>
+#endif
+#ifdef __BEOS__
+#include <OS.h>
+#endif
+
+ struct taskinfo {
+ int n;
+#ifdef USE_PTHREAD
+ pthread_t id;
+#endif
+#ifdef _plan9_
+ int id;
+#endif
+#ifdef __BEOS__
+ thread_id id;
+#endif
+ };
+
+ extern struct taskinfo definfo;
+ extern int ethreads; /*Is threading enabled? */
+ extern int nthreads; /*Number of threads */
+ typedef void (*xfunction) (void *, struct taskinfo *, int, int);
+
+/*No-thread API implementation version */
+#define nothread { }
+#define nothread_init(nthreads) nothread
+#define nothread_uninit() nothread
+#define nothread_function(f,data,range) f(data,&definfo,0,range)
+#define nothread_bgjob(f,d) f(d,&definfo,0,0)
+#define nothread_lock(n) nothread
+#define nothread_unlock(n) nothread
+#define nothread_sync() nothread
+#define nothread_sleep(n,l) nothread
+#define nothread_wakeup(n) nothread
+#define nothread_wakefirst(n) nothread
+
+#define xth_wrap(f1,f2) if(nthreads!=1) f1(); else f2();
+
+#ifdef USE_PTHREAD
+/* A posix thread API maps */
+ void pth_init(int nthreads);
+ void pth_uninit(void);
+ void pth_function(xfunction f, void *d, int r);
+ void pth_synchronize(void);
+ void pth_bgjob(xfunction f, void *d);
+ extern pthread_mutex_t semaphors[MAXSEMAPHORS];
+ extern pthread_cond_t conds[MAXCONDS];
+
+/*Map pthread API to XaoS thread API */
+
+#define xth_init(nthreads) pth_init(nthreads)
+#define xth_uninit() pth_uninit()
+#define xth_lock(n) if(ethreads) pthread_mutex_lock(semaphors+(n))
+#define xth_unlock(n) if(ethreads) pthread_mutex_unlock(semaphors+(n))
+#define xth_function(f,d,r) if(ethreads) pth_function(f,d,r); else nothread_function(f,d,r)
+#define xth_nthread(ts) (ethreads?ts->n:0)
+#define xth_sync() if(ethreads) pth_synchronize();
+#define xth_bgjob(f,d) if(ethreads) pth_bgjob(f,d); else f(d,&definfo,0,0);
+#define xth_sleep(n,l) if(ethreads) pthread_cond_wait(conds+(n),semaphors+(l))
+#define xth_wakeup(n) if(ethreads) pthread_cond_broadcast(conds+(n))
+#define xth_wakefirst(n) if(ethreads) pthread_cond_signal(conds+(n))
+#define API_MAPPED
+#endif /*USE_PTHREAD */
+
+#ifdef _plan9_
+
+ struct Stack {
+ int nwaiting;
+ int tags[MAXTHREADS];
+ };
+#ifdef _plan9v2_
+#include <lock.h> /* in plan9v3 part of libc */
+#endif
+/* A plan9 thread API maps */
+ void p9wait(struct Stack *s, Lock * l);
+ void p9wakeup(struct Stack *s);
+ void p9wakeall(struct Stack *s);
+ void p9init(int nthreads);
+ void p9uninit(void);
+ void p9function(xfunction f, void *d, int r);
+ void p9synchronize(void);
+ void p9bgjob(xfunction f, void *d);
+ extern Lock semaphors[MAXSEMAPHORS];
+ extern struct Stack conds[MAXCONDS];
+
+/*Map pthread API to XaoS thread API */
+
+#define xth_init(nthreads) p9init(nthreads)
+#define xth_uninit() p9uninit()
+#define xth_lock(n) if(ethreads) lock(semaphors+(n))
+#define xth_unlock(n) if(ethreads) unlock(semaphors+(n))
+#define xth_function(f,d,r) if(ethreads) p9function(f,d,r); else nothread_function(f,d,r)
+#define xth_nthread(ts) (ethreads?ts->n:0)
+#define xth_sync() if(ethreads) p9synchronize();
+#define xth_bgjob(f,d) if(ethreads) p9bgjob(f,d); else f(d,&definfo,0,0);
+#define xth_sleep(n,l) if(ethreads) p9wait(conds+(n), semaphors+(l))
+#define xth_wakeup(n) if(ethreads) p9wakeall(conds+(n))
+#define xth_wakefirst(n) if(ethreads) p9wakeup(conds+(n))
+#define API_MAPPED
+#endif /*USE_PTHREAD */
+
+#ifdef __BEOS__
+ typedef struct {
+ int32 cnt;
+ sem_id sem;
+ } benaphore;
+
+ void acquire_benaphore(benaphore * p);
+ void release_benaphore(benaphore * p);
+#ifdef __GNUC__
+ extern
+#endif
+ inline void acquire_benaphore(benaphore * p) {
+ if (atomic_add(&(p->cnt), 1) >= 1) {
+ /* Someone was faster. */
+ while (acquire_sem(p->sem) == B_INTERRUPTED);
+ }
+ }
+#ifdef __GNUC__
+ extern
+#endif
+ inline void release_benaphore(benaphore * p) {
+ if (atomic_add(&(p->cnt), -1) > 1) {
+ /* Someone was slower. */
+ release_sem(p->sem);
+ }
+ }
+
+ extern benaphore mutexes[MAXSEMAPHORS];
+ extern benaphore condvars[MAXCONDS];
+
+ void be_thread_init(int num_threads);
+ void be_thread_uninit(void);
+ void be_thread_function(xfunction f, void *d, int r);
+ void be_thread_synchronize(void);
+ void be_thread_bgjob(xfunction f, void *d);
+ void be_thread_sleep(benaphore * pCondition, benaphore * pMutex);
+ void be_thread_wakeup(benaphore * pCondition);
+ void be_thread_wakefirst(benaphore * pCondition);
+
+/* Map BeOS API to XaoS thread API. */
+
+#define xth_init(nthreads) be_thread_init(nthreads)
+#define xth_uninit() be_thread_uninit()
+#define xth_function(f,d,r) if(ethreads) be_thread_function(f,d,r); else nothread_function(f,d,r)
+#define xth_nthread(ts) (ethreads?ts->n:0)
+#define xth_sync() if(ethreads) be_thread_synchronize();
+#define xth_bgjob(f,d) if(ethreads) be_thread_bgjob(f,d); else f(d,&definfo,0,0);
+#define xth_lock(n) if(ethreads) acquire_benaphore(mutexes+(n))
+#define xth_unlock(n) if(ethreads) release_benaphore(mutexes+(n))
+#define xth_sleep(n,l) if(ethreads) be_thread_sleep(condvars+(n),mutexes+(l))
+#define xth_wakeup(n) if(ethreads) be_thread_wakeup(condvars+(n))
+#define xth_wakefirst(n) if(ethreads) be_thread_wakefirst(condvars+(n))
+#define API_MAPPED
+#endif /* __BEOS__ */
+
+#ifndef API_MAPPED
+/*
+ * No thread support is compiled - do just wrappers
+ * to nothread implementation
+ */
+#define nthreads 1
+#define ethreads 0
+#define xth_init(n) nothread_init(n)
+#define xth_uninit() nothread_uninit()
+#define xth_function(f,d,r) nothread_function(f,d,r)
+#define xth_lock(n) nothread_lock(n)
+#define xth_unlock(n) nothread_unlock(n)
+#define xth_sync() nothread_sync()
+#define xth_bgjob(f,d) nothread_bgjob(f,d)
+#define xth_nthread(ts) 0
+#define xth_wakeup(n) nothreads_wakeup(n)
+#define xth_wakefirst(n) nothreads_wakefirst(n)
+#define xth_sleep(n,l) nothreads_sleep(n,l)
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/src/include/zoom.h b/src/include/zoom.h
new file mode 100644
index 0000000..f42eecd
--- /dev/null
+++ b/src/include/zoom.h
@@ -0,0 +1,40 @@
+/*
+ * XaoS, a fast portable realtime fractal zoomer
+ * Copyright (C) 1996,1997 by
+ *
+ * Jan Hubicka (hubicka@paru.cas.cz)
+ * Thomas Marsh (tmarsh@austin.ibm.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+#ifndef ZOOM_H
+#define ZOOM_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#define LOWQUALITY (1<<30)
+#define ZOOMMASK (LOWQUALITY|UNCOMPLETTE)
+
+ extern CONST struct filteraction zoom_filter;
+ extern struct filter cfilter;
+ extern CONST struct filteraction subwindow_filter;
+ void subwindow_setsecond(struct filter *f, struct filter *f1);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* ZOOM_H */