Skip to content

Commit

Permalink
Misc. fixes
Browse files Browse the repository at this point in the history
With the siwtch to a C++ compiler, the AC_PATH_XTRA has become less
effective as it internally relies on the C compiler invokation.  Fixed
CXXFLAGS, CPPFLAGS, and LDFLAGS when detecting <X11/xpm.h> usability.

Various bitmasks in src/hyper and src/graph were bogusly using 'char'
(instead of 'unsigned char') when they specify values larger than 127.
Caught by the C++ compiler, thanks to no-narrowing conversion.  Fixed.

Eventually the X11-based HD interface and graphics should be replaced
by a more modern GUI interface.
  • Loading branch information
GabrielDosReis committed Jan 24, 2016
1 parent c8d6a86 commit ffe9a03
Show file tree
Hide file tree
Showing 20 changed files with 60 additions and 50 deletions.
1 change: 0 additions & 1 deletion Makefile.in
Expand Up @@ -370,7 +370,6 @@ TOUCH = @TOUCH@
VERSION = @VERSION@
XMKMF = @XMKMF@
X_CFLAGS = @X_CFLAGS@
X_CLFAGS = @X_CLFAGS@
X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
Expand Down
15 changes: 9 additions & 6 deletions config/open-axiom.m4
Expand Up @@ -1009,12 +1009,6 @@ dnl 4. checks for special X11R6 libraries that need to be linked before
dnl the flag [[-lX11]].
AC_DEFUN([OPENAXIOM_CHECK_X11],[
AC_PATH_XTRA
## Output directives for the C compiler
AC_SUBST(X_CLFAGS)
## Output directives for the linker
AC_SUBST(X_LIBS)
## Output any extra libraries required by X11
AC_SUBST(X_EXTRA_LIBS)
## Finally, output the list of libraries that need to appear before -lX11
## Some part of OpenAxiom depends on Xpm. That library has kind of uncertain
Expand All @@ -1035,10 +1029,19 @@ oa_use_x=no
if test x"$no_x" = xyes; then
AC_MSG_NOTICE([The Graphics component is disabled.])
else
oa_saved_cxxflags=$CXXFLAGS
oa_saved_cppflags=$CPPFLAGS
oa_saved_ldflags=$LDFLAGS
CXXFLAGS="$CXXFLAGS $X_CFLAGS"
CPPFLAGS="$CPPFLAGS $X_CFLAGS"
LDFLAGS="$X_PRE_LIBS $X_LIBS $X_EXTRA_LIBS"
AC_CHECK_HEADERS([X11/xpm.h],[],
[AC_MSG_ERROR([The header <X11/xpm.h> could not be found. Install Xpm development package and re-start the configuration process.])])
oa_use_x=yes
oa_c_runtime="$oa_c_runtime graphics"
LDFLAGS=$oa_saved_ldflags
CPPFLAGS=$oa_saved_cppflags
CXXFLAGS=$oa_saved_cxxflags
fi
AC_SUBST(oa_use_x)
])
Expand Down
36 changes: 19 additions & 17 deletions configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for OpenAxiom 1.5.0-2016-01-16.
# Generated by GNU Autoconf 2.69 for OpenAxiom 1.5.0-2016-01-24.
#
# Report bugs to <open-axiom-bugs@lists.sf.net>.
#
Expand Down Expand Up @@ -590,8 +590,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='OpenAxiom'
PACKAGE_TARNAME='openaxiom'
PACKAGE_VERSION='1.5.0-2016-01-16'
PACKAGE_STRING='OpenAxiom 1.5.0-2016-01-16'
PACKAGE_VERSION='1.5.0-2016-01-24'
PACKAGE_STRING='OpenAxiom 1.5.0-2016-01-24'
PACKAGE_BUGREPORT='open-axiom-bugs@lists.sf.net'
PACKAGE_URL=''

