Codebase list libdvdnav / 7a9d55b
Update upstream source from tag 'upstream/6.1.1' Update to upstream version '6.1.1' with Debian dir ae6405ea7f4da5d775bb0c20bdab76a376922a30 Sebastian Ramacher 2 years ago
8 changed file(s) with 759 addition(s) and 1303 deletion(s). Raw diff Collapse all Expand all
0 libdvdnav (6.1.1)
1 * fix build issues
2 * improve CI
3
04 libdvdnav (6.1.0)
15 * add a dvdnav_open2 API to setup a logging mechanism, similar to libdvdread
26 * add a dvdnav_get_number_of_angles API
0 # Makefile.in generated by automake 1.16.1 from Makefile.am.
0 # Makefile.in generated by automake 1.16.3 from Makefile.am.
11 # @configure_input@
22
3 # Copyright (C) 1994-2018 Free Software Foundation, Inc.
3 # Copyright (C) 1994-2020 Free Software Foundation, Inc.
44
55 # This Makefile.in is free software; the Free Software Foundation
66 # gives unlimited permission to copy and/or distribute it,
208208 esac
209209 DATA = $(dist_doc_DATA) $(pkgconfig_DATA)
210210 HEADERS = $(pkginclude_HEADERS)
211 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \
212 $(LISP)config.h.in
211 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) \
212 config.h.in
213213 # Read a list of newline-separated strings from the standard input,
214214 # and print each of them once, without duplicates. Input order is
215215 # *not* preserved.
249249 GZIP_ENV = --best
250250 DIST_ARCHIVES = $(distdir).tar.bz2
251251 DIST_TARGETS = dist-bzip2
252 # Exists only to be overridden by the user if desired.
253 AM_DISTCHECK_DVI_TARGET = dvi
252254 distuninstallcheck_listfiles = find . -type f -print
253255 am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
254256 | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
824826 tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
825827 $(am__post_remove_distdir)
826828
829 dist-zstd: distdir
830 tardir=$(distdir) && $(am__tar) | zstd -c $${ZSTD_CLEVEL-$${ZSTD_OPT--19}} >$(distdir).tar.zst
831 $(am__post_remove_distdir)
832
827833 dist-tarZ: distdir
828834 @echo WARNING: "Support for distribution archives compressed with" \
829835 "legacy program 'compress' is deprecated." >&2
866872 eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\
867873 *.zip*) \
868874 unzip $(distdir).zip ;;\
875 *.tar.zst*) \
876 zstd -dc $(distdir).tar.zst | $(am__untar) ;;\
869877 esac
870878 chmod -R a-w $(distdir)
871879 chmod u+w $(distdir)
881889 $(DISTCHECK_CONFIGURE_FLAGS) \
882890 --srcdir=../.. --prefix="$$dc_install_base" \
883891 && $(MAKE) $(AM_MAKEFLAGS) \
884 && $(MAKE) $(AM_MAKEFLAGS) dvi \
892 && $(MAKE) $(AM_MAKEFLAGS) $(AM_DISTCHECK_DVI_TARGET) \
885893 && $(MAKE) $(AM_MAKEFLAGS) check \
886894 && $(MAKE) $(AM_MAKEFLAGS) install \
887895 && $(MAKE) $(AM_MAKEFLAGS) installcheck \
10831091 check-am clean clean-cscope clean-generic clean-libLTLIBRARIES \
10841092 clean-libtool cscope cscopelist-am ctags ctags-am dist \
10851093 dist-all dist-bzip2 dist-gzip dist-lzip dist-shar dist-tarZ \
1086 dist-xz dist-zip distcheck distclean distclean-compile \
1087 distclean-generic distclean-hdr distclean-libtool \
1088 distclean-tags distcleancheck distdir distuninstallcheck dvi \
1089 dvi-am html html-am info info-am install install-am \
1090 install-data install-data-am install-dist_docDATA install-dvi \
1091 install-dvi-am install-exec install-exec-am install-html \
1092 install-html-am install-info install-info-am \
1093 install-libLTLIBRARIES install-man install-pdf install-pdf-am \
1094 install-pkgconfigDATA install-pkgincludeHEADERS install-ps \
1095 install-ps-am install-strip installcheck installcheck-am \
1096 installdirs maintainer-clean maintainer-clean-generic \
1097 mostlyclean mostlyclean-compile mostlyclean-generic \
1098 mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \
1099 uninstall-am uninstall-dist_docDATA uninstall-libLTLIBRARIES \
1100 uninstall-pkgconfigDATA uninstall-pkgincludeHEADERS
1094 dist-xz dist-zip dist-zstd distcheck distclean \
1095 distclean-compile distclean-generic distclean-hdr \
1096 distclean-libtool distclean-tags distcleancheck distdir \
1097 distuninstallcheck dvi dvi-am html html-am info info-am \
1098 install install-am install-data install-data-am \
1099 install-dist_docDATA install-dvi install-dvi-am install-exec \
1100 install-exec-am install-html install-html-am install-info \
1101 install-info-am install-libLTLIBRARIES install-man install-pdf \
1102 install-pdf-am install-pkgconfigDATA install-pkgincludeHEADERS \
1103 install-ps install-ps-am install-strip installcheck \
1104 installcheck-am installdirs maintainer-clean \
1105 maintainer-clean-generic mostlyclean mostlyclean-compile \
1106 mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
1107 tags tags-am uninstall uninstall-am uninstall-dist_docDATA \
1108 uninstall-libLTLIBRARIES uninstall-pkgconfigDATA \
1109 uninstall-pkgincludeHEADERS
11011110
11021111 .PRECIOUS: Makefile
11031112
0 # generated automatically by aclocal 1.16.1 -*- Autoconf -*-
1
2 # Copyright (C) 1996-2018 Free Software Foundation, Inc.
0 # generated automatically by aclocal 1.16.3 -*- Autoconf -*-
1
2 # Copyright (C) 1996-2020 Free Software Foundation, Inc.
33
44 # This file is free software; the Free Software Foundation
55 # gives unlimited permission to copy and/or distribute it,
1919 If you have problems, you may need to regenerate the build system entirely.
2020 To do so, use the procedure documented by the package, typically 'autoreconf'.])])
2121
22 dnl pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
23 dnl serial 11 (pkg-config-0.29)
24 dnl
22 # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
23 # serial 12 (pkg-config-0.29.2)
24
2525 dnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
2626 dnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
2727 dnl
6262 dnl See the "Since" comment for each macro you use to see what version
6363 dnl of the macros you require.
6464 m4_defun([PKG_PREREQ],
65 [m4_define([PKG_MACROS_VERSION], [0.29])
65 [m4_define([PKG_MACROS_VERSION], [0.29.2])
6666 m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
6767 [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
6868 ])dnl PKG_PREREQ
163163 AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
164164
165165 pkg_failed=no
166 AC_MSG_CHECKING([for $1])
166 AC_MSG_CHECKING([for $2])
167167
168168 _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
169169 _PKG_CONFIG([$1][_LIBS], [libs], [$2])
173173 See the pkg-config man page for more details.])
174174
175175 if test $pkg_failed = yes; then
176 AC_MSG_RESULT([no])
176 AC_MSG_RESULT([no])
177177 _PKG_SHORT_ERRORS_SUPPORTED
178178 if test $_pkg_short_errors_supported = yes; then
179179 $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
180 else
180 else
181181 $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
182182 fi
183183 # Put the nasty error message in config.log where it belongs
194194 _PKG_TEXT])[]dnl
195195 ])
196196 elif test $pkg_failed = untried; then
197 AC_MSG_RESULT([no])
197 AC_MSG_RESULT([no])
198198 m4_default([$4], [AC_MSG_FAILURE(
199199 [The pkg-config script could not be found or is too old. Make sure it
200200 is in your PATH or set the PKG_CONFIG environment variable to the full
295295 AS_VAR_IF([$1], [""], [$5], [$4])dnl
296296 ])dnl PKG_CHECK_VAR
297297
298 # Copyright (C) 2002-2018 Free Software Foundation, Inc.
298 # Copyright (C) 2002-2020 Free Software Foundation, Inc.
299299 #
300300 # This file is free software; the Free Software Foundation
301301 # gives unlimited permission to copy and/or distribute it,
310310 [am__api_version='1.16'
311311 dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
312312 dnl require some minimum version. Point them to the right macro.
313 m4_if([$1], [1.16.1], [],
313 m4_if([$1], [1.16.3], [],
314314 [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
315315 ])
316316
326326 # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
327327 # This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
328328 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
329 [AM_AUTOMAKE_VERSION([1.16.1])dnl
329 [AM_AUTOMAKE_VERSION([1.16.3])dnl
330330 m4_ifndef([AC_AUTOCONF_VERSION],
331331 [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
332332 _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
333333
334334 # AM_AUX_DIR_EXPAND -*- Autoconf -*-
335335
336 # Copyright (C) 2001-2018 Free Software Foundation, Inc.
336 # Copyright (C) 2001-2020 Free Software Foundation, Inc.
337337 #
338338 # This file is free software; the Free Software Foundation
339339 # gives unlimited permission to copy and/or distribute it,
385385
386386 # AM_CONDITIONAL -*- Autoconf -*-
387387
388 # Copyright (C) 1997-2018 Free Software Foundation, Inc.
388 # Copyright (C) 1997-2020 Free Software Foundation, Inc.
389389 #
390390 # This file is free software; the Free Software Foundation
391391 # gives unlimited permission to copy and/or distribute it,
416416 Usually this means the macro was only invoked conditionally.]])
417417 fi])])
418418
419 # Copyright (C) 1999-2018 Free Software Foundation, Inc.
419 # Copyright (C) 1999-2020 Free Software Foundation, Inc.
420420 #
421421 # This file is free software; the Free Software Foundation
422422 # gives unlimited permission to copy and/or distribute it,
607607
608608 # Generate code to set up dependency tracking. -*- Autoconf -*-
609609
610 # Copyright (C) 1999-2018 Free Software Foundation, Inc.
610 # Copyright (C) 1999-2020 Free Software Foundation, Inc.
611611 #
612612 # This file is free software; the Free Software Foundation
613613 # gives unlimited permission to copy and/or distribute it,
646646 done
647647 if test $am_rc -ne 0; then
648648 AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
649 for automatic dependency tracking. Try re-running configure with the
649 for automatic dependency tracking. If GNU make was not used, consider
650 re-running the configure script with MAKE="gmake" (or whatever is
651 necessary). You can also try re-running configure with the
650652 '--disable-dependency-tracking' option to at least be able to build
651653 the package (albeit without support for automatic dependency tracking).])
652654 fi
673675
674676 # Do all the work for Automake. -*- Autoconf -*-
675677
676 # Copyright (C) 1996-2018 Free Software Foundation, Inc.
678 # Copyright (C) 1996-2020 Free Software Foundation, Inc.
677679 #
678680 # This file is free software; the Free Software Foundation
679681 # gives unlimited permission to copy and/or distribute it,
870872 done
871873 echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
872874
873 # Copyright (C) 2001-2018 Free Software Foundation, Inc.
875 # Copyright (C) 2001-2020 Free Software Foundation, Inc.
874876 #
875877 # This file is free software; the Free Software Foundation
876878 # gives unlimited permission to copy and/or distribute it,
891893 fi
892894 AC_SUBST([install_sh])])
893895
894 # Copyright (C) 2003-2018 Free Software Foundation, Inc.
896 # Copyright (C) 2003-2020 Free Software Foundation, Inc.
895897 #
896898 # This file is free software; the Free Software Foundation
897899 # gives unlimited permission to copy and/or distribute it,
912914
913915 # Check to see how 'make' treats includes. -*- Autoconf -*-
914916
915 # Copyright (C) 2001-2018 Free Software Foundation, Inc.
917 # Copyright (C) 2001-2020 Free Software Foundation, Inc.
916918 #
917919 # This file is free software; the Free Software Foundation
918920 # gives unlimited permission to copy and/or distribute it,
955957
956958 # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
957959
958 # Copyright (C) 1997-2018 Free Software Foundation, Inc.
960 # Copyright (C) 1997-2020 Free Software Foundation, Inc.
959961 #
960962 # This file is free software; the Free Software Foundation
961963 # gives unlimited permission to copy and/or distribute it,
976978 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
977979 AC_REQUIRE_AUX_FILE([missing])dnl
978980 if test x"${MISSING+set}" != xset; then
979 case $am_aux_dir in
980 *\ * | *\ *)
981 MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
982 *)
983 MISSING="\${SHELL} $am_aux_dir/missing" ;;
984 esac
981 MISSING="\${SHELL} '$am_aux_dir/missing'"
985982 fi
986983 # Use eval to expand $SHELL
987984 if eval "$MISSING --is-lightweight"; then
994991
995992 # Helper functions for option handling. -*- Autoconf -*-
996993
997 # Copyright (C) 2001-2018 Free Software Foundation, Inc.
994 # Copyright (C) 2001-2020 Free Software Foundation, Inc.
998995 #
999996 # This file is free software; the Free Software Foundation
1000997 # gives unlimited permission to copy and/or distribute it,
10231020 AC_DEFUN([_AM_IF_OPTION],
10241021 [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
10251022
1026 # Copyright (C) 1999-2018 Free Software Foundation, Inc.
1023 # Copyright (C) 1999-2020 Free Software Foundation, Inc.
10271024 #
10281025 # This file is free software; the Free Software Foundation
10291026 # gives unlimited permission to copy and/or distribute it,
10701067 # For backward compatibility.
10711068 AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
10721069
1073 # Copyright (C) 2001-2018 Free Software Foundation, Inc.
1070 # Copyright (C) 2001-2020 Free Software Foundation, Inc.
10741071 #
10751072 # This file is free software; the Free Software Foundation
10761073 # gives unlimited permission to copy and/or distribute it,
10891086
10901087 # Check to make sure that the build environment is sane. -*- Autoconf -*-
10911088
1092 # Copyright (C) 1996-2018 Free Software Foundation, Inc.
1089 # Copyright (C) 1996-2020 Free Software Foundation, Inc.
10931090 #
10941091 # This file is free software; the Free Software Foundation
10951092 # gives unlimited permission to copy and/or distribute it,
11701167 rm -f conftest.file
11711168 ])
11721169
1173 # Copyright (C) 2009-2018 Free Software Foundation, Inc.
1170 # Copyright (C) 2009-2020 Free Software Foundation, Inc.
11741171 #
11751172 # This file is free software; the Free Software Foundation
11761173 # gives unlimited permission to copy and/or distribute it,
12301227 _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
12311228 ])
12321229
1233 # Copyright (C) 2001-2018 Free Software Foundation, Inc.
1230 # Copyright (C) 2001-2020 Free Software Foundation, Inc.
12341231 #
12351232 # This file is free software; the Free Software Foundation
12361233 # gives unlimited permission to copy and/or distribute it,
12581255 INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
12591256 AC_SUBST([INSTALL_STRIP_PROGRAM])])
12601257
1261 # Copyright (C) 2006-2018 Free Software Foundation, Inc.
1258 # Copyright (C) 2006-2020 Free Software Foundation, Inc.
12621259 #
12631260 # This file is free software; the Free Software Foundation
12641261 # gives unlimited permission to copy and/or distribute it,
12771274
12781275 # Check how to create a tarball. -*- Autoconf -*-
12791276
1280 # Copyright (C) 2004-2018 Free Software Foundation, Inc.
1277 # Copyright (C) 2004-2020 Free Software Foundation, Inc.
12811278 #
12821279 # This file is free software; the Free Software Foundation
12831280 # gives unlimited permission to copy and/or distribute it,
00 #! /bin/sh
11 # Guess values for system-dependent variables and create Makefiles.
2 # Generated by GNU Autoconf 2.69 for libdvdnav 6.1.0.
2 # Generated by GNU Autoconf 2.69 for libdvdnav 6.1.1.
33 #
44 #
55 # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
586586 # Identity of this package.
587587 PACKAGE_NAME='libdvdnav'
588588 PACKAGE_TARNAME='libdvdnav'
589 PACKAGE_VERSION='6.1.0'
590 PACKAGE_STRING='libdvdnav 6.1.0'
589 PACKAGE_VERSION='6.1.1'
590 PACKAGE_STRING='libdvdnav 6.1.1'
591591 PACKAGE_BUGREPORT=''
592592 PACKAGE_URL=''
593593
13411341 # Omit some internal or obsolete options to make the list less imposing.
13421342 # This message is too long to be a string in the A/UX 3.1 sh.
13431343 cat <<_ACEOF
1344 \`configure' configures libdvdnav 6.1.0 to adapt to many kinds of systems.
1344 \`configure' configures libdvdnav 6.1.1 to adapt to many kinds of systems.
13451345
13461346 Usage: $0 [OPTION]... [VAR=VALUE]...
13471347
14121412
14131413 if test -n "$ac_init_help"; then
14141414 case $ac_init_help in
1415 short | recursive ) echo "Configuration of libdvdnav 6.1.0:";;
1415 short | recursive ) echo "Configuration of libdvdnav 6.1.1:";;
14161416 esac
14171417 cat <<\_ACEOF
14181418
15321532 test -n "$ac_init_help" && exit $ac_status
15331533 if $ac_init_version; then
15341534 cat <<\_ACEOF
1535 libdvdnav configure 6.1.0
1535 libdvdnav configure 6.1.1
15361536 generated by GNU Autoconf 2.69
15371537
15381538 Copyright (C) 2012 Free Software Foundation, Inc.
18101810 This file contains any messages produced by compilers while
18111811 running configure, to aid debugging if configure makes a mistake.
18121812
1813 It was created by libdvdnav $as_me 6.1.0, which was
1813 It was created by libdvdnav $as_me 6.1.1, which was
18141814 generated by GNU Autoconf 2.69. Invocation command line was
18151815
18161816 $ $0 $@
24382438 am_aux_dir=`cd "$ac_aux_dir" && pwd`
24392439
24402440 if test x"${MISSING+set}" != xset; then
2441 case $am_aux_dir in
2442 *\ * | *\ *)
2443 MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
2444 *)
2445 MISSING="\${SHELL} $am_aux_dir/missing" ;;
2446 esac
2441 MISSING="\${SHELL} '$am_aux_dir/missing'"
24472442 fi
24482443 # Use eval to expand $SHELL
24492444 if eval "$MISSING --is-lightweight"; then
27482743
27492744 # Define the identity of the package.
27502745 PACKAGE='libdvdnav'
2751 VERSION='6.1.0'
2746 VERSION='6.1.1'
27522747
27532748
27542749 cat >>confdefs.h <<_ACEOF
1194411939
1194511940 DVDNAV_MAJOR="6"
1194611941 DVDNAV_MINOR="1"
11947 DVDNAV_SUB="0"
11942 DVDNAV_SUB="1"
1194811943 DVDNAV_PRE=""
1194911944
1195011945 DVDREAD_MIN_VERSION="6.0.0"
1196311958
1196411959
1196511960
11966 ac_ext=c
11967 ac_cpp='$CPP $CPPFLAGS'
11968 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
11969 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
11970 ac_compiler_gnu=$ac_cv_c_compiler_gnu
11971 if test -n "$ac_tool_prefix"; then
11972 # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
11973 set dummy ${ac_tool_prefix}gcc; ac_word=$2
11974 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
11975 $as_echo_n "checking for $ac_word... " >&6; }
11976 if ${ac_cv_prog_CC+:} false; then :
11961 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C99" >&5
11962 $as_echo_n "checking for $CC option to accept ISO C99... " >&6; }
11963 if ${ac_cv_prog_cc_c99+:} false; then :
1197711964 $as_echo_n "(cached) " >&6
1197811965 else
11979 if test -n "$CC"; then
11980 ac_cv_prog_CC="$CC" # Let the user override the test.
11981 else
11982 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
11983 for as_dir in $PATH
11984 do
11985 IFS=$as_save_IFS
11986 test -z "$as_dir" && as_dir=.
11987 for ac_exec_ext in '' $ac_executable_extensions; do
11988 if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
11989 ac_cv_prog_CC="${ac_tool_prefix}gcc"
11990 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
11991 break 2
11992 fi
11993 done
11994 done
11995 IFS=$as_save_IFS
11996
11997 fi
11998 fi
11999 CC=$ac_cv_prog_CC
12000 if test -n "$CC"; then
12001 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
12002 $as_echo "$CC" >&6; }
12003 else
12004 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
12005 $as_echo "no" >&6; }
12006 fi
12007
12008
12009 fi
12010 if test -z "$ac_cv_prog_CC"; then
12011 ac_ct_CC=$CC
12012 # Extract the first word of "gcc", so it can be a program name with args.
12013 set dummy gcc; ac_word=$2
12014 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
12015 $as_echo_n "checking for $ac_word... " >&6; }
12016 if ${ac_cv_prog_ac_ct_CC+:} false; then :
12017 $as_echo_n "(cached) " >&6
12018 else
12019 if test -n "$ac_ct_CC"; then
12020 ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
12021 else
12022 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
12023 for as_dir in $PATH
12024 do
12025 IFS=$as_save_IFS
12026 test -z "$as_dir" && as_dir=.
12027 for ac_exec_ext in '' $ac_executable_extensions; do
12028 if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
12029 ac_cv_prog_ac_ct_CC="gcc"
12030 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
12031 break 2
12032 fi
12033 done
12034 done
12035 IFS=$as_save_IFS
12036
12037 fi
12038 fi
12039 ac_ct_CC=$ac_cv_prog_ac_ct_CC
12040 if test -n "$ac_ct_CC"; then
12041 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
12042 $as_echo "$ac_ct_CC" >&6; }
12043 else
12044 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
12045 $as_echo "no" >&6; }
12046 fi
12047
12048 if test "x$ac_ct_CC" = x; then
12049 CC=""
12050 else
12051 case $cross_compiling:$ac_tool_warned in
12052 yes:)
12053 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
12054 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
12055 ac_tool_warned=yes ;;
12056 esac
12057 CC=$ac_ct_CC
12058 fi
12059 else
12060 CC="$ac_cv_prog_CC"
12061 fi
12062
12063 if test -z "$CC"; then
12064 if test -n "$ac_tool_prefix"; then
12065 # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
12066 set dummy ${ac_tool_prefix}cc; ac_word=$2
12067 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
12068 $as_echo_n "checking for $ac_word... " >&6; }
12069 if ${ac_cv_prog_CC+:} false; then :
12070 $as_echo_n "(cached) " >&6
12071 else
12072 if test -n "$CC"; then
12073 ac_cv_prog_CC="$CC" # Let the user override the test.
12074 else
12075 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
12076 for as_dir in $PATH
12077 do
12078 IFS=$as_save_IFS
12079 test -z "$as_dir" && as_dir=.
12080 for ac_exec_ext in '' $ac_executable_extensions; do
12081 if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
12082 ac_cv_prog_CC="${ac_tool_prefix}cc"
12083 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
12084 break 2
12085 fi
12086 done
12087 done
12088 IFS=$as_save_IFS
12089
12090 fi
12091 fi
12092 CC=$ac_cv_prog_CC
12093 if test -n "$CC"; then
12094 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
12095 $as_echo "$CC" >&6; }
12096 else
12097 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
12098 $as_echo "no" >&6; }
12099 fi
12100
12101
12102 fi
12103 fi
12104 if test -z "$CC"; then
12105 # Extract the first word of "cc", so it can be a program name with args.
12106 set dummy cc; ac_word=$2
12107 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
12108 $as_echo_n "checking for $ac_word... " >&6; }
12109 if ${ac_cv_prog_CC+:} false; then :
12110 $as_echo_n "(cached) " >&6
12111 else
12112 if test -n "$CC"; then
12113 ac_cv_prog_CC="$CC" # Let the user override the test.
12114 else
12115 ac_prog_rejected=no
12116 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
12117 for as_dir in $PATH
12118 do
12119 IFS=$as_save_IFS
12120 test -z "$as_dir" && as_dir=.
12121 for ac_exec_ext in '' $ac_executable_extensions; do
12122 if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
12123 if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
12124 ac_prog_rejected=yes
12125 continue
12126 fi
12127 ac_cv_prog_CC="cc"
12128 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
12129 break 2
12130 fi
12131 done
12132 done
12133 IFS=$as_save_IFS
12134
12135 if test $ac_prog_rejected = yes; then
12136 # We found a bogon in the path, so make sure we never use it.
12137 set dummy $ac_cv_prog_CC
12138 shift
12139 if test $# != 0; then
12140 # We chose a different compiler from the bogus one.
12141 # However, it has the same basename, so the bogon will be chosen
12142 # first if we set CC to just the basename; use the full file name.
12143 shift
12144 ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
12145 fi
12146 fi
12147 fi
12148 fi
12149 CC=$ac_cv_prog_CC
12150 if test -n "$CC"; then
12151 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
12152 $as_echo "$CC" >&6; }
12153 else
12154 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
12155 $as_echo "no" >&6; }
12156 fi
12157
12158
12159 fi
12160 if test -z "$CC"; then
12161 if test -n "$ac_tool_prefix"; then
12162 for ac_prog in cl.exe
12163 do
12164 # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
12165 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
12166 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
12167 $as_echo_n "checking for $ac_word... " >&6; }
12168 if ${ac_cv_prog_CC+:} false; then :
12169 $as_echo_n "(cached) " >&6
12170 else
12171 if test -n "$CC"; then
12172 ac_cv_prog_CC="$CC" # Let the user override the test.
12173 else
12174 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
12175 for as_dir in $PATH
12176 do
12177 IFS=$as_save_IFS
12178 test -z "$as_dir" && as_dir=.
12179 for ac_exec_ext in '' $ac_executable_extensions; do
12180 if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
12181 ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
12182 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
12183 break 2
12184 fi
12185 done
12186 done
12187 IFS=$as_save_IFS
12188
12189 fi
12190 fi
12191 CC=$ac_cv_prog_CC
12192 if test -n "$CC"; then
12193 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
12194 $as_echo "$CC" >&6; }
12195 else
12196 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
12197 $as_echo "no" >&6; }
12198 fi
12199
12200
12201 test -n "$CC" && break
12202 done
12203 fi
12204 if test -z "$CC"; then
12205 ac_ct_CC=$CC
12206 for ac_prog in cl.exe
12207 do
12208 # Extract the first word of "$ac_prog", so it can be a program name with args.
12209 set dummy $ac_prog; ac_word=$2
12210 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
12211 $as_echo_n "checking for $ac_word... " >&6; }
12212 if ${ac_cv_prog_ac_ct_CC+:} false; then :
12213 $as_echo_n "(cached) " >&6
12214 else
12215 if test -n "$ac_ct_CC"; then
12216 ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
12217 else
12218 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
12219 for as_dir in $PATH
12220 do
12221 IFS=$as_save_IFS
12222 test -z "$as_dir" && as_dir=.
12223 for ac_exec_ext in '' $ac_executable_extensions; do
12224 if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
12225 ac_cv_prog_ac_ct_CC="$ac_prog"
12226 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
12227 break 2
12228 fi
12229 done
12230 done
12231 IFS=$as_save_IFS
12232
12233 fi
12234 fi
12235 ac_ct_CC=$ac_cv_prog_ac_ct_CC
12236 if test -n "$ac_ct_CC"; then
12237 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
12238 $as_echo "$ac_ct_CC" >&6; }
12239 else
12240 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
12241 $as_echo "no" >&6; }
12242 fi
12243
12244
12245 test -n "$ac_ct_CC" && break
12246 done
12247
12248 if test "x$ac_ct_CC" = x; then
12249 CC=""
12250 else
12251 case $cross_compiling:$ac_tool_warned in
12252 yes:)
12253 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
12254 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
12255 ac_tool_warned=yes ;;
12256 esac
12257 CC=$ac_ct_CC
12258 fi
12259 fi
12260
12261 fi
12262
12263
12264 test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
12265 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
12266 as_fn_error $? "no acceptable C compiler found in \$PATH
12267 See \`config.log' for more details" "$LINENO" 5; }
12268
12269 # Provide some information about the compiler.
12270 $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
12271 set X $ac_compile
12272 ac_compiler=$2
12273 for ac_option in --version -v -V -qversion; do
12274 { { ac_try="$ac_compiler $ac_option >&5"
12275 case "(($ac_try" in
12276 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
12277 *) ac_try_echo=$ac_try;;
12278 esac
12279 eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
12280 $as_echo "$ac_try_echo"; } >&5
12281 (eval "$ac_compiler $ac_option >&5") 2>conftest.err
12282 ac_status=$?
12283 if test -s conftest.err; then
12284 sed '10a\
12285 ... rest of stderr output deleted ...
12286 10q' conftest.err >conftest.er1
12287 cat conftest.er1 >&5
12288 fi
12289 rm -f conftest.er1 conftest.err
12290 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
12291 test $ac_status = 0; }
12292 done
12293
12294 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
12295 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
12296 if ${ac_cv_c_compiler_gnu+:} false; then :
12297 $as_echo_n "(cached) " >&6
12298 else
12299 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
11966 ac_cv_prog_cc_c99=no
11967 ac_save_CC=$CC
11968 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1230011969 /* end confdefs.h. */
11970 #include <stdarg.h>
11971 #include <stdbool.h>
11972 #include <stdlib.h>
11973 #include <wchar.h>
11974 #include <stdio.h>
11975
11976 // Check varargs macros. These examples are taken from C99 6.10.3.5.
11977 #define debug(...) fprintf (stderr, __VA_ARGS__)
11978 #define showlist(...) puts (#__VA_ARGS__)
11979 #define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__))
11980 static void
11981 test_varargs_macros (void)
11982 {
11983 int x = 1234;
11984 int y = 5678;
11985 debug ("Flag");
11986 debug ("X = %d\n", x);
11987 showlist (The first, second, and third items.);
11988 report (x>y, "x is %d but y is %d", x, y);
11989 }
11990
11991 // Check long long types.
11992 #define BIG64 18446744073709551615ull
11993 #define BIG32 4294967295ul
11994 #define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0)
11995 #if !BIG_OK
11996 your preprocessor is broken;
11997 #endif
11998 #if BIG_OK
11999 #else
12000 your preprocessor is broken;
12001 #endif
12002 static long long int bignum = -9223372036854775807LL;
12003 static unsigned long long int ubignum = BIG64;
12004
12005 struct incomplete_array
12006 {
12007 int datasize;
12008 double data[];
12009 };
12010
12011 struct named_init {
12012 int number;
12013 const wchar_t *name;
12014 double average;
12015 };
12016
12017 typedef const char *ccp;
12018
12019 static inline int
12020 test_restrict (ccp restrict text)
12021 {
12022 // See if C++-style comments work.
12023 // Iterate through items via the restricted pointer.
12024 // Also check for declarations in for loops.
12025 for (unsigned int i = 0; *(text+i) != '\0'; ++i)
12026 continue;
12027 return 0;
12028 }
12029
12030 // Check varargs and va_copy.
12031 static void
12032 test_varargs (const char *format, ...)
12033 {
12034 va_list args;
12035 va_start (args, format);
12036 va_list args_copy;
12037 va_copy (args_copy, args);
12038
12039 const char *str;
12040 int number;
12041 float fnumber;
12042
12043 while (*format)
12044 {
12045 switch (*format++)
12046 {
12047 case 's': // string
12048 str = va_arg (args_copy, const char *);
12049 break;
12050 case 'd': // int
12051 number = va_arg (args_copy, int);
12052 break;
12053 case 'f': // float
12054 fnumber = va_arg (args_copy, double);
12055 break;
12056 default:
12057 break;
12058 }
12059 }
12060 va_end (args_copy);
12061 va_end (args);
12062 }
1230112063
1230212064 int
1230312065 main ()
1230412066 {
12305 #ifndef __GNUC__
12306 choke me
12307 #endif
12067
12068 // Check bool.
12069 _Bool success = false;
12070
12071 // Check restrict.
12072 if (test_restrict ("String literal") == 0)
12073 success = true;
12074 char *restrict newvar = "Another string";
12075
12076 // Check varargs.
12077 test_varargs ("s, d' f .", "string", 65, 34.234);
12078 test_varargs_macros ();
12079
12080 // Check flexible array members.
12081 struct incomplete_array *ia =
12082 malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10));
12083 ia->datasize = 10;
12084 for (int i = 0; i < ia->datasize; ++i)
12085 ia->data[i] = i * 1.234;
12086
12087 // Check named initializers.
12088 struct named_init ni = {
12089 .number = 34,
12090 .name = L"Test wide string",
12091 .average = 543.34343,
12092 };
12093
12094 ni.number = 58;
12095
12096 int dynamic_array[ni.number];
12097 dynamic_array[ni.number - 1] = 543;
12098
12099 // work around unused variable warnings
12100 return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x'
12101 || dynamic_array[ni.number - 1] != 543);
1230812102
1230912103 ;
1231012104 return 0;
1231112105 }
1231212106 _ACEOF
12313 if ac_fn_c_try_compile "$LINENO"; then :
12314 ac_compiler_gnu=yes
12315 else
12316 ac_compiler_gnu=no
12317 fi
12318 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
12319 ac_cv_c_compiler_gnu=$ac_compiler_gnu
12320
12321 fi
12322 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
12323 $as_echo "$ac_cv_c_compiler_gnu" >&6; }
12324 if test $ac_compiler_gnu = yes; then
12325 GCC=yes
12326 else
12327 GCC=
12328 fi
12329 ac_test_CFLAGS=${CFLAGS+set}
12330 ac_save_CFLAGS=$CFLAGS
12331 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
12332 $as_echo_n "checking whether $CC accepts -g... " >&6; }
12333 if ${ac_cv_prog_cc_g+:} false; then :
12334 $as_echo_n "(cached) " >&6
12335 else
12336 ac_save_c_werror_flag=$ac_c_werror_flag
12337 ac_c_werror_flag=yes
12338 ac_cv_prog_cc_g=no
12339 CFLAGS="-g"
12340 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
12341 /* end confdefs.h. */
12342
12343 int
12344 main ()
12345 {
12346
12347 ;
12348 return 0;
12349 }
12350 _ACEOF
12351 if ac_fn_c_try_compile "$LINENO"; then :
12352 ac_cv_prog_cc_g=yes
12353 else
12354 CFLAGS=""
12355 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
12356 /* end confdefs.h. */
12357
12358 int
12359 main ()
12360 {
12361
12362 ;
12363 return 0;
12364 }
12365 _ACEOF
12366 if ac_fn_c_try_compile "$LINENO"; then :
12367
12368 else
12369 ac_c_werror_flag=$ac_save_c_werror_flag
12370 CFLAGS="-g"
12371 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
12372 /* end confdefs.h. */
12373
12374 int
12375 main ()
12376 {
12377
12378 ;
12379 return 0;
12380 }
12381 _ACEOF
12382 if ac_fn_c_try_compile "$LINENO"; then :
12383 ac_cv_prog_cc_g=yes
12384 fi
12385 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
12386 fi
12387 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
12388 fi
12389 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
12390 ac_c_werror_flag=$ac_save_c_werror_flag
12391 fi
12392 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
12393 $as_echo "$ac_cv_prog_cc_g" >&6; }
12394 if test "$ac_test_CFLAGS" = set; then
12395 CFLAGS=$ac_save_CFLAGS
12396 elif test $ac_cv_prog_cc_g = yes; then
12397 if test "$GCC" = yes; then
12398 CFLAGS="-g -O2"
12399 else
12400 CFLAGS="-g"
12401 fi
12402 else
12403 if test "$GCC" = yes; then
12404 CFLAGS="-O2"
12405 else
12406 CFLAGS=
12407 fi
12408 fi
12409 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
12410 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
12411 if ${ac_cv_prog_cc_c89+:} false; then :
12412 $as_echo_n "(cached) " >&6
12413 else
12414 ac_cv_prog_cc_c89=no
12415 ac_save_CC=$CC
12416 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
12417 /* end confdefs.h. */
12418 #include <stdarg.h>
12419 #include <stdio.h>
12420 struct stat;
12421 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
12422 struct buf { int x; };
12423 FILE * (*rcsopen) (struct buf *, struct stat *, int);
12424 static char *e (p, i)
12425 char **p;
12426 int i;
12427 {
12428 return p[i];
12429 }
12430 static char *f (char * (*g) (char **, int), char **p, ...)
12431 {
12432 char *s;
12433 va_list v;
12434 va_start (v,p);
12435 s = g (p, va_arg (v,int));
12436 va_end (v);
12437 return s;
12438 }
12439
12440 /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
12441 function prototypes and stuff, but not '\xHH' hex character constants.
12442 These don't provoke an error unfortunately, instead are silently treated
12443 as 'x'. The following induces an error, until -std is added to get
12444 proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
12445 array size at least. It's necessary to write '\x00'==0 to get something
12446 that's true only with -std. */
12447 int osf4_cc_array ['\x00' == 0 ? 1 : -1];
12448
12449 /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
12450 inside strings and character constants. */
12451 #define FOO(x) 'x'
12452 int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
12453
12454 int test (int i, double x);
12455 struct s1 {int (*f) (int a);};
12456 struct s2 {int (*f) (double a);};
12457 int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
12458 int argc;
12459 char **argv;
12460 int
12461 main ()
12462 {
12463 return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
12464 ;
12465 return 0;
12466 }
12467 _ACEOF
12468 for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
12469 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
12107 for ac_arg in '' -std=gnu99 -std=c99 -c99 -AC99 -D_STDC_C99= -qlanglvl=extc99
1247012108 do
1247112109 CC="$ac_save_CC $ac_arg"
1247212110 if ac_fn_c_try_compile "$LINENO"; then :
12473 ac_cv_prog_cc_c89=$ac_arg
12111 ac_cv_prog_cc_c99=$ac_arg
1247412112 fi
1247512113 rm -f core conftest.err conftest.$ac_objext
12476 test "x$ac_cv_prog_cc_c89" != "xno" && break
12114 test "x$ac_cv_prog_cc_c99" != "xno" && break
1247712115 done
1247812116 rm -f conftest.$ac_ext
1247912117 CC=$ac_save_CC
1248012118
1248112119 fi
1248212120 # AC_CACHE_VAL
12483 case "x$ac_cv_prog_cc_c89" in
12121 case "x$ac_cv_prog_cc_c99" in
1248412122 x)
1248512123 { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
1248612124 $as_echo "none needed" >&6; } ;;
1248812126 { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
1248912127 $as_echo "unsupported" >&6; } ;;
1249012128 *)
12491 CC="$CC $ac_cv_prog_cc_c89"
12492 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
12493 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
12129 CC="$CC $ac_cv_prog_cc_c99"
12130 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5
12131 $as_echo "$ac_cv_prog_cc_c99" >&6; } ;;
1249412132 esac
12495 if test "x$ac_cv_prog_cc_c89" != xno; then :
12496
12497 fi
12498
12499 ac_ext=c
12500 ac_cpp='$CPP $CPPFLAGS'
12501 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
12502 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
12503 ac_compiler_gnu=$ac_cv_c_compiler_gnu
12504
12505 ac_ext=c
12506 ac_cpp='$CPP $CPPFLAGS'
12507 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
12508 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
12509 ac_compiler_gnu=$ac_cv_c_compiler_gnu
12510 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5
12511 $as_echo_n "checking whether $CC understands -c and -o together... " >&6; }
12512 if ${am_cv_prog_cc_c_o+:} false; then :
12513 $as_echo_n "(cached) " >&6
12514 else
12515 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
12516 /* end confdefs.h. */
12517
12518 int
12519 main ()
12520 {
12521
12522 ;
12523 return 0;
12524 }
12525 _ACEOF
12526 # Make sure it works both with $CC and with simple cc.
12527 # Following AC_PROG_CC_C_O, we do the test twice because some
12528 # compilers refuse to overwrite an existing .o file with -o,
12529 # though they will create one.
12530 am_cv_prog_cc_c_o=yes
12531 for am_i in 1 2; do
12532 if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5
12533 ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5
12534 ac_status=$?
12535 echo "$as_me:$LINENO: \$? = $ac_status" >&5
12536 (exit $ac_status); } \
12537 && test -f conftest2.$ac_objext; then
12538 : OK
12539 else
12540 am_cv_prog_cc_c_o=no
12541 break
12542 fi
12543 done
12544 rm -f core conftest*
12545 unset am_i
12546 fi
12547 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5
12548 $as_echo "$am_cv_prog_cc_c_o" >&6; }
12549 if test "$am_cv_prog_cc_c_o" != yes; then
12550 # Losing compiler, so override with the script.
12551 # FIXME: It is wrong to rewrite CC.
12552 # But if we don't then we get into trouble of one sort or another.
12553 # A longer-term fix would be to have automake use am__CC in this case,
12554 # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
12555 CC="$am_aux_dir/compile $CC"
12556 fi
12557 ac_ext=c
12558 ac_cpp='$CPP $CPPFLAGS'
12559 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
12560 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
12561 ac_compiler_gnu=$ac_cv_c_compiler_gnu
12562
12563
12564 depcc="$CC" am_compiler_list=
12565
12566 { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
12567 $as_echo_n "checking dependency style of $depcc... " >&6; }
12568 if ${am_cv_CC_dependencies_compiler_type+:} false; then :
12569 $as_echo_n "(cached) " >&6
12570 else
12571 if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
12572 # We make a subdir and do the tests there. Otherwise we can end up
12573 # making bogus files that we don't know about and never remove. For
12574 # instance it was reported that on HP-UX the gcc test will end up
12575 # making a dummy file named 'D' -- because '-MD' means "put the output
12576 # in D".
12577 rm -rf conftest.dir
12578 mkdir conftest.dir
12579 # Copy depcomp to subdir because otherwise we won't find it if we're
12580 # using a relative directory.
12581 cp "$am_depcomp" conftest.dir
12582 cd conftest.dir
12583 # We will build objects and dependencies in a subdirectory because
12584 # it helps to detect inapplicable dependency modes. For instance
12585 # both Tru64's cc and ICC support -MD to output dependencies as a
12586 # side effect of compilation, but ICC will put the dependencies in
12587 # the current directory while Tru64 will put them in the object
12588 # directory.
12589 mkdir sub
12590
12591 am_cv_CC_dependencies_compiler_type=none
12592 if test "$am_compiler_list" = ""; then
12593 am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
12594 fi
12595 am__universal=false
12596 case " $depcc " in #(
12597 *\ -arch\ *\ -arch\ *) am__universal=true ;;
12598 esac
12599
12600 for depmode in $am_compiler_list; do
12601 # Setup a source with many dependencies, because some compilers
12602 # like to wrap large dependency lists on column 80 (with \), and
12603 # we should not choose a depcomp mode which is confused by this.
12604 #
12605 # We need to recreate these files for each test, as the compiler may
12606 # overwrite some of them when testing with obscure command lines.
12607 # This happens at least with the AIX C compiler.
12608 : > sub/conftest.c
12609 for i in 1 2 3 4 5 6; do
12610 echo '#include "conftst'$i'.h"' >> sub/conftest.c
12611 # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
12612 # Solaris 10 /bin/sh.
12613 echo '/* dummy */' > sub/conftst$i.h
12614 done
12615 echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
12616
12617 # We check with '-c' and '-o' for the sake of the "dashmstdout"
12618 # mode. It turns out that the SunPro C++ compiler does not properly
12619 # handle '-M -o', and we need to detect this. Also, some Intel
12620 # versions had trouble with output in subdirs.
12621 am__obj=sub/conftest.${OBJEXT-o}
12622 am__minus_obj="-o $am__obj"
12623 case $depmode in
12624 gcc)
12625 # This depmode causes a compiler race in universal mode.
12626 test "$am__universal" = false || continue
12627 ;;
12628 nosideeffect)
12629 # After this tag, mechanisms are not by side-effect, so they'll
12630 # only be used when explicitly requested.
12631 if test "x$enable_dependency_tracking" = xyes; then
12632 continue
12633 else
12634 break
12635 fi
12636 ;;
12637 msvc7 | msvc7msys | msvisualcpp | msvcmsys)
12638 # This compiler won't grok '-c -o', but also, the minuso test has
12639 # not run yet. These depmodes are late enough in the game, and
12640 # so weak that their functioning should not be impacted.
12641 am__obj=conftest.${OBJEXT-o}
12642 am__minus_obj=
12643 ;;
12644 none) break ;;
12645 esac
12646 if depmode=$depmode \
12647 source=sub/conftest.c object=$am__obj \
12648 depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
12649 $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
12650 >/dev/null 2>conftest.err &&
12651 grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
12652 grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
12653 grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
12654 ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
12655 # icc doesn't choke on unknown options, it will just issue warnings
12656 # or remarks (even with -Werror). So we grep stderr for any message
12657 # that says an option was ignored or not supported.
12658 # When given -MP, icc 7.0 and 7.1 complain thusly:
12659 # icc: Command line warning: ignoring option '-M'; no argument required
12660 # The diagnosis changed in icc 8.0:
12661 # icc: Command line remark: option '-MP' not supported
12662 if (grep 'ignoring option' conftest.err ||
12663 grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
12664 am_cv_CC_dependencies_compiler_type=$depmode
12665 break
12666 fi
12667 fi
12668 done
12669
12670 cd ..
12671 rm -rf conftest.dir
12672 else
12673 am_cv_CC_dependencies_compiler_type=none
12674 fi
12675
12676 fi
12677 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5
12678 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; }
12679 CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
12680
12681 if
12682 test "x$enable_dependency_tracking" != xno \
12683 && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
12684 am__fastdepCC_TRUE=
12685 am__fastdepCC_FALSE='#'
12686 else
12687 am__fastdepCC_TRUE='#'
12688 am__fastdepCC_FALSE=
12133 if test "x$ac_cv_prog_cc_c99" != xno; then :
12134
1268912135 fi
1269012136
1269112137
1331212758 fi
1331312759
1331412760 pkg_failed=no
13315 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for DVDREAD" >&5
13316 $as_echo_n "checking for DVDREAD... " >&6; }
12761 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dvdread >= ${DVDREAD_MIN_VERSION}" >&5
12762 $as_echo_n "checking for dvdread >= ${DVDREAD_MIN_VERSION}... " >&6; }
1331712763
1331812764 if test -n "$DVDREAD_CFLAGS"; then
1331912765 pkg_cv_DVDREAD_CFLAGS="$DVDREAD_CFLAGS"
1335312799
1335412800
1335512801 if test $pkg_failed = yes; then
13356 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
12802 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
1335712803 $as_echo "no" >&6; }
1335812804
1335912805 if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
1338012826 and DVDREAD_LIBS to avoid the need to call pkg-config.
1338112827 See the pkg-config man page for more details." "$LINENO" 5
1338212828 elif test $pkg_failed = untried; then
13383 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
12829 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
1338412830 $as_echo "no" >&6; }
1338512831 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
1338612832 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
1366513111 as_fn_error $? "conditional \"am__fastdepCC\" was never defined.
1366613112 Usually this means the macro was only invoked conditionally." "$LINENO" 5
1366713113 fi
13668 if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
13669 as_fn_error $? "conditional \"am__fastdepCC\" was never defined.
13670 Usually this means the macro was only invoked conditionally." "$LINENO" 5
13671 fi
1367213114
1367313115
1367413116 : "${CONFIG_STATUS=./config.status}"
1406713509 # report actual input values of CONFIG_FILES etc. instead of their
1406813510 # values after options handling.
1406913511 ac_log="
14070 This file was extended by libdvdnav $as_me 6.1.0, which was
13512 This file was extended by libdvdnav $as_me 6.1.1, which was
1407113513 generated by GNU Autoconf 2.69. Invocation command line was
1407213514
1407313515 CONFIG_FILES = $CONFIG_FILES
1413313575 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
1413413576 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
1413513577 ac_cs_version="\\
14136 libdvdnav config.status 6.1.0
13578 libdvdnav config.status 6.1.1
1413713579 configured by $0, generated by GNU Autoconf 2.69,
1413813580 with options \\"\$ac_cs_config\\"
1413913581
1522914671 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
1523014672 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
1523114673 as_fn_error $? "Something went wrong bootstrapping makefile fragments
15232 for automatic dependency tracking. Try re-running configure with the
14674 for automatic dependency tracking. If GNU make was not used, consider
14675 re-running the configure script with MAKE=\"gmake\" (or whatever is
14676 necessary). You can also try re-running configure with the
1523314677 '--disable-dependency-tracking' option to at least be able to build
1523414678 the package (albeit without support for automatic dependency tracking).
1523514679 See \`config.log' for more details" "$LINENO" 5; }
44 dnl --------------------------------------------------------------
55 m4_define([dvdnav_major], [6])
66 m4_define([dvdnav_minor], [1])
7 m4_define([dvdnav_sub], [0])
7 m4_define([dvdnav_sub], [1])
88 m4_define([dvdnav_pre], [])
99
1010 AC_INIT([libdvdnav], [dvdnav_major.dvdnav_minor.dvdnav_sub[]dvdnav_pre])
6666 AC_SUBST(DVDNAV_LT_AGE)
6767 AC_SUBST(DVDNAV_LT_REVISION)
6868
69 AC_PROG_CC
69 AC_PROG_CC_C99
7070
7171 AC_SYS_LARGEFILE
7272 AC_C_BIGENDIAN
2424
2525 #define DVDNAV_VERSION_MAJOR 6
2626 #define DVDNAV_VERSION_MINOR 1
27 #define DVDNAV_VERSION_MICRO 0
27 #define DVDNAV_VERSION_MICRO 1
2828
29 #define DVDNAV_VERSION_STRING "6.1.0"
29 #define DVDNAV_VERSION_STRING "6.1.1"
3030
3131 #define DVDNAV_VERSION \
3232 DVDNAV_VERSION_CODE(DVDNAV_VERSION_MAJOR, DVDNAV_VERSION_MINOR, DVDNAV_VERSION_MICRO)
2121 #include "config.h"
2222 #endif
2323
24 /* Un-comment the following to enable additional Log3() function calls.
25 * Do not forget to #define TRACE in src/vm/vm.h (required) */
2426 /*
2527 #define LOG_DEBUG
2628 */
557559 vm_position_get(this->vm, &this->position_next);
558560
559561 #ifdef LOG_DEBUG
560 Log3(vm, "POS-NEXT ");
562 Log3(this->vm, "POS-NEXT ");
561563 vm_position_print(this->vm, &this->position_next);
562 Log3(vm, "POS-CUR ");
564 Log3(this->vm, "POS-CUR ");
563565 vm_position_print(this->vm, &this->position_current);
564566 #endif
565567
567569 if(this->position_current.hop_channel != this->position_next.hop_channel) {
568570 (*event) = DVDNAV_HOP_CHANNEL;
569571 #ifdef LOG_DEBUG
570 Log3(vm, "HOP_CHANNEL");
572 Log3(this->vm, "HOP_CHANNEL");
571573 #endif
572574 if (this->position_next.hop_channel - this->position_current.hop_channel >= HOP_SEEK) {
573575 int32_t num_angles = 0, current;
113113 } else {
114114 return get_GPRM(command->registers, reg & 0x0f) ;
115115 }
116 }
117
118 /* Eval register or immediate data.
119 AAAA_AAAA BBBB_BBBB, if immediate use all 16 bits for data else use
120 lower eight bits for the system or general purpose register. */
121 static uint16_t eval_reg_or_data(command_t* command, int32_t imm, int32_t start) {
122 if(imm) { /* immediate */
123 return vm_getbits(command, start, 16);
124 } else {
125 return eval_reg(command, vm_getbits(command, (start - 8), 8));
126 }
127 }
128
129 /* Eval register or immediate data.
130 xBBB_BBBB, if immediate use all 7 bits for data else use
131 lower four bits for the general purpose register number. */
132 /* Evaluates gprm or data depending on bit, data is in byte n */
133 static uint16_t eval_reg_or_data_2(command_t* command,
134 int32_t imm, int32_t start) {
135 if(imm) /* immediate */
136 return vm_getbits(command, (start - 1), 7);
137 else
138 return get_GPRM(command->registers, (vm_getbits(command, (start - 4), 4)) );
139 }
140
141
142 /* Compare data using operation, return result from comparison.
143 Helper function for the different if functions. */
144 static int32_t eval_compare(uint8_t operation, uint16_t data1, uint16_t data2) {
145 switch(operation) {
146 case 1:
147 return data1 & data2;
148 case 2:
149 return data1 == data2;
150 case 3:
151 return data1 != data2;
152 case 4:
153 return data1 >= data2;
154 case 5:
155 return data1 > data2;
156 case 6:
157 return data1 <= data2;
158 case 7:
159 return data1 < data2;
160 }
161 fprintf(MSG_OUT, "libdvdnav: eval_compare: Invalid comparison code\n");
162 return 0;
163 }
164
165
166 /* Evaluate if version 1.
167 Has comparison data in byte 3 and 4-5 (immediate or register) */
168 static int32_t eval_if_version_1(command_t* command) {
169 uint8_t op = vm_getbits(command, 54, 3);
170 if(op) {
171 return eval_compare(op, eval_reg(command, vm_getbits(command, 39, 8)),
172 eval_reg_or_data(command, vm_getbits(command, 55, 1), 31));
173 }
174 return 1;
175 }
176
177 /* Evaluate if version 2.
178 This version only compares register which are in byte 6 and 7 */
179 static int32_t eval_if_version_2(command_t* command) {
180 uint8_t op = vm_getbits(command, 54, 3);
181 if(op) {
182 return eval_compare(op, eval_reg(command, vm_getbits(command, 15, 8)),
183 eval_reg(command, vm_getbits(command, 7, 8)));
184 }
185 return 1;
186 }
187
188 /* Evaluate if version 3.
189 Has comparison data in byte 2 and 6-7 (immediate or register) */
190 static int32_t eval_if_version_3(command_t* command) {
191 uint8_t op = vm_getbits(command, 54, 3);
192 if(op) {
193 return eval_compare(op, eval_reg(command, vm_getbits(command, 47, 8)),
194 eval_reg_or_data(command, vm_getbits(command, 55, 1), 15));
195 }
196 return 1;
197 }
198
199 /* Evaluate if version 4.
200 Has comparison data in byte 1 and 4-5 (immediate or register)
201 The register in byte 1 is only the lowe nibble (4 bits) */
202 static int32_t eval_if_version_4(command_t* command) {
203 uint8_t op = vm_getbits(command, 54, 3);
204 if(op) {
205 return eval_compare(op, eval_reg(command, vm_getbits(command, 51, 4)),
206 eval_reg_or_data(command, vm_getbits(command, 55, 1), 31));
207 }
208 return 1;
209 }
210
211 /* Evaluate special instruction.... returns the new row/line number,
212 0 if no new row and 256 if Break. */
213 static int32_t eval_special_instruction(command_t* command, int32_t cond) {
214 int32_t line, level;
215
216 switch(vm_getbits(command, 51, 4)) {
217 case 0: /* NOP */
218 line = 0;
219 return cond ? line : 0;
220 case 1: /* Goto line */
221 line = vm_getbits(command, 7, 8);
222 return cond ? line : 0;
223 case 2: /* Break */
224 /* max number of rows < 256, so we will end this set */
225 line = 256;
226 return cond ? 256 : 0;
227 case 3: /* Set temporary parental level and goto */
228 line = vm_getbits(command, 7, 8);
229 level = vm_getbits(command, 11, 4);
230 if(cond) {
231 /* This always succeeds now, if we want real parental protection */
232 /* we need to ask the user and have passwords and stuff. */
233 command->registers->SPRM[13] = level;
234 }
235 return cond ? line : 0;
236 }
237 return 0;
238 }
239
240 /* Evaluate link by subinstruction.
241 Return 1 if link, or 0 if no link
242 Actual link instruction is in return_values parameter */
243 static int32_t eval_link_subins(command_t* command, int32_t cond, link_t *return_values) {
244 uint16_t button = vm_getbits(command, 15, 6);
245 uint8_t linkop = vm_getbits(command, 4, 5);
246
247 if(linkop > 0x10)
248 return 0; /* Unknown Link by Sub-Instruction command */
249
250 /* Assumes that the link_cmd_t enum has the same values as the LinkSIns codes */
251 return_values->command = linkop;
252 return_values->data1 = button;
253 return cond;
254 }
255
256
257 /* Evaluate link instruction.
258 Return 1 if link, or 0 if no link
259 Actual link instruction is in return_values parameter */
260 static int32_t eval_link_instruction(command_t* command, int32_t cond, link_t *return_values) {
261 uint8_t op = vm_getbits(command, 51, 4);
262
263 switch(op) {
264 case 1:
265 return eval_link_subins(command, cond, return_values);
266 case 4:
267 return_values->command = LinkPGCN;
268 return_values->data1 = vm_getbits(command, 14, 15);
269 return cond;
270 case 5:
271 return_values->command = LinkPTTN;
272 return_values->data1 = vm_getbits(command, 9, 10);
273 return_values->data2 = vm_getbits(command, 15, 6);
274 return cond;
275 case 6:
276 return_values->command = LinkPGN;
277 return_values->data1 = vm_getbits(command, 6, 7);
278 return_values->data2 = vm_getbits(command, 15, 6);
279 return cond;
280 case 7:
281 return_values->command = LinkCN;
282 return_values->data1 = vm_getbits(command, 7, 8);
283 return_values->data2 = vm_getbits(command, 15, 6);
284 return cond;
285 }
286 return 0;
287 }
288
289
290 /* Evaluate a jump instruction.
291 returns 1 if jump or 0 if no jump
292 actual jump instruction is in return_values parameter */
293 static int32_t eval_jump_instruction(command_t* command, int32_t cond, link_t *return_values) {
294
295 switch(vm_getbits(command, 51, 4)) {
296 case 1:
297 return_values->command = Exit;
298 return cond;
299 case 2:
300 return_values->command = JumpTT;
301 return_values->data1 = vm_getbits(command, 22, 7);
302 return cond;
303 case 3:
304 return_values->command = JumpVTS_TT;
305 return_values->data1 = vm_getbits(command, 22, 7);
306 return cond;
307 case 5:
308 return_values->command = JumpVTS_PTT;
309 return_values->data1 = vm_getbits(command, 22, 7);
310 return_values->data2 = vm_getbits(command, 41, 10);
311 return cond;
312 case 6:
313 switch(vm_getbits(command, 23, 2)) {
314 case 0:
315 return_values->command = JumpSS_FP;
316 return cond;
317 case 1:
318 return_values->command = JumpSS_VMGM_MENU;
319 return_values->data1 = vm_getbits(command, 19, 4);
320 return cond;
321 case 2:
322 return_values->command = JumpSS_VTSM;
323 return_values->data1 = vm_getbits(command, 31, 8);
324 return_values->data2 = vm_getbits(command, 39, 8);
325 return_values->data3 = vm_getbits(command, 19, 4);
326 return cond;
327 case 3:
328 return_values->command = JumpSS_VMGM_PGC;
329 return_values->data1 = vm_getbits(command, 46, 15);
330 return cond;
331 }
332 break;
333 case 8:
334 switch(vm_getbits(command, 23, 2)) {
335 case 0:
336 return_values->command = CallSS_FP;
337 return_values->data1 = vm_getbits(command, 31, 8);
338 return cond;
339 case 1:
340 return_values->command = CallSS_VMGM_MENU;
341 return_values->data1 = vm_getbits(command, 19, 4);
342 return_values->data2 = vm_getbits(command, 31, 8);
343 return cond;
344 case 2:
345 return_values->command = CallSS_VTSM;
346 return_values->data1 = vm_getbits(command, 19, 4);
347 return_values->data2 = vm_getbits(command, 31, 8);
348 return cond;
349 case 3:
350 return_values->command = CallSS_VMGM_PGC;
351 return_values->data1 = vm_getbits(command, 46, 15);
352 return_values->data2 = vm_getbits(command, 31, 8);
353 return cond;
354 }
355 break;
356 }
357 return 0;
358 }
359
360 /* Evaluate a set sytem register instruction
361 May contain a link so return the same as eval_link */
362 static int32_t eval_system_set(command_t* command, int32_t cond, link_t *return_values) {
363 int32_t i;
364 uint16_t data, data2;
365
366 switch(vm_getbits(command, 59, 4)) {
367 case 1: /* Set system reg 1 &| 2 &| 3 (Audio, Subp. Angle) */
368 for(i = 1; i <= 3; i++) {
369 if(vm_getbits(command, 63 - ((2 + i)*8), 1)) {
370 data = eval_reg_or_data_2(command, vm_getbits(command, 60, 1), (47 - (i*8)));
371 if(cond) {
372 command->registers->SPRM[i] = data;
373 }
374 }
375 }
376 break;
377 case 2: /* Set system reg 9 & 10 (Navigation timer, Title PGC number) */
378 data = eval_reg_or_data(command, vm_getbits(command, 60, 1), 47);
379 data2 = vm_getbits(command, 23, 8); /* ?? size */
380 if(cond) {
381 command->registers->SPRM[9] = data; /* time */
382 command->registers->SPRM[10] = data2; /* pgcN */
383 }
384 break;
385 case 3: /* Mode: Counter / Register + Set */
386 data = eval_reg_or_data(command, vm_getbits(command, 60, 1), 47);
387 data2 = vm_getbits(command, 19, 4);
388 if(vm_getbits(command, 23, 1)) {
389 command->registers->GPRM_mode[data2] |= 1; /* Set bit 0 */
390 } else {
391 command->registers->GPRM_mode[data2] &= ~ 0x01; /* Reset bit 0 */
392 }
393 if(cond) {
394 set_GPRM(command->registers, data2, data);
395 }
396 break;
397 case 6: /* Set system reg 8 (Highlighted button) */
398 data = eval_reg_or_data(command, vm_getbits(command, 60, 1), 31); /* Not system reg!! */
399 if(cond) {
400 command->registers->SPRM[8] = data;
401 }
402 break;
403 }
404 if(vm_getbits(command, 51, 4)) {
405 return eval_link_instruction(command, cond, return_values);
406 }
407 return 0;
408 }
409
410
411 /* Evaluate set operation
412 Sets the register given to the value indicated by op and data.
413 For the swap case the contents of reg is stored in reg2.
414 */
415 static void eval_set_op(command_t* command, int32_t op, int32_t reg, int32_t reg2, int32_t data) {
416 static const int32_t shortmax = 0xffff;
417 int32_t tmp;
418 switch(op) {
419 case 1:
420 set_GPRM(command->registers, reg, data);
421 break;
422 case 2: /* SPECIAL CASE - SWAP! */
423 set_GPRM(command->registers, reg2, get_GPRM(command->registers, reg));
424 set_GPRM(command->registers, reg, data);
425 break;
426 case 3:
427 tmp = get_GPRM(command->registers, reg) + data;
428 if(tmp > shortmax) tmp = shortmax;
429 set_GPRM(command->registers, reg, (uint16_t)tmp);
430 break;
431 case 4:
432 tmp = get_GPRM(command->registers, reg) - data;
433 if(tmp < 0) tmp = 0;
434 set_GPRM(command->registers, reg, (uint16_t)tmp);
435 break;
436 case 5:
437 tmp = get_GPRM(command->registers, reg) * data;
438 if(tmp > shortmax) tmp = shortmax;
439 set_GPRM(command->registers, reg, (uint16_t)tmp);
440 break;
441 case 6:
442 if (data != 0) {
443 set_GPRM(command->registers, reg, (get_GPRM(command->registers, reg) / data) );
444 } else {
445 set_GPRM(command->registers, reg, 0xffff); /* Avoid that divide by zero! */
446 }
447 break;
448 case 7:
449 if (data != 0) {
450 set_GPRM(command->registers, reg, (get_GPRM(command->registers, reg) % data) );
451 } else {
452 set_GPRM(command->registers, reg, 0xffff); /* Avoid that divide by zero! */
453 }
454 break;
455 case 8: /* SPECIAL CASE - RND! Return numbers between 1 and data. */
456 set_GPRM(command->registers, reg, 1 + ((uint16_t) ((float) data * rand()/(RAND_MAX+1.0))) );
457 break;
458 case 9:
459 set_GPRM(command->registers, reg, (get_GPRM(command->registers, reg) & data) );
460 break;
461 case 10:
462 set_GPRM(command->registers, reg, (get_GPRM(command->registers, reg) | data) );
463 break;
464 case 11:
465 set_GPRM(command->registers, reg, (get_GPRM(command->registers, reg) ^ data) );
466 break;
467 }
468 }
469
470 /* Evaluate set instruction, combined with either Link or Compare. */
471 static void eval_set_version_1(command_t* command, int32_t cond) {
472 uint8_t op = vm_getbits(command, 59, 4);
473 uint8_t reg = vm_getbits(command, 35, 4); /* FIXME: This is different from vmcmd.c!!! */
474 uint8_t reg2 = vm_getbits(command, 19, 4);
475 uint16_t data = eval_reg_or_data(command, vm_getbits(command, 60, 1), 31);
476
477 if(cond) {
478 eval_set_op(command, op, reg, reg2, data);
479 }
480 }
481
482
483 /* Evaluate set instruction, combined with both Link and Compare. */
484 static void eval_set_version_2(command_t* command, int32_t cond) {
485 uint8_t op = vm_getbits(command, 59, 4);
486 uint8_t reg = vm_getbits(command, 51, 4);
487 uint8_t reg2 = vm_getbits(command, 35, 4); /* FIXME: This is different from vmcmd.c!!! */
488 uint16_t data = eval_reg_or_data(command, vm_getbits(command, 60, 1), 47);
489
490 if(cond) {
491 eval_set_op(command, op, reg, reg2, data);
492 }
493 }
494
495
496 /* Evaluate a command
497 returns row number of goto, 0 if no goto, -1 if link.
498 Link command in return_values */
499 static int32_t eval_command(uint8_t *bytes, registers_t* registers, link_t *return_values) {
500 int32_t cond, res = 0;
501 command_t command;
502 command.instruction =( (uint64_t) bytes[0] << 56 ) |
503 ( (uint64_t) bytes[1] << 48 ) |
504 ( (uint64_t) bytes[2] << 40 ) |
505 ( (uint64_t) bytes[3] << 32 ) |
506 ( (uint64_t) bytes[4] << 24 ) |
507 ( (uint64_t) bytes[5] << 16 ) |
508 ( (uint64_t) bytes[6] << 8 ) |
509 (uint64_t) bytes[7] ;
510 command.examined = 0;
511 command.registers = registers;
512 memset(return_values, 0, sizeof(link_t));
513
514 switch(vm_getbits(&command, 63, 3)) { /* three first old_bits */
515 case 0: /* Special instructions */
516 cond = eval_if_version_1(&command);
517 res = eval_special_instruction(&command, cond);
518 if(res == -1) {
519 fprintf(MSG_OUT, "libdvdnav: Unknown Instruction!\n");
520 assert(0);
521 }
522 break;
523 case 1: /* Link/jump instructions */
524 if(vm_getbits(&command, 60, 1)) {
525 cond = eval_if_version_2(&command);
526 res = eval_jump_instruction(&command, cond, return_values);
527 } else {
528 cond = eval_if_version_1(&command);
529 res = eval_link_instruction(&command, cond, return_values);
530 }
531 if(res)
532 res = -1;
533 break;
534 case 2: /* System set instructions */
535 cond = eval_if_version_2(&command);
536 res = eval_system_set(&command, cond, return_values);
537 if(res)
538 res = -1;
539 break;
540 case 3: /* Set instructions, either Compare or Link may be used */
541 cond = eval_if_version_3(&command);
542 eval_set_version_1(&command, cond);
543 if(vm_getbits(&command, 51, 4)) {
544 res = eval_link_instruction(&command, cond, return_values);
545 }
546 if(res)
547 res = -1;
548 break;
549 case 4: /* Set, Compare -> Link Sub-Instruction */
550 eval_set_version_2(&command, /*True*/ 1);
551 cond = eval_if_version_4(&command);
552 res = eval_link_subins(&command, cond, return_values);
553 if(res)
554 res = -1;
555 break;
556 case 5: /* Compare -> (Set and Link Sub-Instruction) */
557 /* FIXME: These are wrong. Need to be updated from vmcmd.c */
558 cond = eval_if_version_4(&command);
559 eval_set_version_2(&command, cond);
560 res = eval_link_subins(&command, cond, return_values);
561 if(res)
562 res = -1;
563 break;
564 case 6: /* Compare -> Set, allways Link Sub-Instruction */
565 /* FIXME: These are wrong. Need to be updated from vmcmd.c */
566 cond = eval_if_version_4(&command);
567 eval_set_version_2(&command, cond);
568 res = eval_link_subins(&command, /*True*/ 1, return_values);
569 if(res)
570 res = -1;
571 break;
572 default: /* Unknown command type */
573 fprintf(MSG_OUT, "libdvdnav: WARNING: Unknown Command Type=%x\n", vm_getbits(&command, 63, 3));
574 }
575 /* Check if there are bits not yet examined */
576
577 if(command.instruction & ~ command.examined) {
578 fprintf(MSG_OUT, "libdvdnav: decoder.c: [WARNING, unknown bits:");
579 fprintf(MSG_OUT, " %08"PRIx64, (command.instruction & ~ command.examined) );
580 fprintf(MSG_OUT, "]\n");
581 }
582
583 return res;
584 }
585
586 /* Evaluate a set of commands in the given register set (which is modified) */
587 int32_t vmEval_CMD(vm_cmd_t commands[], int32_t num_commands,
588 registers_t *registers, link_t *return_values) {
589 int32_t i = 0;
590 int32_t total = 0;
591
592 #ifdef TRACE
593 /* DEBUG */
594 fprintf(MSG_OUT, "libdvdnav: Registers before transaction\n");
595 vm_print_registers( registers );
596 fprintf(MSG_OUT, "libdvdnav: Full list of commands to execute\n");
597 for(i = 0; i < num_commands; i++)
598 vm_print_cmd(i, &commands[i]);
599 fprintf(MSG_OUT, "libdvdnav: --------------------------------------------\n");
600 fprintf(MSG_OUT, "libdvdnav: Single stepping commands\n");
601 #endif
602
603 i = 0;
604 while(i < num_commands && total < 100000) {
605 int32_t line;
606
607 #ifdef TRACE
608 vm_print_cmd(i, &commands[i]);
609 #endif
610
611 line = eval_command(&commands[i].bytes[0], registers, return_values);
612
613 if (line < 0) { /* Link command */
614 #ifdef TRACE
615 fprintf(MSG_OUT, "libdvdnav: Registers after transaction\n");
616 vm_print_registers( registers );
617 fprintf(MSG_OUT, "libdvdnav: eval: Doing Link/Jump/Call\n");
618 #endif
619 return 1;
620 }
621
622 if (line > 0) /* Goto command */
623 i = line - 1;
624 else /* Just continue on the next line */
625 i++;
626
627 total++;
628 }
629
630 memset(return_values, 0, sizeof(link_t));
631 #ifdef TRACE
632 fprintf(MSG_OUT, "libdvdnav: Registers after transaction\n");
633 vm_print_registers( registers );
634 #endif
635 return 0;
636116 }
637117
638118 #ifdef TRACE
781261
782262 #endif
783263
264 /* Eval register or immediate data.
265 AAAA_AAAA BBBB_BBBB, if immediate use all 16 bits for data else use
266 lower eight bits for the system or general purpose register. */
267 static uint16_t eval_reg_or_data(command_t* command, int32_t imm, int32_t start) {
268 if(imm) { /* immediate */
269 return vm_getbits(command, start, 16);
270 } else {
271 return eval_reg(command, vm_getbits(command, (start - 8), 8));
272 }
273 }
274
275 /* Eval register or immediate data.
276 xBBB_BBBB, if immediate use all 7 bits for data else use
277 lower four bits for the general purpose register number. */
278 /* Evaluates gprm or data depending on bit, data is in byte n */
279 static uint16_t eval_reg_or_data_2(command_t* command,
280 int32_t imm, int32_t start) {
281 if(imm) /* immediate */
282 return vm_getbits(command, (start - 1), 7);
283 else
284 return get_GPRM(command->registers, (vm_getbits(command, (start - 4), 4)) );
285 }
286
287
288 /* Compare data using operation, return result from comparison.
289 Helper function for the different if functions. */
290 static int32_t eval_compare(uint8_t operation, uint16_t data1, uint16_t data2) {
291 switch(operation) {
292 case 1:
293 return data1 & data2;
294 case 2:
295 return data1 == data2;
296 case 3:
297 return data1 != data2;
298 case 4:
299 return data1 >= data2;
300 case 5:
301 return data1 > data2;
302 case 6:
303 return data1 <= data2;
304 case 7:
305 return data1 < data2;
306 }
307 fprintf(MSG_OUT, "libdvdnav: eval_compare: Invalid comparison code\n");
308 return 0;
309 }
310
311
312 /* Evaluate if version 1.
313 Has comparison data in byte 3 and 4-5 (immediate or register) */
314 static int32_t eval_if_version_1(command_t* command) {
315 uint8_t op = vm_getbits(command, 54, 3);
316 if(op) {
317 return eval_compare(op, eval_reg(command, vm_getbits(command, 39, 8)),
318 eval_reg_or_data(command, vm_getbits(command, 55, 1), 31));
319 }
320 return 1;
321 }
322
323 /* Evaluate if version 2.
324 This version only compares register which are in byte 6 and 7 */
325 static int32_t eval_if_version_2(command_t* command) {
326 uint8_t op = vm_getbits(command, 54, 3);
327 if(op) {
328 return eval_compare(op, eval_reg(command, vm_getbits(command, 15, 8)),
329 eval_reg(command, vm_getbits(command, 7, 8)));
330 }
331 return 1;
332 }
333
334 /* Evaluate if version 3.
335 Has comparison data in byte 2 and 6-7 (immediate or register) */
336 static int32_t eval_if_version_3(command_t* command) {
337 uint8_t op = vm_getbits(command, 54, 3);
338 if(op) {
339 return eval_compare(op, eval_reg(command, vm_getbits(command, 47, 8)),
340 eval_reg_or_data(command, vm_getbits(command, 55, 1), 15));
341 }
342 return 1;
343 }
344
345 /* Evaluate if version 4.
346 Has comparison data in byte 1 and 4-5 (immediate or register)
347 The register in byte 1 is only the lowe nibble (4 bits) */
348 static int32_t eval_if_version_4(command_t* command) {
349 uint8_t op = vm_getbits(command, 54, 3);
350 if(op) {
351 return eval_compare(op, eval_reg(command, vm_getbits(command, 51, 4)),
352 eval_reg_or_data(command, vm_getbits(command, 55, 1), 31));
353 }
354 return 1;
355 }
356
357 /* Evaluate special instruction.... returns the new row/line number,
358 0 if no new row and 256 if Break. */
359 static int32_t eval_special_instruction(command_t* command, int32_t cond) {
360 int32_t line, level;
361
362 switch(vm_getbits(command, 51, 4)) {
363 case 0: /* NOP */
364 line = 0;
365 return cond ? line : 0;
366 case 1: /* Goto line */
367 line = vm_getbits(command, 7, 8);
368 return cond ? line : 0;
369 case 2: /* Break */
370 /* max number of rows < 256, so we will end this set */
371 line = 256;
372 return cond ? 256 : 0;
373 case 3: /* Set temporary parental level and goto */
374 line = vm_getbits(command, 7, 8);
375 level = vm_getbits(command, 11, 4);
376 if(cond) {
377 /* This always succeeds now, if we want real parental protection */
378 /* we need to ask the user and have passwords and stuff. */
379 command->registers->SPRM[13] = level;
380 }
381 return cond ? line : 0;
382 }
383 return 0;
384 }
385
386 /* Evaluate link by subinstruction.
387 Return 1 if link, or 0 if no link
388 Actual link instruction is in return_values parameter */
389 static int32_t eval_link_subins(command_t* command, int32_t cond, link_t *return_values) {
390 uint16_t button = vm_getbits(command, 15, 6);
391 uint8_t linkop = vm_getbits(command, 4, 5);
392
393 if(linkop > 0x10)
394 return 0; /* Unknown Link by Sub-Instruction command */
395
396 /* Assumes that the link_cmd_t enum has the same values as the LinkSIns codes */
397 return_values->command = linkop;
398 return_values->data1 = button;
399 return cond;
400 }
401
402
403 /* Evaluate link instruction.
404 Return 1 if link, or 0 if no link
405 Actual link instruction is in return_values parameter */
406 static int32_t eval_link_instruction(command_t* command, int32_t cond, link_t *return_values) {
407 uint8_t op = vm_getbits(command, 51, 4);
408
409 switch(op) {
410 case 1:
411 return eval_link_subins(command, cond, return_values);
412 case 4:
413 return_values->command = LinkPGCN;
414 return_values->data1 = vm_getbits(command, 14, 15);
415 return cond;
416 case 5:
417 return_values->command = LinkPTTN;
418 return_values->data1 = vm_getbits(command, 9, 10);
419 return_values->data2 = vm_getbits(command, 15, 6);
420 return cond;
421 case 6:
422 return_values->command = LinkPGN;
423 return_values->data1 = vm_getbits(command, 6, 7);
424 return_values->data2 = vm_getbits(command, 15, 6);
425 return cond;
426 case 7:
427 return_values->command = LinkCN;
428 return_values->data1 = vm_getbits(command, 7, 8);
429 return_values->data2 = vm_getbits(command, 15, 6);
430 return cond;
431 }
432 return 0;
433 }
434
435
436 /* Evaluate a jump instruction.
437 returns 1 if jump or 0 if no jump
438 actual jump instruction is in return_values parameter */
439 static int32_t eval_jump_instruction(command_t* command, int32_t cond, link_t *return_values) {
440
441 switch(vm_getbits(command, 51, 4)) {
442 case 1:
443 return_values->command = Exit;
444 return cond;
445 case 2:
446 return_values->command = JumpTT;
447 return_values->data1 = vm_getbits(command, 22, 7);
448 return cond;
449 case 3:
450 return_values->command = JumpVTS_TT;
451 return_values->data1 = vm_getbits(command, 22, 7);
452 return cond;
453 case 5:
454 return_values->command = JumpVTS_PTT;
455 return_values->data1 = vm_getbits(command, 22, 7);
456 return_values->data2 = vm_getbits(command, 41, 10);
457 return cond;
458 case 6:
459 switch(vm_getbits(command, 23, 2)) {
460 case 0:
461 return_values->command = JumpSS_FP;
462 return cond;
463 case 1:
464 return_values->command = JumpSS_VMGM_MENU;
465 return_values->data1 = vm_getbits(command, 19, 4);
466 return cond;
467 case 2:
468 return_values->command = JumpSS_VTSM;
469 return_values->data1 = vm_getbits(command, 31, 8);
470 return_values->data2 = vm_getbits(command, 39, 8);
471 return_values->data3 = vm_getbits(command, 19, 4);
472 return cond;
473 case 3:
474 return_values->command = JumpSS_VMGM_PGC;
475 return_values->data1 = vm_getbits(command, 46, 15);
476 return cond;
477 }
478 break;
479 case 8:
480 switch(vm_getbits(command, 23, 2)) {
481 case 0:
482 return_values->command = CallSS_FP;
483 return_values->data1 = vm_getbits(command, 31, 8);
484 return cond;
485 case 1:
486 return_values->command = CallSS_VMGM_MENU;
487 return_values->data1 = vm_getbits(command, 19, 4);
488 return_values->data2 = vm_getbits(command, 31, 8);
489 return cond;
490 case 2:
491 return_values->command = CallSS_VTSM;
492 return_values->data1 = vm_getbits(command, 19, 4);
493 return_values->data2 = vm_getbits(command, 31, 8);
494 return cond;
495 case 3:
496 return_values->command = CallSS_VMGM_PGC;
497 return_values->data1 = vm_getbits(command, 46, 15);
498 return_values->data2 = vm_getbits(command, 31, 8);
499 return cond;
500 }
501 break;
502 }
503 return 0;
504 }
505
506 /* Evaluate a set sytem register instruction
507 May contain a link so return the same as eval_link */
508 static int32_t eval_system_set(command_t* command, int32_t cond, link_t *return_values) {
509 int32_t i;
510 uint16_t data, data2;
511
512 switch(vm_getbits(command, 59, 4)) {
513 case 1: /* Set system reg 1 &| 2 &| 3 (Audio, Subp. Angle) */
514 for(i = 1; i <= 3; i++) {
515 if(vm_getbits(command, 63 - ((2 + i)*8), 1)) {
516 data = eval_reg_or_data_2(command, vm_getbits(command, 60, 1), (47 - (i*8)));
517 if(cond) {
518 command->registers->SPRM[i] = data;
519 }
520 }
521 }
522 break;
523 case 2: /* Set system reg 9 & 10 (Navigation timer, Title PGC number) */
524 data = eval_reg_or_data(command, vm_getbits(command, 60, 1), 47);
525 data2 = vm_getbits(command, 23, 8); /* ?? size */
526 if(cond) {
527 command->registers->SPRM[9] = data; /* time */
528 command->registers->SPRM[10] = data2; /* pgcN */
529 }
530 break;
531 case 3: /* Mode: Counter / Register + Set */
532 data = eval_reg_or_data(command, vm_getbits(command, 60, 1), 47);
533 data2 = vm_getbits(command, 19, 4);
534 if(vm_getbits(command, 23, 1)) {
535 command->registers->GPRM_mode[data2] |= 1; /* Set bit 0 */
536 } else {
537 command->registers->GPRM_mode[data2] &= ~ 0x01; /* Reset bit 0 */
538 }
539 if(cond) {
540 set_GPRM(command->registers, data2, data);
541 }
542 break;
543 case 6: /* Set system reg 8 (Highlighted button) */
544 data = eval_reg_or_data(command, vm_getbits(command, 60, 1), 31); /* Not system reg!! */
545 if(cond) {
546 command->registers->SPRM[8] = data;
547 }
548 break;
549 }
550 if(vm_getbits(command, 51, 4)) {
551 return eval_link_instruction(command, cond, return_values);
552 }
553 return 0;
554 }
555
556
557 /* Evaluate set operation
558 Sets the register given to the value indicated by op and data.
559 For the swap case the contents of reg is stored in reg2.
560 */
561 static void eval_set_op(command_t* command, int32_t op, int32_t reg, int32_t reg2, int32_t data) {
562 static const int32_t shortmax = 0xffff;
563 int32_t tmp;
564 switch(op) {
565 case 1:
566 set_GPRM(command->registers, reg, data);
567 break;
568 case 2: /* SPECIAL CASE - SWAP! */
569 set_GPRM(command->registers, reg2, get_GPRM(command->registers, reg));
570 set_GPRM(command->registers, reg, data);
571 break;
572 case 3:
573 tmp = get_GPRM(command->registers, reg) + data;
574 if(tmp > shortmax) tmp = shortmax;
575 set_GPRM(command->registers, reg, (uint16_t)tmp);
576 break;
577 case 4:
578 tmp = get_GPRM(command->registers, reg) - data;
579 if(tmp < 0) tmp = 0;
580 set_GPRM(command->registers, reg, (uint16_t)tmp);
581 break;
582 case 5:
583 tmp = get_GPRM(command->registers, reg) * data;
584 if(tmp > shortmax) tmp = shortmax;
585 set_GPRM(command->registers, reg, (uint16_t)tmp);
586 break;
587 case 6:
588 if (data != 0) {
589 set_GPRM(command->registers, reg, (get_GPRM(command->registers, reg) / data) );
590 } else {
591 set_GPRM(command->registers, reg, 0xffff); /* Avoid that divide by zero! */
592 }
593 break;
594 case 7:
595 if (data != 0) {
596 set_GPRM(command->registers, reg, (get_GPRM(command->registers, reg) % data) );
597 } else {
598 set_GPRM(command->registers, reg, 0xffff); /* Avoid that divide by zero! */
599 }
600 break;
601 case 8: /* SPECIAL CASE - RND! Return numbers between 1 and data. */
602 set_GPRM(command->registers, reg, 1 + ((uint16_t) ((float) data * rand()/(RAND_MAX+1.0))) );
603 break;
604 case 9:
605 set_GPRM(command->registers, reg, (get_GPRM(command->registers, reg) & data) );
606 break;
607 case 10:
608 set_GPRM(command->registers, reg, (get_GPRM(command->registers, reg) | data) );
609 break;
610 case 11:
611 set_GPRM(command->registers, reg, (get_GPRM(command->registers, reg) ^ data) );
612 break;
613 }
614 }
615
616 /* Evaluate set instruction, combined with either Link or Compare. */
617 static void eval_set_version_1(command_t* command, int32_t cond) {
618 uint8_t op = vm_getbits(command, 59, 4);
619 uint8_t reg = vm_getbits(command, 35, 4); /* FIXME: This is different from vmcmd.c!!! */
620 uint8_t reg2 = vm_getbits(command, 19, 4);
621 uint16_t data = eval_reg_or_data(command, vm_getbits(command, 60, 1), 31);
622
623 if(cond) {
624 eval_set_op(command, op, reg, reg2, data);
625 }
626 }
627
628
629 /* Evaluate set instruction, combined with both Link and Compare. */
630 static void eval_set_version_2(command_t* command, int32_t cond) {
631 uint8_t op = vm_getbits(command, 59, 4);
632 uint8_t reg = vm_getbits(command, 51, 4);
633 uint8_t reg2 = vm_getbits(command, 35, 4); /* FIXME: This is different from vmcmd.c!!! */
634 uint16_t data = eval_reg_or_data(command, vm_getbits(command, 60, 1), 47);
635
636 if(cond) {
637 eval_set_op(command, op, reg, reg2, data);
638 }
639 }
640
641
642 /* Evaluate a command
643 returns row number of goto, 0 if no goto, -1 if link.
644 Link command in return_values */
645 static int32_t eval_command(uint8_t *bytes, registers_t* registers, link_t *return_values) {
646 int32_t cond, res = 0;
647 command_t command;
648 command.instruction =( (uint64_t) bytes[0] << 56 ) |
649 ( (uint64_t) bytes[1] << 48 ) |
650 ( (uint64_t) bytes[2] << 40 ) |
651 ( (uint64_t) bytes[3] << 32 ) |
652 ( (uint64_t) bytes[4] << 24 ) |
653 ( (uint64_t) bytes[5] << 16 ) |
654 ( (uint64_t) bytes[6] << 8 ) |
655 (uint64_t) bytes[7] ;
656 command.examined = 0;
657 command.registers = registers;
658 memset(return_values, 0, sizeof(link_t));
659
660 switch(vm_getbits(&command, 63, 3)) { /* three first old_bits */
661 case 0: /* Special instructions */
662 cond = eval_if_version_1(&command);
663 res = eval_special_instruction(&command, cond);
664 if(res == -1) {
665 fprintf(MSG_OUT, "libdvdnav: Unknown Instruction!\n");
666 assert(0);
667 }
668 break;
669 case 1: /* Link/jump instructions */
670 if(vm_getbits(&command, 60, 1)) {
671 cond = eval_if_version_2(&command);
672 res = eval_jump_instruction(&command, cond, return_values);
673 } else {
674 cond = eval_if_version_1(&command);
675 res = eval_link_instruction(&command, cond, return_values);
676 }
677 if(res)
678 res = -1;
679 break;
680 case 2: /* System set instructions */
681 cond = eval_if_version_2(&command);
682 res = eval_system_set(&command, cond, return_values);
683 if(res)
684 res = -1;
685 break;
686 case 3: /* Set instructions, either Compare or Link may be used */
687 cond = eval_if_version_3(&command);
688 eval_set_version_1(&command, cond);
689 if(vm_getbits(&command, 51, 4)) {
690 res = eval_link_instruction(&command, cond, return_values);
691 }
692 if(res)
693 res = -1;
694 break;
695 case 4: /* Set, Compare -> Link Sub-Instruction */
696 eval_set_version_2(&command, /*True*/ 1);
697 cond = eval_if_version_4(&command);
698 res = eval_link_subins(&command, cond, return_values);
699 if(res)
700 res = -1;
701 break;
702 case 5: /* Compare -> (Set and Link Sub-Instruction) */
703 /* FIXME: These are wrong. Need to be updated from vmcmd.c */
704 cond = eval_if_version_4(&command);
705 eval_set_version_2(&command, cond);
706 res = eval_link_subins(&command, cond, return_values);
707 if(res)
708 res = -1;
709 break;
710 case 6: /* Compare -> Set, allways Link Sub-Instruction */
711 /* FIXME: These are wrong. Need to be updated from vmcmd.c */
712 cond = eval_if_version_4(&command);
713 eval_set_version_2(&command, cond);
714 res = eval_link_subins(&command, /*True*/ 1, return_values);
715 if(res)
716 res = -1;
717 break;
718 default: /* Unknown command type */
719 fprintf(MSG_OUT, "libdvdnav: WARNING: Unknown Command Type=%x\n", vm_getbits(&command, 63, 3));
720 }
721 /* Check if there are bits not yet examined */
722
723 if(command.instruction & ~ command.examined) {
724 fprintf(MSG_OUT, "libdvdnav: decoder.c: [WARNING, unknown bits:");
725 fprintf(MSG_OUT, " %08"PRIx64, (command.instruction & ~ command.examined) );
726 fprintf(MSG_OUT, "]\n");
727 }
728
729 return res;
730 }
731
732 /* Evaluate a set of commands in the given register set (which is modified) */
733 int32_t vmEval_CMD(vm_cmd_t commands[], int32_t num_commands,
734 registers_t *registers, link_t *return_values) {
735 int32_t i = 0;
736 int32_t total = 0;
737
738 #ifdef TRACE
739 /* DEBUG */
740 fprintf(MSG_OUT, "libdvdnav: Registers before transaction\n");
741 vm_print_registers( registers );
742 fprintf(MSG_OUT, "libdvdnav: Full list of commands to execute\n");
743 for(i = 0; i < num_commands; i++)
744 vm_print_cmd(i, &commands[i]);
745 fprintf(MSG_OUT, "libdvdnav: --------------------------------------------\n");
746 fprintf(MSG_OUT, "libdvdnav: Single stepping commands\n");
747 #endif
748
749 i = 0;
750 while(i < num_commands && total < 100000) {
751 int32_t line;
752
753 #ifdef TRACE
754 vm_print_cmd(i, &commands[i]);
755 #endif
756
757 line = eval_command(&commands[i].bytes[0], registers, return_values);
758
759 if (line < 0) { /* Link command */
760 #ifdef TRACE
761 fprintf(MSG_OUT, "libdvdnav: Registers after transaction\n");
762 vm_print_registers( registers );
763 fprintf(MSG_OUT, "libdvdnav: eval: Doing Link/Jump/Call\n");
764 #endif
765 return 1;
766 }
767
768 if (line > 0) /* Goto command */
769 i = line - 1;
770 else /* Just continue on the next line */
771 i++;
772
773 total++;
774 }
775
776 memset(return_values, 0, sizeof(link_t));
777 #ifdef TRACE
778 fprintf(MSG_OUT, "libdvdnav: Registers after transaction\n");
779 vm_print_registers( registers );
780 #endif
781 return 0;
782 }
783