aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.h.in3
-rwxr-xr-xconfigure32
-rw-r--r--configure.ac10
-rw-r--r--src/Makefile.am9
-rw-r--r--src/Makefile.in22
-rw-r--r--src/dirax.c58
-rw-r--r--src/dirax.h9
-rw-r--r--src/hdfsee.c1
-rw-r--r--src/image.h5
9 files changed, 51 insertions, 98 deletions
diff --git a/config.h.in b/config.h.in
index cf537d9b..e58d569f 100644
--- a/config.h.in
+++ b/config.h.in
@@ -3,9 +3,6 @@
/* Define to 1 if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
-/* Define to 1 if GLib is available */
-#undef HAVE_GLIB
-
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
diff --git a/configure b/configure
index 32881f22..65c1873f 100755
--- a/configure
+++ b/configure
@@ -641,8 +641,6 @@ am__EXEEXT_TRUE
LTLIBOBJS
HAVE_OPENCL_FALSE
HAVE_OPENCL_TRUE
-HAVE_GLIB_FALSE
-HAVE_GLIB_TRUE
HAVE_GTK_FALSE
HAVE_GTK_TRUE
GTK_LIBS
@@ -5139,10 +5137,9 @@ if test "${enable_gtk+set}" = set; then
enableval=$enable_gtk;
fi
-haveglib=false
havegtk=false
-{ $as_echo "$as_me:$LINENO: checking whether to use GTK/GLib" >&5
-$as_echo_n "checking whether to use GTK/GLib... " >&6; }
+{ $as_echo "$as_me:$LINENO: checking whether to use GTK" >&5
+$as_echo_n "checking whether to use GTK... " >&6; }
if test "x$enable_gtk" != "xno"; then
{ $as_echo "$as_me:$LINENO: result: yes" >&5
@@ -5381,13 +5378,7 @@ fi
$as_echo "yes (version $gtk_config_major_version.$gtk_config_minor_version.$gtk_config_micro_version)" >&6; }
havegtk=true
- haveglib=true
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_GLIB 1
-_ACEOF
-
- GTK_LIBS="$GTK_LIBS -lgthread-2.0 -lutil"
+ GTK_LIBS="$GTK_LIBS"
else
{ $as_echo "$as_me:$LINENO: result: no" >&5
@@ -5495,14 +5486,6 @@ else
HAVE_GTK_FALSE=
fi
- if test x$haveglib = xtrue; then
- HAVE_GLIB_TRUE=
- HAVE_GLIB_FALSE='#'
-else
- HAVE_GLIB_TRUE='#'
- HAVE_GLIB_FALSE=
-fi
-
if test x$have_opencl = xtrue; then
HAVE_OPENCL_TRUE=
HAVE_OPENCL_FALSE='#'
@@ -5513,7 +5496,7 @@ fi
CFLAGS="$CFLAGS $HDF5_CFLAGS $GTK_CFLAGS $GSL_CFLAGS $OPENCL_CFLAGS"
-LIBS="$LIBS $HDF5_LIBS -lm -lz $GSL_LIBS $GTK_LIBS $OPENCL_LIBS"
+LIBS="$LIBS $HDF5_LIBS -lm -lz $GSL_LIBS $GTK_LIBS $OPENCL_LIBS -lutil"
ac_config_files="$ac_config_files Makefile src/Makefile data/Makefile"
@@ -5643,13 +5626,6 @@ $as_echo "$as_me: error: conditional \"HAVE_GTK\" was never defined.
Usually this means the macro was only invoked conditionally." >&2;}
{ (exit 1); exit 1; }; }
fi
-if test -z "${HAVE_GLIB_TRUE}" && test -z "${HAVE_GLIB_FALSE}"; then
- { { $as_echo "$as_me:$LINENO: error: conditional \"HAVE_GLIB\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-$as_echo "$as_me: error: conditional \"HAVE_GLIB\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
- { (exit 1); exit 1; }; }
-fi
if test -z "${HAVE_OPENCL_TRUE}" && test -z "${HAVE_OPENCL_FALSE}"; then
{ { $as_echo "$as_me:$LINENO: error: conditional \"HAVE_OPENCL\" was never defined.
Usually this means the macro was only invoked conditionally." >&5
diff --git a/configure.ac b/configure.ac
index e8365f03..1911f67d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -54,18 +54,15 @@ AS_IF([test "x$enable_opencl" == "xyes"],
AC_ARG_ENABLE(gtk, AS_HELP_STRING([--disable-gtk], [Disable GTK+/GLib]))
-haveglib=false
havegtk=false
-AC_MSG_CHECKING([whether to use GTK/GLib])
+AC_MSG_CHECKING([whether to use GTK])
AS_IF([test "x$enable_gtk" != "xno"],
[
AC_MSG_RESULT([yes])
AM_PATH_GTK_2_0(2.0.0,
[
havegtk=true
- haveglib=true
- AC_DEFINE([HAVE_GLIB], [1], [Define to 1 if GLib is available])
- GTK_LIBS="$GTK_LIBS -lgthread-2.0 -lutil"
+ GTK_LIBS="$GTK_LIBS"
],
[
AC_MSG_WARN([GTK not found. hdfsee will not be built.])
@@ -76,10 +73,9 @@ AS_IF([test "x$enable_gtk" != "xno"],
])
AM_CONDITIONAL([HAVE_GTK], test x$havegtk = xtrue)
-AM_CONDITIONAL([HAVE_GLIB], test x$haveglib = xtrue)
AM_CONDITIONAL([HAVE_OPENCL], test x$have_opencl = xtrue)
CFLAGS="$CFLAGS $HDF5_CFLAGS $GTK_CFLAGS $GSL_CFLAGS $OPENCL_CFLAGS"
-LIBS="$LIBS $HDF5_LIBS -lm -lz $GSL_LIBS $GTK_LIBS $OPENCL_LIBS"
+LIBS="$LIBS $HDF5_LIBS -lm -lz $GSL_LIBS $GTK_LIBS $OPENCL_LIBS -lutil"
AC_OUTPUT(Makefile src/Makefile data/Makefile)
diff --git a/src/Makefile.am b/src/Makefile.am
index 3240290a..e696fcbf 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -23,15 +23,12 @@ process_hkl_LDADD = @LIBS@
indexamajig_SOURCES = indexamajig.c hdf5-file.c utils.c cell.c image.c \
intensities.c peaks.c index.c filters.c \
- diffraction.c detector.c sfac.c
+ diffraction.c detector.c sfac.c dirax.c
indexamajig_LDADD = @LIBS@
if HAVE_OPENCL
indexamajig_SOURCES += diffraction-gpu.c cl-utils.c
endif
-if HAVE_GLIB
-indexamajig_SOURCES += dirax.c
-endif
if HAVE_GTK
hdfsee_SOURCES = hdfsee.c displaywindow.c render.c hdf5-file.c utils.c image.c \
@@ -49,8 +46,4 @@ powder_plot_SOURCES = powder_plot.c cell.c utils.c image.c hdf5-file.c \
detector.c
powder_plot_LDADD = @LIBS@
-if HAVE_GLIB
-powder_plot_SOURCES += dirax.c
-endif
-
INCLUDES = "-I$(top_srcdir)/data"
diff --git a/src/Makefile.in b/src/Makefile.in
index 0eccb84c..5e775b44 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -38,8 +38,6 @@ bin_PROGRAMS = pattern_sim$(EXEEXT) process_hkl$(EXEEXT) \
@HAVE_GTK_TRUE@am__append_1 = hdfsee
@HAVE_OPENCL_TRUE@am__append_2 = diffraction-gpu.c cl-utils.c
@HAVE_OPENCL_TRUE@am__append_3 = diffraction-gpu.c cl-utils.c
-@HAVE_GLIB_TRUE@am__append_4 = dirax.c
-@HAVE_GLIB_TRUE@am__append_5 = dirax.c
subdir = src
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -71,16 +69,15 @@ hdfsee_OBJECTS = $(am_hdfsee_OBJECTS)
hdfsee_DEPENDENCIES =
am__indexamajig_SOURCES_DIST = indexamajig.c hdf5-file.c utils.c \
cell.c image.c intensities.c peaks.c index.c filters.c \
- diffraction.c detector.c sfac.c diffraction-gpu.c cl-utils.c \
- dirax.c
+ diffraction.c detector.c sfac.c dirax.c diffraction-gpu.c \
+ cl-utils.c
@HAVE_OPENCL_TRUE@am__objects_1 = diffraction-gpu.$(OBJEXT) \
@HAVE_OPENCL_TRUE@ cl-utils.$(OBJEXT)
-@HAVE_GLIB_TRUE@am__objects_2 = dirax.$(OBJEXT)
am_indexamajig_OBJECTS = indexamajig.$(OBJEXT) hdf5-file.$(OBJEXT) \
utils.$(OBJEXT) cell.$(OBJEXT) image.$(OBJEXT) \
intensities.$(OBJEXT) peaks.$(OBJEXT) index.$(OBJEXT) \
filters.$(OBJEXT) diffraction.$(OBJEXT) detector.$(OBJEXT) \
- sfac.$(OBJEXT) $(am__objects_1) $(am__objects_2)
+ sfac.$(OBJEXT) dirax.$(OBJEXT) $(am__objects_1)
indexamajig_OBJECTS = $(am_indexamajig_OBJECTS)
indexamajig_DEPENDENCIES =
am__pattern_sim_SOURCES_DIST = pattern_sim.c diffraction.c utils.c \
@@ -92,11 +89,9 @@ am_pattern_sim_OBJECTS = pattern_sim.$(OBJEXT) diffraction.$(OBJEXT) \
intensities.$(OBJEXT) reflections.$(OBJEXT) $(am__objects_1)
pattern_sim_OBJECTS = $(am_pattern_sim_OBJECTS)
pattern_sim_DEPENDENCIES =
-am__powder_plot_SOURCES_DIST = powder_plot.c cell.c utils.c image.c \
- hdf5-file.c detector.c dirax.c
am_powder_plot_OBJECTS = powder_plot.$(OBJEXT) cell.$(OBJEXT) \
utils.$(OBJEXT) image.$(OBJEXT) hdf5-file.$(OBJEXT) \
- detector.$(OBJEXT) $(am__objects_2)
+ detector.$(OBJEXT)
powder_plot_OBJECTS = $(am_powder_plot_OBJECTS)
powder_plot_DEPENDENCIES =
am_process_hkl_OBJECTS = process_hkl.$(OBJEXT) sfac.$(OBJEXT) \
@@ -117,8 +112,8 @@ SOURCES = $(compare_hkl_SOURCES) $(get_hkl_SOURCES) $(hdfsee_SOURCES) \
$(powder_plot_SOURCES) $(process_hkl_SOURCES)
DIST_SOURCES = $(compare_hkl_SOURCES) $(get_hkl_SOURCES) \
$(am__hdfsee_SOURCES_DIST) $(am__indexamajig_SOURCES_DIST) \
- $(am__pattern_sim_SOURCES_DIST) \
- $(am__powder_plot_SOURCES_DIST) $(process_hkl_SOURCES)
+ $(am__pattern_sim_SOURCES_DIST) $(powder_plot_SOURCES) \
+ $(process_hkl_SOURCES)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -223,7 +218,7 @@ process_hkl_SOURCES = process_hkl.c sfac.c statistics.c cell.c utils.c \
process_hkl_LDADD = @LIBS@
indexamajig_SOURCES = indexamajig.c hdf5-file.c utils.c cell.c image.c \
intensities.c peaks.c index.c filters.c diffraction.c \
- detector.c sfac.c $(am__append_3) $(am__append_4)
+ detector.c sfac.c dirax.c $(am__append_3)
indexamajig_LDADD = @LIBS@
@HAVE_GTK_TRUE@hdfsee_SOURCES = hdfsee.c displaywindow.c render.c hdf5-file.c utils.c image.c \
@HAVE_GTK_TRUE@ filters.c
@@ -234,7 +229,8 @@ get_hkl_LDADD = @LIBS@
compare_hkl_SOURCES = compare_hkl.c sfac.c cell.c utils.c reflections.c
compare_hkl_LDADD = @LIBS@
powder_plot_SOURCES = powder_plot.c cell.c utils.c image.c hdf5-file.c \
- detector.c $(am__append_5)
+ detector.c
+
powder_plot_LDADD = @LIBS@
INCLUDES = "-I$(top_srcdir)/data"
all: all-am
diff --git a/src/dirax.c b/src/dirax.c
index 78f2f2b3..8a6f05fd 100644
--- a/src/dirax.c
+++ b/src/dirax.c
@@ -15,7 +15,6 @@
#endif
-#include <glib.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
@@ -165,8 +164,7 @@ static void dirax_send_next(struct image *image)
break;
default:
- image->dirax_step = 0;
- g_main_loop_quit(image->dirax_ml);
+ dirax_sendline("exit\n", image);
return;
}
@@ -175,24 +173,15 @@ static void dirax_send_next(struct image *image)
}
-static gboolean dirax_readable(GIOChannel *dirax, GIOCondition condition,
- struct image *image)
+static int dirax_readable(struct image *image)
{
int rval;
int no_string = 0;
rval = read(image->dirax_pty, image->dirax_rbuffer+image->dirax_rbufpos,
- image->dirax_rbuflen-image->dirax_rbufpos);
+ image->dirax_rbuflen-image->dirax_rbufpos);
- if ( (rval == -1) || (rval == 0) ) {
-
- ERROR("Lost connection to DirAx (rval=%i)\n", rval);
- waitpid(image->dirax_pid, NULL, 0);
- g_io_channel_shutdown(image->dirax, FALSE, NULL);
- image->dirax = NULL;
- return FALSE;
-
- }
+ if ( (rval == -1) || (rval == 0) ) return 1;
image->dirax_rbufpos += rval;
assert(image->dirax_rbufpos <= image->dirax_rbuflen);
@@ -264,10 +253,7 @@ static gboolean dirax_readable(GIOChannel *dirax, GIOCondition condition,
/* Obviously, this never happens :) */
ERROR("Unrecognised DirAx input mode! "
"I don't know how to understand DirAx\n");
- waitpid(image->dirax_pid, NULL, 0);
- g_io_channel_shutdown(image->dirax, FALSE, NULL);
- image->dirax = NULL;
- return FALSE;
+ return 1;
}
@@ -306,7 +292,7 @@ static gboolean dirax_readable(GIOChannel *dirax, GIOCondition condition,
}
- return TRUE;
+ return 0;
}
@@ -315,6 +301,7 @@ void run_dirax(struct image *image)
unsigned int opts;
int saved_stderr;
int status;
+ int rval;
saved_stderr = dup(STDERR_FILENO);
image->dirax_pid = forkpty(&image->dirax_pty, NULL, NULL, NULL);
@@ -352,13 +339,34 @@ void run_dirax(struct image *image)
image->dirax_step = 1; /* This starts the "initialisation" procedure */
image->dirax_read_cell = 0;
- image->dirax = g_io_channel_unix_new(image->dirax_pty);
- g_io_add_watch(image->dirax, G_IO_IN | G_IO_HUP,
- (GIOFunc)dirax_readable, image);
+ do {
+
+ fd_set fds;
+ struct timeval tv;
+ int sval;
+
+ FD_ZERO(&fds);
+ FD_SET(image->dirax_pty, &fds);
+
+ tv.tv_sec = 1;
+ tv.tv_usec = 0;
+
+ sval = select(image->dirax_pty+1, &fds, NULL, NULL, &tv);
+
+ if ( sval == -1 ) {
+ ERROR("select() failed.\n");
+ rval = 1;
+ } else if ( sval != 0 ) {
+ rval = dirax_readable(image);
+ } else {
+ ERROR("No response from DirAx..\n");
+ rval = 1;
+ }
+
+ } while ( !rval );
- image->dirax_ml = g_main_loop_new(NULL, FALSE);
- g_main_loop_run(image->dirax_ml);
close(image->dirax_pty);
+ close(saved_stderr);
wait(&status);
return;
diff --git a/src/dirax.h b/src/dirax.h
index 530d2696..8c429710 100644
--- a/src/dirax.h
+++ b/src/dirax.h
@@ -19,17 +19,8 @@
#include "utils.h"
-#if HAVE_GLIB
extern void run_dirax(struct image *image);
-#else
-
-static void run_dirax(struct image *image)
-{
- ERROR("Can't run DirAx without GLib.\n");
-}
-
-#endif
#endif /* DIRAX_H */
diff --git a/src/hdfsee.c b/src/hdfsee.c
index 5306059b..a1d16b56 100644
--- a/src/hdfsee.c
+++ b/src/hdfsee.c
@@ -91,7 +91,6 @@ int main(int argc, char *argv[])
{0, 0, NULL, 0}
};
- g_thread_init(NULL);
gtk_init(&argc, &argv);
/* Short options */
diff --git a/src/image.h b/src/image.h
index 349e680c..413f633b 100644
--- a/src/image.h
+++ b/src/image.h
@@ -87,19 +87,16 @@ struct image {
ImageFeatureList *rflist; /* "Predicted" features */
/* DirAx auto-indexing low-level stuff */
-#if HAVE_GLIB
- GIOChannel *dirax;
int dirax_pty;
pid_t dirax_pid;
char *dirax_rbuffer;
int dirax_rbufpos;
int dirax_rbuflen;
- GMainLoop *dirax_ml;
/* DirAx auto-indexing high-level stuff */
int dirax_step;
int dirax_read_cell;
-#endif
+
};
/* An opaque type representing a list of images */