view libgui/module.mk @ 20574:dd6345fd8a97

use exceptions for better invalid index error reporting (bug #45957) * lo-array-gripes.h, lo-array-gripes.cc (index_exception): New base class for indexing errors. (invalid_index, out_of_range): New classes. (gripe_index_out_of_range): New overloaded function. (gripe_invalid_index): New overloaded functions. Delete version with no arguments. (gripe_invalid_assignment_size, gripe_assignment_dimension_mismatch): Delete. Change uses of gripe functions as needed. * Cell.cc (Cell::index, Cell::assign, Cell::delete_elements): Use exceptions to collect error info about and handle indexing errors. * data.cc (Fnth_element, do_accumarray_sum, F__accumarray_sum__, do_accumarray_minmax, do_accumarray_minmax_fun, F__accumdim_sum__): Likewise. * oct-map.cc (octave_map::index, octave_map::assign, octave_map::delete_elements): Likewise. * sparse.cc (Fsparse): Likewise. * sub2ind.cc (Fsub2ind, Find2sub): Likewise. New tests. * utils.cc (dims_to_numel): Likewise. * ov-base-diag.cc (octave_base_diag<DMT, MT>::do_index_op, octave_base_diag<DMT, MT>::subsasgn): Likewise. * ov-base-mat.cc (octave_base_matrix<MT>::subsref, octave_base_matrix<MT>::assign): Likewise. * ov-base-sparse.cc (octave_base_sparse<T>::do_index_op, octave_base_sparse<T>::assign, octave_base_sparse<MT>::delete_elements): Likewise. * ov-classdef.cc (cdef_object_array::subsref, cdef_object_array::subsasgn): Likewise. * ov-java.cc (make_java_index): Likewise. * ov-perm.cc (octave_perm_matrix::do_index_op): Likewise. * ov-range.cc (octave_range::do_index_op): Likewise. * ov-re-diag.cc (octave_diag_matrix::do_index_op): Likewise. * ov-str-mat.cc (octave_char_matrix_str::do_index_op_internal): Likewise. * pt-assign.cc (tree_simple_assignment::rvalue1): Likewise. * pt-idx.cc (tree_index_expression::rvalue, tree_index_expression::lvalue): Likewise. * Array-util.cc (sub2ind): Likewise. * toplev.cc (main_loop): Also catch unhandled index_exception exceptions. * ov-base.cc (octave_base_value::index_vector): Improve error message. * ov-re-sparse.cc (octave_sparse_matrix::index_vector): Likewise. * ov-complex.cc (complex_index): New class. (gripe_complex_index): New function. (octave_complex::index_vector): Use it. * pt-id.h, pt-id.cc (tree_identifier::is_variable, tree_black_hole::is_variable): Now const. * pt-idx.cc (final_index_error): New static function. (tree_index_expression::rvalue, tree_index_expression::lvalue): Use it. * index.tst: New tests.
author Lachlan Andrew <lachlanbis@gmail.com>
date Fri, 02 Oct 2015 15:07:37 -0400
parents 048f7cda88ea
children
line wrap: on
line source

if AMCOND_BUILD_GUI

libgui_EXTRA_DIST =

libgui_CLEANFILES =
libgui_DISTCLEANFILES =
libgui_MAINTAINERCLEANFILES =

MOC_CPPFLAGS =

## Fix for bug #42839 where -mieee CFLAG option is added to CPPFLAGS by gnulib.
## Users may also pass other options in CPPFLAGS that moc does not understand.
## Only keep moc-compatible options -Idir, -Dmacro, and -Umacro.
MOC_OCTAVE_CPPFLAGS = $(filter -I% -D% -U%, $(AM_CPPFLAGS) $(CPPFLAGS))

octlib_LTLIBRARIES += libgui/liboctgui.la

TRANSLATIONS = \
  libgui/languages/be_BY.ts \
  libgui/languages/de_DE.ts \
  libgui/languages/en_US.ts \
  libgui/languages/es_ES.ts \
  libgui/languages/eu_ES.ts \
  libgui/languages/fr_FR.ts \
  libgui/languages/it_IT.ts \
  libgui/languages/ja_JP.ts \
  libgui/languages/nl_NL.ts \
  libgui/languages/pt_BR.ts \
  libgui/languages/pt_PT.ts \
  libgui/languages/ru_RU.ts \
  libgui/languages/uk_UA.ts \
  libgui/languages/zh_CN.ts

LOCALES = $(patsubst libgui/languages/%.ts, libgui/languages/%.qm, $(TRANSLATIONS))

include libgui/src/module.mk
include libgui/graphics/module.mk
include libgui/qterminal-module.mk

## liboctgui merely collects a bunch of compiled convenience libraries.
## It has no source code itself.
libgui_liboctgui_la_SOURCES =

# Dummy C++ source to force C++ linking.
nodist_EXTRA_libgui_liboctgui_la_SOURCES = libgui/dummy.cc

libgui_liboctgui_la_LIBADD = \
  libgui/qterminal/libqterminal.la \
  libgui/src/libgui-src.la \
  libgui/graphics/libgui-graphics.la \
  $(top_builddir)/libinterp/liboctinterp.la \
  $(top_builddir)/liboctave/liboctave.la \
  $(LIBOCTGUI_LINK_DEPS)

# Increment these as needed and according to the rules in the libtool manual:
libgui_liboctgui_current = 1
libgui_liboctgui_revision = 0
libgui_liboctgui_age = 0

libgui_liboctgui_version_info = $(libgui_liboctgui_current):$(libgui_liboctgui_revision):$(libgui_liboctgui_age)

libgui_liboctgui_la_LDFLAGS = \
  -version-info $(libgui_liboctgui_version_info) \
  $(NO_UNDEFINED_LDFLAG) \
  -bindir $(bindir) \
  $(LIBOCTGUI_LINK_OPTS)

octetc_DATA += libgui/default-qt-settings

octlocale_DATA += $(LOCALES)

libgui/default-qt-settings: libgui/default-qt-settings.in | libgui/$(octave_dirstamp)
	$(AM_V_GEN)$(do_subst_qt_settings)

DIRSTAMP_FILES += \
  libgui/$(octave_dirstamp)

define moc-command
  rm -f $@-t $@ && \
  ( echo "#ifdef HAVE_CONFIG_H"; \
    echo "#include <config.h>"; \
    echo "#endif"; \
    $(MOC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(MOC_OCTAVE_CPPFLAGS) $(MOC_CPPFLAGS) $(libgui_liboctgui_la_CPPFLAGS) $< ) > $@-t && \
  mv $@-t $@
endef

define rcc-command
  rm -f $@-t $@ && \
  ( echo "#ifdef HAVE_CONFIG_H"; \
    echo "#include <config.h>"; \
    echo "#endif"; \
    $(RCC) -name $(@D) $< ) > $@-t && \
  mv $@-t $@
endef

moc-%.cc: %.h
	$(AM_V_GEN)$(moc-command)

ui-%.h: %.ui
	$(AM_V_GEN)$(UIC) -o $@ $<

qrc-%.cc: %.qrc
	$(AM_V_GEN)$(rcc-command)

AM_V_lrelease = $(am__v_lrelease_$(V))
am__v_lrelease_ = $(am__v_lrelease_$(AM_DEFAULT_VERBOSITY))
am__v_lrelease_0 = -silent
am__v_lrelease_1 =

%.qm: %.ts | libgui/languages/$(octave_dirstamp)
	$(AM_V_GEN)$(LRELEASE) $(AM_V_lrelease) -qm $@ $<

DIRSTAMP_FILES += \
  libgui/languages/$(octave_dirstamp)

libgui_EXTRA_DIST += \
  $(TRANSLATIONS) \
  libgui/default-qt-settings.in

EXTRA_DIST += $(libgui_EXTRA_DIST)

libgui_DISTCLEANFILES += \
  libgui/default-qt-settings \
  $(LOCALES)

CLEANFILES += $(libgui_CLEANFILES)
DISTCLEANFILES += $(libgui_DISTCLEANFILES)
MAINTAINERCLEANFILES += $(libgui_MAINTAINERCLEANFILES)

libgui-clean:
	rm -f $(libgui_CLEANFILES)

libgui-distclean: libgui-clean
	rm -f $(libgui_DISTCLEANFILES)

libgui-maintainer-clean: libgui-distclean
	rm -f $(libgui_MAINTAINERCLEANFILES)
endif