aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xconfigure18
-rw-r--r--configure.ac2
-rw-r--r--configure.ac.pamphlet2
-rw-r--r--src/ChangeLog93
-rw-r--r--src/graph/include/view.h1
-rw-r--r--src/graph/view2D/write2d.c4
-rw-r--r--src/graph/view3D/header.h7
-rw-r--r--src/graph/view3D/process3d.c4
-rw-r--r--src/graph/view3D/smoothShade3d.c4
-rw-r--r--src/graph/view3D/stuff3d.c4
-rw-r--r--src/graph/view3D/write3d.c4
-rw-r--r--src/hyper/Makefile.in14
-rw-r--r--src/hyper/ReadBitmap.c9
-rw-r--r--src/hyper/cond.c9
-rw-r--r--src/hyper/dialog.c35
-rw-r--r--src/hyper/display.c5
-rw-r--r--src/hyper/display.h7
-rw-r--r--src/hyper/event.c968
-rw-r--r--src/hyper/event.h12
-rw-r--r--src/hyper/extent.h19
-rw-r--r--src/hyper/extent1.c39
-rw-r--r--src/hyper/extent2.c16
-rw-r--r--src/hyper/form-ext.c10
-rw-r--r--src/hyper/group.c7
-rw-r--r--src/hyper/group.h17
-rw-r--r--src/hyper/htadd.c4
-rw-r--r--src/hyper/htinp.c20
-rw-r--r--src/hyper/hyper.c24
-rw-r--r--src/hyper/hyper.h75
-rw-r--r--src/hyper/initx.c22
-rw-r--r--src/hyper/initx.h8
-rw-r--r--src/hyper/input.c7
-rw-r--r--src/hyper/item.c25
-rw-r--r--src/hyper/keyin.c10
-rw-r--r--src/hyper/keyin.h5
-rw-r--r--src/hyper/macro.c38
-rw-r--r--src/hyper/mem.c19
-rw-r--r--src/hyper/parse-aux.c8
-rw-r--r--src/hyper/parse-input.c9
-rw-r--r--src/hyper/parse-paste.c23
-rw-r--r--src/hyper/parse-paste.h6
-rw-r--r--src/hyper/parse-types.c8
-rw-r--r--src/hyper/parse-types.h25
-rw-r--r--src/hyper/parse.c17
-rw-r--r--src/hyper/parse.h42
-rw-r--r--src/hyper/scrollbar.c11
-rw-r--r--src/hyper/scrollbar.h17
-rw-r--r--src/hyper/show-types.c15
-rw-r--r--src/hyper/spadint.c16
-rw-r--r--src/hyper/titlebar.c12
-rw-r--r--src/hyper/titlebar.h7
-rw-r--r--src/include/ReadBitmap.H16
-rw-r--r--src/include/all_hyper_proto.H126
-rw-r--r--src/include/bsdsignal.h11
-rw-r--r--src/include/cond.H16
-rw-r--r--src/include/cursor.H18
-rw-r--r--src/include/dialog.H133
-rw-r--r--src/include/display.H14
-rw-r--r--src/include/edin.H18
-rw-r--r--src/include/event.H134
-rw-r--r--src/include/extent1.H137
-rw-r--r--src/include/extent2.H123
-rw-r--r--src/include/fnct_key.H18
-rw-r--r--src/include/form_ext.H18
-rw-r--r--src/include/group.H114
-rw-r--r--src/include/halloc.h10
-rw-r--r--src/include/hash.h14
-rw-r--r--src/include/htinp.H118
-rw-r--r--src/include/hyper.H110
-rw-r--r--src/include/initx.H117
-rw-r--r--src/include/input.H111
-rw-r--r--src/include/item.H15
-rw-r--r--src/include/keyin.H12
-rw-r--r--src/include/macro.H111
-rw-r--r--src/include/mem.H132
-rw-r--r--src/include/parse.H120
-rw-r--r--src/include/parse_aux.H118
-rw-r--r--src/include/parse_input.H116
-rw-r--r--src/include/parse_paste.H16
-rw-r--r--src/include/parse_types.H125
-rw-r--r--src/include/pixmap.H14
-rw-r--r--src/include/pixmap.h53
-rw-r--r--src/include/prt.H18
-rw-r--r--src/include/rgb.h9
-rw-r--r--src/include/scrollbar.H119
-rw-r--r--src/include/show_types.H110
-rw-r--r--src/include/sockio.h9
-rw-r--r--src/include/spadcolors.H19
-rw-r--r--src/include/spadcolors.h36
-rw-r--r--src/include/spadint.H125
-rw-r--r--src/include/titlebar.H17
-rw-r--r--src/include/util.H18
-rw-r--r--src/include/wct.H18
-rw-r--r--src/lib/XSpadFill.c7
-rw-r--r--src/lib/pixmap.c7
-rw-r--r--src/lib/spadcolors.c4
96 files changed, 1256 insertions, 1191 deletions
diff --git a/configure b/configure
index 671f7e9d..f342afff 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.63 for OpenAxiom 1.4.0-2010-07-18.
+# Generated by GNU Autoconf 2.63 for OpenAxiom 1.4.0-2010-07-29.
#
# Report bugs to <open-axiom-bugs@lists.sf.net>.
#
@@ -745,8 +745,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='OpenAxiom'
PACKAGE_TARNAME='openaxiom'
-PACKAGE_VERSION='1.4.0-2010-07-18'
-PACKAGE_STRING='OpenAxiom 1.4.0-2010-07-18'
+PACKAGE_VERSION='1.4.0-2010-07-29'
+PACKAGE_STRING='OpenAxiom 1.4.0-2010-07-29'
PACKAGE_BUGREPORT='open-axiom-bugs@lists.sf.net'
ac_unique_file="src/Makefile.pamphlet"
@@ -1513,7 +1513,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures OpenAxiom 1.4.0-2010-07-18 to adapt to many kinds of systems.
+\`configure' configures OpenAxiom 1.4.0-2010-07-29 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1583,7 +1583,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of OpenAxiom 1.4.0-2010-07-18:";;
+ short | recursive ) echo "Configuration of OpenAxiom 1.4.0-2010-07-29:";;
esac
cat <<\_ACEOF
@@ -1691,7 +1691,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-OpenAxiom configure 1.4.0-2010-07-18
+OpenAxiom configure 1.4.0-2010-07-29
generated by GNU Autoconf 2.63
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1705,7 +1705,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by OpenAxiom $as_me 1.4.0-2010-07-18, which was
+It was created by OpenAxiom $as_me 1.4.0-2010-07-29, which was
generated by GNU Autoconf 2.63. Invocation command line was
$ $0 $@
@@ -21182,7 +21182,7 @@ exec 6>&1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by OpenAxiom $as_me 1.4.0-2010-07-18, which was
+This file was extended by OpenAxiom $as_me 1.4.0-2010-07-29, which was
generated by GNU Autoconf 2.63. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -21245,7 +21245,7 @@ Report bugs to <bug-autoconf@gnu.org>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_version="\\
-OpenAxiom config.status 1.4.0-2010-07-18
+OpenAxiom config.status 1.4.0-2010-07-29
configured by $0, generated by GNU Autoconf 2.63,
with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
diff --git a/configure.ac b/configure.ac
index 409df6f5..7287a7ad 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,6 @@
sinclude(config/open-axiom.m4)
sinclude(config/aclocal.m4)
-AC_INIT([OpenAxiom], [1.4.0-2010-07-18],
+AC_INIT([OpenAxiom], [1.4.0-2010-07-29],
[open-axiom-bugs@lists.sf.net])
AC_CONFIG_AUX_DIR(config)
diff --git a/configure.ac.pamphlet b/configure.ac.pamphlet
index 02c9434c..13660715 100644
--- a/configure.ac.pamphlet
+++ b/configure.ac.pamphlet
@@ -1210,7 +1210,7 @@ information:
<<Autoconf init>>=
sinclude(config/open-axiom.m4)
sinclude(config/aclocal.m4)
-AC_INIT([OpenAxiom], [1.4.0-2010-07-18],
+AC_INIT([OpenAxiom], [1.4.0-2010-07-29],
[open-axiom-bugs@lists.sf.net])
@
diff --git a/src/ChangeLog b/src/ChangeLog
index 0f1ff3d3..eb9edaff 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,98 @@
2010-07-29 Gabriel Dos Reis <gdr@cs.tamu.edu>
+ * lib/XSpadFill.c: Tidy.
+ * lib/pixmap.c: Likewise.
+ * lib/spadcolors.c: Likewise.
+ * include/ReadBitmap.H1: Remove.
+ * include/all_hyper_proto.H1: Likewise.
+ * include/cond.H1: Likewise.
+ * include/cursor.H1: Likewise.
+ * include/dialog.H1: Likewise.
+ * include/display.H1: Likewise.
+ * include/event.H1: Likewise.
+ * include/extent1.H1: Likewise.
+ * include/extent2.H1: Likewise.
+ * include/form_ext.H1: Likewise.
+ * include/group.H1: Likewise.
+ * include/htinp.H1: Likewise.
+ * include/hyper.H1: Likewise.
+ * include/initx.H1: Likewise.
+ * include/input.H1: Likewise.
+ * include/item.H1: Likewise.
+ * include/keyin.H1: Likewise.
+ * include/macro.H1: Likewise.
+ * include/mem.H1: Likewise.
+ * include/parse.H1: Likewise.
+ * include/parse_aux.H1: Likewise.
+ * include/parse_input.H1: Likewise.
+ * include/parse_paste.H1: Likewise.
+ * include/parse_types.H1: Likewise.
+ * include/scrollbar.H1: Likewise.
+ * include/show_types.H1: Likewise.
+ * include/spadcolors.H1: Likewise.
+ * include/spadint.H1: Likewise.
+ * include/titlebar.H1: Likewise.
+ * hyper/Makefile.in: Compile and Link with a C++ compiler.
+ * hyper/ReadBitmap.c: Make it acceptable to a C++ compiler.
+ * hyper/cond.c: Likewise.
+ * hyper/dialog.c: Likewise.
+ * hyper/display.c: Likewise.
+ * hyper/display.h: Likewise.
+ * hyper/event.c: Likewise.
+ * hyper/event.h: Likewise.
+ * hyper/extent.h: Likewise.
+ * hyper/extent1.c: Likewise.
+ * hyper/extent2.c: Likewise.
+ * hyper/form-ext.c: Likewise.
+ * hyper/group.c: Likewise.
+ * hyper/group.h: Likewise.
+ * hyper/htadd.c: Likewise.
+ * hyper/htinp.c: Likewise.
+ * hyper/hyper.c: Likewise.
+ * hyper/hyper.h: Likewise.
+ * hyper/initx.c: Likewise.
+ * hyper/initx.h: Likewise.
+ * hyper/input.c: Likewise.
+ * hyper/item.c: Likewise.
+ * hyper/keyin.h: Likewise.
+ * hyper/keyin.c: Likewise.
+ * hyper/macro.c: Likewise.
+ * hyper/mem.c: Likewise.
+ * hyper/parse-aux.c: Likewise.
+ * hyper/parse-input.c: Likewise.
+ * hyper/parse-paste.c: Likewise.
+ * hyper/parse-paste.h: Likewise.
+ * hyper/parse-types.h: Likewise.
+ * hyper/parse-types.c: Likewise.
+ * hyper/parse.h: Likewise.
+ * hyper/parse.c: Likewise.
+ * hyper/scrollbar.c: Likewise.
+ * hyper/scrollbar.h: Likewise.
+ * hyper/show-types.c: Likewise.
+ * hyper/spadint.c: Likewise.
+ * hyper/titlebar.c: Likewise.
+ * hyper/titlebar.h: Likewise.
+ * graph/view3D/smoothShade3d.c: Include spadcolors.h
+ * graph/view3D/stuff3d.c: Likewise.
+ * graph/include/view.h (saymem): #undef before #define.
+ * graph/view2D/write2d.c: Include pixmap.h.
+ * graph/view3D/process3d.c: Likewise.
+ * graph/view3D/write3d.c: Likewise.
+ * graph/view3D/header.h: Remove macro definition for endColor and
+ colorStep.
+ * include/bsdsignal.h: Remove.
+ * include/edin.H1: Likewise.
+ * include/fnct_key.H1: Likewise.
+ * include/halloc.h: Likewise.
+ * include/hash.h: Likewise.
+ * include/prt.H1: Likewise.
+ * include/rgb.H1: Likewise.
+ * include/sockio.h: Likewise.
+ * include/util.h: Likewise.
+ * include/pixmap.h: Rename from pixmap.H1
+
+2010-07-29 Gabriel Dos Reis <gdr@cs.tamu.edu>
+
* algebra/sf.spad.pamphlet (DoubleFloat): Use builtin
trigonometric functions.
* interp/g-opt.boot ($VMsideEffectFreeOperators): Include them.
diff --git a/src/graph/include/view.h b/src/graph/include/view.h
index 52ecf42b..5d77d46f 100644
--- a/src/graph/include/view.h
+++ b/src/graph/include/view.h
@@ -34,6 +34,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/* This file is to be included by all the viewport files */
#define check(code) checker(code,__LINE__,"")
+#undef saymem
#define saymem(a,b,c) saymemWithLine(a,b,c,__LINE__)
#define exitWithAck(ACK,ACKsize,i) \
check(write(Socket,&(ACK),sizeof(ACKsize))); exit(i);
diff --git a/src/graph/view2D/write2d.c b/src/graph/view2D/write2d.c
index 41740132..99dfe667 100644
--- a/src/graph/view2D/write2d.c
+++ b/src/graph/view2D/write2d.c
@@ -1,7 +1,7 @@
/*
Copyright (C) 1991-2002, The Numerical Algorithms Group Ltd.
All rights reserved.
- Copyright (C) 2007-2008, Gabriel Dos Reis.
+ Copyright (C) 2007-2010, Gabriel Dos Reis.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -43,7 +43,7 @@
#include "write.h"
#include "all_2d.H1"
-#include "pixmap.H1"
+#include "pixmap.h"
#include "Gfun.H1"
diff --git a/src/graph/view3D/header.h b/src/graph/view3D/header.h
index 1cb58a0d..aa6e27ec 100644
--- a/src/graph/view3D/header.h
+++ b/src/graph/view3D/header.h
@@ -1,7 +1,7 @@
/*
Copyright (C) 1991-2002, The Numerical ALgorithms Group Ltd.
All rights reserved.
- Copyright (C) 2007-2008, Gabriel Dos Reis.
+ Copyright (C) 2007-2010, Gabriel Dos Reis.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -139,6 +139,8 @@
#define totalHuesConst 27
#define hueEnd 360
+
+#undef hueStep
#define hueStep (hueEnd/totalHuesConst)
#define black BlackPixel(dsply,scrn)
@@ -146,12 +148,9 @@
#define numPlanes 1
#define numColors 10
#define startColor 0
-#define endColor (startColor+numColors)
#define maxColors (DisplayCells(dsply,scrn)-1)
#define maxPlanes (DefaultVisual((dpy),(scr))->bits_per_rgb)
-#define colorStep ((maxColors+1)/numColors)
-
/**********************************/
/*** Screen and Window Sizes */
/**********************************/
diff --git a/src/graph/view3D/process3d.c b/src/graph/view3D/process3d.c
index 1af50a8b..f8f52bdd 100644
--- a/src/graph/view3D/process3d.c
+++ b/src/graph/view3D/process3d.c
@@ -1,7 +1,7 @@
/*
Copyright (C) 1991-2002, The Numerical Algorithms Group Ltd.
All rights reserved.
- Copyright (C) 2007-2008, Gabriel Dos Reis.
+ Copyright (C) 2007-2010, Gabriel Dos Reis.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -56,7 +56,7 @@
#include "util.H1"
#include "Gfun.H1"
-#include "pixmap.H1"
+#include "pixmap.h"
#include "XShade.H1"
#include "XSpadFill.H1"
#include "all_3d.H1"
diff --git a/src/graph/view3D/smoothShade3d.c b/src/graph/view3D/smoothShade3d.c
index 81b01bcb..b8896c57 100644
--- a/src/graph/view3D/smoothShade3d.c
+++ b/src/graph/view3D/smoothShade3d.c
@@ -1,7 +1,7 @@
/*
Copyright (C) 1991-2002, The Numerical ALgorithms Group Ltd.
All rights reserved.
- Copyright (C) 2007-2008, Gabriel Dos Reis.
+ Copyright (C) 2007-2010, Gabriel Dos Reis.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -45,7 +45,7 @@
#include "volume.h"
#include "mode.h" /* for #define components */
-#include "spadcolors.H1"
+#include "spadcolors.h"
#include "Gfun.H1"
#include "util.H1"
#include "XSpadFill.H1"
diff --git a/src/graph/view3D/stuff3d.c b/src/graph/view3D/stuff3d.c
index d68b0785..ed466eb3 100644
--- a/src/graph/view3D/stuff3d.c
+++ b/src/graph/view3D/stuff3d.c
@@ -1,7 +1,7 @@
/*
Copyright (C) 1991-2002, The Numerical Algorithms Group Ltd.
All rights reserved.
- Copyright (C) 2007-2008, Gabriel Dos Reis.
+ Copyright (C) 2007-2010, Gabriel Dos Reis.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -45,7 +45,7 @@
#include "Gfun.H1"
-#include "spadcolors.H1"
+#include "spadcolors.h"
#include "util.H1"
#include "all_3d.H1"
diff --git a/src/graph/view3D/write3d.c b/src/graph/view3D/write3d.c
index caf3aab3..2007293c 100644
--- a/src/graph/view3D/write3d.c
+++ b/src/graph/view3D/write3d.c
@@ -1,7 +1,7 @@
/*
Copyright (C) 1991-2002, The Numerical Algorithms Group Ltd.
All rights reserved.
- Copyright (C) 2007-2008, Gabriel Dos Reis.
+ Copyright (C) 2007-2010, Gabriel Dos Reis.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -44,7 +44,7 @@
#include "mode.h"
-#include "pixmap.H1"
+#include "pixmap.h"
#include "XShade.H1"
#include "Gfun.H1"
diff --git a/src/hyper/Makefile.in b/src/hyper/Makefile.in
index 8b8dafa5..d690bf35 100644
--- a/src/hyper/Makefile.in
+++ b/src/hyper/Makefile.in
@@ -1,4 +1,4 @@
-# Copyright (C) 2007-2009, Gabriel Dos Reis.
+# Copyright (C) 2007-2010, Gabriel Dos Reis.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -141,7 +141,7 @@ distclean-local: clean-local
.PRECIOUS: %.lo %.$(OBJEXT)
%.$(OBJEXT) %.lo: %.c $(HEADERS)
- $(COMPILE) -o $@ $(CFLAGS) ${CCF} $(axiom_includes) $(AXIOM_X11_CFLAGS) -I. $<
+ $(CXXCOMPILE) -o $@ $(CFLAGS) ${CCF} $(axiom_includes) $(AXIOM_X11_CFLAGS) -I. $<
${HYPER}/pages/ht.db: all-hyper-pre $(srcdir)/pages/*.pht
@echo making ${HYPER}/pages from $(axiom_src_srcdir)/pages directory
@@ -169,17 +169,17 @@ ${OUTLIB}/presea: presea
cp -p $< $@ && chmod +x $@
${OUTLIB}/ex2ht$(EXEEXT): $(ex2ht_objects) $(ex2ht_DEPENDENCIES)
- ${LINK} -o $@ $(ex2ht_objects) $(ex2ht_LDADD)
+ ${CXXLINK} -o $@ $(ex2ht_objects) $(ex2ht_LDADD)
$(OUTLIB)/htadd$(EXEEXT): $(htadd_objects) $(htadd_DEPENDENCIES)
- ${LINK} -o $@ $(htadd_objects) $(htadd_LDADD)
+ ${CXXLINK} -o $@ $(htadd_objects) $(htadd_LDADD)
${OUTLIB}/hthits$(EXEEXT): $(hthits_objects) $(hthits_DEPENDENCIES)
- ${LINK} -o $@ $(hthits_objects) $(hthits_LDADD)
+ ${CXXLINK} -o $@ $(hthits_objects) $(hthits_LDADD)
$(OUTLIB)/hypertex$(EXEEXT): $(hypertex_objects) $(hypertex_DEPENDENCIES)
- ${LINK} -o $@ $(hypertex_objects) $(hypertex_LDADD)
+ ${CXXLINK} -o $@ $(hypertex_objects) $(hypertex_LDADD)
${OUTLIB}/spadbuf$(EXEEXT): $(spadbuf_objects) $(spadbuf_DEPENDENCIES)
- ${LINK} -o $@ $(spadbuf_objects) $(spadbuf_LDADD)
+ ${CXXLINK} -o $@ $(spadbuf_objects) $(spadbuf_LDADD)
diff --git a/src/hyper/ReadBitmap.c b/src/hyper/ReadBitmap.c
index 0046726f..d1ada58c 100644
--- a/src/hyper/ReadBitmap.c
+++ b/src/hyper/ReadBitmap.c
@@ -1,7 +1,7 @@
/*
Copyright (C) 1991-2002, The Numerical Algorithms Group Ltd.
All rights reserved.
- Copyright (C) 2007-2008, Gabriel Dos Reis.
+ Copyright (C) 2007-2010, Gabriel Dos Reis.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -33,17 +33,14 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#define _READBITMAP_C
-
#include "openaxiom-c-macros.h"
-
#include "debug.h"
#include "halloc.h"
#include "sockio.h"
#include "hyper.h"
-#include "all_hyper_proto.H1"
-#include "pixmap.H1"
+static int read_hot(FILE * fd , char Line[] , int * x_hot , int * y_hot);
+static int read_w_and_h(FILE * fd , unsigned int * width , unsigned int * height);
#define MAXLINE 256
diff --git a/src/hyper/cond.c b/src/hyper/cond.c
index f1930a89..1771ca02 100644
--- a/src/hyper/cond.c
+++ b/src/hyper/cond.c
@@ -1,7 +1,7 @@
/*
Copyright (C) 1991-2002, The Numerical Algorithms Group Ltd.
All rights reserved.
- Copyright (C) 2007-2008, Gabriel Dos Reis.
+ Copyright (C) 2007-2010, Gabriel Dos Reis.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -40,19 +40,16 @@
* Copyright The Numerical Algorithms Group Limited 1991, 1992, 1993.
*
****************************************************************************/
-#define _COND_C
-#include "openaxiom-c-macros.h"
+#include "openaxiom-c-macros.h"
#include "debug.h"
-
#include "sockio.h"
#include "halloc.h"
#include "lex.h"
#include "hyper.h"
-
-#include "all_hyper_proto.H1"
#include "sockio.h"
+static int check_memostack(TextNode * node);
void
insert_cond(char *label, char *cond)
diff --git a/src/hyper/dialog.c b/src/hyper/dialog.c
index 5d067a4a..36be2390 100644
--- a/src/hyper/dialog.c
+++ b/src/hyper/dialog.c
@@ -1,7 +1,7 @@
/*
Copyright (C) 1991-2002, The Numerical Algorithms Group Ltd.
All rights reserved.
- Copyright (C) 2007-2008, Gabriel Dos Reis.
+ Copyright (C) 2007-2010, Gabriel Dos Reis.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -40,6 +40,8 @@
* Copyright The Numerical Algorithms Group Limited 1991, 1992, 1993.
*
****************************************************************************/
+#include <X11/keysym.h>
+
#define _DIALOG_C
#include "openaxiom-c-macros.h"
@@ -50,14 +52,41 @@
#include "keyin.h"
#include "display.h"
#include "group.h"
+#include "event.h"
-#include <X11/keysym.h>
#define min(x,y) ( (x<y)?(x):(y))
-#include "all_hyper_proto.H1"
+static void back_over_char(InputItem * sym);
+static void back_over_eoln(InputItem * sym);
+static void clear_cursor(InputItem * sym);
+static void clear_cursorline(InputItem * sym);
+static void dec_line_numbers(LineStruct * line);
+static void decrease_line_numbers(LineStruct * line , int am);
+static void delete_char(InputItem * sym);
+static void delete_eoln(InputItem * sym);
+static int delete_one_char(InputItem * sym);
+static void delete_rest_of_line(InputItem * sym);
+static void draw_cursor(InputItem * sym);
+static void enter_new_line(InputItem * sym);
+static void inc_line_numbers(LineStruct * line);
+static void insert_buffer(char * buffer , InputItem * sym);
+static int move_back_one_char(InputItem * sym);
+static void move_cursor_backward(InputItem * sym);
+static void move_cursor_down(InputItem * sym);
+static void move_cursor_end(InputItem * sym);
+static void move_cursor_forward(InputItem * sym);
+static void move_cursor_home(InputItem * sym);
+static void move_cursor_up(InputItem * sym);
+static char move_rest_back(LineStruct * line , int size);
+static int move_sym_forward(LineStruct * line , int num , int size , InputItem * sym);
+static char * mystrncpy(char * buff1 , char * buff2 , int n);
+static void overwrite_buffer(char * buffer , InputItem * item);
+static void redraw_win(void);
+static void tough_enter(InputItem * sym);
+
static void
redraw_win()
{
diff --git a/src/hyper/display.c b/src/hyper/display.c
index e8ce034e..e7d493f6 100644
--- a/src/hyper/display.c
+++ b/src/hyper/display.c
@@ -1,7 +1,7 @@
/*
Copyright (C) 1991-2002, The Numerical Algorithms Group Ltd.
All rights reserved.
- Copyright (C) 2007-2008, Gabriel Dos Reis.
+ Copyright (C) 2007-2010, Gabriel Dos Reis.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -63,8 +63,7 @@
#include "group.h"
#include "scrollbar.h"
#include "titlebar.h"
-
-#include "all_hyper_proto.H1"
+#include "parse-types.h"
extern ItemStack *gTopOfItemStack;
diff --git a/src/hyper/display.h b/src/hyper/display.h
index 39bcf2a7..ef630f18 100644
--- a/src/hyper/display.h
+++ b/src/hyper/display.h
@@ -1,7 +1,7 @@
/*
Copyright (C) 1991-2002, The Numerical Algorithms Group Ltd.
All rights reserved.
- Copyright (C) 2007-2008, Gabriel Dos Reis.
+ Copyright (C) 2007-2010, Gabriel Dos Reis.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -38,6 +38,11 @@
#include "hyper.h"
+extern void expose_page(HyperDocPage * page);
+extern void paste_page(TextNode * node);
+extern void scroll_page(HyperDocPage * page);
+extern void show_page(HyperDocPage * page);
+
extern short int gDisplayRegion;
extern int gRegionOffset;
diff --git a/src/hyper/event.c b/src/hyper/event.c
index 80c907d3..0ba54a27 100644
--- a/src/hyper/event.c
+++ b/src/hyper/event.c
@@ -1,7 +1,7 @@
/*
Copyright (C) 1991-2002, The Numerical Algorithms Group Ltd.
All rights reserved.
- Copyright (C) 2007-2008, Gabriel Dos Reis.
+ Copyright (C) 2007-2010, Gabriel Dos Reis.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -34,12 +34,8 @@
*/
#define _EVENT_C
-#include "openaxiom-c-macros.h"
-
-#include "debug.h"
-#include "sockio.h"
-#include "hyper.h"
+#include "openaxiom-c-macros.h"
#include <X11/X.h>
#include <X11/Xatom.h>
@@ -49,6 +45,9 @@
#include <sys/types.h>
#include <sys/time.h>
+#include "debug.h"
+#include "sockio.h"
+#include "hyper.h"
#include "event.h"
#include "keyin.h"
#include "hyper.h"
@@ -59,8 +58,6 @@
#include "scrollbar.h"
#include "group.h"
#include "lex.h"
-
-#include "all_hyper_proto.H1"
#include "sockio.h"
jmp_buf env;
@@ -71,317 +68,197 @@ unsigned long bigmask= 0xffffffff;
static HyperLink *gSavedInputAreaLink = NULL;
-
-/*
- * This is the main X loop. It keeps grabbing events. Since the only way the
- * window can die is through an event, it never actually end. One of the
- * subroutines it calls is responsible for killing everything
- */
-
-void
-mainEventLoop(void)
+static int
+HyperDocErrorHandler(Display *display, XErrorEvent *xe)
{
- XEvent event;
- int Xcon;
- fd_set rd, dum1, dum2;
- motion = 0;
- gActiveWindow = -1;
- set_error_handlers();
- Xcon = ConnectionNumber(gXDisplay);
-
- while (1) {
-/* fprintf(stderr,"event:mainEventLoop: loop top\n");*/
- while (gSessionHashTable.num_entries == 0)
- pause();
+ if (xe->request_code != 15) {
+ char buf[1024];
- /* XFlush(gXDisplay); */
+ XGetErrorText(display, xe->error_code, buf, sizeof(buf));
- if (!motion)
- init_cursor_states();
- motion = 0;
+ fprintf(stderr, "error code = %d\n", xe->error_code);
+ fprintf(stderr, "major op code = %d\n", xe->request_code);
+ fprintf(stderr, "minor op code = %d\n", xe->minor_code);
+ fprintf(stderr, "XID = %ld\n", xe->resourceid);
+ fprintf(stderr, "%s\n", buf);
- if (!spad_socket == 0) {
- FD_ZERO(&rd);
- FD_ZERO(&dum1);
- FD_ZERO(&dum2);
- FD_CLR(0, &dum1);
- FD_CLR(0, &dum2);
- FD_CLR(0, &rd);
- FD_SET(spad_socket->socket, &rd);
- FD_SET(Xcon, &rd);
- if (!session_server == 0) {
- FD_SET(session_server->socket, &rd);
- }
- if (XEventsQueued(gXDisplay, QueuedAlready)) {
- XNextEvent(gXDisplay, &event);
- handle_event(&event);
- }
- else {
- select(FD_SETSIZE,(void *)&rd,(void *)&dum1,(void *)&dum2,NULL);
- if (FD_ISSET(Xcon, &rd) ||
- XEventsQueued(gXDisplay, QueuedAfterFlush)) {
- XNextEvent(gXDisplay, &event);
- handle_event(&event);
- }
- else if (FD_ISSET(spad_socket->socket, &rd))
- /*
- * Axiom Socket do what handle_event does The 100 is
- * $SpadStuff in hypertex.boot
- */
- {
- if (100 == get_int(spad_socket)) {
- set_window(gParentWindow->fMainWindow);
- make_busy_cursors();
- get_new_window();
- }
- }
- /*
- * Session Socket Telling us about the death of a spadbuf
- * (plus maybe more later) service_session_socket in
- * spadint.c
- */
- else
- if (session_server && FD_ISSET(session_server->socket, &rd)) {
- service_session_socket();
- }
- }
- }
- else {
- XNextEvent(gXDisplay, &event);
- handle_event(&event);
- }
- }
+ if (xe->request_code != 15)
+ exit(-1);
+ }
+ return(0);
}
static void
-handle_event(XEvent * event)
+set_error_handlers(void)
{
- XWindowAttributes wa;
-/* fprintf(stderr,"event:handle_event entered\n");*/
- set_window(event->xany.window);
- if (event->type == MotionNotify) {
-/* fprintf(stderr,"event:handle_event type=MotionNotify\n");*/
- handle_motion_event((XMotionEvent *)event);
- motion = 1;
- return;
- }
- make_busy_cursors();
- switch (event->type) {
- case DestroyNotify:
-/* fprintf(stderr,"event:handle_event type=DestroyNotify\n");*/
- break;
- case Expose:
-/* fprintf(stderr,"event:handle_event type=Expose\n");*/
- XGetWindowAttributes(gXDisplay, gWindow->fMainWindow, &wa);
- if ((gWindow->width == 0 && gWindow->height == 0) ||
- (wa.width != gWindow->width || wa.height != gWindow->height)) {
- gWindow->width = wa.width;
- gWindow->height = wa.height;
- display_page(gWindow->page);
- gWindow->fWindowHashTable = gWindow->page->fLinkHashTable;
- }
- else /** just redraw the thing **/
- expose_page(gWindow->page);
- XFlush(gXDisplay);
- clear_exposures(gWindow->fMainWindow);
- clear_exposures(gWindow->fScrollWindow);
- break;
- case ButtonPress:
-/* fprintf(stderr,"event:handle_event type=ButtonPress\n");*/
- handle_button(event->xbutton.button, (XButtonEvent *)event);
- XFlush(gXDisplay);
- if (gWindow) {
- while (XCheckTypedWindowEvent(gXDisplay, gWindow->fMainWindow,
- Expose, event));
- while (XCheckTypedWindowEvent(gXDisplay, gWindow->fScrollWindow,
- Expose, event));
- }
- break;
- case KeyPress:
-/* fprintf(stderr,"event:handle_event type=KeyPress\n");*/
- handle_key(event);
- if (gWindow) {
- while (XCheckTypedWindowEvent(gXDisplay, gWindow->fMainWindow,
- Expose, event));
- while (XCheckTypedWindowEvent(gXDisplay, gWindow->fScrollWindow,
- Expose, event));
- }
- break;
- case MapNotify:
-/* fprintf(stderr,"event:handle_event type=MapNotify\n");*/
- create_window();
- break;
-
- case SelectionNotify:
-/* fprintf(stderr,"event:handle_event type=SelectionNotify\n");*/
- /* this is in response to a previous request in an input area */
- if ( gSavedInputAreaLink ) {
- XSelectionEvent *pSelEvent;
- Atom dataProperty;
- pSelEvent = (XSelectionEvent *) event;
- dataProperty = XInternAtom(gXDisplay, "PASTE_SELECTION", False);
- /* change the input focus */
-
- /* change_input_focus(gSavedInputAreaLink); */
+ XSetErrorHandler(HyperDocErrorHandler);
+}
- /* try to get the selection as a window property */
+static int
+set_window(Window window)
+{
+ Window root, parent, *children, grandparent,myarg;
+ HDWindow *htw;
+ unsigned int nchildren;
+ int st;
- if ( pSelEvent->requestor == gWindow->fMainWindow &&
- pSelEvent->selection == XA_PRIMARY &&
- /* pSelEvent->time == CurrentTime && */
- pSelEvent->target == XA_STRING &&
- pSelEvent->property == dataProperty )
- {
- Atom actual_type;
- int actual_format;
- unsigned long nitems, leftover;
- char *pSelection = NULL;
+ myarg=window;
+ nchildren = 0;
+ htw = (HDWindow *) hash_find(&gSessionHashTable, (char *)&myarg);
+ if (htw != NULL) {
+ gWindow = htw;
+ return 1;
+ }
+ st = XQueryTree(gXDisplay, myarg, &root, &parent, &children, &nchildren);
+ if (st==0) goto ERROR;
+ if (nchildren > 0)
+ XFree(children);
+ htw = (HDWindow *) hash_find(&gSessionHashTable, (char *)&parent);
+ if (htw != NULL) {
+ gWindow = htw;
+ return 1;
- if (Success == XGetWindowProperty(gXDisplay,
- gWindow->fMainWindow,
- pSelEvent->property, 0L, 100000000L, True,
- AnyPropertyType, &actual_type, &actual_format,
- &nitems, &leftover, (unsigned char **) &pSelection) )
- {
- char *pBuffer;
- InputItem *item = gSavedInputAreaLink->reference.string;
+ }
+ else {
+ /* check for a grandparent */
+ st = XQueryTree(gXDisplay, parent, &root, &grandparent, &children, &nchildren);
+ if (st==0) goto ERROR;
+ if (nchildren > 0)
+ XFree(children);
+ htw = (HDWindow *) hash_find(&gSessionHashTable, (char *)&grandparent);
+ if (htw != NULL) {
+ gWindow = htw;
+ return 1;
+ }
+ }
- for (pBuffer = pSelection; *pBuffer; ++pBuffer)
- add_buffer_to_sym(pBuffer, item);
+ /*
+ * fprintf(stderr, "window(%d) and it's parent(%d) aren't in
+ * gSessionHashTable\n", window, parent);
+
+ we never found that window. this happens if (not iff) we exit from
+ an unfocused non-main window under certain wm's and click-to-type. the program returns here with
+ the window handle that was just destroyed. So let's set the global gWindow
+ to the main window.
+ */
- XFree(pSelection);
- }
- }
+ERROR:
+ gWindow=gParentWindow;
+ return 0;
+}
- /* clear the link info */
- gSavedInputAreaLink = NULL;
- }
- break;
+static HyperLink *
+findButtonInList(HDWindow * window, int x, int y)
+{
+ ButtonList *bl;
- default:
-/* fprintf(stderr,"event:handle_event type=default\n");*/
- break;
- }
+ if (!window || window->page->type == UnloadedPageType)
+ return NULL;
+ for (bl = window->page->s_button_list; bl != NULL; bl = bl->next)
+ if (x >= bl->x0 && x <= bl->x1 && y >= bl->y0 && y <= bl->y1)
+ return bl->link;
+ for (bl = window->page->button_list; bl != NULL; bl = bl->next)
+ if (x >= bl->x0 && x <= bl->x1 && y >= bl->y0 && y <= bl->y1)
+ return bl->link;
+ return NULL;
+}
+static void
+set_cursor(HDWindow *window,Cursor state)
+{
+ if (state == gBusyCursor)
+ XDefineCursor(gXDisplay, window->fMainWindow, gBusyCursor);
+ else if (state == gActiveCursor)
+ XDefineCursor(gXDisplay, window->fMainWindow, gActiveCursor);
+ else
+ XDefineCursor(gXDisplay, window->fMainWindow, gNormalCursor);
+ XFlush(gXDisplay);
}
static void
-create_window(void)
+change_cursor(Cursor state, HDWindow *window)
{
- XWindowAttributes wa;
+ if (window->fDisplayedCursor == state)
+ return;
+ window->fDisplayedCursor = state;
+ set_cursor(window, state);
+}
- XGetWindowAttributes(gXDisplay, gWindow->fMainWindow, &wa);
- gWindow->width = wa.width;
- gWindow->height = wa.height;
- display_page(gWindow->page);
- gWindow->fWindowHashTable = gWindow->page->fLinkHashTable;
+static void
+make_busy_cursor(HDWindow *window)
+{
+ change_cursor(gBusyCursor, window);
+}
- /* then select for the events I normally would like to catch */
- XSelectInput(gXDisplay, gWindow->fMainWindow, ButtonPress | KeyPressMask |
- PointerMotionMask |
- ExposureMask /* | EnterWindowMask | LeaveWindowMask */ );
- XSelectInput(gXDisplay, gWindow->fScrollWindow, ExposureMask);
+static void
+make_busy_cursors(void)
+{
+ hash_map(&gSessionHashTable, (MappableFunction)make_busy_cursor);
+}
+static void
+handle_motion_event(XMotionEvent *event)
+{
+ if (!gWindow)
+ return;
+ if (findButtonInList(gWindow, event->x, event->y) != NULL)
+ change_cursor(gActiveCursor, gWindow);
+ else
+ change_cursor(gNormalCursor, gWindow);
}
+
/*
- * This routine is called when the quitbutton is hit. For the moment I am
- * just going to leave it all behind
+ * This procedure whips thru the stack and clears all expose events for the
+ * given routine
*/
-
-void
-quitHyperDoc(void)
+static void
+clear_exposures(Window w)
{
- HyperDocPage *page;
+ XEvent report;
- if (gSessionHashTable.num_entries == 1 || gParentWindow == gWindow) {
- if (!strcmp(gWindow->page->name, "ProtectedQuitPage")){
- exitHyperDoc();
- }
- page = (HyperDocPage *) hash_find(gWindow->fPageHashTable, "ProtectedQuitPage");
- if (page == NULL) {
- fprintf(stderr, "Unknown page name %s\n", "ProtectedQuitPage");
- exitHyperDoc();
- return;
- }
- if (gWindow->fDownLinkStackIndex == MaxDownlinkDepth)
- fprintf(stderr, "exceeded maximum link nesting level\n");
- else
- gWindow->fDownLinkStack[gWindow->fDownLinkStackIndex++] = gWindow->page;
- gWindow->page = page;
- display_page(gWindow->page);
- gWindow->fWindowHashTable = gWindow->page->fLinkHashTable;
- }
- else
- exitHyperDoc();
+ XFlush(gXDisplay);
+ while (XCheckTypedWindowEvent(gXDisplay, w, Expose, &report));
}
+static HyperLink *
+get_hyper_link(XButtonEvent * event)
+{
+ HyperLink *l1, *l2;
+
+ l1 = (HyperLink *) hash_find(gWindow->fWindowHashTable, (char *)&(event->window));
+ if (l1)
+ return l1;
+ l2 = findButtonInList(gWindow, event->x, event->y);
+ return l2;
+}
-/*
- * find_page takes as an argument the HyperDoc for a page name and returns
- * the associated page
- */
static HyperDocPage *
-find_page(TextNode * node)
+paste_button(PasteNode * paste)
{
- char *page_name;
- HyperDocPage *page;
+ HyperDocPage *page = NULL;
+ int pastewhere=paste->where;
- /* try and find the page name */
- page_name = print_to_string(node);
- page = (HyperDocPage *) hash_find(gWindow->fPageHashTable, page_name);
- if (page == NULL) {
- /* try to find the unknown page */
- page = (HyperDocPage *) hash_find(gWindow->fPageHashTable, "UnknownPage");
- if (page == NULL) {
- /* Yikes, Even that could not be found */
- fprintf(stderr, "Unknown page name %s\n", page_name);
- }
- else {
- if (page->type == UnloadedPageType)
- page->type = UlUnknownPage;
- else
- page->type = UnknownPage;
+ if ( paste->end_node ==NULL || paste->begin_node==NULL || paste->arg_node==NULL ){
+ BeepAtTheUser();
+ return NULL;
}
- }
- return page;
-}
-
-/*
- * These are macros for taking care of the downlink stack, and the memolink
- * stack.
- */
-
-#define NotSpecial(t) \
- ((t == openaxiom_Quitbutton_token || t == openaxiom_Returnbutton_token \
- || t == openaxiom_Upbutton_token || t == UnknownPage \
- || t == UlUnknownPage || t == ErrorPage) \
- ?(0):(1))
-/* pushes a page onto the down link stack */
+ page=parse_patch(paste);
+/* paste has changed after this call so use pastewhere*/
-static void
-downlink(void)
-{
- if (gWindow->fDownLinkStackIndex == MaxDownlinkDepth)
- fprintf(stderr, "exceeded maximum link nesting level\n");
+ if (pastewhere && page ) {
+ if (0 == strcmp(page->name, "ErrorPage"))
+ page = NULL;
+ }
else
- gWindow->fDownLinkStack[gWindow->fDownLinkStackIndex++] = gWindow->page;
-}
+ BeepAtTheUser();
-static void
-memolink(void)
-{
- if (gWindow->fMemoStackIndex == MaxMemoDepth)
- fprintf(stderr, "exceeded maximum link nesting level\n");
- else {
- gWindow->fMemoStack[gWindow->fMemoStackIndex] = gWindow->page;
- gWindow->fDownLinkStackTop[gWindow->fMemoStackIndex++] = gWindow->fDownLinkStackIndex;
- }
+ return page;
}
static void
@@ -442,6 +319,60 @@ uplink(void)
}
}
+/*
+ * find_page takes as an argument the HyperDoc for a page name and returns
+ * the associated page
+ */
+
+static HyperDocPage *
+find_page(TextNode * node)
+{
+ char *page_name;
+ HyperDocPage *page;
+
+ /* try and find the page name */
+ page_name = print_to_string(node);
+ page = (HyperDocPage *) hash_find(gWindow->fPageHashTable, page_name);
+
+ if (page == NULL) {
+ /* try to find the unknown page */
+ page = (HyperDocPage *) hash_find(gWindow->fPageHashTable, "UnknownPage");
+ if (page == NULL) {
+ /* Yikes, Even that could not be found */
+ fprintf(stderr, "Unknown page name %s\n", page_name);
+ }
+ else {
+ if (page->type == UnloadedPageType)
+ page->type = UlUnknownPage;
+ else
+ page->type = UnknownPage;
+ }
+ }
+ return page;
+}
+
+/* pushes a page onto the down link stack */
+
+static void
+downlink(void)
+{
+ if (gWindow->fDownLinkStackIndex == MaxDownlinkDepth)
+ fprintf(stderr, "exceeded maximum link nesting level\n");
+ else
+ gWindow->fDownLinkStack[gWindow->fDownLinkStackIndex++] = gWindow->page;
+}
+
+static void
+memolink(void)
+{
+ if (gWindow->fMemoStackIndex == MaxMemoDepth)
+ fprintf(stderr, "exceeded maximum link nesting level\n");
+ else {
+ gWindow->fMemoStack[gWindow->fMemoStackIndex] = gWindow->page;
+ gWindow->fDownLinkStackTop[gWindow->fMemoStackIndex++] = gWindow->fDownLinkStackIndex;
+ }
+}
+
static void
windowlink_handler(TextNode * node)
{
@@ -456,14 +387,6 @@ windowlink_handler(TextNode * node)
/* gWindow->fWindowHashTable = gWindow->page->fLinkHashTable;*/
}
-void
-make_window_link(char *name)
-{
- if (init_top_window(name) != -1)
-{}/* gWindow->fWindowHashTable = gWindow->page->fLinkHashTable; */
-}
-
-
static void
lispwindowlink_handler(HyperLink * link)
{
@@ -484,86 +407,36 @@ lispwindowlink_handler(HyperLink * link)
}
}
-static HyperDocPage *
-paste_button(PasteNode * paste)
-{
- HyperDocPage *page = NULL;
- int pastewhere=paste->where;
-
-
- if ( paste->end_node ==NULL || paste->begin_node==NULL || paste->arg_node==NULL ){
- BeepAtTheUser();
- return NULL;
- }
-
- page=parse_patch(paste);
-/* paste has changed after this call so use pastewhere*/
-
- if (pastewhere && page ) {
- if (0 == strcmp(page->name, "ErrorPage"))
- page = NULL;
- }
- else
- BeepAtTheUser();
-
- return page;
-}
-
-void
-helpForHyperDoc(void)
+static void
+create_window(void)
{
- HyperDocPage *page = NULL;
-
- /* do not do anything if we are already at the "no more help" page */
-
- if (0 == strcmp(gWindow->page->name, NoMoreHelpPage))
- return;
-
- /* if no help page recorded, use the standard "no more help" page */
-
- if (!gWindow->page->helppage)
- gWindow->page->helppage = alloc_string(NoMoreHelpPage);
-
- /* if we are on the main help page, use "no more help" page */
-
- if (0 == strcmp(gWindow->page->name, TopLevelHelpPage))
- gWindow->page->helppage = alloc_string(NoMoreHelpPage);
+ XWindowAttributes wa;
- page = (HyperDocPage *) hash_find(gWindow->fPageHashTable, gWindow->page->helppage);
+ XGetWindowAttributes(gXDisplay, gWindow->fMainWindow, &wa);
- if (page)
- make_window_link(gWindow->page->helppage);
- else
- BeepAtTheUser();
-}
+ gWindow->width = wa.width;
+ gWindow->height = wa.height;
+ display_page(gWindow->page);
+ gWindow->fWindowHashTable = gWindow->page->fLinkHashTable;
-static HyperLink *
-findButtonInList(HDWindow * window, int x, int y)
-{
- ButtonList *bl;
+ /* then select for the events I normally would like to catch */
+ XSelectInput(gXDisplay, gWindow->fMainWindow, ButtonPress | KeyPressMask |
+ PointerMotionMask |
+ ExposureMask /* | EnterWindowMask | LeaveWindowMask */ );
+ XSelectInput(gXDisplay, gWindow->fScrollWindow, ExposureMask);
- if (!window || window->page->type == UnloadedPageType)
- return NULL;
- for (bl = window->page->s_button_list; bl != NULL; bl = bl->next)
- if (x >= bl->x0 && x <= bl->x1 && y >= bl->y0 && y <= bl->y1)
- return bl->link;
- for (bl = window->page->button_list; bl != NULL; bl = bl->next)
- if (x >= bl->x0 && x <= bl->x1 && y >= bl->y0 && y <= bl->y1)
- return bl->link;
- return NULL;
}
-static HyperLink *
-get_hyper_link(XButtonEvent * event)
-{
- HyperLink *l1, *l2;
+/*
+ * These are macros for taking care of the downlink stack, and the memolink
+ * stack.
+ */
- l1 = (HyperLink *) hash_find(gWindow->fWindowHashTable, (char *)&(event->window));
- if (l1)
- return l1;
- l2 = findButtonInList(gWindow, event->x, event->y);
- return l2;
-}
+#define NotSpecial(t) \
+ ((t == openaxiom_Quitbutton_token || t == openaxiom_Returnbutton_token \
+ || t == openaxiom_Upbutton_token || t == UnknownPage \
+ || t == UlUnknownPage || t == ErrorPage) \
+ ?(0):(1))
/*
* Handle a button pressed event. window is the subwindow in which the event
@@ -736,6 +609,190 @@ handle_button(int button, XButtonEvent * event)
}
+static void
+handle_event(XEvent * event)
+{
+ XWindowAttributes wa;
+/* fprintf(stderr,"event:handle_event entered\n");*/
+ set_window(event->xany.window);
+ if (event->type == MotionNotify) {
+/* fprintf(stderr,"event:handle_event type=MotionNotify\n");*/
+ handle_motion_event((XMotionEvent *)event);
+ motion = 1;
+ return;
+ }
+ make_busy_cursors();
+ switch (event->type) {
+ case DestroyNotify:
+/* fprintf(stderr,"event:handle_event type=DestroyNotify\n");*/
+ break;
+ case Expose:
+/* fprintf(stderr,"event:handle_event type=Expose\n");*/
+ XGetWindowAttributes(gXDisplay, gWindow->fMainWindow, &wa);
+ if ((gWindow->width == 0 && gWindow->height == 0) ||
+ (wa.width != gWindow->width || wa.height != gWindow->height)) {
+ gWindow->width = wa.width;
+ gWindow->height = wa.height;
+ display_page(gWindow->page);
+ gWindow->fWindowHashTable = gWindow->page->fLinkHashTable;
+ }
+ else /** just redraw the thing **/
+ expose_page(gWindow->page);
+ XFlush(gXDisplay);
+ clear_exposures(gWindow->fMainWindow);
+ clear_exposures(gWindow->fScrollWindow);
+ break;
+ case ButtonPress:
+/* fprintf(stderr,"event:handle_event type=ButtonPress\n");*/
+ handle_button(event->xbutton.button, (XButtonEvent *)event);
+ XFlush(gXDisplay);
+ if (gWindow) {
+ while (XCheckTypedWindowEvent(gXDisplay, gWindow->fMainWindow,
+ Expose, event));
+ while (XCheckTypedWindowEvent(gXDisplay, gWindow->fScrollWindow,
+ Expose, event));
+ }
+ break;
+ case KeyPress:
+/* fprintf(stderr,"event:handle_event type=KeyPress\n");*/
+ handle_key(event);
+ if (gWindow) {
+ while (XCheckTypedWindowEvent(gXDisplay, gWindow->fMainWindow,
+ Expose, event));
+ while (XCheckTypedWindowEvent(gXDisplay, gWindow->fScrollWindow,
+ Expose, event));
+ }
+ break;
+ case MapNotify:
+/* fprintf(stderr,"event:handle_event type=MapNotify\n");*/
+ create_window();
+ break;
+
+ case SelectionNotify:
+/* fprintf(stderr,"event:handle_event type=SelectionNotify\n");*/
+ /* this is in response to a previous request in an input area */
+ if ( gSavedInputAreaLink ) {
+ XSelectionEvent *pSelEvent;
+ Atom dataProperty;
+ pSelEvent = (XSelectionEvent *) event;
+ dataProperty = XInternAtom(gXDisplay, "PASTE_SELECTION", False);
+ /* change the input focus */
+
+ /* change_input_focus(gSavedInputAreaLink); */
+
+ /* try to get the selection as a window property */
+
+ if ( pSelEvent->requestor == gWindow->fMainWindow &&
+ pSelEvent->selection == XA_PRIMARY &&
+ /* pSelEvent->time == CurrentTime && */
+ pSelEvent->target == XA_STRING &&
+ pSelEvent->property == dataProperty )
+ {
+ Atom actual_type;
+ int actual_format;
+ unsigned long nitems, leftover;
+ char *pSelection = NULL;
+
+ if (Success == XGetWindowProperty(gXDisplay,
+ gWindow->fMainWindow,
+ pSelEvent->property, 0L, 100000000L, True,
+ AnyPropertyType, &actual_type, &actual_format,
+ &nitems, &leftover, (unsigned char **) &pSelection) )
+ {
+ char *pBuffer;
+ InputItem *item = gSavedInputAreaLink->reference.string;
+
+ for (pBuffer = pSelection; *pBuffer; ++pBuffer)
+ add_buffer_to_sym(pBuffer, item);
+
+ XFree(pSelection);
+ }
+ }
+
+ /* clear the link info */
+
+ gSavedInputAreaLink = NULL;
+ }
+ break;
+
+ default:
+/* fprintf(stderr,"event:handle_event type=default\n");*/
+ break;
+ }
+
+}
+
+/*
+ * This routine is called when the quitbutton is hit. For the moment I am
+ * just going to leave it all behind
+ */
+
+void
+quitHyperDoc(void)
+{
+ HyperDocPage *page;
+
+ if (gSessionHashTable.num_entries == 1 || gParentWindow == gWindow) {
+ if (!strcmp(gWindow->page->name, "ProtectedQuitPage")){
+ exitHyperDoc();
+ }
+ page = (HyperDocPage *) hash_find(gWindow->fPageHashTable, "ProtectedQuitPage");
+ if (page == NULL) {
+ fprintf(stderr, "Unknown page name %s\n", "ProtectedQuitPage");
+ exitHyperDoc();
+ return;
+ }
+ if (gWindow->fDownLinkStackIndex == MaxDownlinkDepth)
+ fprintf(stderr, "exceeded maximum link nesting level\n");
+ else
+ gWindow->fDownLinkStack[gWindow->fDownLinkStackIndex++] = gWindow->page;
+ gWindow->page = page;
+ display_page(gWindow->page);
+ gWindow->fWindowHashTable = gWindow->page->fLinkHashTable;
+ }
+ else
+ exitHyperDoc();
+}
+
+
+
+void
+make_window_link(char *name)
+{
+ if (init_top_window(name) != -1)
+{}/* gWindow->fWindowHashTable = gWindow->page->fLinkHashTable; */
+}
+
+
+void
+helpForHyperDoc(void)
+{
+ HyperDocPage *page = NULL;
+
+ /* do not do anything if we are already at the "no more help" page */
+
+ if (0 == strcmp(gWindow->page->name, NoMoreHelpPage))
+ return;
+
+ /* if no help page recorded, use the standard "no more help" page */
+
+ if (!gWindow->page->helppage)
+ gWindow->page->helppage = alloc_string(NoMoreHelpPage);
+
+ /* if we are on the main help page, use "no more help" page */
+
+ if (0 == strcmp(gWindow->page->name, TopLevelHelpPage))
+ gWindow->page->helppage = alloc_string(NoMoreHelpPage);
+
+ page = (HyperDocPage *) hash_find(gWindow->fPageHashTable, gWindow->page->helppage);
+
+ if (page)
+ make_window_link(gWindow->page->helppage);
+ else
+ BeepAtTheUser();
+}
+
+
void
exitHyperDoc(void)
{
@@ -776,71 +833,6 @@ exitHyperDoc(void)
XFlush(gXDisplay);
}
-static int
-set_window(Window window)
-{
- Window root, parent, *children, grandparent,myarg;
- HDWindow *htw;
- unsigned int nchildren;
- int st;
-
- myarg=window;
- nchildren = 0;
- htw = (HDWindow *) hash_find(&gSessionHashTable, (char *)&myarg);
- if (htw != NULL) {
- gWindow = htw;
- return 1;
- }
- st = XQueryTree(gXDisplay, myarg, &root, &parent, &children, &nchildren);
- if (st==0) goto ERROR;
- if (nchildren > 0)
- XFree(children);
- htw = (HDWindow *) hash_find(&gSessionHashTable, (char *)&parent);
- if (htw != NULL) {
- gWindow = htw;
- return 1;
-
- }
- else {
- /* check for a grandparent */
- st = XQueryTree(gXDisplay, parent, &root, &grandparent, &children, &nchildren);
- if (st==0) goto ERROR;
- if (nchildren > 0)
- XFree(children);
- htw = (HDWindow *) hash_find(&gSessionHashTable, (char *)&grandparent);
- if (htw != NULL) {
- gWindow = htw;
- return 1;
- }
- }
-
- /*
- * fprintf(stderr, "window(%d) and it's parent(%d) aren't in
- * gSessionHashTable\n", window, parent);
-
- we never found that window. this happens if (not iff) we exit from
- an unfocused non-main window under certain wm's and click-to-type. the program returns here with
- the window handle that was just destroyed. So let's set the global gWindow
- to the main window.
- */
-
-ERROR:
- gWindow=gParentWindow;
- return 0;
-}
-
-/*
- * This procedure whips thru the stack and clears all expose events for the
- * given routine
- */
-static void
-clear_exposures(Window w)
-{
- XEvent report;
-
- XFlush(gXDisplay);
- while (XCheckTypedWindowEvent(gXDisplay, w, Expose, &report));
-}
void
get_new_window(void)
{
@@ -963,37 +955,6 @@ get_new_window(void)
}
break;
}
- }
-static void
-set_cursor(HDWindow *window,Cursor state)
-{
- if (state == gBusyCursor)
- XDefineCursor(gXDisplay, window->fMainWindow, gBusyCursor);
- else if (state == gActiveCursor)
- XDefineCursor(gXDisplay, window->fMainWindow, gActiveCursor);
- else
- XDefineCursor(gXDisplay, window->fMainWindow, gNormalCursor);
- XFlush(gXDisplay);
-}
-
-static void
-change_cursor(Cursor state, HDWindow *window)
-{
- if (window->fDisplayedCursor == state)
- return;
- window->fDisplayedCursor = state;
- set_cursor(window, state);
-}
-
-static void
-handle_motion_event(XMotionEvent *event)
-{
- if (!gWindow)
- return;
- if (findButtonInList(gWindow, event->x, event->y) != NULL)
- change_cursor(gActiveCursor, gWindow);
- else
- change_cursor(gNormalCursor, gWindow);
}
static void
@@ -1019,42 +980,83 @@ init_cursor_states(void)
}
-static void
-make_busy_cursor(HDWindow *window)
-{
- change_cursor(gBusyCursor, window);
-}
-
-static void
-make_busy_cursors(void)
-{
- hash_map(&gSessionHashTable, (MappableFunction)make_busy_cursor);
-}
+/*
+ * This is the main X loop. It keeps grabbing events. Since the only way the
+ * window can die is through an event, it never actually end. One of the
+ * subroutines it calls is responsible for killing everything
+ */
-static int
-HyperDocErrorHandler(Display *display, XErrorEvent *xe)
+void
+mainEventLoop(void)
{
- if (xe->request_code != 15) {
- char buf[1024];
-
- XGetErrorText(display, xe->error_code, buf, sizeof(buf));
-
- fprintf(stderr, "error code = %d\n", xe->error_code);
- fprintf(stderr, "major op code = %d\n", xe->request_code);
- fprintf(stderr, "minor op code = %d\n", xe->minor_code);
- fprintf(stderr, "XID = %ld\n", xe->resourceid);
- fprintf(stderr, "%s\n", buf);
+ XEvent event;
+ int Xcon;
+ fd_set rd, dum1, dum2;
+ motion = 0;
+ gActiveWindow = -1;
+ set_error_handlers();
+ Xcon = ConnectionNumber(gXDisplay);
- if (xe->request_code != 15)
- exit(-1);
- }
- return(0);
-}
+ while (1) {
+/* fprintf(stderr,"event:mainEventLoop: loop top\n");*/
+ while (gSessionHashTable.num_entries == 0)
+ pause();
+ /* XFlush(gXDisplay); */
+ if (!motion)
+ init_cursor_states();
+ motion = 0;
-static void
-set_error_handlers(void)
-{
- XSetErrorHandler(HyperDocErrorHandler);
+ if (!spad_socket == 0) {
+ FD_ZERO(&rd);
+ FD_ZERO(&dum1);
+ FD_ZERO(&dum2);
+ FD_CLR(0, &dum1);
+ FD_CLR(0, &dum2);
+ FD_CLR(0, &rd);
+ FD_SET(spad_socket->socket, &rd);
+ FD_SET(Xcon, &rd);
+ if (!session_server == 0) {
+ FD_SET(session_server->socket, &rd);
+ }
+ if (XEventsQueued(gXDisplay, QueuedAlready)) {
+ XNextEvent(gXDisplay, &event);
+ handle_event(&event);
+ }
+ else {
+ select(FD_SETSIZE, &rd, &dum1, &dum2, NULL);
+ if (FD_ISSET(Xcon, &rd) ||
+ XEventsQueued(gXDisplay, QueuedAfterFlush)) {
+ XNextEvent(gXDisplay, &event);
+ handle_event(&event);
+ }
+ else if (FD_ISSET(spad_socket->socket, &rd))
+ /*
+ * Axiom Socket do what handle_event does The 100 is
+ * $SpadStuff in hypertex.boot
+ */
+ {
+ if (100 == get_int(spad_socket)) {
+ set_window(gParentWindow->fMainWindow);
+ make_busy_cursors();
+ get_new_window();
+ }
+ }
+ /*
+ * Session Socket Telling us about the death of a spadbuf
+ * (plus maybe more later) service_session_socket in
+ * spadint.c
+ */
+ else
+ if (session_server && FD_ISSET(session_server->socket, &rd)) {
+ service_session_socket();
+ }
+ }
+ }
+ else {
+ XNextEvent(gXDisplay, &event);
+ handle_event(&event);
+ }
+ }
}
diff --git a/src/hyper/event.h b/src/hyper/event.h
index 517fc3ea..5a4971f0 100644
--- a/src/hyper/event.h
+++ b/src/hyper/event.h
@@ -1,7 +1,7 @@
/*
Copyright (C) 1991-2002, The Numerical Algorithms Group Ltd.
All rights reserved.
- Copyright (C) 2007-2008, Gabriel Dos Reis.
+ Copyright (C) 2007-2010, Gabriel Dos Reis.
All rights reserbed.
Redistribution and use in source and binary forms, with or without
@@ -38,6 +38,16 @@
#include "hyper.h"
+extern void sigusr2_handler(int sig);
+extern void sigcld_handler(int sig);
+extern void clean_socket(void);
+extern void init_page_structs(HDWindow * w);
+extern void helpForHyperDoc(void);
+extern void quitHyperDoc(void);
+extern void exitHyperDoc(void);
+extern void mainEventLoop(void);
+extern void make_window_link(char*);
+
extern Window gActiveWindow;
extern int gNeedIconName;
diff --git a/src/hyper/extent.h b/src/hyper/extent.h
index 5ef24361..efc9ece4 100644
--- a/src/hyper/extent.h
+++ b/src/hyper/extent.h
@@ -1,7 +1,7 @@
/*
Copyright (C) 1991-2002, The Numerical Algorithms Group Ltd.
All rights reserved.
- Copyright (C) 2007-2008, Gabriel Dos Reis.
+ Copyright (C) 2007-2010, Gabriel Dos Reis.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -68,6 +68,23 @@
#define dash_width 5
#define dash_y 4
+extern void compute_header_extent(HyperDocPage * page);
+extern void compute_footer_extent(HyperDocPage * page);
+extern void compute_scrolling_extent(HyperDocPage * page);
+extern void compute_title_extent(HyperDocPage * page);
+extern void compute_text_extent(TextNode * node);
+extern void init_extents(void );
+extern void init_text(void );
+extern void init_title_extents(HyperDocPage * page);
+extern void insert_bitmap_file(TextNode * node);
+extern void insert_pixmap_file(TextNode * node);
+extern int max_x(TextNode * node , int Ender);
+extern int plh(int height);
+extern void start_newline(int distance , TextNode * node);
+extern int text_height(TextNode * node , int Ender);
+extern int text_width(TextNode * node , int Ender);
+extern int total_width(TextNode * node , int Ender);
+extern int trailing_space(TextNode * node);
/* next two from display.h. Reorg! */
diff --git a/src/hyper/extent1.c b/src/hyper/extent1.c
index 0c92fbb4..0642957c 100644
--- a/src/hyper/extent1.c
+++ b/src/hyper/extent1.c
@@ -1,7 +1,7 @@
/*
Copyright (C) 1991-2002, The Numerical Algorithms Group Ltd.
All rights reserved.
- Copyright (C) 2007-2008, Gabriel Dos Reis.
+ Copyright (C) 2007-2010, Gabriel Dos Reis.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -40,12 +40,9 @@
* Copyright The Numerical Algorithms Group Limited 1991, 1992, 1993.
*
****************************************************************************/
-#define _EXTENT1_C
-#include "openaxiom-c-macros.h"
+#include "openaxiom-c-macros.h"
#include "debug.h"
-
-
#include "sockio.h"
#include "extent.h"
#include "hyper.h"
@@ -53,8 +50,36 @@
#include "titlebar.h"
#include "scrollbar.h"
-#include "all_hyper_proto.H1"
-
+static void compute_begin_items_extent(TextNode * node);
+static void compute_bf_extent(TextNode * node);
+static void compute_box_extent(TextNode * node);
+static void compute_button_extent(TextNode * node);
+static void compute_center_extent(TextNode * node);
+static void compute_dash_extent(TextNode * node);
+static void compute_em_extent(TextNode * node);
+static void compute_ifcond_extent(TextNode * node);
+static void compute_image_extent(TextNode * node);
+static void compute_input_extent(TextNode * node);
+static void compute_ir_extent(TextNode * node);
+static void compute_it_extent(TextNode * node);
+static void compute_item_extent(TextNode * node);
+static void compute_mbox_extent(TextNode * node);
+static void compute_mitem_extent(TextNode * node);
+static void compute_paste_extent(TextNode * node);
+static void compute_pastebutton_extent(TextNode * node);
+static void compute_punctuation_extent(TextNode * node);
+static void compute_rm_extent(TextNode * node);
+static void compute_spadcommand_extent(TextNode * node);
+static void compute_spadsrc_extent(TextNode * node);
+static void compute_spadsrctxt_extent(TextNode * node);
+static void compute_table_extent(TextNode * * node);
+static void compute_verbatim_extent(TextNode * node);
+static void compute_word_extent(TextNode * node);
+static void end_spadcommand_extent(TextNode * node);
+static void end_spadsrc_extent(TextNode * node);
+static void endbutton_extent(TextNode * node);
+static void endif_extent(TextNode * node);
+static void endpastebutton_extent(TextNode * node);
/*
* Now we declare all the values which are shared among the extent routines
diff --git a/src/hyper/extent2.c b/src/hyper/extent2.c
index 4cac2fe8..56c37777 100644
--- a/src/hyper/extent2.c
+++ b/src/hyper/extent2.c
@@ -1,7 +1,7 @@
/*
Copyright (C) 1991-2002, The Numerical Algorithms Group Ltd.
All rights reserved.
- Copyright (C) 2007-2008, Gabriel Dos Reis.
+ Copyright (C) 2007-2010, Gabriel Dos Reis.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -41,21 +41,23 @@
*
****************************************************************************/
-#define _EXTENT2_C
#include "openaxiom-c-macros.h"
-
#include "debug.h"
-
#include "halloc.h"
#include "sockio.h"
#include "extent.h"
#include "group.h"
#include "titlebar.h"
-
-#include "all_hyper_proto.H1"
-#include "pixmap.H1"
#include "cfuns.h"
+static void center_nodes(TextNode * begin_node , TextNode * end_node);
+static int input_string_width(TextNode * node);
+static int punctuation_width(TextNode * node);
+static int text_height1(TextNode * node , int Ender);
+static int verbatim_width(TextNode * node);
+static int width_of_dash(TextNode * node);
+static int word_width(TextNode * node);
+static int x_value(TextNode * node);
static int cur_height = 0;
static int max_x_value = 0;
diff --git a/src/hyper/form-ext.c b/src/hyper/form-ext.c
index edfffe9f..93d8d0b0 100644
--- a/src/hyper/form-ext.c
+++ b/src/hyper/form-ext.c
@@ -1,7 +1,7 @@
/*
Copyright (C) 1991-2002, The Numerical Algorithms Group Ltd.
All rights reserved.
- Copyright (C) 2007-2008, Gabriel Dos Reis.
+ Copyright (C) 2007-2010, Gabriel Dos Reis.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -33,18 +33,18 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#define _FORM_EXT_C
#include "openaxiom-c-macros.h"
-
#include "debug.h"
-
#include "sockio.h"
#include "extent.h"
#include "group.h"
#include "scrollbar.h"
-#include "all_hyper_proto.H1"
+static int window_height(HyperDocPage * page);
+static void form_header_extent(HyperDocPage * page);
+static void form_footer_extent(HyperDocPage * page);
+static void form_scrolling_extent(HyperDocPage * page);
/*
diff --git a/src/hyper/group.c b/src/hyper/group.c
index f1f69f84..c7a53240 100644
--- a/src/hyper/group.c
+++ b/src/hyper/group.c
@@ -1,7 +1,7 @@
/*
Copyright (C) 1991-2002, The Numerical Algorithms Group Ltd.
All rights reserved.
- Copyright (C) 2007-2008, Gabriel Dos Reis.
+ Copyright (C) 2007-2010, Gabriel Dos Reis.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -41,17 +41,12 @@
*
****************************************************************************/
-#define _GROUP_C
-
#include "debug.h"
-
#include "halloc.h"
#include "sockio.h"
#include "group.h"
#include "initx.h"
-#include "all_hyper_proto.H1"
-
GroupItem *gTopOfGroupStack = NULL;
diff --git a/src/hyper/group.h b/src/hyper/group.h
index 4bf52264..7253cd83 100644
--- a/src/hyper/group.h
+++ b/src/hyper/group.h
@@ -1,7 +1,7 @@
/*
Copyright (C) 1991-2002, The Numerical Algorithms Group Ltd.
All rights reserved.
- Copyright (C) 2007-2008, Gabriel Dos Reis.
+ Copyright (C) 2007-2010, Gabriel Dos Reis.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -39,6 +39,21 @@
#include "openaxiom-c-macros.h"
#include "hyper.h"
+extern void bf_top_group(void );
+extern GroupItem * copy_group_stack(void );
+extern void em_top_group(void );
+extern void free_group_stack(GroupItem * g);
+extern void init_group_stack(void );
+extern void init_top_group(void );
+extern void line_top_group(void );
+extern int pop_group_stack(void );
+extern void push_active_group(void );
+extern void push_group_stack(void );
+extern void push_spad_group(void );
+extern void rm_top_group(void );
+extern void tt_top_group(void );
+extern void center_top_group(void );
+
extern GroupItem *gTopOfGroupStack;
#endif
diff --git a/src/hyper/htadd.c b/src/hyper/htadd.c
index d289fea0..2363c140 100644
--- a/src/hyper/htadd.c
+++ b/src/hyper/htadd.c
@@ -1,7 +1,7 @@
/*
Copyright (C) 1991-2002, The Numerical Algorithms Group Ltd.
All rights reserved.
- Copyright (C) 2007-2009, Gabriel Dos Reis.
+ Copyright (C) 2007-2010, Gabriel Dos Reis.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -75,8 +75,6 @@ extern int line_number; /* keeps track of which line a page starts on
* in a file. This way someone can start
* including a line number counter into
* HyperDoc. */
-/* for compatibility with HyperDoc */
-openaxiom_sio *spad_socket = NULL;
int fresh = 0;
#define Delete 1
diff --git a/src/hyper/htinp.c b/src/hyper/htinp.c
index c78d52bf..c4a62bd5 100644
--- a/src/hyper/htinp.c
+++ b/src/hyper/htinp.c
@@ -1,7 +1,7 @@
/*
Copyright (C) 1991-2002, The Numerical Algorithms Group Ltd.
All rights reserved.
- Copyright (C) 2007-2008, Gabriel Dos Reis.
+ Copyright (C) 2007-2010, Gabriel Dos Reis.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -33,15 +33,12 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#define _HTINP_C
-#include "openaxiom-c-macros.h"
-
-#include "debug.h"
-
#include <sys/stat.h>
#include <sys/signal.h>
#include <setjmp.h>
+#include "openaxiom-c-macros.h"
+#include "debug.h"
#include "halloc.h"
#include "sockio.h"
#include "hyper.h"
@@ -49,8 +46,6 @@
#include "parse.h"
#include "bsdsignal.h"
#include "cfuns.h"
-
-#include "all_hyper_proto.H1"
#include "sockio.h"
extern char **input_file_list;
@@ -59,6 +54,15 @@ extern int make_patch_files;
extern int kill_spad;
extern jmp_buf jmpbuf;
+static void make_input_file_list(void );
+static char * make_input_file_name(char * buf , char * filename);
+static char * make_paste_file_name(char * buf , char * filename);
+static void make_the_input_file(UnloadedPage * page);
+static void make_input_file_from_page(HyperDocPage * page);
+static int inListAndNewer(char * inputFile , char * htFile);
+static void print_paste(FILE * pfile , char * realcom , char * command , char * pagename , int com_type);
+static void print_graph_paste(FILE * pfile , char * realcom , char * command , char * pagename , int com_type);
+static void send_command(char * command , int com_type);
#define MaxInputFiles 256
char *active_file_list[MaxInputFiles];
diff --git a/src/hyper/hyper.c b/src/hyper/hyper.c
index 9c24c30f..5b22142d 100644
--- a/src/hyper/hyper.c
+++ b/src/hyper/hyper.c
@@ -1,7 +1,7 @@
/*
Copyright (C) 1991-2002, The Numerical Algorithms Group Ltd.
All rights reserved.
- Copyright (C) 2007-2009, Gabriel Dos Reis.
+ Copyright (C) 2007-2010, Gabriel Dos Reis.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -43,14 +43,6 @@
/* Include all the needed include files */
-#define _HYPER_C
-
-#include "debug.h"
-
-#include "sockio.h"
-#include "hyper.h"
-#include "lex.h"
-
#include <sys/signal.h>
#include <sys/types.h>
#include <sys/wait.h>
@@ -59,14 +51,24 @@
#include <stdlib.h>
#include <locale.h>
+#include "debug.h"
+#include "sockio.h"
+#include "hyper.h"
+#include "lex.h"
#include "keyin.h"
#include "initx.h"
#include "event.h"
#include "hyper.h"
#include "bsdsignal.h"
-
-#include "all_hyper_proto.H1"
#include "sockio.h"
+#include "parse.h"
+
+static void init_hash(void);
+static void make_server_connections(void);
+static void check_arguments(void);
+static void init_hash(void);
+static void make_server_connections(void);
+static void check_arguments(void);
/*
* Here is a flag used to tell me whether I made a good connection to the
diff --git a/src/hyper/hyper.h b/src/hyper/hyper.h
index f71b45ae..de108ea4 100644
--- a/src/hyper/hyper.h
+++ b/src/hyper/hyper.h
@@ -1,7 +1,7 @@
/*
Copyright (C) 1991-2002, The Numerical Algorithms Group Ltd.
All rights reserved.
- Copyright (C) 2007-2008, Gabriel Dos Reis.
+ Copyright (C) 2007-2010, Gabriel Dos Reis.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -47,6 +47,7 @@
#include "token.h"
#include "hash.h"
#include "node.h"
+#include "pixmap.h"
#define boolean unsigned short int
@@ -57,6 +58,78 @@
#define FALSE ((boolean) 0x0)
#endif
+extern void sigusr2_handler(int sig);
+extern void sigcld_handler(int sig);
+extern void clean_socket(void);
+extern void init_page_structs(HDWindow * w);
+extern void push_item_stack(void);
+extern void clear_item_stack(void);
+extern void pop_item_stack(void);
+extern ItemStack * copy_item_stack(void);
+extern void free_item_stack(ItemStack * is);
+extern ButtonList * alloc_button_list(void);
+extern CondNode * alloc_condnode(void);
+extern HDWindow * alloc_hd_window(void);
+extern IfNode * alloc_ifnode(void);
+extern InputBox * alloc_inputbox(void);
+extern LineStruct * alloc_inputline(int size);
+extern TextNode * alloc_node(void);
+extern HyperDocPage * alloc_page(char * name);
+extern PasteNode * alloc_paste_node(char * name);
+extern RadioBoxes * alloc_rbs(void);
+extern void free_button_list(ButtonList * bl);
+extern void free_hd_window(HDWindow * w);
+extern void free_input_item(InputItem * sym , short des);
+extern void free_input_list(InputItem * il);
+extern void free_node(TextNode * node , short des);
+extern void free_page(HyperDocPage * page);
+extern void free_patch(PatchStore * p);
+extern void free_string(char * str);
+extern char * resizeBuffer(int size , char * oldBuf , int * oldSize);
+extern PatchStore * alloc_patchstore(void);
+extern InputItem * return_item(char * name);
+extern void fill_box(Window w , ImageStruct * image);
+extern void toggle_input_box(HyperLink * link);
+extern void toggle_radio_box(HyperLink * link);
+extern void change_input_focus(HyperLink * link);
+extern void next_input_focus(void);
+extern void prev_input_focus(void);
+extern int delete_item(char * name);
+extern XImage * HTReadBitmapFile(Display * display , int screen , char * filename , int * width , int * height);
+extern ImageStruct * insert_image_struct(char * filename);
+extern void compute_form_page(HyperDocPage * page);
+extern int window_width(int cols);
+extern void ht2_input(void );
+extern void make_record(void );
+extern void verify_record(void );
+extern char * strCopy(char * s);
+extern void print_paste_line(FILE * pfile , char * str);
+extern void get_spad_output(FILE * pfile , char * command , int com_type);
+extern void get_graph_output(char * command , char * pagename , int com_type);
+extern void add_buffer_to_sym(char * buffer , InputItem * sym);
+extern void dialog(XEvent * event , KeySym keysym , char * buffer);
+extern void draw_inputsymbol(InputItem * sym);
+extern void update_inputsymbol(InputItem * sym);
+extern HyperDocPage * issue_server_command(HyperLink * link);
+extern HyperDocPage * issue_unixlink(TextNode * node);
+extern char * print_to_string(TextNode * command);
+extern void issue_spadcommand(HyperDocPage * page , TextNode * command , int immediate , int type);
+extern openaxiom_sio * accept_menu_connection(openaxiom_sio * server_sock);
+extern char * print_to_string1(TextNode * command , int * sizeBuf);
+extern int issue_serverpaste(TextNode * command);
+extern void issue_unixcommand(TextNode * node);
+extern int issue_unixpaste(TextNode * node);
+extern void service_session_socket(void);
+extern void send_lisp_command(char * command);
+extern void escape_string(char * s);
+extern void unescape_string(char * s);
+extern char * print_source_to_string1(TextNode * command , int * sizeBuf);
+extern char * print_source_to_string(TextNode * command);
+extern void change_cond(char * label , char * newcond);
+extern int check_condition(TextNode * node);
+extern void insert_cond(char * label , char * cond);
+
+
#ifndef HTADD
extern int MenuServerOpened;
diff --git a/src/hyper/initx.c b/src/hyper/initx.c
index cff60806..45a9ff4d 100644
--- a/src/hyper/initx.c
+++ b/src/hyper/initx.c
@@ -1,7 +1,7 @@
/*
Copyright (C) 1991-2002, The Numerical Algorithms Group Ltd.
All rights reserved.
- Copyright (C) 2007-2008, Gabriel Dos Reis.
+ Copyright (C) 2007-2010, Gabriel Dos Reis.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -43,7 +43,6 @@
/* #define DEBUG 1 */
-#define _INITX_C
#include "openaxiom-c-macros.h"
#include <unistd.h>
@@ -67,18 +66,23 @@ extern int gethostname(char *, int );
#include "hyper.h"
#include "scrollbar.h"
#include "titlebar.h"
-
-#include "all_hyper_proto.H1"
#include "util.H1"
#include "cfuns.h"
-
#include "spadcolors.h"
-#include "spadcolors.H1"
-
#include "mouse11.bitmap"
#include "mouse11.mask"
+static void get_GCs(HDWindow * window);
+static int get_border_properties(void);
+static int get_color(char * , char * , int, Colormap*);
+static void ingItColors_and_fonts(void);
+static void load_font(XFontStruct * * font_info , char * fontname);
+static void mergeDatabases(void);
+static void open_form_window(void);
+static void open_window(Window w);
+static void set_name_and_icon(void);
+static void set_size_hints(Window w);
static GContext server_font;
unsigned long *spadColors;
@@ -893,7 +897,7 @@ change_text(int color, XFontStruct *font)
*/
static int
-get_color(char *name, char *class, int def, Colormap *map)
+get_color(char *name, char *klass, int def, Colormap *map)
{
char fullname[256];
char fullclass[256];
@@ -911,7 +915,7 @@ get_color(char *name, char *class, int def, Colormap *map)
strcpy(fullname, "OpenAxiom.hyperdoc.");
strcat(fullname, name);
strcpy(fullclass,"OpenAxiom.hyperdoc.");
- strcat(fullclass,class);
+ strcat(fullclass, klass);
if (XrmGetResource(rDB, fullname, fullclass, str_type, &value) == True) {
(void) strncpy(prop, value.addr, (int) value.size);
diff --git a/src/hyper/initx.h b/src/hyper/initx.h
index 7533fe78..7005ba3b 100644
--- a/src/hyper/initx.h
+++ b/src/hyper/initx.h
@@ -1,7 +1,7 @@
/*
Copyright (C) 1991-2002, The Numerical Algorithms Group Ltd.
All rights reserved.
- Copyright (C) 2007-2008, Gabriel Dos Reis.
+ Copyright (C) 2007-2010, Gabriel Dos Reis.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -38,6 +38,12 @@
#include "hyper.h"
+extern void change_text(int color , XFontStruct * font);
+extern int init_form_window(char * name , int cols);
+extern int init_top_window(char * name);
+extern void initializeWindowSystem(void);
+extern int is_it_850(XFontStruct * fontarg);
+
extern int gBorderColor;
#endif
diff --git a/src/hyper/input.c b/src/hyper/input.c
index c3a19958..dc6c0fbe 100644
--- a/src/hyper/input.c
+++ b/src/hyper/input.c
@@ -1,7 +1,7 @@
/*
Copyright (C) 1991-2002, The Numerical Algorithms Group Ltd.
All rights reserved.
- Copyright (C) 2007-2008, Gabriel Dos Reis.
+ Copyright (C) 2007-2010, Gabriel Dos Reis.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -33,15 +33,12 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#define _INPUT_C
#include "openaxiom-c-macros.h"
-
#include "debug.h"
#include "sockio.h"
#include "hyper.h"
-#include "all_hyper_proto.H1"
-
+static void clear_rbs(InputBox * list);
void
fill_box(Window w,ImageStruct * image)
diff --git a/src/hyper/item.c b/src/hyper/item.c
index c6764ba6..93cceb82 100644
--- a/src/hyper/item.c
+++ b/src/hyper/item.c
@@ -1,7 +1,7 @@
/*
Copyright (C) 1991-2002, The Numerical Algorithms Group Ltd.
All rights reserved.
- Copyright (C) 2007-2008, Gabriel Dos Reis.
+ Copyright (C) 2007-2010, Gabriel Dos Reis.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -35,13 +35,10 @@
#include "openaxiom-c-macros.h"
#include "sockio.h"
-#define _ITEM_C
#include "debug.h"
#include "halloc.h"
#include "extent.h"
-#include "all_hyper_proto.H1"
-
/*
* Here are structures needed for manipulating the item stack
*/
@@ -92,25 +89,25 @@ pop_item_stack(void)
ItemStack *
copy_item_stack(void)
{
- ItemStack *new = NULL;
+ ItemStack *stack = NULL;
ItemStack *prev = NULL;
ItemStack *trace = gTopOfItemStack;
ItemStack *first = NULL;
while (trace) {
- new = (ItemStack *) halloc(sizeof(ItemStack), "Item stack");
- new->indent = trace->indent;
- new->item_indent = trace->item_indent;
- new->in_item = gInItem;
+ stack = (ItemStack *) halloc(sizeof(ItemStack), "Item stack");
+ stack->indent = trace->indent;
+ stack->item_indent = trace->item_indent;
+ stack->in_item = gInItem;
if (!first)
- first = new;
+ first = stack;
else
- prev->next = new;
- prev = new;
+ prev->next = stack;
+ prev = stack;
trace = trace->next;
}
- if (new)
- new->next = NULL;
+ if (stack)
+ stack->next = NULL;
return first;
}
diff --git a/src/hyper/keyin.c b/src/hyper/keyin.c
index 7b0d310b..9e0f35e8 100644
--- a/src/hyper/keyin.c
+++ b/src/hyper/keyin.c
@@ -1,7 +1,7 @@
/*
Copyright (C) 1991-2002, The Numerical Algorithms Group Ltd.
All rights reserved.
- Copyright (C) 2007-2008, Gabriel Dos Reis.
+ Copyright (C) 2007-2010, Gabriel Dos Reis.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -40,11 +40,10 @@
* Copyright The Numerical Algorithms Group Limited 1991, 1992, 1993.
*
****************************************************************************/
-#define _KEYIN_C
-#include "openaxiom-c-macros.h"
+#include <X11/keysym.h>
+#include "openaxiom-c-macros.h"
#include "debug.h"
-
#include "halloc.h"
#include "sockio.h"
#include "hyper.h"
@@ -53,9 +52,6 @@
#include "parse.h"
#include "scrollbar.h"
-#include "all_hyper_proto.H1"
-#include <X11/keysym.h>
-
#define min(x,y) ( (x<y)?(x):(y))
diff --git a/src/hyper/keyin.h b/src/hyper/keyin.h
index 752150ff..aad41b1c 100644
--- a/src/hyper/keyin.h
+++ b/src/hyper/keyin.h
@@ -1,7 +1,7 @@
/*
Copyright (C) 1991-2002, The Numerical Algorithms Group Ltd.
All rights reserved.
- Copyright (C) 2007-2008, Gabriel Dos Reis.
+ Copyright (C) 2007-2010, Gabriel Dos Reis.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -36,6 +36,9 @@
#ifndef _KEYIN_H_
#define _KEYIN_H_ 1
+extern void handle_key(XEvent * event);
+extern void init_keyin(void);
+
extern int in_cursor_height;
extern int in_cursor_width;
extern int out_cursor_height;
diff --git a/src/hyper/macro.c b/src/hyper/macro.c
index dd1625b7..cdabf8f8 100644
--- a/src/hyper/macro.c
+++ b/src/hyper/macro.c
@@ -1,7 +1,7 @@
/*
Copyright (C) 1991-2002, The Numerical Algorithms Group Ltd.
All rights reserved.
- Copyright (C) 2007-2008, Gabriel Dos Reis.
+ Copyright (C) 2007-2010, Gabriel Dos Reis.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -33,9 +33,7 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#define _MACRO_C
#include "openaxiom-c-macros.h"
-
#include "debug.h"
#include "halloc.h"
#include "sockio.h"
@@ -43,8 +41,8 @@
#include "hyper.h"
#include "lex.h"
-#include "all_hyper_proto.H1"
-
+static char * load_macro(MacroStore * macro);
+static void get_parameter_strings(int number , char * macro_name);
/* #define DEBUG 1 */
@@ -178,35 +176,35 @@ ParameterList parameters = NULL;
ParameterList
init_parameter_elem(int number)
{
- ParameterList new;
+ ParameterList parms;
int count;
/** allocate the space neeeded **/
- new = (ParameterList) halloc(sizeof(struct parameter_list_type),
+ parms = (ParameterList) halloc(sizeof(struct parameter_list_type),
"ParameterList");
/** now allocate the memeory for the pointers to the parameters **/
if (number) {
- new->list = (char **) halloc(number * sizeof(char *), "Parameter List");
+ parms->list = (char **) halloc(number * sizeof(char *), "Parameter List");
/** initialize my pointers **/
for (count = 0; count < number; count++)
- (new->list)[count] = NULL;
+ (parms->list)[count] = NULL;
}
- new->number = number;
- return new;
+ parms->number = number;
+ return parms;
}
int
-push_parameters(ParameterList new)
+push_parameters(ParameterList parms)
{
- if (new == NULL) {
+ if (parms == NULL) {
fprintf(stderr, "Tried pushing a null list onto the parameter stack\n");
longjmp(jmpbuf, 1);
}
- new->next = parameters;
- parameters = new;
+ parms->next = parameters;
+ parameters = parms;
return 1;
}
int
@@ -291,13 +289,13 @@ get_parameter_strings(int number,char * macro_name)
int lbrace_counter;
char c;
int size;
- ParameterList new = init_parameter_elem(number);
+ ParameterList parms = init_parameter_elem(number);
int pnum;
char pnum_chars[5];
int pc;
if (!number) { /* nothing to be done */
- push_parameters(new);
+ push_parameters(parms);
return;
}
for (count = 0; count < number; count++) {
@@ -362,10 +360,10 @@ get_parameter_strings(int number,char * macro_name)
*buffer_pntr = '\0';
/*** Now add it to the current parameter list **/
size = strlen(buffer) + 1;
- new->list[count] = (char *) halloc(size, "Parameter Strings");
- strcpy(new->list[count], buffer);
+ parms->list[count] = (char *) halloc(size, "Parameter Strings");
+ strcpy(parms->list[count], buffer);
}
- push_parameters(new);
+ push_parameters(parms);
return ;
}
void
diff --git a/src/hyper/mem.c b/src/hyper/mem.c
index e127ae3a..1617e21d 100644
--- a/src/hyper/mem.c
+++ b/src/hyper/mem.c
@@ -1,7 +1,7 @@
/*
Copyright (C) 1991-2002, The Numerical Algorithms Group Ltd.
All rights reserved.
- Copyright (C) 2007-2008, Gabriel Dos Reis.
+ Copyright (C) 2007-2010, Gabriel Dos Reis.
All rights reversed.
Redistribution and use in source and binary forms, with or without
@@ -40,18 +40,25 @@
* Copyright The Numerical Algorithms Group Limited 1991, 1992, 1993.
*
****************************************************************************/
-#define _MEM_C
#include "debug.h"
-
#include "halloc.h"
#include "sockio.h"
#include "hyper.h"
#include "group.h"
#include "event.h"
-
-#include "all_hyper_proto.H1"
-
+#include "parse.h"
+
+static void free_cond(CondNode * cond);
+static void free_depend(SpadcomDepend * sd);
+static void free_lines(LineStruct * lines);
+static void dont_free(void * link);
+static void free_if_non_NULL(void * p);
+static void free_input_box(InputBox * box);
+static void free_paste(PasteNode * paste , short des);
+static void free_pastearea(TextNode * node , short des);
+static void free_pastebutton(TextNode * node , short des);
+static void free_radio_boxes(RadioBoxes * radio);
extern HashTable init_page_hash;
diff --git a/src/hyper/parse-aux.c b/src/hyper/parse-aux.c
index ac6008c7..27556058 100644
--- a/src/hyper/parse-aux.c
+++ b/src/hyper/parse-aux.c
@@ -1,7 +1,7 @@
/*
Copyright (C) 1991-2002, The Numerical Algorithms Group Ltd.
All rights reserved.
- Copyright (C) 2007-2008, Gabriel Dos Reis.
+ Copyright (C) 2007-2010, Gabriel Dos Reis.
All rights reverved.
Redistribution and use in source and binary forms, with or without
@@ -34,8 +34,6 @@
*/
#include "openaxiom-c-macros.h"
-#define _PARSE_AUX_C
-
#include "debug.h"
#include "halloc.h"
#include "sockio.h"
@@ -44,8 +42,8 @@
#include "lex.h"
#include "hyper.h"
-#include "all_hyper_proto.H1"
-
+static void read_ht_file(HashTable * page_hash , HashTable * macro_hash , HashTable * patch_hash , FILE * db_fp , char * db_file);
+static HyperDocPage * make_special_page(int type , char * name);
extern int make_input_file;
extern int gverify_dates;
diff --git a/src/hyper/parse-input.c b/src/hyper/parse-input.c
index 8eadc5ac..f927c64c 100644
--- a/src/hyper/parse-input.c
+++ b/src/hyper/parse-input.c
@@ -1,7 +1,7 @@
/*
Copyright (C) 1991-2002, The Numerical Algorithms Group Ltd.
All rights reserved.
- Copyright (C) 2007-2008, Gabriel Dos Reis.
+ Copyright (C) 2007-2010, Gabriel Dos Reis.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -34,15 +34,12 @@
*/
#include "openaxiom-c-macros.h"
-#define _PARSE_INPUT_C
/***
Contains all the code needed to parse input items,
InputString
SimpleBox
RadioBox.
****/
-
-
#include "debug.h"
#include "halloc.h"
#include "sockio.h"
@@ -50,7 +47,9 @@
#include "lex.h"
#include "hyper.h"
-#include "all_hyper_proto.H1"
+static void insert_item(InputItem * item);
+static void add_box_to_rb_list(char * name , InputBox * box);
+static int check_others(InputBox * list);
/* create an unmapped input window for getting strings * */
extern int make_input_file;
diff --git a/src/hyper/parse-paste.c b/src/hyper/parse-paste.c
index 7789565b..c8d67c85 100644
--- a/src/hyper/parse-paste.c
+++ b/src/hyper/parse-paste.c
@@ -1,7 +1,7 @@
/*
Copyright (C) 1991-2002, The Numerical Algorithms Group Ltd.
All rights reserved.
- Copyright (C) 2007-2008, Gabriel Dos Reis.
+ Copyright (C) 2007-2010, Gabriel Dos Reis.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -40,11 +40,9 @@
* Copyright The Numerical Algorithms Group Limited 1991, 1992, 1993.
*
****************************************************************************/
-#define _PARSE_PASTE_C
-#include "openaxiom-c-macros.h"
+#include "openaxiom-c-macros.h"
#include "debug.h"
-
#include "halloc.h"
#include "sockio.h"
#include "parse.h"
@@ -53,8 +51,7 @@
#include "group.h"
#include "lex.h"
-#include "all_hyper_proto.H1"
-
+static void load_patch(PatchStore * patch);
short int gInPaste;
@@ -212,11 +209,11 @@ parse_pastebutton(void)
HyperDocPage *
parse_patch(PasteNode *paste)
{
- TextNode *new;
+ TextNode *new_paste;
TextNode *end_node;
TextNode *begin_node;
TextNode *arg_node;
- TextNode *throw;
+ TextNode *old;
TextNode *next_node;
InputItem *paste_item = paste->paste_item;
int where = paste->where;
@@ -231,7 +228,7 @@ parse_patch(PasteNode *paste)
next_node = end_node->next;
begin_node = paste->begin_node;
arg_node = paste->arg_node;
- throw = begin_node->next;
+ old = begin_node->next;
/* now read the new stuff and add it in between all this stuff */
@@ -289,7 +286,7 @@ parse_patch(PasteNode *paste)
end_node->next = 0;
- free_node(throw, 1);
+ free_node(old, 1);
init_parse_patch(gWindow->page);
init_paste_item(paste_item);
@@ -324,14 +321,14 @@ parse_patch(PasteNode *paste)
jump();
}
}
- new = alloc_node();
- curr_node = new;
+ new_paste = alloc_node();
+ curr_node = new_paste;
parse_HyperDoc();
/* Once I am back, I need only reallign all the text structures */
curr_node->type = openaxiom_Noop_token;
curr_node->next = next_node;
- begin_node->next = new;
+ begin_node->next = new_paste;
begin_node->type = openaxiom_Noop_token;
free(begin_node->data.text);
begin_node->data.text = 0;
diff --git a/src/hyper/parse-paste.h b/src/hyper/parse-paste.h
index d730b9bd..deb7f552 100644
--- a/src/hyper/parse-paste.h
+++ b/src/hyper/parse-paste.h
@@ -1,7 +1,7 @@
/*
Copyright (C) 1991-2002, The Numerical Algorithms Group Ltd.
All rights reserved.
- Copyirght (C) 2007-2008, Gabriel Dos Reis.
+ Copyirght (C) 2007-2010, Gabriel Dos Reis.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -39,6 +39,10 @@
#include "openaxiom-c-macros.h"
#include "hyper.h"
+extern void parse_paste(void);
+extern void parse_pastebutton(void);
+extern HyperDocPage * parse_patch(PasteNode * paste);
+
extern short int gInPaste;
#endif
diff --git a/src/hyper/parse-types.c b/src/hyper/parse-types.c
index ec19f66f..67bbc252 100644
--- a/src/hyper/parse-types.c
+++ b/src/hyper/parse-types.c
@@ -1,7 +1,7 @@
/*
Copyright (C) 1991-2002, The Numerical Algorithms Group Ltd.
All rights reserved.
- Copyright (C) 2007-2008, Gabriel Dos Reis.
+ Copyright (C) 2007-2010, Gabriel Dos Reis.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -40,9 +40,8 @@
* Copyright The Numerical Algorithms Group Limited 1991, 1992, 1993.
*
****************************************************************************/
-#define _PARSE_TYPES_C
-#include "openaxiom-c-macros.h"
+#include "openaxiom-c-macros.h"
#include "debug.h"
#include "halloc.h"
#include "sockio.h"
@@ -53,7 +52,8 @@
#include "extent.h"
#include "cfuns.h"
-#include "all_hyper_proto.H1"
+static void parse_condnode(void );
+static void parse_hasreturnto(void );
boolean gInButton = FALSE;
boolean gInIf = FALSE;
diff --git a/src/hyper/parse-types.h b/src/hyper/parse-types.h
index c5bd3802..9e4fdcbf 100644
--- a/src/hyper/parse-types.h
+++ b/src/hyper/parse-types.h
@@ -1,7 +1,7 @@
/*
Copyright (C) 1991-2002, The Numerical Algorithms Group Ltd.
All rights reserved.
- Copyright (C) 2007-2008, Gabriel Dos Reis.
+ Copyright (C) 2007-2010, Gabriel Dos Reis.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -38,6 +38,29 @@
#include "hyper.h"
+extern void parse_begin_items(void );
+extern void parse_box(void );
+extern void parse_button(void );
+extern void parse_centerline(void );
+extern void parse_command(void );
+extern void parse_env(TextNode * node);
+extern void parse_free(void );
+extern void parse_help(void );
+extern void parse_ifcond(void );
+extern void parse_input_pix(void );
+extern void parse_item(void );
+extern void parse_mbox(void );
+extern void parse_mitem(void );
+extern void parse_newcond(void );
+extern void parse_setcond(void );
+extern void parse_spadcommand(TextNode * spad_node);
+extern void parse_spadsrc(TextNode * spad_node);
+extern void parse_table(void );
+extern void parse_value1(void );
+extern void parse_value2(void );
+extern void parse_verbatim(int type);
+extern void show_text(TextNode * node , int Ender);
+
extern boolean gInButton;
extern boolean gInIf;
extern boolean gInItems;
diff --git a/src/hyper/parse.c b/src/hyper/parse.c
index bd3ec318..5ef50baf 100644
--- a/src/hyper/parse.c
+++ b/src/hyper/parse.c
@@ -1,7 +1,7 @@
/*
Copyright (C) 1991-2002, The Numerical Algorithms Group Ltd.
All rights reserved.
- Copyright (C) 2007-2008, Gabriel Dos Reis.
+ Copyright (C) 2007-2010, Gabriel Dos Reis.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -33,8 +33,6 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#define _PARSE_C
-
#include "debug.h"
#include "halloc.h"
#include "sockio.h"
@@ -50,8 +48,17 @@
#include "scrollbar.h"
#include "titlebar.h"
-#include "all_hyper_proto.H1"
-
+static void end_a_page(void );
+static HyperDocPage * format_page(UnloadedPage * ulpage);
+static void parse_page(HyperDocPage * page);
+static void parse_replacepage(void );
+static void start_footer(void );
+static void start_scrolling(void );
+static void Push_MR(void );
+static void Pop_MR(void );
+static void parse_title(HyperDocPage * page);
+static void parse_header(HyperDocPage * page);
+static void init_parse_page(HyperDocPage * page);
TextNode *curr_node; /* current node being parsed. It is to be the
diff --git a/src/hyper/parse.h b/src/hyper/parse.h
index 3de6024a..eaddd9bf 100644
--- a/src/hyper/parse.h
+++ b/src/hyper/parse.h
@@ -1,7 +1,7 @@
/*
Copyright (C) 1991-2002, The Numerical Algorithms Group Ltd.
All rights reserved.
- Copyright (C) 2007-2008, Gabriel Dos Reis.
+ Copyright (C) 2007-2010, Gabriel Dos Reis.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -50,6 +50,46 @@
#include <setjmp.h>
+extern void display_page(HyperDocPage * page);
+extern void init_parse_patch(HyperDocPage * page);
+extern void load_page(HyperDocPage * page);
+extern void parse_HyperDoc(void );
+extern void parse_from_string(char * str);
+extern HyperDocPage * parse_page_from_socket(void );
+extern HyperDocPage * parse_page_from_unixfd(void );
+extern HyperLink * make_input_window(InputItem * item);
+extern HyperLink * make_box_window(InputBox * box , int type);
+extern void initialize_default(InputItem * item , char * buff);
+extern void parse_inputstring(void);
+extern void parse_simplebox(void);
+extern void parse_radiobox(void);
+extern void init_paste_item(InputItem * item);
+extern void repaste_item(void);
+extern InputItem * current_item(void);
+extern int already_there(char * name);
+extern void parse_radioboxes(void);
+extern void add_dependencies(void );
+extern FILE * find_fp(FilePosition fp);
+extern char * get_input_string(void );
+extern HyperLink * make_link_window(TextNode * link_node , int type , int isSubWin);
+extern HyperLink * make_paste_window(PasteNode * paste);
+extern void make_special_pages(HashTable * pageHashTable);
+extern int window_code(Window * w , int size);
+extern int window_equal(Window * w1 , Window * w2);
+extern char * window_id(Window w);
+extern void read_ht_db(HashTable * page_hash , HashTable * macro_hash , HashTable * patch_hash);
+extern int get_filename(void);
+extern int is_number(char * str);
+extern void parser_error(char * str);
+extern int get_where(void);
+extern void scan_HyperDoc(void);
+extern int number(char * str);
+extern ParameterList init_parameter_elem(int number);
+extern int push_parameters(ParameterList);
+extern int pop_parameters(void);
+extern int parse_macro(void);
+extern void parse_parameters(void);
+
extern jmp_buf jmpbuf;
extern int vbuff;
diff --git a/src/hyper/scrollbar.c b/src/hyper/scrollbar.c
index ac7addf7..bc858325 100644
--- a/src/hyper/scrollbar.c
+++ b/src/hyper/scrollbar.c
@@ -1,7 +1,7 @@
/*
Copyright (C) 1991-2002, The Numerical Algorithms Group Ltd.
All rights reserved.
- Copyright (C) 2007-2008, Gabriel Dos Reis.
+ Copyright (C) 2007-2010, Gabriel Dos Reis.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -40,9 +40,8 @@
* Copyright The Numerical Algorithms Group Limited 1991, 1992, 1993.
*
****************************************************************************/
-#define _SCROLLBAR_C
-#include "openaxiom-c-macros.h"
+#include "openaxiom-c-macros.h"
#include "debug.h"
#include "halloc.h"
#include "sockio.h"
@@ -53,8 +52,6 @@
#include "scrollbar.h"
#include "parse.h"
-#include "all_hyper_proto.H1"
-
/*************************************************************************
Scrollbar Comments 10/08/89
@@ -95,6 +92,10 @@
**************************************************************************/
+static int ch(int height);
+static void changeWindowBackgroundPixmap(Window window , Pixmap pixmap);
+static void drawScroller3DEffects(HDWindow * hdWindow , int x1 , int y1 , int x2 , int y2);
+
static int ch(int height);
static void changeWindowBackgroundPixmap(Window window, Pixmap pixmap);
diff --git a/src/hyper/scrollbar.h b/src/hyper/scrollbar.h
index c1721fe8..98054bb8 100644
--- a/src/hyper/scrollbar.h
+++ b/src/hyper/scrollbar.h
@@ -1,7 +1,7 @@
/*
Copyright (C) 1991-2002, The Numerical Algorithms Group Ltd.
All rights reserved.
- Copyright (C) 2007-2008, Gabriel Dos Reis.
+ Copyright (C) 2007-2010, Gabriel Dos Reis.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -38,6 +38,21 @@
#include "hyper.h"
+extern void calculateScrollBarMeasures(void );
+extern void drawScrollLines(void );
+extern void hideScrollBars(HDWindow * hdWindow);
+extern void getScrollBarMinimumSize(int * width , int * height);
+extern void linkScrollBars(void );
+extern void makeScrollBarWindows(void );
+extern void moveScroller(HDWindow * hdWindow);
+extern void scrollDown(void );
+extern void scrollDownPage(void );
+extern void scrollScroller(XButtonEvent * event);
+extern void scrollToFirstPage(void );
+extern void scrollUp(void );
+extern void scrollUpPage(void );
+extern void showScrollBars(HDWindow * hdWindow);
+
extern int gScrollbarWidth;
#endif
diff --git a/src/hyper/show-types.c b/src/hyper/show-types.c
index f55bd06c..1942901b 100644
--- a/src/hyper/show-types.c
+++ b/src/hyper/show-types.c
@@ -1,7 +1,7 @@
/*
Copyright (C) 1991-2002, The Numerical Algorithms Group Ltd.
All rights reserved.
- Copyright (C) 2007-2008, Gabriel Dos Reis.
+ Copyright (C) 2007-2010, Gabriel Dos Reis.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -40,19 +40,22 @@
* Copyright The Numerical Algorithms Group Limited 1991, 1992, 1993.
*
****************************************************************************/
-#define _SHOW_TYPES_C
-#include "openaxiom-c-macros.h"
+#include "openaxiom-c-macros.h"
#include "debug.h"
-
#include "sockio.h"
#include "hyper.h"
#include "display.h"
#include "extent.h"
#include "group.h"
-#include "all_hyper_proto.H1"
-
+static void show_image(TextNode * node , GC gc);
+static void show_input(TextNode * node);
+static void show_link(TextNode * node);
+static void show_paste(TextNode * node);
+static void show_pastebutton(TextNode * node);
+static void show_simple_box(TextNode * node);
+static void show_spadcommand(TextNode * node);
/*
diff --git a/src/hyper/spadint.c b/src/hyper/spadint.c
index fe8219a1..f872baf8 100644
--- a/src/hyper/spadint.c
+++ b/src/hyper/spadint.c
@@ -1,7 +1,7 @@
/*
Copyright (C) 1991-2002, The Numerical Algorithms Group Ltd.
All rights reserved.
- Copyright (C) 2007-2008, Gabriel Dos Reis.
+ Copyright (C) 2007-2010, Gabriel Dos Reis.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -36,22 +36,26 @@
/* Still a problem with close_client */
/* Communication interface for external OpenAxiom buffers */
-#define _SPADINT_C
#include "open-axiom.h"
#include "debug.h"
-
#include <signal.h>
#include "halloc.h"
#include "sockio.h"
#include "hyper.h"
#include "parse.h"
#include "bsdsignal.h"
-
-#include "all_hyper_proto.H1"
#include "sockio.h"
#include "cfuns.h"
+static void start_user_buffer(HyperDocPage * page);
+static void clear_execution_marks(HashTable * depend_hash);
+static void issue_dependent_commands(HyperDocPage * page , TextNode * command , int type);
+static void send_pile(openaxiom_sio * sock , char * str);
+static void mark_as_executed(HyperDocPage * page , TextNode * command , int type);
+static void accept_menu_server_connection(HyperDocPage * page);
+static void switch_frames(void );
+static void close_client(int pid);
typedef struct sock_list { /* linked list of openaxiom_sio */
openaxiom_sio Socket;
@@ -59,8 +63,6 @@ typedef struct sock_list { /* linked list of openaxiom_sio */
} Sock_List;
Sock_List *plSock = (Sock_List *) 0;
-openaxiom_sio *spad_socket = (openaxiom_sio *) 0; /* to_server socket for SpadServer */
-
/* connect to OpenAxiom , return 0 if succesful, 1 if not */
int
diff --git a/src/hyper/titlebar.c b/src/hyper/titlebar.c
index f1601345..90dfabf4 100644
--- a/src/hyper/titlebar.c
+++ b/src/hyper/titlebar.c
@@ -1,7 +1,7 @@
/*
Copyright (C) 1991-2002, The Numerical Algorithms Group Ltd.
All rights reserved.
- Copyright (C) 2007-2008, Gabriel Dos Reis.
+ Copyright (C) 2007-2010, Gabriel Dos Reis.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -40,13 +40,10 @@
* Copyright The Numerical Algorithms Group Limited 1991, 1992, 1993.
*
****************************************************************************/
-#define _TITLEBAR_C
-#include "openaxiom-c-macros.h"
-
-#include "debug.h"
#include <stdlib.h>
-
+#include "openaxiom-c-macros.h"
+#include "debug.h"
#include "halloc.h"
#include "sockio.h"
#include "titlebar.h"
@@ -55,8 +52,9 @@
#include "initx.h"
#include "parse.h"
#include "cfuns.h"
+#include "parse-types.h"
-#include "all_hyper_proto.H1"
+static void readTitleBarImages(void);
extern int y_off; /* y offset for scrolling regions */
diff --git a/src/hyper/titlebar.h b/src/hyper/titlebar.h
index 2bf66cbe..db7059a4 100644
--- a/src/hyper/titlebar.h
+++ b/src/hyper/titlebar.h
@@ -1,7 +1,7 @@
/*
Copyright (C) 1991-2002, The Numerical Algorithms Group Ltd.
All rights reserved.
- Copyright (C) 2007-2008, Gabriel Dos Reis.
+ Copyright (C) 2007-2010, Gabriel Dos Reis.
All right reserved.
Redistribution and use in source and binary forms, with or without
@@ -38,6 +38,11 @@
#include "hyper.h"
+extern void getTitleBarMinimumSize(int * width , int * height);
+extern void linkTitleBarWindows(void);
+extern void makeTitleBarWindows(void);
+extern void showTitleBar(void);
+
extern int twwidth, twheight; /* the width and height for all windows in the */
/* title bar */
diff --git a/src/include/ReadBitmap.H1 b/src/include/ReadBitmap.H1
deleted file mode 100644
index 52fd579c..00000000
--- a/src/include/ReadBitmap.H1
+++ /dev/null
@@ -1,6 +0,0 @@
-extern XImage * HTReadBitmapFile(Display * display , int screen , char * filename , int * width , int * height);
-extern ImageStruct * insert_image_struct(char * filename);
-#ifdef _READBITMAP_C
-static int read_hot(FILE * fd , char Line[] , int * x_hot , int * y_hot);
-static int read_w_and_h(FILE * fd , unsigned int * width , unsigned int * height);
-#endif
diff --git a/src/include/all_hyper_proto.H1 b/src/include/all_hyper_proto.H1
deleted file mode 100644
index ac6d8ce1..00000000
--- a/src/include/all_hyper_proto.H1
+++ /dev/null
@@ -1,26 +0,0 @@
-#include "ReadBitmap.H1"
-#include "dialog.H1"
-#include "cond.H1"
-#include "display.H1"
-#include "event.H1"
-#include "form_ext.H1"
-#include "extent1.H1"
-#include "extent2.H1"
-#include "group.H1"
-#include "htinp.H1"
-#include "hyper.H1"
-#include "initx.H1"
-#include "input.H1"
-#include "keyin.H1"
-#include "item.H1"
-#include "parse.H1"
-#include "macro.H1"
-#include "parse_paste.H1"
-#include "parse_aux.H1"
-#include "parse_input.H1"
-#include "show_types.H1"
-#include "parse_types.H1"
-#include "scrollbar.H1"
-#include "titlebar.H1"
-#include "spadint.H1"
-#include "mem.H1"
diff --git a/src/include/bsdsignal.h b/src/include/bsdsignal.h
index 1a55293c..ecbebebe 100644
--- a/src/include/bsdsignal.h
+++ b/src/include/bsdsignal.h
@@ -36,9 +36,14 @@
#ifndef OPENAXIOM_BSDSIGNAL_included
#define OPENAXIOM_BSDSIGNAL_included
+#include <signal.h>
+
#include "open-axiom.h"
-#include <signal.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#ifdef SIGCHLD
# define OPENAXIOM_SIGCHLD SIGCHLD
@@ -53,4 +58,8 @@
typedef void (* SignalHandlerFunc)(int);
OPENAXIOM_EXPORT SignalHandlerFunc bsdSignal(int, SignalHandlerFunc, int);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* OPENAXIOM_BSDSIGNAL_included */
diff --git a/src/include/cond.H1 b/src/include/cond.H1
deleted file mode 100644
index a2843d4e..00000000
--- a/src/include/cond.H1
+++ /dev/null
@@ -1,6 +0,0 @@
-extern void change_cond(char * label , char * newcond);
-extern int check_condition(TextNode * node);
-extern void insert_cond(char * label , char * cond);
-#ifdef _COND_C
-static int check_memostack(TextNode * node);
-#endif
diff --git a/src/include/cursor.H1 b/src/include/cursor.H1
index 090e0573..6538a398 100644
--- a/src/include/cursor.H1
+++ b/src/include/cursor.H1
@@ -1 +1,9 @@
+#ifdef __cplusplus
+extern "C" {
+#endif
+
extern int Cursor_shape(int );
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/src/include/dialog.H1 b/src/include/dialog.H1
deleted file mode 100644
index db5257ad..00000000
--- a/src/include/dialog.H1
+++ /dev/null
@@ -1,33 +0,0 @@
-extern void add_buffer_to_sym(char * buffer , InputItem * sym);
-extern void dialog(XEvent * event , KeySym keysym , char * buffer);
-extern void draw_inputsymbol(InputItem * sym);
-extern void update_inputsymbol(InputItem * sym);
-#ifdef _DIALOG_C
-static void back_over_char(InputItem * sym);
-static void back_over_eoln(InputItem * sym);
-static void clear_cursor(InputItem * sym);
-static void clear_cursorline(InputItem * sym);
-static void dec_line_numbers(LineStruct * line);
-static void decrease_line_numbers(LineStruct * line , int am);
-static void delete_char(InputItem * sym);
-static void delete_eoln(InputItem * sym);
-static int delete_one_char(InputItem * sym);
-static void delete_rest_of_line(InputItem * sym);
-static void draw_cursor(InputItem * sym);
-static void enter_new_line(InputItem * sym);
-static void inc_line_numbers(LineStruct * line);
-static void insert_buffer(char * buffer , InputItem * sym);
-static int move_back_one_char(InputItem * sym);
-static void move_cursor_backward(InputItem * sym);
-static void move_cursor_down(InputItem * sym);
-static void move_cursor_end(InputItem * sym);
-static void move_cursor_forward(InputItem * sym);
-static void move_cursor_home(InputItem * sym);
-static void move_cursor_up(InputItem * sym);
-static char move_rest_back(LineStruct * line , int size);
-static int move_sym_forward(LineStruct * line , int num , int size , InputItem * sym);
-static char * mystrncpy(char * buff1 , char * buff2 , int n);
-static void overwrite_buffer(char * buffer , InputItem * item);
-static void redraw_win(void);
-static void tough_enter(InputItem * sym);
-#endif
diff --git a/src/include/display.H1 b/src/include/display.H1
deleted file mode 100644
index 8ccc2af5..00000000
--- a/src/include/display.H1
+++ /dev/null
@@ -1,4 +0,0 @@
-extern void expose_page(HyperDocPage * page);
-extern void paste_page(TextNode * node);
-extern void scroll_page(HyperDocPage * page);
-extern void show_page(HyperDocPage * page);
diff --git a/src/include/edin.H1 b/src/include/edin.H1
index 5e5cf563..546b2951 100644
--- a/src/include/edin.H1
+++ b/src/include/edin.H1
@@ -1,3 +1,7 @@
+#ifdef __cplusplus
+extern "C" {
+#endif
+
extern void init_reader(void);
extern void init_flag(int * , int );
extern void do_reading(void);
@@ -15,3 +19,7 @@ extern void flagcpy(int * , int * );
extern void flagncpy(int * , int * , int );
extern void send_function_to_child(void);
extern void send_buff_to_child(int );
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/src/include/event.H1 b/src/include/event.H1
deleted file mode 100644
index f748adbf..00000000
--- a/src/include/event.H1
+++ /dev/null
@@ -1,34 +0,0 @@
-extern void exitHyperDoc(void );
-extern void helpForHyperDoc(void );
-extern void mainEventLoop(void );
-extern void make_window_link(char * name);
-extern void quitHyperDoc(void );
-extern void get_new_window(void );
-#ifdef _EVENT_C
-static void set_cursor(HDWindow * window , Cursor state);
-static void change_cursor(Cursor state , HDWindow * window);
-static void create_window(void );
-static void downlink(void );
-static HyperDocPage * find_page(TextNode * node);
-static void handle_button(int button , XButtonEvent * event);
-static void handle_event(XEvent * event);
-static void handle_motion_event(XMotionEvent * event);
-static int HyperDocErrorHandler(Display * display , XErrorEvent * xe);
-static void init_cursor_states(void );
-static void killAxiomPage(HyperDocPage * page);
-static void make_busy_cursor(HDWindow * window);
-static void make_busy_cursors(void );
-static void memolink(void );
-static void set_error_handlers(void );
-static int set_window(Window window);
-static void clear_exposures(Window w);
-static void kill_page(HyperDocPage * page);
-static HyperDocPage * returnlink(void );
-static HyperDocPage * uplink(void );
-static void windowlink_handler(TextNode * node);
-static void lispwindowlink_handler(HyperLink * link);
-static HyperDocPage * paste_button(PasteNode * paste);
-static HyperLink * findButtonInList(HDWindow * window , int x , int y);
-static HyperLink * get_hyper_link(XButtonEvent * event);
-static void init_cursor_state(HDWindow * window);
-#endif
diff --git a/src/include/extent1.H1 b/src/include/extent1.H1
deleted file mode 100644
index aae58d18..00000000
--- a/src/include/extent1.H1
+++ /dev/null
@@ -1,37 +0,0 @@
-extern void compute_header_extent(HyperDocPage * page);
-extern void compute_footer_extent(HyperDocPage * page);
-extern void compute_scrolling_extent(HyperDocPage * page);
-extern void compute_title_extent(HyperDocPage * page);
-extern void compute_text_extent(TextNode * node);
-#ifdef _EXTENT1_C
-static void compute_begin_items_extent(TextNode * node);
-static void compute_bf_extent(TextNode * node);
-static void compute_box_extent(TextNode * node);
-static void compute_button_extent(TextNode * node);
-static void compute_center_extent(TextNode * node);
-static void compute_dash_extent(TextNode * node);
-static void compute_em_extent(TextNode * node);
-static void compute_ifcond_extent(TextNode * node);
-static void compute_image_extent(TextNode * node);
-static void compute_input_extent(TextNode * node);
-static void compute_ir_extent(TextNode * node);
-static void compute_it_extent(TextNode * node);
-static void compute_item_extent(TextNode * node);
-static void compute_mbox_extent(TextNode * node);
-static void compute_mitem_extent(TextNode * node);
-static void compute_paste_extent(TextNode * node);
-static void compute_pastebutton_extent(TextNode * node);
-static void compute_punctuation_extent(TextNode * node);
-static void compute_rm_extent(TextNode * node);
-static void compute_spadcommand_extent(TextNode * node);
-static void compute_spadsrc_extent(TextNode * node);
-static void compute_spadsrctxt_extent(TextNode * node);
-static void compute_table_extent(TextNode * * node);
-static void compute_verbatim_extent(TextNode * node);
-static void compute_word_extent(TextNode * node);
-static void end_spadcommand_extent(TextNode * node);
-static void end_spadsrc_extent(TextNode * node);
-static void endbutton_extent(TextNode * node);
-static void endif_extent(TextNode * node);
-static void endpastebutton_extent(TextNode * node);
-#endif
diff --git a/src/include/extent2.H1 b/src/include/extent2.H1
deleted file mode 100644
index c8d20d13..00000000
--- a/src/include/extent2.H1
+++ /dev/null
@@ -1,23 +0,0 @@
-extern void init_extents(void );
-extern void init_text(void );
-extern void init_title_extents(HyperDocPage * page);
-extern void insert_bitmap_file(TextNode * node);
-extern void insert_pixmap_file(TextNode * node);
-extern int max_x(TextNode * node , int Ender);
-extern int plh(int height);
-extern void start_newline(int distance , TextNode * node);
-extern int text_height(TextNode * node , int Ender);
-extern int text_width(TextNode * node , int Ender);
-extern int total_width(TextNode * node , int Ender);
-extern int trailing_space(TextNode * node);
-#ifdef _EXTENT2_C
-static void center_nodes(TextNode * begin_node , TextNode * end_node);
-static int input_string_width(TextNode * node);
-static int punctuation_width(TextNode * node);
-static int text_height1(TextNode * node , int Ender);
-static int verbatim_width(TextNode * node);
-static int width_of_dash(TextNode * node);
-static int word_width(TextNode * node);
-static int x_value(TextNode * node);
-#endif
-
diff --git a/src/include/fnct_key.H1 b/src/include/fnct_key.H1
index cf920e85..60bdcac8 100644
--- a/src/include/fnct_key.H1
+++ b/src/include/fnct_key.H1
@@ -1,6 +1,14 @@
+#ifdef __cplusplus
+extern "C" {
+#endif
+
extern void set_editor_key(void);
extern void define_function_keys(void);
extern int get_key(int , char * );
extern int get_str(int , char * );
extern void null_fnct(int );
extern void handle_function_key(int , int );
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/src/include/form_ext.H1 b/src/include/form_ext.H1
deleted file mode 100644
index c4c2db71..00000000
--- a/src/include/form_ext.H1
+++ /dev/null
@@ -1,8 +0,0 @@
-extern void compute_form_page(HyperDocPage * page);
-extern int window_width(int cols);
-#ifdef _FORM_EXT_C
-static int window_height(HyperDocPage * page);
-static void form_header_extent(HyperDocPage * page);
-static void form_footer_extent(HyperDocPage * page);
-static void form_scrolling_extent(HyperDocPage * page);
-#endif
diff --git a/src/include/group.H1 b/src/include/group.H1
deleted file mode 100644
index 99c15afd..00000000
--- a/src/include/group.H1
+++ /dev/null
@@ -1,14 +0,0 @@
-extern void bf_top_group(void );
-extern GroupItem * copy_group_stack(void );
-extern void em_top_group(void );
-extern void free_group_stack(GroupItem * g);
-extern void init_group_stack(void );
-extern void init_top_group(void );
-extern void line_top_group(void );
-extern int pop_group_stack(void );
-extern void push_active_group(void );
-extern void push_group_stack(void );
-extern void push_spad_group(void );
-extern void rm_top_group(void );
-extern void tt_top_group(void );
-extern void center_top_group(void );
diff --git a/src/include/halloc.h b/src/include/halloc.h
index 9ecd3aa0..6df64c31 100644
--- a/src/include/halloc.h
+++ b/src/include/halloc.h
@@ -1,7 +1,7 @@
/*
Copyright (C) 1991-2002, The Numerical Algorithms Group Ltd.
All rights reserved.
- Copyright (C) 2007-2008, Gabriel Dos Reis.
+ Copyright (C) 2007-2010, Gabriel Dos Reis.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -36,6 +36,14 @@
#ifndef OPENAXIOM_HALLOC
#define OPENAXIOM_HALLOC
+#ifdef __cplusplus
+extern "C" {
+#endif
+
extern char * halloc(int, const char*);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* OPENAXIOM_HALLOC */
diff --git a/src/include/hash.h b/src/include/hash.h
index 5c63b315..aadcec03 100644
--- a/src/include/hash.h
+++ b/src/include/hash.h
@@ -31,10 +31,12 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef _HASH_H_
-#define _HASH_H_ 1
-
+#ifndef OPENAXIOM_HASH_INCLUDED
+#define OPENAXIOM_HASH_INCLUDED
+#ifdef __cplusplus
+extern "C" {
+#endif
typedef struct HashEntry {
const char *key; /* pointer to key data */
@@ -67,4 +69,8 @@ extern char* hash_replace(HashTable*, char*, const char*);
extern int string_equal(const char*, const char*);
extern int string_hash(const char*, int size);
-#endif
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* OPENAXIOM_HASH_INCLUDED */
diff --git a/src/include/htinp.H1 b/src/include/htinp.H1
deleted file mode 100644
index dbd87d65..00000000
--- a/src/include/htinp.H1
+++ /dev/null
@@ -1,18 +0,0 @@
-extern void ht2_input(void );
-extern void make_record(void );
-extern void verify_record(void );
-extern char * strCopy(char * s);
-extern void print_paste_line(FILE * pfile , char * str);
-extern void get_spad_output(FILE * pfile , char * command , int com_type);
-extern void get_graph_output(char * command , char * pagename , int com_type);
-#ifdef _HTINP_C
-static void make_input_file_list(void );
-static char * make_input_file_name(char * buf , char * filename);
-static char * make_paste_file_name(char * buf , char * filename);
-static void make_the_input_file(UnloadedPage * page);
-static void make_input_file_from_page(HyperDocPage * page);
-static int inListAndNewer(char * inputFile , char * htFile);
-static void print_paste(FILE * pfile , char * realcom , char * command , char * pagename , int com_type);
-static void print_graph_paste(FILE * pfile , char * realcom , char * command , char * pagename , int com_type);
-static void send_command(char * command , int com_type);
-#endif
diff --git a/src/include/hyper.H1 b/src/include/hyper.H1
deleted file mode 100644
index e0350f6a..00000000
--- a/src/include/hyper.H1
+++ /dev/null
@@ -1,10 +0,0 @@
-extern void sigusr2_handler(int sig);
-extern void sigcld_handler(int sig);
-extern void clean_socket(void);
-extern int main(int argc , char * * argv);
-extern void init_page_structs(HDWindow * w);
-#ifdef _HYPER_C
-static void init_hash(void);
-static void make_server_connections(void);
-static void check_arguments(void);
-#endif
diff --git a/src/include/initx.H1 b/src/include/initx.H1
deleted file mode 100644
index 347d99ff..00000000
--- a/src/include/initx.H1
+++ /dev/null
@@ -1,17 +0,0 @@
-extern void change_text(int color , XFontStruct * font);
-extern int init_form_window(char * name , int cols);
-extern int init_top_window(char * name);
-extern void initializeWindowSystem(void);
-extern int is_it_850(XFontStruct * fontarg);
-#ifdef _INITX_C
-static void get_GCs(HDWindow * window);
-static int get_border_properties(void);
-static int get_color(char * name , char * class , int def , Colormap * map);
-static void ingItColors_and_fonts(void);
-static void load_font(XFontStruct * * font_info , char * fontname);
-static void mergeDatabases(void);
-static void open_form_window(void);
-static void open_window(Window w);
-static void set_name_and_icon(void);
-static void set_size_hints(Window w);
-#endif
diff --git a/src/include/input.H1 b/src/include/input.H1
deleted file mode 100644
index 99f79a35..00000000
--- a/src/include/input.H1
+++ /dev/null
@@ -1,11 +0,0 @@
-extern InputItem * return_item(char * name);
-extern void fill_box(Window w , ImageStruct * image);
-extern void toggle_input_box(HyperLink * link);
-extern void toggle_radio_box(HyperLink * link);
-extern void change_input_focus(HyperLink * link);
-extern void next_input_focus(void);
-extern void prev_input_focus(void);
-extern int delete_item(char * name);
-#ifdef _INPUT_C
-static void clear_rbs(InputBox * list);
-#endif
diff --git a/src/include/item.H1 b/src/include/item.H1
deleted file mode 100644
index e462d98f..00000000
--- a/src/include/item.H1
+++ /dev/null
@@ -1,5 +0,0 @@
-extern void push_item_stack(void);
-extern void clear_item_stack(void);
-extern void pop_item_stack(void);
-extern ItemStack * copy_item_stack(void);
-extern void free_item_stack(ItemStack * is);
diff --git a/src/include/keyin.H1 b/src/include/keyin.H1
deleted file mode 100644
index 0faab2fd..00000000
--- a/src/include/keyin.H1
+++ /dev/null
@@ -1,2 +0,0 @@
-extern void handle_key(XEvent * event);
-extern void init_keyin(void);
diff --git a/src/include/macro.H1 b/src/include/macro.H1
deleted file mode 100644
index f7853c72..00000000
--- a/src/include/macro.H1
+++ /dev/null
@@ -1,11 +0,0 @@
-extern void scan_HyperDoc(void);
-extern int number(char * str);
-extern ParameterList init_parameter_elem(int number);
-extern int push_parameters(ParameterList new);
-extern int pop_parameters(void);
-extern int parse_macro(void);
-extern void parse_parameters(void);
-#ifdef _MACRO_C
-static char * load_macro(MacroStore * macro);
-static void get_parameter_strings(int number , char * macro_name);
-#endif
diff --git a/src/include/mem.H1 b/src/include/mem.H1
deleted file mode 100644
index a8e1a11b..00000000
--- a/src/include/mem.H1
+++ /dev/null
@@ -1,32 +0,0 @@
-extern ButtonList * alloc_button_list(void);
-extern CondNode * alloc_condnode(void);
-extern HDWindow * alloc_hd_window(void);
-extern IfNode * alloc_ifnode(void);
-extern InputBox * alloc_inputbox(void);
-extern LineStruct * alloc_inputline(int size);
-extern TextNode * alloc_node(void);
-extern HyperDocPage * alloc_page(char * name);
-extern PasteNode * alloc_paste_node(char * name);
-extern RadioBoxes * alloc_rbs(void);
-extern void free_button_list(ButtonList * bl);
-extern void free_hd_window(HDWindow * w);
-extern void free_input_item(InputItem * sym , short des);
-extern void free_input_list(InputItem * il);
-extern void free_node(TextNode * node , short des);
-extern void free_page(HyperDocPage * page);
-extern void free_patch(PatchStore * p);
-extern void free_string(char * str);
-extern char * resizeBuffer(int size , char * oldBuf , int * oldSize);
-extern PatchStore * alloc_patchstore(void);
-#ifdef _MEM_C
-static void free_cond(CondNode * cond);
-static void free_depend(SpadcomDepend * sd);
-static void free_lines(LineStruct * lines);
-static void dont_free(void * link);
-static void free_if_non_NULL(void * p);
-static void free_input_box(InputBox * box);
-static void free_paste(PasteNode * paste , short des);
-static void free_pastearea(TextNode * node , short des);
-static void free_pastebutton(TextNode * node , short des);
-static void free_radio_boxes(RadioBoxes * radio);
-#endif
diff --git a/src/include/parse.H1 b/src/include/parse.H1
deleted file mode 100644
index fc2c346d..00000000
--- a/src/include/parse.H1
+++ /dev/null
@@ -1,20 +0,0 @@
-extern void display_page(HyperDocPage * page);
-extern void init_parse_patch(HyperDocPage * page);
-extern void load_page(HyperDocPage * page);
-extern void parse_HyperDoc(void );
-extern void parse_from_string(char * str);
-extern HyperDocPage * parse_page_from_socket(void );
-extern HyperDocPage * parse_page_from_unixfd(void );
-#ifdef _PARSE_C
-static void end_a_page(void );
-static HyperDocPage * format_page(UnloadedPage * ulpage);
-static void parse_page(HyperDocPage * page);
-static void parse_replacepage(void );
-static void start_footer(void );
-static void start_scrolling(void );
-static void Push_MR(void );
-static void Pop_MR(void );
-static void parse_title(HyperDocPage * page);
-static void parse_header(HyperDocPage * page);
-static void init_parse_page(HyperDocPage * page);
-#endif
diff --git a/src/include/parse_aux.H1 b/src/include/parse_aux.H1
deleted file mode 100644
index 4de9b249..00000000
--- a/src/include/parse_aux.H1
+++ /dev/null
@@ -1,18 +0,0 @@
-extern void add_dependencies(void );
-extern FILE * find_fp(FilePosition fp);
-extern char * get_input_string(void );
-extern HyperLink * make_link_window(TextNode * link_node , int type , int isSubWin);
-extern HyperLink * make_paste_window(PasteNode * paste);
-extern void make_special_pages(HashTable * pageHashTable);
-extern int window_code(Window * w , int size);
-extern int window_equal(Window * w1 , Window * w2);
-extern char * window_id(Window w);
-extern void read_ht_db(HashTable * page_hash , HashTable * macro_hash , HashTable * patch_hash);
-extern int get_filename(void);
-extern int is_number(char * str);
-extern void parser_error(char * str);
-extern int get_where(void);
-#ifdef _PARSE_AUX_C
-static void read_ht_file(HashTable * page_hash , HashTable * macro_hash , HashTable * patch_hash , FILE * db_fp , char * db_file);
-static HyperDocPage * make_special_page(int type , char * name);
-#endif
diff --git a/src/include/parse_input.H1 b/src/include/parse_input.H1
deleted file mode 100644
index b837f89e..00000000
--- a/src/include/parse_input.H1
+++ /dev/null
@@ -1,16 +0,0 @@
-extern HyperLink * make_input_window(InputItem * item);
-extern HyperLink * make_box_window(InputBox * box , int type);
-extern void initialize_default(InputItem * item , char * buff);
-extern void parse_inputstring(void);
-extern void parse_simplebox(void);
-extern void parse_radiobox(void);
-extern void init_paste_item(InputItem * item);
-extern void repaste_item(void);
-extern InputItem * current_item(void);
-extern int already_there(char * name);
-extern void parse_radioboxes(void);
-#ifdef _PARSE_INPUT_C
-static void insert_item(InputItem * item);
-static void add_box_to_rb_list(char * name , InputBox * box);
-static int check_others(InputBox * list);
-#endif
diff --git a/src/include/parse_paste.H1 b/src/include/parse_paste.H1
deleted file mode 100644
index 771e995e..00000000
--- a/src/include/parse_paste.H1
+++ /dev/null
@@ -1,6 +0,0 @@
-extern void parse_paste(void);
-extern void parse_pastebutton(void);
-extern HyperDocPage * parse_patch(PasteNode * paste);
-#ifdef _PARSE_PASTE_C
-static void load_patch(PatchStore * patch);
-#endif
diff --git a/src/include/parse_types.H1 b/src/include/parse_types.H1
deleted file mode 100644
index 1dca22f8..00000000
--- a/src/include/parse_types.H1
+++ /dev/null
@@ -1,25 +0,0 @@
-extern void parse_begin_items(void );
-extern void parse_box(void );
-extern void parse_button(void );
-extern void parse_centerline(void );
-extern void parse_command(void );
-extern void parse_env(TextNode * node);
-extern void parse_free(void );
-extern void parse_help(void );
-extern void parse_ifcond(void );
-extern void parse_input_pix(void );
-extern void parse_item(void );
-extern void parse_mbox(void );
-extern void parse_mitem(void );
-extern void parse_newcond(void );
-extern void parse_setcond(void );
-extern void parse_spadcommand(TextNode * spad_node);
-extern void parse_spadsrc(TextNode * spad_node);
-extern void parse_table(void );
-extern void parse_value1(void );
-extern void parse_value2(void );
-extern void parse_verbatim(int type);
-#ifdef _PARSE_TYPES_C
-static void parse_condnode(void );
-static void parse_hasreturnto(void );
-#endif
diff --git a/src/include/pixmap.H1 b/src/include/pixmap.H1
deleted file mode 100644
index 77c08cd2..00000000
--- a/src/include/pixmap.H1
+++ /dev/null
@@ -1,4 +0,0 @@
-extern int file_exists(char * );
-extern FILE * zzopen(char * , char * );
-extern void write_pixmap_file(Display * , int , char * , Window , int , int , int , int );
-extern int read_pixmap_file(Display * , int , char * , XImage * * , int * , int * );
diff --git a/src/include/pixmap.h b/src/include/pixmap.h
new file mode 100644
index 00000000..86f34437
--- /dev/null
+++ b/src/include/pixmap.h
@@ -0,0 +1,53 @@
+/*
+ Copyright (C) 1991-2002, The Numerical Algorithms Group Ltd.
+ All rights reserved.
+ Copyright (C) 2007-2008, Gabriel Dos Reis.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+
+ - Neither the name of The Numerical Algorithms Group Ltd. nor the
+ names of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+ OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef OPENAXIOM_PIXMAP_included
+#define OPENAXIOM_PIXMAP_included
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern int file_exists(char * );
+extern FILE * zzopen(char * , char * );
+extern void write_pixmap_file(Display * , int , char * , Window , int , int , int , int );
+extern int read_pixmap_file(Display * , int , char * , XImage * * , int * , int * );
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/src/include/prt.H1 b/src/include/prt.H1
index 5c76fd80..061c11ba 100644
--- a/src/include/prt.H1
+++ b/src/include/prt.H1
@@ -1,3 +1,7 @@
+#ifdef __cplusplus
+extern "C" {
+#endif
+
extern void myputchar(char );
extern void clear_buff(void);
extern void move_end(void);
@@ -17,3 +21,7 @@ extern void print_whole_buff(void);
extern void move_ahead(void);
extern void move_back(void);
extern void back_over_current_char(void);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/src/include/rgb.h b/src/include/rgb.h
index cd3cd72b..758969df 100644
--- a/src/include/rgb.h
+++ b/src/include/rgb.h
@@ -31,6 +31,9 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#ifndef OPENAXIOM_RGB_included
+#define OPENAXIOM_RGB_included
+
typedef struct _RGB {
float r,g,b;
} RGB ;
@@ -44,8 +47,4 @@ typedef struct _HLS {
} HLS ;
-
-
-
-
-
+#endif
diff --git a/src/include/scrollbar.H1 b/src/include/scrollbar.H1
deleted file mode 100644
index 76a9ed43..00000000
--- a/src/include/scrollbar.H1
+++ /dev/null
@@ -1,19 +0,0 @@
-extern void calculateScrollBarMeasures(void );
-extern void drawScrollLines(void );
-extern void hideScrollBars(HDWindow * hdWindow);
-extern void getScrollBarMinimumSize(int * width , int * height);
-extern void linkScrollBars(void );
-extern void makeScrollBarWindows(void );
-extern void moveScroller(HDWindow * hdWindow);
-extern void scrollDown(void );
-extern void scrollDownPage(void );
-extern void scrollScroller(XButtonEvent * event);
-extern void scrollToFirstPage(void );
-extern void scrollUp(void );
-extern void scrollUpPage(void );
-extern void showScrollBars(HDWindow * hdWindow);
-#ifdef _SCROLLBAR_C
-static int ch(int height);
-static void changeWindowBackgroundPixmap(Window window , Pixmap pixmap);
-static void drawScroller3DEffects(HDWindow * hdWindow , int x1 , int y1 , int x2 , int y2);
-#endif
diff --git a/src/include/show_types.H1 b/src/include/show_types.H1
deleted file mode 100644
index 1c125f2c..00000000
--- a/src/include/show_types.H1
+++ /dev/null
@@ -1,10 +0,0 @@
-extern void show_text(TextNode * node , int Ender);
-#ifdef _SHOW_TYPES_C
-static void show_image(TextNode * node , GC gc);
-static void show_input(TextNode * node);
-static void show_link(TextNode * node);
-static void show_paste(TextNode * node);
-static void show_pastebutton(TextNode * node);
-static void show_simple_box(TextNode * node);
-static void show_spadcommand(TextNode * node);
-#endif
diff --git a/src/include/sockio.h b/src/include/sockio.h
index f618dbc4..07d9097a 100644
--- a/src/include/sockio.h
+++ b/src/include/sockio.h
@@ -53,6 +53,11 @@
#include "openaxiom-c-macros.h"
#include "open-axiom.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
/* On Windows, a socket identifier is not a file descriptor. It is
represented by an integer type, but that integer type is not just
plain int as in the Unix world. It is an unsigned integer.
@@ -221,4 +226,8 @@ OPENAXIOM_EXPORT extern fd_set socket_mask;
OPENAXIOM_EXPORT extern fd_set server_mask;
+#ifdef __cplusplus
+}
+#endif
+
#endif /* OPENAXIOM_SOCKIO_included */
diff --git a/src/include/spadcolors.H1 b/src/include/spadcolors.H1
deleted file mode 100644
index 39a2317a..00000000
--- a/src/include/spadcolors.H1
+++ /dev/null
@@ -1,9 +0,0 @@
-extern RGB HSVtoRGB(HSV );
-extern RGB HLStoRGB(HLS );
-extern float value(float , float , float );
-extern int makeColors(Display * , int , Colormap * , unsigned long * * , int * );
-extern int makePermVector(Display * , int , unsigned long * * );
-extern int makeNewColorMap(Display * , Colormap , int );
-extern unsigned long XPixelColor(int );
-extern void FreePixels(Display * , Colormap , int );
-extern int AllocCells(Display * , Colormap , int );
diff --git a/src/include/spadcolors.h b/src/include/spadcolors.h
index 43047242..c244cc6f 100644
--- a/src/include/spadcolors.h
+++ b/src/include/spadcolors.h
@@ -31,7 +31,16 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <X11/X.h>
+#ifndef OPENAXIOM_SPADCOLORS_included
+#define OPENAXIOM_SPADCOLORS_included
+
+#include <X11/Xlib.h>
+#include "rgb.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define numOfColors 240
#define totalHuesConst 27
#define totalShadesConst 5
@@ -41,9 +50,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define numPlanes 1
#define numColors 10
#define startColor 0
-#define endColor startColor+numColors
+#define endColor (startColor+numColors)
-#define colorStep (maxColors+1)/numColors
+#define colorStep ((maxColors+1)/numColors)
#define yes 1
#define no 0
@@ -51,9 +60,19 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define smoothConst 50
#define saymem(a,b,c) saymemWithLine(a,b,c,0)
#define Colorcells 256 /* KF number of elements in permutation vector */
-#define shade 5
+/* #define shade 5 */
#define saturation 0.8
+extern RGB HSVtoRGB(HSV );
+extern RGB HLStoRGB(HLS );
+extern float value(float , float , float );
+extern int makeColors(Display * , int , Colormap * , unsigned long * * , int * );
+extern int makePermVector(Display * , int , unsigned long * * );
+extern int makeNewColorMap(Display * , Colormap , int );
+extern unsigned long XPixelColor(int );
+extern void FreePixels(Display * , Colormap , int );
+extern int AllocCells(Display * , Colormap , int );
+
extern int smoothHue;
extern Colormap colorMap;
extern int num;
@@ -61,4 +80,11 @@ extern int scrn;
#define maxColors DisplayCells(dsply,scrn)-1
-#include "rgb.h"
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* OPENAXIOM_SPADCOLORS_included */
diff --git a/src/include/spadint.H1 b/src/include/spadint.H1
deleted file mode 100644
index e1ba6165..00000000
--- a/src/include/spadint.H1
+++ /dev/null
@@ -1,25 +0,0 @@
-extern HyperDocPage * issue_server_command(HyperLink * link);
-extern HyperDocPage * issue_unixlink(TextNode * node);
-extern char * print_to_string(TextNode * command);
-extern void issue_spadcommand(HyperDocPage * page , TextNode * command , int immediate , int type);
-extern openaxiom_sio * accept_menu_connection(openaxiom_sio * server_sock);
-extern char * print_to_string1(TextNode * command , int * sizeBuf);
-extern int issue_serverpaste(TextNode * command);
-extern void issue_unixcommand(TextNode * node);
-extern int issue_unixpaste(TextNode * node);
-extern void service_session_socket(void);
-extern void send_lisp_command(char * command);
-extern void escape_string(char * s);
-extern void unescape_string(char * s);
-extern char * print_source_to_string1(TextNode * command , int * sizeBuf);
-extern char * print_source_to_string(TextNode * command);
-#ifdef _SPADINT_C
-static void start_user_buffer(HyperDocPage * page);
-static void clear_execution_marks(HashTable * depend_hash);
-static void issue_dependent_commands(HyperDocPage * page , TextNode * command , int type);
-static void send_pile(openaxiom_sio * sock , char * str);
-static void mark_as_executed(HyperDocPage * page , TextNode * command , int type);
-static void accept_menu_server_connection(HyperDocPage * page);
-static void switch_frames(void );
-static void close_client(int pid);
-#endif
diff --git a/src/include/titlebar.H1 b/src/include/titlebar.H1
deleted file mode 100644
index b5d564c1..00000000
--- a/src/include/titlebar.H1
+++ /dev/null
@@ -1,7 +0,0 @@
-extern void getTitleBarMinimumSize(int * width , int * height);
-extern void linkTitleBarWindows(void);
-extern void makeTitleBarWindows(void);
-extern void showTitleBar(void);
-#ifdef _TITLEBAR_C
-static void readTitleBarImages(void);
-#endif
diff --git a/src/include/util.H1 b/src/include/util.H1
index bed0da32..c60bd374 100644
--- a/src/include/util.H1
+++ b/src/include/util.H1
@@ -1,6 +1,14 @@
+#ifdef __cplusplus
+extern "C" {
+#endif
+
extern int checker(int , int , char * );
extern char * getmemWithLine(int , char * , int );
extern char * saymemWithLine(char * , int , int , int );
extern void myfree(void * , int );
extern XPoint getWindowPositionXY(Display * , Window );
extern XPoint getWindowSizeXY(Display * , Window );
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/src/include/wct.H1 b/src/include/wct.H1
index b156c430..1f403594 100644
--- a/src/include/wct.H1
+++ b/src/include/wct.H1
@@ -1,3 +1,7 @@
+#ifdef __cplusplus
+extern "C" {
+#endif
+
extern time_t ftime(char * );
extern void fatal(char * , char * );
extern off_t fsize(char * );
@@ -24,3 +28,7 @@ extern void skim_wct(void);
extern void rescan_wct(void);
extern void find_wct(void);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/src/lib/XSpadFill.c b/src/lib/XSpadFill.c
index 1487d95b..6a332dba 100644
--- a/src/lib/XSpadFill.c
+++ b/src/lib/XSpadFill.c
@@ -1,7 +1,7 @@
/*
Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd.
All rights reserved.
- Copyright (C) Gabriel Dos Reis.
+ Copyright (C) 2007-2010, Gabriel Dos Reis.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -49,8 +49,6 @@
*/
-#include "openaxiom-c-macros.h"
-
#include <stdio.h>
#include <stdlib.h>
@@ -60,12 +58,11 @@
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
+#include "openaxiom-c-macros.h"
#include "spadcolors.h"
-
#include "XSpadFill.H1"
#include "XShade.H1"
#include "XDither.H1"
-#include "spadcolors.H1"
extern unsigned long *spadColors;
static GC stippleGC, solidGC;
diff --git a/src/lib/pixmap.c b/src/lib/pixmap.c
index de24d8e3..bc1f548f 100644
--- a/src/lib/pixmap.c
+++ b/src/lib/pixmap.c
@@ -1,6 +1,8 @@
/*
Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd.
All rights reserved.
+ Copyright (C) 2007-2010, Gabriel Dos Reis.
+ All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -46,10 +48,9 @@
#include "spadcolors.h"
-
#include "halloc.h"
-#include "pixmap.H1"
-#include "spadcolors.H1"
+#include "pixmap.h"
+#include "spadcolors.h"
diff --git a/src/lib/spadcolors.c b/src/lib/spadcolors.c
index db4a8647..b8d784f2 100644
--- a/src/lib/spadcolors.c
+++ b/src/lib/spadcolors.c
@@ -1,6 +1,8 @@
/*
Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd.
All rights reserved.
+ Copyright (C) 2007-2010, Gabriel Dos Reis.
+ All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -39,7 +41,7 @@
#include <stdlib.h>
#include <math.h>
-#include "spadcolors.H1"
+#include "spadcolors.h"
#include "util.H1"
#if 0