Expand Down Expand Up @@ -652,7 +652,6 @@ oa_host_has_regex
OA_QT_QMAKE
OA_QT_MOC
oa_use_x
X_CLFAGS
X_EXTRA_LIBS
X_LIBS
X_PRE_LIBS
Expand Down Expand Up @@ -1421,7 +1420,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.5.0-2016-01-16 to adapt to many kinds of systems.
\`configure' configures OpenAxiom 1.5.0-2016-01-24 to adapt to many kinds of systems.

Usage: $0 [OPTION]... [VAR=VALUE]...

Expand Down Expand Up @@ -1496,7 +1495,7 @@ fi

if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of OpenAxiom 1.5.0-2016-01-16:";;
short | recursive ) echo "Configuration of OpenAxiom 1.5.0-2016-01-24:";;
esac
cat <<\_ACEOF

Expand Down Expand Up @@ -1613,7 +1612,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
OpenAxiom configure 1.5.0-2016-01-16
OpenAxiom configure 1.5.0-2016-01-24
generated by GNU Autoconf 2.69

Copyright (C) 2012 Free Software Foundation, Inc.
Expand Down Expand Up @@ -2430,7 +2429,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.5.0-2016-01-16, which was
It was created by OpenAxiom $as_me 1.5.0-2016-01-24, which was
generated by GNU Autoconf 2.69. Invocation command line was

$ $0 $@
Expand Down Expand Up @@ -3449,7 +3448,7 @@ fi

# Define the identity of the package.
PACKAGE='openaxiom'
VERSION='1.5.0-2016-01-16'
VERSION='1.5.0-2016-01-24'


cat >>confdefs.h <<_ACEOF
Expand Down Expand Up @@ -18978,12 +18977,6 @@ fi

fi

## Output directives for the C compiler

## Output directives for the linker

## Output any extra libraries required by X11


## Finally, output the list of libraries that need to appear before -lX11
## Some part of OpenAxiom depends on Xpm. That library has kind of uncertain
Expand All @@ -19005,6 +18998,12 @@ if test x"$no_x" = xyes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: The Graphics component is disabled." >&5
$as_echo "$as_me: The Graphics component is disabled." >&6;}
else
oa_saved_cxxflags=$CXXFLAGS
oa_saved_cppflags=$CPPFLAGS
oa_saved_ldflags=$LDFLAGS
CXXFLAGS="$CXXFLAGS $X_CFLAGS"
CPPFLAGS="$CPPFLAGS $X_CFLAGS"
LDFLAGS="$X_PRE_LIBS $X_LIBS $X_EXTRA_LIBS"
for ac_header in X11/xpm.h
do :
ac_fn_cxx_check_header_mongrel "$LINENO" "X11/xpm.h" "ac_cv_header_X11_xpm_h" "$ac_includes_default"
Expand All @@ -19021,6 +19020,9 @@ done

oa_use_x=yes
oa_c_runtime="$oa_c_runtime graphics"
LDFLAGS=$oa_saved_ldflags
CPPFLAGS=$oa_saved_cppflags
CXXFLAGS=$oa_saved_cxxflags
fi


Expand Down Expand Up @@ -20053,7 +20055,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=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.5.0-2016-01-16, which was
This file was extended by OpenAxiom $as_me 1.5.0-2016-01-24, which was
generated by GNU Autoconf 2.69. Invocation command line was

CONFIG_FILES = $CONFIG_FILES
Expand Down Expand Up @@ -20123,7 +20125,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
OpenAxiom config.status 1.5.0-2016-01-16
OpenAxiom config.status 1.5.0-2016-01-24
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"

Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Expand Up @@ -33,7 +33,7 @@ dnl Makefiles for building OpenAxiom interpreter, compiler, libraries, and
dnl auxiliary tools where appropriate.
dnl

AC_INIT([OpenAxiom], [1.5.0-2016-01-16],
AC_INIT([OpenAxiom], [1.5.0-2016-01-24],
[open-axiom-bugs@lists.sf.net])

dnl Most of the macros used in this configure.ac are defined in files
Expand Down
1 change: 0 additions & 1 deletion src/Makefile.in
Expand Up @@ -302,7 +302,6 @@ TOUCH = @TOUCH@
VERSION = @VERSION@
XMKMF = @XMKMF@
X_CFLAGS = @X_CFLAGS@
X_CLFAGS = @X_CLFAGS@
X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
Expand Down
1 change: 0 additions & 1 deletion src/algebra/Makefile.in
Expand Up @@ -486,7 +486,6 @@ TOUCH = @TOUCH@
VERSION = @VERSION@
XMKMF = @XMKMF@
X_CFLAGS = @X_CFLAGS@
X_CLFAGS = @X_CLFAGS@
X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
Expand Down
1 change: 0 additions & 1 deletion src/boot/Makefile.in
Expand Up @@ -330,7 +330,6 @@ TOUCH = @TOUCH@
VERSION = @VERSION@
XMKMF = @XMKMF@
X_CFLAGS = @X_CFLAGS@
X_CLFAGS = @X_CLFAGS@
X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
Expand Down
2 changes: 1 addition & 1 deletion src/graph/include/light11.mask
Expand Up @@ -2,7 +2,7 @@
#define lightMask_height 16
#define lightMask_x_hot 8
#define lightMask_y_hot 0
static char lightMask_bits[] = {
static unsigned char lightMask_bits[] = {
0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x04, 0x40, 0xc8, 0x27, 0x20, 0x08,
0x10, 0x11, 0x96, 0x12, 0x90, 0xd2, 0x90, 0x10, 0x24, 0x09, 0x42, 0x45,
0x40, 0x85, 0x80, 0x03, 0x80, 0x02, 0x00, 0x01};
2 changes: 1 addition & 1 deletion src/hyper/ht_icon
Expand Up @@ -2,7 +2,7 @@
#define ht_icon_height 40
#define ht_icon_x_hot -1
#define ht_icon_y_hot -1
static char ht_icon_bits[] = {
static unsigned char ht_icon_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xf7, 0x00, 0x00, 0x00, 0x00, 0xe7, 0x00, 0x00, 0x00,
0x00, 0xe7, 0x00, 0x00, 0x00, 0x00, 0xe7, 0xef, 0x7b, 0x3c, 0xe7, 0xff,
Expand Down
11 changes: 10 additions & 1 deletion src/hyper/hyper.h
@@ -1,7 +1,7 @@
/*
Copyright (C) 1991-2002, The Numerical Algorithms Group Ltd.
All rights reserved.
Copyright (C) 2007-2010, Gabriel Dos Reis.
Copyright (C) 2007-2016, Gabriel Dos Reis.
All rights reserved.
Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -303,4 +303,13 @@ extern GroupItem *gTopOfGroupStack;

extern HyperDocPage *gPageBeingParsed;


// Kludge between the more correct 'array of unsigned char' incoming data,
// and the unprincipled 'pointer to char' parameters of several X11
// functions below.
template<int N>
inline const char* as_chars(const unsigned char (&ary)[N]) {
return reinterpret_cast<const char*>(&ary[0]);
}

#endif
14 changes: 8 additions & 6 deletions src/hyper/initx.c
@@ -1,7 +1,7 @@
/*
Copyright (C) 1991-2002, The Numerical Algorithms Group Ltd.
All rights reserved.
Copyright (C) 2007-2012, Gabriel Dos Reis.
Copyright (C) 2007-2016, Gabriel Dos Reis.
All rights reserved.
Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -86,6 +86,7 @@ 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;
int scrn; /* used in spad_colors */
Expand Down Expand Up @@ -176,11 +177,11 @@ initializeWindowSystem(void)
/* fprintf(stderr,"initx:initializeWindowSystem:XCreateBitmapFromData 1\n");*/
mousebits = XCreateBitmapFromData(gXDisplay,
RootWindow(gXDisplay, gXScreenNumber),
mouseBitmap_bits, mouseBitmap_width,mouseBitmap_height);
as_chars(mouseBitmap_bits), mouseBitmap_width,mouseBitmap_height);
/* fprintf(stderr,"initx:initializeWindowSystem:XCreateBitmapFromData 2\n");*/
mousemask = XCreateBitmapFromData(gXDisplay,
RootWindow(gXDisplay, gXScreenNumber),
mouseMask_bits, mouseMask_width,mouseMask_height);
as_chars(mouseMask_bits), mouseMask_width,mouseMask_height);
/* fprintf(stderr,"initx:initializeWindowSystem:XCreateBitmapFromData 2\n");*/
gActiveCursor = XCreatePixmapCursor(gXDisplay,
mousebits, mousemask, &fg, &bg,
Expand Down Expand Up @@ -396,7 +397,8 @@ set_name_and_icon(void)
XStoreName(gXDisplay, gWindow->fMainWindow, "HyperDoc");

/* define and assign the pixmap for the icon */
icon_pixmap = XCreateBitmapFromData(gXDisplay, gWindow->fMainWindow, ht_icon_bits,
icon_pixmap = XCreateBitmapFromData(gXDisplay, gWindow->fMainWindow,
as_chars(ht_icon_bits),
ht_icon_width, ht_icon_height);
wmhints.icon_pixmap = icon_pixmap;
wmhints.flags = IconPixmapHint;
Expand Down Expand Up @@ -592,7 +594,7 @@ set_size_hints(Window w)

#define stipple_width 4
#define stipple_height 4
static char stipple_bits[] = {
static unsigned char stipple_bits[] = {
0xff, 0xff, 0xff, 0xff};
Pixmap stipple;

Expand All @@ -615,7 +617,7 @@ get_GCs(HDWindow *window)

stipple = XCreateBitmapFromData(gXDisplay,
RootWindow(gXDisplay, gXScreenNumber),
stipple_bits, stipple_width, stipple_height);
as_chars(stipple_bits), stipple_width, stipple_height);

values.background = gInputBackgroundColor;
values.foreground = gInputForegroundColor;
Expand Down
2 changes: 1 addition & 1 deletion src/hyper/mouse11.bitmap
Expand Up @@ -2,7 +2,7 @@
#define mouseBitmap_height 16
#define mouseBitmap_x_hot 8
#define mouseBitmap_y_hot 0
static char mouseBitmap_bits[] = {
static unsigned char mouseBitmap_bits[] = {
0x00, 0x01, 0x00, 0x01, 0x80, 0x02, 0x40, 0x04, 0xc0, 0x06, 0x20, 0x08,
0x20, 0x08, 0x30, 0x18, 0x50, 0x14, 0x58, 0x34, 0x90, 0x12, 0x20, 0x08,
0xc0, 0x47, 0x00, 0x21, 0x80, 0x10, 0x00, 0x0f};
2 changes: 1 addition & 1 deletion src/hyper/mouse11.mask
@@ -1,6 +1,6 @@
#define mouseMask_width 16
#define mouseMask_height 16
static char mouseMask_bits[] = {
static unsigned char mouseMask_bits[] = {
0x00, 0x01, 0x00, 0x01, 0x80, 0x03, 0xc0, 0x07, 0xc0, 0x07, 0xe0, 0x0f,
0xe0, 0x0f, 0xf0, 0x1f, 0xf0, 0x1f, 0xf8, 0x3f, 0xf0, 0x1f, 0xe0, 0x0f,
0xc0, 0x47, 0x00, 0x21, 0x80, 0x10, 0x00, 0x0f};
10 changes: 5 additions & 5 deletions src/hyper/scrollbar.c
@@ -1,7 +1,7 @@
/*
Copyright (C) 1991-2002, The Numerical Algorithms Group Ltd.
All rights reserved.
Copyright (C) 2007-2010, Gabriel Dos Reis.
Copyright (C) 2007-2016, Gabriel Dos Reis.
All rights reserved.
Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -183,29 +183,29 @@ makeScrollBarWindows(void)
sup = XCreatePixmapFromBitmapData(
gXDisplay,
RootWindow(gXDisplay, gXScreenNumber),
sup_bits, supwidth, supheight,
const_cast<char*>(as_chars(sup_bits)), supwidth, supheight,
FORECOLOR, BACKCOLOR,
DefaultDepth(gXDisplay, gXScreenNumber));

if (sdown == 0)
sdown = XCreatePixmapFromBitmapData(
gXDisplay,
RootWindow(gXDisplay, gXScreenNumber),
sdown_bits, sdown_width, sdown_height,
const_cast<char*>(as_chars(sdown_bits)), sdown_width, sdown_height,
FORECOLOR, BACKCOLOR,
DefaultDepth(gXDisplay, gXScreenNumber));

if (CONTROLS_3D) {
sup_pressed = XCreatePixmapFromBitmapData(
gXDisplay,
RootWindow(gXDisplay, gXScreenNumber),
sup3dpr_bits, sup3dpr_width, sup3dpr_height,
const_cast<char*>(as_chars(sup3dpr_bits)), sup3dpr_width, sup3dpr_height,
FORECOLOR, BACKCOLOR,
DefaultDepth(gXDisplay, gXScreenNumber));
sdown_pressed = XCreatePixmapFromBitmapData(
gXDisplay,
RootWindow(gXDisplay, gXScreenNumber),
sdown3dpr_bits, sdown3dpr_width, sdown3dpr_height,
const_cast<char*>(as_chars(sdown3dpr_bits)), sdown3dpr_width, sdown3dpr_height,
FORECOLOR, BACKCOLOR,
DefaultDepth(gXDisplay, gXScreenNumber));
}
Expand Down
2 changes: 1 addition & 1 deletion src/hyper/sdown3d.bitmap
@@ -1,6 +1,6 @@
#define sdown3d_width 21
#define sdown3d_height 21
static char sdown3d_bits[] = {
static unsigned char sdown3d_bits[] = {
0xaa, 0xaa, 0x0a, 0x55, 0x55, 0x15, 0x02, 0x00, 0x0c, 0x51, 0x55, 0x15,
0xaa, 0xaa, 0x0e, 0x51, 0x5f, 0x15, 0xaa, 0xae, 0x0e, 0x51, 0x5f, 0x15,
0xaa, 0xae, 0x0e, 0x51, 0x5f, 0x15, 0xea, 0xff, 0x0e, 0xd1, 0x7f, 0x15,
Expand Down
2 changes: 1 addition & 1 deletion src/hyper/sdown3dpr.bitmap
@@ -1,6 +1,6 @@
#define sdown3dpr_width 21
#define sdown3dpr_height 21
static char sdown3dpr_bits[] = {
static unsigned char sdown3dpr_bits[] = {
0xaa, 0xaa, 0x0a, 0x55, 0x55, 0x15, 0xfe, 0xff, 0x0f, 0x55, 0x55, 0x11,
0xae, 0xaa, 0x0a, 0x55, 0x55, 0x11, 0xae, 0xbe, 0x0a, 0x55, 0x5d, 0x11,
0xae, 0xbe, 0x0a, 0x55, 0x5d, 0x11, 0xae, 0xbe, 0x0a, 0xd5, 0xff, 0x11,
Expand Down
2 changes: 1 addition & 1 deletion src/hyper/sup3d.bitmap
@@ -1,6 +1,6 @@
#define sup3d_width 21
#define sup3d_height 21
static char sup3d_bits[] = {
static unsigned char sup3d_bits[] = {
0xaa, 0xaa, 0x0a, 0x55, 0x55, 0x15, 0x02, 0x00, 0x0c, 0x51, 0x55, 0x15,
0xaa, 0xaa, 0x0e, 0x51, 0x55, 0x15, 0xaa, 0xae, 0x0e, 0x51, 0x5f, 0x15,
0xaa, 0xbf, 0x0e, 0xd1, 0x7f, 0x15, 0xea, 0xff, 0x0e, 0x51, 0x5f, 0x15,
Expand Down
2 changes: 1 addition & 1 deletion src/hyper/sup3dpr.bitmap
@@ -1,6 +1,6 @@
#define sup3dpr_width 21
#define sup3dpr_height 21
static char sup3dpr_bits[] = {
static unsigned char sup3dpr_bits[] = {
0xaa, 0xaa, 0x0a, 0x55, 0x55, 0x15, 0xfe, 0xff, 0x0f, 0x55, 0x55, 0x11,
0xae, 0xaa, 0x0a, 0x55, 0x55, 0x11, 0xae, 0xaa, 0x0a, 0x55, 0x5d, 0x11,
0xae, 0xbe, 0x0a, 0x55, 0x7f, 0x11, 0xae, 0xff, 0x0a, 0xd5, 0xff, 0x11,
Expand Down
1 change: 0 additions & 1 deletion src/rt/Makefile.in
Expand Up @@ -292,7 +292,6 @@ TOUCH = @TOUCH@
VERSION = @VERSION@
XMKMF = @XMKMF@
X_CFLAGS = @X_CFLAGS@
X_CLFAGS = @X_CLFAGS@
X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
Expand Down

0 comments on commit ffe9a03

Please sign in to comment.