diff --git a/java/AUTHORS b/java/AUTHORS new file mode 100644 index 0000000..2d7d2db --- /dev/null +++ b/java/AUTHORS @@ -0,0 +1 @@ +Vreixo Formoso diff --git a/java/COPYING b/java/COPYING new file mode 100644 index 0000000..5a965fb --- /dev/null +++ b/java/COPYING @@ -0,0 +1,280 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS diff --git a/java/ChangeLog b/java/ChangeLog new file mode 100644 index 0000000..e69de29 diff --git a/java/INSTALL b/java/INSTALL new file mode 100644 index 0000000..8b7a984 --- /dev/null +++ b/java/INSTALL @@ -0,0 +1,32 @@ +Installation Instructions +************************* + +TODO write better install instructions +TODO you need Apache Ant to compile the code +TODO ant install is not implemented yet, you should copy .jar and .so files + manually + +The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. + + Running `configure' might take a while. While running, it prints + some messages telling which features it is checking for. + + 2. Type `ant' to compile the package. + + 3. Optionally, type `ant check' to run any self-tests that come with + the package. + + 4. Type `ant install' to install the programs and any data files and + documentation. + + 5. You can remove the program binaries and object files from the + source code directory by typing `ant clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `ant distclean'. There is + also a `ant maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. diff --git a/java/NEWS b/java/NEWS new file mode 100644 index 0000000..e69de29 diff --git a/java/README b/java/README new file mode 100644 index 0000000..2cb872b --- /dev/null +++ b/java/README @@ -0,0 +1,20 @@ + +These are Java bindings for the libburnia project + +This version is a full binding for libisofs 0.2.4 and libburn 0.3.4. + +NOTE: + +This is realeased under GPL. + +However, it is implemented using 1.5 version of the Java language. At this time +there isn't, at my knowledge, any free JVM implementation with fully support +for Java 1.5. Given that this project is still in a very early stage, I really +prefer to live with this problem for a while. I hope that free JVM with 1.5 +support will be available soon. + +Anyway as these bindings reach release 1.0 they will be fully compilable and +executable on a free environment, even if this implies porting them back to 1.4. + +Vreixo, +17-Apr-2007 \ No newline at end of file diff --git a/java/TODO b/java/TODO new file mode 100644 index 0000000..d1ce804 --- /dev/null +++ b/java/TODO @@ -0,0 +1,16 @@ + +Documentation: + - Review of javadocs, update methods to java ones. + - Write a little tutorial. + - Usage examples. + +Design: + - Improve error notification. Decide what functions should return error + as int/boolean and what should throw an exception. Design exception hierarchy. + - Walk to a improved Java-like API... + - Java based BurnSource. java IO/NIO burn sources + +Testing: + - Test program like test/libburner and test/iso.c (this last already done) + - Write a lot of tests, either manual tests and automatic test (Junit based) + to cover all methods. diff --git a/java/build.properties.in b/java/build.properties.in new file mode 100644 index 0000000..4038bba --- /dev/null +++ b/java/build.properties.in @@ -0,0 +1,4 @@ +package=@PACKAGE_NAME@ +version=@PACKAGE_VERSION@ +cflags.isofs=@ISOFS_INCLUDE@ +cflags.burn=@BURN_INCLUDE@ \ No newline at end of file diff --git a/java/build.xml b/java/build.xml new file mode 100644 index 0000000..4141535 --- /dev/null +++ b/java/build.xml @@ -0,0 +1,288 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ---------------------------------------------------- + Building ${package}... + ---------------------------------------------------- + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + NOT IMPLEMENTED YET + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + NOT IMPLEMENTED YET + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/config.log b/java/config.log new file mode 100644 index 0000000..652d813 --- /dev/null +++ b/java/config.log @@ -0,0 +1,228 @@ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by java-libburn configure 0.1, which was +generated by GNU Autoconf 2.60. Invocation command line was + + $ ./configure + +## --------- ## +## Platform. ## +## --------- ## + +hostname = mplaptop +uname -m = i686 +uname -r = 2.6.17-10-generic +uname -s = Linux +uname -v = #2 SMP Fri Oct 13 18:45:35 UTC 2006 + +/usr/bin/uname -p = unknown +/bin/uname -X = unknown + +/bin/arch = i686 +/usr/bin/arch -k = unknown +/usr/convex/getsysinfo = unknown +/usr/bin/hostinfo = unknown +/bin/machine = unknown +/usr/bin/oslevel = unknown +/bin/universe = unknown + +PATH: /usr/local/sbin +PATH: /usr/local/bin +PATH: /usr/sbin +PATH: /usr/bin +PATH: /sbin +PATH: /bin +PATH: /usr/bin/X11 +PATH: /usr/games + + +## ----------- ## +## Core tests. ## +## ----------- ## + +configure:1633: checking for javac +configure:1651: found /usr/local/bin/javac +configure:1663: result: /usr/local/bin/javac +configure:1673: checking for javah +configure:1691: found /usr/bin/javah +configure:1703: result: /usr/bin/javah +configure:1713: checking for jar +configure:1731: found /usr/bin/jar +configure:1743: result: /usr/bin/jar +configure:1800: checking for gcc +configure:1816: found /usr/bin/gcc +configure:1827: result: gcc +configure:2065: checking for C compiler version +configure:2072: gcc --version >&5 +gcc (GCC) 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5) +Copyright (C) 2006 Free Software Foundation, Inc. +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +configure:2075: $? = 0 +configure:2082: gcc -v >&5 +Using built-in specs. +Target: i486-linux-gnu +Configured with: ../src/configure -v --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug --enable-mpfr --enable-checking=release i486-linux-gnu +Thread model: posix +gcc version 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5) +configure:2085: $? = 0 +configure:2092: gcc -V >&5 +gcc: '-V' option must have argument +configure:2095: $? = 1 +configure:2118: checking for C compiler default output file name +configure:2145: gcc conftest.c >&5 +configure:2148: $? = 0 +configure:2194: result: a.out +configure:2199: checking whether the C compiler works +configure:2209: ./a.out +configure:2212: $? = 0 +configure:2229: result: yes +configure:2236: checking whether we are cross compiling +configure:2238: result: no +configure:2241: checking for suffix of executables +configure:2248: gcc -o conftest conftest.c >&5 +configure:2251: $? = 0 +configure:2275: result: +configure:2281: checking for suffix of object files +configure:2307: gcc -c conftest.c >&5 +configure:2310: $? = 0 +configure:2333: result: o +configure:2337: checking whether we are using the GNU C compiler +configure:2366: gcc -c conftest.c >&5 +configure:2372: $? = 0 +configure:2379: test -z "$ac_c_werror_flag" || test ! -s conftest.err +configure:2382: $? = 0 +configure:2389: test -s conftest.o +configure:2392: $? = 0 +configure:2406: result: yes +configure:2411: checking whether gcc accepts -g +configure:2441: gcc -c -g conftest.c >&5 +configure:2447: $? = 0 +configure:2454: test -z "$ac_c_werror_flag" || test ! -s conftest.err +configure:2457: $? = 0 +configure:2464: test -s conftest.o +configure:2467: $? = 0 +configure:2597: result: yes +configure:2614: checking for gcc option to accept ISO C89 +configure:2688: gcc -c -g -O2 conftest.c >&5 +configure:2694: $? = 0 +configure:2701: test -z "$ac_c_werror_flag" || test ! -s conftest.err +configure:2704: $? = 0 +configure:2711: test -s conftest.o +configure:2714: $? = 0 +configure:2734: result: none needed +configure:2893: creating ./config.status + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by java-libburn config.status 0.1, which was +generated by GNU Autoconf 2.60. Invocation command line was + + CONFIG_FILES = + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status + +on mplaptop + +config.status:563: creating build.properties + +## ---------------- ## +## Cache variables. ## +## ---------------- ## + +ac_cv_c_compiler_gnu=yes +ac_cv_env_CC_set= +ac_cv_env_CC_value= +ac_cv_env_CFLAGS_set= +ac_cv_env_CFLAGS_value= +ac_cv_env_CPPFLAGS_set= +ac_cv_env_CPPFLAGS_value= +ac_cv_env_LDFLAGS_set= +ac_cv_env_LDFLAGS_value= +ac_cv_env_build_alias_set= +ac_cv_env_build_alias_value= +ac_cv_env_host_alias_set= +ac_cv_env_host_alias_value= +ac_cv_env_target_alias_set= +ac_cv_env_target_alias_value= +ac_cv_objext=o +ac_cv_path_JAR=/usr/bin/jar +ac_cv_path_JAVAC=/usr/local/bin/javac +ac_cv_path_JAVAH=/usr/bin/javah +ac_cv_prog_ac_ct_CC=gcc +ac_cv_prog_cc_c89= +ac_cv_prog_cc_g=yes + +## ----------------- ## +## Output variables. ## +## ----------------- ## + +BURN_INCLUDE='/usr/local/include/libburn' +CC='gcc' +CFLAGS='-g -O2' +CPPFLAGS='' +DEFS='-DPACKAGE_NAME=\"java-libburn\" -DPACKAGE_TARNAME=\"java-libburn\" -DPACKAGE_VERSION=\"0.1\" -DPACKAGE_STRING=\"java-libburn\ 0.1\" -DPACKAGE_BUGREPORT=\"\"' +ECHO_C='' +ECHO_N='-n' +ECHO_T='' +EXEEXT='' +ISOFS_INCLUDE='/usr/local/include/libisofs' +JAR='/usr/bin/jar' +JAVAC='/usr/local/bin/javac' +JAVAH='/usr/bin/javah' +LDFLAGS='' +LIBOBJS='' +LIBS='' +LTLIBOBJS='' +OBJEXT='o' +PACKAGE_BUGREPORT='' +PACKAGE_NAME='java-libburn' +PACKAGE_STRING='java-libburn 0.1' +PACKAGE_TARNAME='java-libburn' +PACKAGE_VERSION='0.1' +PATH_SEPARATOR=':' +SHELL='/bin/bash' +ac_ct_CC='gcc' +bindir='${exec_prefix}/bin' +build_alias='' +datadir='${datarootdir}' +datarootdir='${prefix}/share' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +dvidir='${docdir}' +exec_prefix='${prefix}' +host_alias='' +htmldir='${docdir}' +includedir='${prefix}/include' +infodir='${datarootdir}/info' +libdir='${exec_prefix}/lib' +libexecdir='${exec_prefix}/libexec' +localedir='${datarootdir}/locale' +localstatedir='${prefix}/var' +mandir='${datarootdir}/man' +oldincludedir='/usr/include' +pdfdir='${docdir}' +prefix='/usr/local' +program_transform_name='s,x,x,' +psdir='${docdir}' +sbindir='${exec_prefix}/sbin' +sharedstatedir='${prefix}/com' +sysconfdir='${prefix}/etc' +target_alias='' + +## ----------- ## +## confdefs.h. ## +## ----------- ## + +#define PACKAGE_NAME "java-libburn" +#define PACKAGE_TARNAME "java-libburn" +#define PACKAGE_VERSION "0.1" +#define PACKAGE_STRING "java-libburn 0.1" +#define PACKAGE_BUGREPORT "" + +configure: exit 0 diff --git a/java/config.status b/java/config.status new file mode 100644 index 0000000..1457445 --- /dev/null +++ b/java/config.status @@ -0,0 +1,749 @@ +#! /bin/bash +# Generated by configure. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false +SHELL=${CONFIG_SHELL-/bin/bash} +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac +fi +BIN_SH=xpg4; export BIN_SH # for Tru64 +DUALCASE=1; export DUALCASE # for MKS sh + + +# PATH needs CR +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +as_nl=' +' +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + { (exit 1); exit 1; } +fi + +# Work around bugs in pre-3.0 UWIN ksh. +for as_var in ENV MAIL MAILPATH +do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# CDPATH. +$as_unset CDPATH + + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line after each line using $LINENO; the second 'sed' + # does the real work. The second script uses 'N' to pair each + # line-number line with the line containing $LINENO, and appends + # trailing '-' during substitution so that $LINENO is not a special + # case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # scripts with optimization help from Paolo Bonzini. Blame Lee + # E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in +-n*) + case `echo 'x\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + *) ECHO_C='\c';; + esac;; +*) + ECHO_N='-n';; +esac + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir +fi +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +# Find out whether ``test -x'' works. Don't use a zero-byte file, as +# systems may use methods other than mode bits to determine executability. +cat >conf$$.file <<_ASEOF +#! /bin/sh +exit 0 +_ASEOF +chmod +x conf$$.file +if test -x conf$$.file >/dev/null 2>&1; then + as_executable_p="test -x" +else + as_executable_p=: +fi +rm -f conf$$.file + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 + +# Save the log message, to keep $[0] and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by java-libburn $as_me 0.1, which was +generated by GNU Autoconf 2.60. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +# Files that config.status was made for. +config_files=" build.properties" + +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + +Configuration files: +$config_files + +Report bugs to ." + +ac_cs_version="\ +java-libburn config.status 0.1 +configured by ./configure, generated by GNU Autoconf 2.60, + with options \"\" + +Copyright (C) 2006 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='/home/metalpain/Dados/workspace/java-libburn' +srcdir='.' +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + echo "$ac_cs_version"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + CONFIG_FILES="$CONFIG_FILES $ac_optarg" + ac_need_defaults=false;; + --he | --h | --help | --hel | -h ) + echo "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) { echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +if $ac_cs_recheck; then + echo "running CONFIG_SHELL=/bin/bash /bin/bash ./configure " $ac_configure_extra_args " --no-create --no-recursion" >&6 + CONFIG_SHELL=/bin/bash + export CONFIG_SHELL + exec /bin/bash "./configure" $ac_configure_extra_args --no-create --no-recursion +fi + +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + echo "$ac_log" +} >&5 + + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "build.properties") CONFIG_FILES="$CONFIG_FILES build.properties" ;; + + *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= + trap 'exit_status=$? + { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status +' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || +{ + echo "$me: cannot create a temporary directory in ." >&2 + { (exit 1); exit 1; } +} + +# +# Set up the sed scripts for CONFIG_FILES section. +# + +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "$CONFIG_FILES"; then + +cat >"$tmp/subs-1.sed" <<\CEOF +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end +s,@SHELL@,|#_!!_#|/bin/bash,g +s,@PATH_SEPARATOR@,|#_!!_#|:,g +s,@PACKAGE_NAME@,|#_!!_#|java-libburn,g +s,@PACKAGE_TARNAME@,|#_!!_#|java-libburn,g +s,@PACKAGE_VERSION@,|#_!!_#|0.1,g +s,@PACKAGE_STRING@,|#_!!_#|java-libburn 0.1,g +s,@PACKAGE_BUGREPORT@,|#_!!_#|,g +s,@exec_prefix@,|#_!!_#|${prefix},g +s,@prefix@,|#_!!_#|/usr/local,g +s,@program_transform_name@,|#_!!_#|s\,x\,x\,,g +s,@bindir@,|#_!!_#|${exec_prefix}/bin,g +s,@sbindir@,|#_!!_#|${exec_prefix}/sbin,g +s,@libexecdir@,|#_!!_#|${exec_prefix}/libexec,g +s,@datarootdir@,|#_!!_#|${prefix}/share,g +s,@datadir@,|#_!!_#|${datarootdir},g +s,@sysconfdir@,|#_!!_#|${prefix}/etc,g +s,@sharedstatedir@,|#_!!_#|${prefix}/com,g +s,@localstatedir@,|#_!!_#|${prefix}/var,g +s,@includedir@,|#_!!_#|${prefix}/include,g +s,@oldincludedir@,|#_!!_#|/usr/include,g +s,@docdir@,|#_!!_#|${datarootdir}/doc/${PACKAGE_TARNAME},g +s,@infodir@,|#_!!_#|${datarootdir}/info,g +s,@htmldir@,|#_!!_#|${docdir},g +s,@dvidir@,|#_!!_#|${docdir},g +s,@pdfdir@,|#_!!_#|${docdir},g +s,@psdir@,|#_!!_#|${docdir},g +s,@libdir@,|#_!!_#|${exec_prefix}/lib,g +s,@localedir@,|#_!!_#|${datarootdir}/locale,g +s,@mandir@,|#_!!_#|${datarootdir}/man,g +s,@DEFS@,|#_!!_#|-DPACKAGE_NAME=\\"java-libburn\\" -DPACKAGE_TARNAME=\\"java-libburn\\" -DPACKAGE_VERSION=\\"0.1\\" -DPACKAGE_STRING=\\"java-libburn\\ 0.1\\" -DPACKAGE_BUGREPORT=\\"\\",g +s,@ECHO_C@,|#_!!_#|,g +s,@ECHO_N@,|#_!!_#|-n,g +s,@ECHO_T@,|#_!!_#|,g +s,@LIBS@,|#_!!_#|,g +s,@build_alias@,|#_!!_#|,g +s,@host_alias@,|#_!!_#|,g +s,@target_alias@,|#_!!_#|,g +s,@JAVAC@,|#_!!_#|/usr/local/bin/javac,g +s,@JAVAH@,|#_!!_#|/usr/bin/javah,g +s,@JAR@,|#_!!_#|/usr/bin/jar,g +s,@CC@,|#_!!_#|gcc,g +s,@CFLAGS@,|#_!!_#|-g -O2,g +s,@LDFLAGS@,|#_!!_#|,g +s,@CPPFLAGS@,|#_!!_#|,g +s,@ac_ct_CC@,|#_!!_#|gcc,g +s,@EXEEXT@,|#_!!_#|,g +s,@OBJEXT@,|#_!!_#|o,g +s,@ISOFS_INCLUDE@,|#_!!_#|/usr/local/include/libisofs,g +s,@BURN_INCLUDE@,|#_!!_#|/usr/local/include/libburn,g +s,@LIBOBJS@,|#_!!_#|,g +s,@LTLIBOBJS@,|#_!!_#|,g +:end +s/|#_!!_#|//g +CEOF +fi # test -n "$CONFIG_FILES" + + +for ac_tag in :F $CONFIG_FILES +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 +echo "$as_me: error: Invalid tag $ac_tag." >&2;} + { (exit 1); exit 1; }; };; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 +echo "$as_me: error: cannot find input file: $ac_f" >&2;} + { (exit 1); exit 1; }; };; + esac + ac_file_inputs="$ac_file_inputs $ac_f" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input="Generated from "`IFS=: + echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure." + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + fi + + case $ac_tag in + *:-:* | *:-) cat >"$tmp/stdin";; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + { as_dir="$ac_dir" + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 +echo "$as_me: error: cannot create directory $as_dir" >&2;} + { (exit 1); exit 1; }; }; } + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= + +case `sed -n '/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p +' $ac_file_inputs` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} + ac_datarootdir_hack=' + s&@datadir@&${datarootdir}&g + s&@docdir@&${datarootdir}/doc/${PACKAGE_TARNAME}&g + s&@infodir@&${datarootdir}/info&g + s&@localedir@&${datarootdir}/locale&g + s&@mandir@&${datarootdir}/man&g + s&\${datarootdir}&${prefix}/share&g' ;; +esac + sed "/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/ +s/:*\${srcdir}:*/:/ +s/:*@srcdir@:*/:/ +s/^\([^=]*=[ ]*\):*/\1/ +s/:*$// +s/^[^=]*=[ ]*$// +} + +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s&@configure_input@&$configure_input&;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +$ac_datarootdir_hack +" $ac_file_inputs | sed -f "$tmp/subs-1.sed" >$tmp/out + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && + { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined." >&5 +echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined." >&2;} + + rm -f "$tmp/stdin" + case $ac_file in + -) cat "$tmp/out"; rm -f "$tmp/out";; + *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;; + esac + ;; + + + + esac + +done # for ac_tag + + +{ (exit 0); exit 0; } diff --git a/java/configure b/java/configure new file mode 100644 index 0000000..c8e0cf3 --- /dev/null +++ b/java/configure @@ -0,0 +1,3757 @@ +#! /bin/sh +# From configure.ac Revision: 0.1 . +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.60 for java-libburn 0.1. +# +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac +fi +BIN_SH=xpg4; export BIN_SH # for Tru64 +DUALCASE=1; export DUALCASE # for MKS sh + + +# PATH needs CR +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +as_nl=' +' +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + { (exit 1); exit 1; } +fi + +# Work around bugs in pre-3.0 UWIN ksh. +for as_var in ENV MAIL MAILPATH +do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# CDPATH. +$as_unset CDPATH + + +if test "x$CONFIG_SHELL" = x; then + if (eval ":") 2>/dev/null; then + as_have_required=yes +else + as_have_required=no +fi + + if test $as_have_required = yes && (eval ": +(as_func_return () { + (exit \$1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = \"\$1\" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test \$exitcode = 0) || { (exit 1); exit 1; } + +( + as_lineno_1=\$LINENO + as_lineno_2=\$LINENO + test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && + test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } +") 2> /dev/null; then + : +else + as_candidate_shells= + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /usr/bin/posix$PATH_SEPARATOR/bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + case $as_dir in + /*) + for as_base in sh bash ksh sh5; do + as_candidate_shells="$as_candidate_shells $as_dir/$as_base" + done;; + esac +done +IFS=$as_save_IFS + + + for as_shell in $as_candidate_shells $SHELL; do + # Try only shells that exist, to save several forks. + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { ("$as_shell") 2> /dev/null <<\_ASEOF +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac +fi +BIN_SH=xpg4; export BIN_SH # for Tru64 +DUALCASE=1; export DUALCASE # for MKS sh + +: +_ASEOF +}; then + CONFIG_SHELL=$as_shell + as_have_required=yes + if { "$as_shell" 2> /dev/null <<\_ASEOF +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac +fi +BIN_SH=xpg4; export BIN_SH # for Tru64 +DUALCASE=1; export DUALCASE # for MKS sh + +: +(as_func_return () { + (exit $1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = "$1" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test $exitcode = 0) || { (exit 1); exit 1; } + +( + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } + +_ASEOF +}; then + break +fi + +fi + + done + + if test "x$CONFIG_SHELL" != x; then + for as_var in BASH_ENV ENV + do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + done + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} +fi + + + if test $as_have_required = no; then + echo This script requires a shell more modern than all the + echo shells that I found on your system. Please install a + echo modern shell, or manually run the script under such a + echo shell if you do have one. + { (exit 1); exit 1; } +fi + + +fi + +fi + + + +(eval "as_func_return () { + (exit \$1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = \"\$1\" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test \$exitcode = 0") || { + echo No shell found that supports shell functions. + echo Please tell autoconf@gnu.org about your system, + echo including any error possibly output before this + echo message +} + + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line after each line using $LINENO; the second 'sed' + # does the real work. The second script uses 'N' to pair each + # line-number line with the line containing $LINENO, and appends + # trailing '-' during substitution so that $LINENO is not a special + # case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # scripts with optimization help from Paolo Bonzini. Blame Lee + # E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in +-n*) + case `echo 'x\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + *) ECHO_C='\c';; + esac;; +*) + ECHO_N='-n';; +esac + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir +fi +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +# Find out whether ``test -x'' works. Don't use a zero-byte file, as +# systems may use methods other than mode bits to determine executability. +cat >conf$$.file <<_ASEOF +#! /bin/sh +exit 0 +_ASEOF +chmod +x conf$$.file +if test -x conf$$.file >/dev/null 2>&1; then + as_executable_p="test -x" +else + as_executable_p=: +fi +rm -f conf$$.file + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + + +exec 7<&0 &1 + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_clean_files= +ac_config_libobj_dir=. +LIBOBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Identity of this package. +PACKAGE_NAME='java-libburn' +PACKAGE_TARNAME='java-libburn' +PACKAGE_VERSION='0.1' +PACKAGE_STRING='java-libburn 0.1' +PACKAGE_BUGREPORT='' + +ac_subst_vars='SHELL +PATH_SEPARATOR +PACKAGE_NAME +PACKAGE_TARNAME +PACKAGE_VERSION +PACKAGE_STRING +PACKAGE_BUGREPORT +exec_prefix +prefix +program_transform_name +bindir +sbindir +libexecdir +datarootdir +datadir +sysconfdir +sharedstatedir +localstatedir +includedir +oldincludedir +docdir +infodir +htmldir +dvidir +pdfdir +psdir +libdir +localedir +mandir +DEFS +ECHO_C +ECHO_N +ECHO_T +LIBS +build_alias +host_alias +target_alias +JAVAC +JAVAH +JAR +CC +CFLAGS +LDFLAGS +CPPFLAGS +ac_ct_CC +EXEEXT +OBJEXT +ISOFS_INCLUDE +BURN_INCLUDE +LIBOBJS +LTLIBOBJS' +ac_subst_files='' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +CPPFLAGS' + + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +# (The list follows the same order as the GNU Coding Standards.) +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +includedir='${prefix}/include' +oldincludedir='/usr/include' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' + +ac_prev= +ac_dashdash= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval $ac_prev=\$ac_option + ac_prev= + continue + fi + + case $ac_option in + *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *) ac_optarg=yes ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + eval enable_$ac_feature=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; + + -enable-* | --enable-*) + ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + eval enable_$ac_feature=\$ac_optarg ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst | --locals) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval with_$ac_package=\$ac_optarg ;; + + -without-* | --without-*) + ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/-/_/g'` + eval with_$ac_package=no ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) { echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + { echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } +fi + +# Be sure to have absolute directory names. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir +do + eval ac_val=\$$ac_var + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; } +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + { echo "$as_me: error: Working directory cannot be determined" >&2 + { (exit 1); exit 1; }; } +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + { echo "$as_me: error: pwd does not report name of working directory" >&2 + { (exit 1); exit 1; }; } + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then the parent directory. + ac_confdir=`$as_dirname -- "$0" || +$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$0" : 'X\(//\)[^/]' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +echo X"$0" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r "$srcdir/$ac_unique_file"; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r "$srcdir/$ac_unique_file"; then + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 + { (exit 1); exit 1; }; } +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2 + { (exit 1); exit 1; }; } + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures java-libburn 0.1 to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/java-libburn] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_ACEOF + + cat <<\_ACEOF +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of java-libburn 0.1:";; + esac + cat <<\_ACEOF + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if + you have headers in a nonstandard directory + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +_ACEOF +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for guested configure. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive + else + echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +java-libburn configure 0.1 +generated by GNU Autoconf 2.60 + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit +fi +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by java-libburn $as_me 0.1, which was +generated by GNU Autoconf 2.60. Invocation command line was + + $ $0 $@ + +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + echo "PATH: $as_dir" +done +IFS=$as_save_IFS + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *\'*) + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; + 2) + ac_configure_args1="$ac_configure_args1 '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + ac_configure_args="$ac_configure_args '$ac_arg'" + ;; + esac + done +done +$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } +$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + cat <<\_ASBOX +## ---------------- ## +## Cache variables. ## +## ---------------- ## +_ASBOX + echo + # The following way of writing the cache mishandles newlines in values, +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 +echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + *) $as_unset $ac_var ;; + esac ;; + esac + done + (set) 2>&1 | + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + sed -n \ + "s/'\''/'\''\\\\'\'''\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" + ;; #( + *) + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) + echo + + cat <<\_ASBOX +## ----------------- ## +## Output variables. ## +## ----------------- ## +_ASBOX + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + echo "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + cat <<\_ASBOX +## ------------------- ## +## File substitutions. ## +## ------------------- ## +_ASBOX + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + echo "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + cat <<\_ASBOX +## ----------- ## +## confdefs.h. ## +## ----------- ## +_ASBOX + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" + echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status +' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -f -r conftest* confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer explicitly selected file to automatically selected ones. +if test -n "$CONFIG_SITE"; then + set x "$CONFIG_SITE" +elif test "x$prefix" != xNONE; then + set x "$prefix/share/config.site" "$prefix/etc/config.site" +else + set x "$ac_default_prefix/share/config.site" \ + "$ac_default_prefix/etc/config.site" +fi +shift +for ac_site_file +do + if test -r "$ac_site_file"; then + { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { echo "$as_me:$LINENO: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; + esac + fi +else + { echo "$as_me:$LINENO: creating cache $cache_file" >&5 +echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 +echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 +echo "$as_me: former value: $ac_old_val" >&2;} + { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 +echo "$as_me: current value: $ac_new_val" >&2;} + ac_cache_corrupted=: + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 +echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { (exit 1); exit 1; }; } +fi + + + + + + + + + + + + + + + + + + + + + + + + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + +# Extract the first word of "javac", so it can be a program name with args. +set dummy javac; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_JAVAC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $JAVAC in + [\\/]* | ?:[\\/]*) + ac_cv_path_JAVAC="$JAVAC" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_JAVAC="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + ;; +esac +fi +JAVAC=$ac_cv_path_JAVAC +if test -n "$JAVAC"; then + { echo "$as_me:$LINENO: result: $JAVAC" >&5 +echo "${ECHO_T}$JAVAC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +# Extract the first word of "javah", so it can be a program name with args. +set dummy javah; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_JAVAH+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $JAVAH in + [\\/]* | ?:[\\/]*) + ac_cv_path_JAVAH="$JAVAH" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_JAVAH="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + ;; +esac +fi +JAVAH=$ac_cv_path_JAVAH +if test -n "$JAVAH"; then + { echo "$as_me:$LINENO: result: $JAVAH" >&5 +echo "${ECHO_T}$JAVAH" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +# Extract the first word of "jar", so it can be a program name with args. +set dummy jar; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_JAR+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $JAR in + [\\/]* | ?:[\\/]*) + ac_cv_path_JAR="$JAR" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_JAR="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + ;; +esac +fi +JAR=$ac_cv_path_JAR +if test -n "$JAR"; then + { echo "$as_me:$LINENO: result: $JAR" >&5 +echo "${ECHO_T}$JAR" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + fi +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:$LINENO: checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (ac_try="$ac_compiler --version >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler --version >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -v >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler -v >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -V >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler -V >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +{ echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 +echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; } +ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +# +# List of possible output files, starting from the most likely. +# The algorithm is not robust to junk in `.', hence go to wildcards (a.*) +# only as a last resort. b.out is created by i960 compilers. +ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out' +# +# The IRIX 6 linker writes into existing files which may not be +# executable, retaining their permissions. Remove them first so a +# subsequent execution test works. +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { (ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_exeext" = no && ac_cv_exeext= + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: C compiler cannot create executables +See \`config.log' for more details." >&5 +echo "$as_me: error: C compiler cannot create executables +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } +fi + +ac_exeext=$ac_cv_exeext +{ echo "$as_me:$LINENO: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6; } + +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ echo "$as_me:$LINENO: checking whether the C compiler works" >&5 +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6; } +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { echo "$as_me:$LINENO: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + fi + fi +fi +{ echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +rm -f a.out a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; } +{ echo "$as_me:$LINENO: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6; } + +{ echo "$as_me:$LINENO: checking for suffix of executables" >&5 +echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; } +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else + { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest$ac_cv_exeext +{ echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +{ echo "$as_me:$LINENO: checking for suffix of object files" >&5 +echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; } +if test "${ac_cv_objext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; } +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_compiler_gnu=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; } +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; } +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + CFLAGS="" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; } +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 +echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } +if test "${ac_cv_prog_cc_c89+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_c89=$ac_arg +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6; } ;; + xno) + { echo "$as_me:$LINENO: result: unsupported" >&5 +echo "${ECHO_T}unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; +esac + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + +ISOFS_INCLUDE=`pkg-config --cflags libisofs-1 | sed -e's/-I//g' -e's/ *$//g'` + +BURN_INCLUDE=`pkg-config --cflags libburn-1 | sed -e's/-I//g' -e's/ *$//g'` + + + +ac_config_files="$ac_config_files build.properties" + +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, we kill variables containing newlines. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 +echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + *) $as_unset $ac_var ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; #( + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + test "x$cache_file" != "x/dev/null" && + { echo "$as_me:$LINENO: updating cache $cache_file" >&5 +echo "$as_me: updating cache $cache_file" >&6;} + cat confcache >$cache_file + else + { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 +echo "$as_me: not updating unwritable cache $cache_file" >&6;} + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +# +# If the first sed substitution is executed (which looks for macros that +# take arguments), then branch to the quote section. Otherwise, +# look for a macro that doesn't take arguments. +ac_script=' +t clear +:clear +s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g +t quote +s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g +t quote +b any +:quote +s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g +s/\[/\\&/g +s/\]/\\&/g +s/\$/$$/g +H +:any +${ + g + s/^\n// + s/\n/ /g + p +} +' +DEFS=`sed -n "$ac_script" confdefs.h` + + +ac_libobjs= +ac_ltlibobjs= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`echo "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" + ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + + +: ${CONFIG_STATUS=./config.status} +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false +SHELL=\${CONFIG_SHELL-$SHELL} +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac +fi +BIN_SH=xpg4; export BIN_SH # for Tru64 +DUALCASE=1; export DUALCASE # for MKS sh + + +# PATH needs CR +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +as_nl=' +' +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + { (exit 1); exit 1; } +fi + +# Work around bugs in pre-3.0 UWIN ksh. +for as_var in ENV MAIL MAILPATH +do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# CDPATH. +$as_unset CDPATH + + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line after each line using $LINENO; the second 'sed' + # does the real work. The second script uses 'N' to pair each + # line-number line with the line containing $LINENO, and appends + # trailing '-' during substitution so that $LINENO is not a special + # case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # scripts with optimization help from Paolo Bonzini. Blame Lee + # E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in +-n*) + case `echo 'x\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + *) ECHO_C='\c';; + esac;; +*) + ECHO_N='-n';; +esac + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir +fi +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +# Find out whether ``test -x'' works. Don't use a zero-byte file, as +# systems may use methods other than mode bits to determine executability. +cat >conf$$.file <<_ASEOF +#! /bin/sh +exit 0 +_ASEOF +chmod +x conf$$.file +if test -x conf$$.file >/dev/null 2>&1; then + as_executable_p="test -x" +else + as_executable_p=: +fi +rm -f conf$$.file + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 + +# Save the log message, to keep $[0] and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by java-libburn $as_me 0.1, which was +generated by GNU Autoconf 2.60. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +# Files that config.status was made for. +config_files="$ac_config_files" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + +Configuration files: +$config_files + +Report bugs to ." + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +ac_cs_version="\\ +java-libburn config.status 0.1 +configured by $0, generated by GNU Autoconf 2.60, + with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" + +Copyright (C) 2006 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + echo "$ac_cs_version"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + CONFIG_FILES="$CONFIG_FILES $ac_optarg" + ac_need_defaults=false;; + --he | --h | --help | --hel | -h ) + echo "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) { echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +if \$ac_cs_recheck; then + echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 + CONFIG_SHELL=$SHELL + export CONFIG_SHELL + exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + echo "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "build.properties") CONFIG_FILES="$CONFIG_FILES build.properties" ;; + + *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= + trap 'exit_status=$? + { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status +' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || +{ + echo "$me: cannot create a temporary directory in ." >&2 + { (exit 1); exit 1; } +} + +# +# Set up the sed scripts for CONFIG_FILES section. +# + +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "$CONFIG_FILES"; then + +_ACEOF + + + +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + cat >conf$$subs.sed <<_ACEOF +SHELL!$SHELL$ac_delim +PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim +PACKAGE_NAME!$PACKAGE_NAME$ac_delim +PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim +PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim +PACKAGE_STRING!$PACKAGE_STRING$ac_delim +PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim +exec_prefix!$exec_prefix$ac_delim +prefix!$prefix$ac_delim +program_transform_name!$program_transform_name$ac_delim +bindir!$bindir$ac_delim +sbindir!$sbindir$ac_delim +libexecdir!$libexecdir$ac_delim +datarootdir!$datarootdir$ac_delim +datadir!$datadir$ac_delim +sysconfdir!$sysconfdir$ac_delim +sharedstatedir!$sharedstatedir$ac_delim +localstatedir!$localstatedir$ac_delim +includedir!$includedir$ac_delim +oldincludedir!$oldincludedir$ac_delim +docdir!$docdir$ac_delim +infodir!$infodir$ac_delim +htmldir!$htmldir$ac_delim +dvidir!$dvidir$ac_delim +pdfdir!$pdfdir$ac_delim +psdir!$psdir$ac_delim +libdir!$libdir$ac_delim +localedir!$localedir$ac_delim +mandir!$mandir$ac_delim +DEFS!$DEFS$ac_delim +ECHO_C!$ECHO_C$ac_delim +ECHO_N!$ECHO_N$ac_delim +ECHO_T!$ECHO_T$ac_delim +LIBS!$LIBS$ac_delim +build_alias!$build_alias$ac_delim +host_alias!$host_alias$ac_delim +target_alias!$target_alias$ac_delim +JAVAC!$JAVAC$ac_delim +JAVAH!$JAVAH$ac_delim +JAR!$JAR$ac_delim +CC!$CC$ac_delim +CFLAGS!$CFLAGS$ac_delim +LDFLAGS!$LDFLAGS$ac_delim +CPPFLAGS!$CPPFLAGS$ac_delim +ac_ct_CC!$ac_ct_CC$ac_delim +EXEEXT!$EXEEXT$ac_delim +OBJEXT!$OBJEXT$ac_delim +ISOFS_INCLUDE!$ISOFS_INCLUDE$ac_delim +BURN_INCLUDE!$BURN_INCLUDE$ac_delim +LIBOBJS!$LIBOBJS$ac_delim +LTLIBOBJS!$LTLIBOBJS$ac_delim +_ACEOF + + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 51; then + break + elif $ac_last_try; then + { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 +echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} + { (exit 1); exit 1; }; } + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` +if test -n "$ac_eof"; then + ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` + ac_eof=`expr $ac_eof + 1` +fi + +cat >>$CONFIG_STATUS <<_ACEOF +cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end +_ACEOF +sed ' +s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g +s/^/s,@/; s/!/@,|#_!!_#|/ +:n +t n +s/'"$ac_delim"'$/,g/; t +s/$/\\/; p +N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n +' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF +:end +s/|#_!!_#|//g +CEOF$ac_eof +_ACEOF + + +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/ +s/:*\${srcdir}:*/:/ +s/:*@srcdir@:*/:/ +s/^\([^=]*=[ ]*\):*/\1/ +s/:*$// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF +fi # test -n "$CONFIG_FILES" + + +for ac_tag in :F $CONFIG_FILES +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 +echo "$as_me: error: Invalid tag $ac_tag." >&2;} + { (exit 1); exit 1; }; };; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 +echo "$as_me: error: cannot find input file: $ac_f" >&2;} + { (exit 1); exit 1; }; };; + esac + ac_file_inputs="$ac_file_inputs $ac_f" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input="Generated from "`IFS=: + echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure." + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + fi + + case $ac_tag in + *:-:* | *:-) cat >"$tmp/stdin";; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + { as_dir="$ac_dir" + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 +echo "$as_me: error: cannot create directory $as_dir" >&2;} + { (exit 1); exit 1; }; }; } + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= + +case `sed -n '/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p +' $ac_file_inputs` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF + sed "$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s&@configure_input@&$configure_input&;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +$ac_datarootdir_hack +" $ac_file_inputs | sed -f "$tmp/subs-1.sed" >$tmp/out + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && + { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined." >&5 +echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined." >&2;} + + rm -f "$tmp/stdin" + case $ac_file in + -) cat "$tmp/out"; rm -f "$tmp/out";; + *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;; + esac + ;; + + + + esac + +done # for ac_tag + + +{ (exit 0); exit 0; } +_ACEOF +chmod +x $CONFIG_STATUS +ac_clean_files=$ac_clean_files_save + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || { (exit 1); exit 1; } +fi + diff --git a/java/configure.ac b/java/configure.ac new file mode 100644 index 0000000..b6f7e3a --- /dev/null +++ b/java/configure.ac @@ -0,0 +1,37 @@ +dnl configure.ac +dnl +dnl Copyright (c) 2007 Vreixo Formoso +dnl +dnl This library is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 2 of the License, or +dnl (at your option) any later version. +dnl See COPYING file for details. +dnl + +AC_INIT(java-libburn, 0.1) +AC_REVISION([$Revision: 0.1 $]) + +dnl look for java programs +AC_PATH_PROG([JAVAC], [javac]) +AC_PATH_PROG([JAVAH], [javah]) +AC_PATH_PROG([JAR], [jar]) + +AC_PROG_CC + +dnl Package dependances +dnl ------------------------------------------------------------------------- + +dnl PKG_PROG_PKG_CONFIG() +dnl PKG_CHECK_MODULES([ISOFS], isofs) + +AC_SUBST(ISOFS_INCLUDE,`pkg-config --cflags libisofs-1 | sed -e's/-I//g' -e's/ *$//g'`) +AC_SUBST(BURN_INCLUDE,`pkg-config --cflags libburn-1 | sed -e's/-I//g' -e's/ *$//g'`) + +dnl Output Files +dnl ------------------------------------------------------------------------- + +AC_CONFIG_FILES([ + build.properties +]) +AC_OUTPUT diff --git a/java/libs/README b/java/libs/README new file mode 100644 index 0000000..53447c3 --- /dev/null +++ b/java/libs/README @@ -0,0 +1,4 @@ +The lib/ hierarchy contains third party libraries. + + +TODO comentar cada libraria usada diff --git a/java/src/java/org/pykix/libburnia/bindings/Proxy.java b/java/src/java/org/pykix/libburnia/bindings/Proxy.java new file mode 100644 index 0000000..ec38b26 --- /dev/null +++ b/java/src/java/org/pykix/libburnia/bindings/Proxy.java @@ -0,0 +1,82 @@ +/* + * Proxy.java + * + * Copyright (c) 2007 Vreixo Formoso + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * See COPYING file for details. + */ + +package org.pykix.libburnia.bindings; + +import java.lang.ref.WeakReference; +import java.util.HashMap; + +/** + * Wrapper around a native C resource, i.e., a pointer. + * + *

+ * This also keeps track of all Java objects that are a wrapper around + * a C object, to prevent replication of objects when retrieved from C + * side. + * + *

+ * This class is a implementation detail, that should be never user + * by a developer + * + * @author Vreixo Formoso + * @since 0.1 + */ +public abstract class Proxy { + + /** Pointer to C object. */ + private final long pointer; + + /** Keeps track of existing pointers. */ + private static final HashMap> proxies = + new HashMap>(); + + protected Proxy(long ptr) { + + assert ptr != 0 : "Can't proxy a NULL pointer"; + assert proxies.get(ptr) == null : + "Can't create a pointer for an existing proxy"; + + pointer = ptr; + proxies.put( ptr, new WeakReference(this) ); + } + + @Override + protected void finalize() throws Throwable { + super.finalize(); + proxies.remove(pointer); + } + + /** + * Get C pointer for a Proxy. + * + * @param obj + * @return + */ + protected static long pointerOf(Proxy obj) { + return obj.pointer; + } + + /** + * Get the proxy registered for a pointer. + * + * @param ptr + * Pointer + * @return + * The Proxy or null if no Proxy is registered. + */ + protected static Proxy proxyFor(long ptr) { + + WeakReference ref = proxies.get(ptr); + return ref == null ? null : ref.get(); + } + +} diff --git a/java/src/java/org/pykix/libburnia/libburn/BlockType.java b/java/src/java/org/pykix/libburnia/libburn/BlockType.java new file mode 100644 index 0000000..7b37362 --- /dev/null +++ b/java/src/java/org/pykix/libburnia/libburn/BlockType.java @@ -0,0 +1,78 @@ +/* + * BlockType.java + * + * Copyright (c) 2007 Vreixo Formoso + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * See COPYING file for details. + */ + +package org.pykix.libburnia.libburn; + +/** + * Data format to send to the drive. + * + * @author Vreixo Formoso + * @since 0.1 + */ +public enum BlockType { + + /** sync, headers, edc/ecc provided by lib/user. */ + RAW0(1), + + /** sync, headers, edc/ecc and p/q subs provided by lib/user. */ + RAW16(2), + + /** sync, headers, edc/ecc and packed p-w subs provided by lib/user. */ + RAW96P(4), + + /** sync, headers, edc/ecc and raw p-w subs provided by lib/user. */ + RAW96R(8), + + /** only 2048 bytes of user data provided by lib/user. */ + MODE1(256), + + /** 2336 bytes of user data provided by lib/user. */ + MODE2R(512), + + /** + * 2048 bytes of user data provided by lib/user + * subheader provided in write parameters + * are we ever going to support this shit? I vote no. + * (supposed to be supported on all drives...) + */ + MODE2_PATHETIC(1024), + + /** + * 2048 bytes of data + 8 byte subheader provided by lib/user + * hey, this is also dumb + */ + MODE2_LAME(2048), + + /** + * 2324 bytes of data provided by lib/user + * subheader provided in write parameters. + * no sir, I don't like it. + */ + MODE2_OBSCURE(4096), + + /** + * 2332 bytes of data supplied by lib/user + * 8 bytes sub header provided in write parameters + * this is the second least suck mode2, and is mandatory for + * all drives to support. + */ + MODE2_OK(8192), + + /** SAO block sizes are based on cue sheet, so use this. */ + SAO(16384); + + int code; + private BlockType(int code) { + this.code = code; + } + +} diff --git a/java/src/java/org/pykix/libburnia/libburn/Burn.java b/java/src/java/org/pykix/libburnia/libburn/Burn.java new file mode 100644 index 0000000..3a28343 --- /dev/null +++ b/java/src/java/org/pykix/libburnia/libburn/Burn.java @@ -0,0 +1,482 @@ +/* + * Burn.java + * + * Copyright (c) 2007 Vreixo Formoso + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * See COPYING file for details. + */ + +package org.pykix.libburnia.libburn; + +/** + * Library initialization/shutdown and miscellaneous functions. + * + * + * @author Vreixo Formoso + * @since 0.1 + */ +public class Burn { + + static final String JNI_LIBRARY_NAME = "java-libburn-0.1"; + + /** Maximum number of particularly permissible drive addresses. */ + public static final int WHITELIST_LEN = 255; + + /** + * Initialize the library. + * + *

+ * This must be called before using any other functions in the library. It + * may be called more than once with no effect. + * + *

+ * It is possible to 'restart' the library by shutting it down and + * re-initializing it. This is necessary if you follow the older and + * more general way of accessing a drive via burn_drive_scan() and + * burn_drive_grab(). See burn_drive_scan_and_grab() with its strong + * urges and its explanations. TODO fix this comment + * + * @throws BurnException + * If library initialization fails. + */ + public static void initialize() throws BurnException { + + if ( burn_initialize() == 0 ) { + + throw new BurnException("Can't initialize libburnia library"); + } + } + + /** + * Shutdown the library. + * + *

+ * This should be called before exiting your application. Make sure that all + * drives you have grabbed are released before calling this. + */ + public static void finish() { + burn_finish(); + } + + /** + * Set parameters for behavior on opening device files. To be called early + * after {@link #initialize()} and before any bus scan. But not mandatory at + * all. + * + *

+ * Parameter value 1 enables a feature, 0 disables. Default is (1,0,0). + * Have a good reason before you change it. + * + * @param exclusive + *

    + *
  • 1 = Try to open only devices which are not marked as busy + * and try to mark them busy if opened sucessfully. (O_EXCL) + * There are kernels which simply don't care about O_EXCL. + * Some have it off, some have it on, some are switchable. + *
  • 2 = in case of a SCSI device, also try to open exclusively + * the matching /dev/sr, /dev/scd and /dev/st . + *
  • 0 = no attempt to make drive access exclusive. + *
+ * @param blocking + * Try to wait for drives which do not open immediately but + * also do not return an error as well. (O_NONBLOCK) + * This might stall indefinitely with /dev/hdX hard disks. + * @param abortOnBusy + * Unconditionally abort process when a non blocking + * exclusive opening attempt indicates a busy drive. + * Use this only after thorough tests with your app. + */ + public static void presetDeviceOpen(int exclusive, int blocking, + int abortOnBusy) { + + burn_preset_device_open(exclusive, blocking, abortOnBusy); + } + + /** + * Allows the use of media types which are implemented in libburn but not + * yet tested. The list of those untested profiles is subject to change. + * Currently it contains: 0x15 "DVD-R/DL Sequential". + * If you really test such media, then please report the outcome on + * libburn-hackers@pykix.org + * If ever then this call should be done soon after {@link #initialize()} + * before any drive scanning. + * + * @param yes + * true to allow all implemented profiles, + * false only tested media (default) + */ + public static void allowUntestedProfiles(boolean yes) { + burn_allow_untested_profiles(yes); + } + + /** + * Scan for drives. + * + *

+ * No drives may be in use when this is called. All drive objects are + * invalidated by using this function. Do NOT store drive + * objects across calls to this function or death AND pain will ensue. + * + *

+ * After this call all drives depicted by the returned array are subject + * to eventual (O_EXCL) locking. See burn_preset_device_open(). This state + * ends either with burn_drive_info_forget() or with burn_drive_release(). + * + *

+ * It is unfriendly to other processes on the system to hold drives locked + * which one does not definitely plan to use soon. + * + * @return + * an array of drive info items (cdroms/burners). + * The returned array must be freed by burn_drive_info_free() + * before burn_finish(), and also before calling this function + * burn_drive_scan() again. + * @throws BurnException + * If scan fails + * + * TODO correct above comment + */ + public static DriveInfo[] scan() throws BurnException { + + DriveInfo[] infos = burn_drive_scan(); + + if ( infos == null ) { + throw new BurnException("No drives found"); + } + return infos; + } + + /** + * Aquire a drive with known persistent address. + * + *

+ * This is the sysadmin friendly way to open one drive and to leave all + * others untouched. It bundles the following API calls to form a + * non-obtrusive way to use libburn: + * burn_drive_add_whitelist() , {@link #scan()}, {@link Drive#grab(boolean)} + * + *

+ * You are strongly urged to use this call whenever you know the + * drive address in advance. + * + *

+ * If not, then you have to use directly above calls. In that case, you are + * strongly urged to drop any unintended drive which will be + * exclusively occupied and not closed by {@link #scan()}. + * This can be done by shutting down the library including a call to + * {@link #finish()}. You may later start a new libburn session and should + * then use the function described here with an address obtained after + * {@link #scan()} via {@link DriveInfo#getAdr()}. + * + *

+ * Another way is to drop the unwanted drives by {@link DriveInfo#forget(int)}. + * + * @param adr + * The persistent address of the desired drive. Either obtained + * by {@link DriveInfo#getAdr()} or guessed skillfully by application + * resp. its user. + * @param load + * true to make the drive attempt to load a disc (close + * its tray door, etc). + * @return + * A DriveInfo object with the requested cdrom/burner. + * @throws BurnException + * If drive not found. + */ + public static DriveInfo scanAndGrab(String adr, boolean load) + throws BurnException { + + DriveInfo info = burn_drive_scan_and_grab(adr, load); + + if ( info == null ) { + throw new BurnException("Drive not found"); + } + return info; + } + + /** + * Add a device to the list of permissible drives. As soon as some entry + * is in the whitelist all non-listed drives are banned from scanning. + * + *

+ * The number of devices that can be added to the whitelist is limited + * to {@link #WHITELIST_LEN}. + * + * @param adr + * The persistent address of the drive. + * @return + * true on success, false otherwise. + */ + public static boolean addWhiteList(String adr) { + return (burn_drive_add_whitelist(adr) == 1); + } + + /** + * Remove all drives from whitelist. This enables all possible drives. + */ + public static void clearWhiteList() { + burn_drive_clear_whitelist(); + } + + /** + * Set the verbosity level of the library. + * + *

+ * The default value is 0, which means that nothing is output on stderr. + * The more you increase this, the more debug output should be displayed + * on stderr for you. + * + *

+ * This is for development only. Not suitable for applications. + * + * @param level + * The verbosity level desired. 0 for nothing, higher positive + * values for more information output. + */ + public static void setVerbosity(int level) { + burn_set_verbosity(level); + } + + /** + * Evaluate wether the given address would be a possible persistent + * drive address of libburn. + */ + public static boolean isEnumerableAdr(String adr) { + return burn_drive_is_enumerable_adr(adr); + } + + /** + * Try to convert a given existing filesystem address into a persistent + * drive address. This succeeds with symbolic links or if a hint about + * the drive's system address can be read from the filesystem object and + * a matching drive is found. + * + * @param path + * The address of an existing file system object + * @return + * The persistent address or null on failure + */ + public static String convertFsAdr(String path) { + return burn_drive_convert_fs_adr(path); + } + + /** + * + */ + public interface AbortHandler { + + /** + * Function suitable to produce appeasing messages while + * burn is been canceled. + * + * @param patience + * Maximum number of seconds to wait. + * @param elapsed + * Elapsed number of seconds. + * @return + */ + public int abortPacifier(int patience, int elapsed); + } + + /** + * Abort any running drive operation and finally call {@link #finish()}. + * + *

+ * You MUST calm down the busy drive if an aborting event occurs during a + * burn run. For that you may call this function either from your own signal + * handling code or indirectly by activating the builtin signal handling: + * burn_set_signal_handling("my_app_name : ", NULL, 0); + * + *

+ * Else you may eventually call {@link Drive#cancel()} on the active drive + * and wait for it to assume state {@link DriveStatus#IDLE}. + * + * @param patience + * Maximum number of seconds to wait for drives to finish + * @param pacifier + * A function to produce appeasing messages. You can pass + * null to not produce those messages. + * @return + * true if all went well, false if had + * to leave a drive in unclean state + * @throws BurnException + * On severe error, do no use libburn again + * @see #abort(int, String) + */ + public static boolean abort(int patience, AbortHandler pacifier) + throws BurnException { + + return burn_abort_java(patience, pacifier); + } + + /** + * Abort any running drive operation and finally call {@link #finish()}. + * + *

+ * You MUST calm down the busy drive if an aborting event occurs during a + * burn run. For that you may call this function either from your own signal + * handling code or indirectly by activating the builtin signal handling: + * burn_set_signal_handling("my_app_name : ", NULL, 0); + * + *

+ * Else you may eventually call {@link Drive#cancel()} on the active drive + * and wait for it to assume state {@link DriveStatus#IDLE}. + * + *

+ * This version of abort uses the default pacifier function that print + * messages to stdout. + * + * @param patience + * Maximum number of seconds to wait for drives to finish + * @param msg + * The message to be printed. + * @return + * true if all went well, false if had + * to leave a drive in unclean state + * @throws BurnException + * On severe error, do no use libburn again + * @see #abort(int, org.pykix.libburnia.libburn.Burn.AbortHandler) + */ + public static boolean abort(int patience, String msg) throws BurnException { + return burn_abort_def(patience, msg); + } + + /** + * Interface suitable for {@link Burn#setSignalHandler(org.pykix.libburnia.libburn.Burn.SignalHandler, int)} + */ + public interface SignalHandler { + + /** + * Function to be called when a signal is received. + * + * @param signum + * @param flag + * @return + * has to return -2 if it does not want the process to + * exit with value 1. + */ + public int handleSignal(int signum, int flag); + } + + /** + * Control builtin signal handling. See also + * {@link #abort(int, org.pykix.libburnia.libburn.Burn.AbortHandler)}. + * + * @param handler + * A handler to be called on signals. It's + * {@link SignalHandler#handleSignal(int, int) handleSignal} method + * will be called when a signal is received. It should finally call + * {@link #abort(int, org.pykix.libburnia.libburn.Burn.AbortHandler)}. + * @param mode + * 0 call handler(signum, 0) on nearly all signals + * 1 enable system default reaction on all signals + * 2 try to ignore nearly all signals + * 10 like mode 2 but handle SIGABRT like with mode 0 + */ + public static void setSignalHandler(SignalHandler handler, int mode) { + + if ( handler == null ) { + throw new NullPointerException("Handler cannot be null"); + } + + burn_set_signal_handling(handler, mode); + } + + /** + * Control builtin signal handling. + * + *

+ * This forces the usage of the default signal handler, that will + * eventually call {@link #abort(int, String) abort} and then perform + * exit(1). + * + *

+ * If you want to provide a custom signal handler you can use + * {@link #setSignalHandler(org.pykix.libburnia.libburn.Burn.SignalHandler, int)} + * + * @param msg + * If not null then it is used as prefix for pacifier + * messages. + * @param mode + * 0 call handler(signum, 0) on nearly all signals + * 1 enable system default reaction on all signals + * 2 try to ignore nearly all signals + * 10 like mode 2 but handle SIGABRT like with mode 0 + */ + public static void setDefaultSignalHandler(String msg, int mode) { + burn_set_default_signal_handling(msg, mode); + } + + public static class Version { + + public int major; + public int minor; + public int micro; + + public Version(int major, int minor, int micro) { + super(); + this.major = major; + this.minor = minor; + this.micro = micro; + } + + @Override + public String toString() { + return major + "." + minor + "." + micro; + } + } + + /** + * Returns the library's version. + */ + public static Version getVersion() { + return burn_version(); + } + + private static native int burn_initialize(); + + private static native void burn_finish(); + + private static native void burn_preset_device_open(int exclusive, + int blocking, int abort_on_busy); + + private static native void burn_allow_untested_profiles(boolean yes); + + private static native DriveInfo[] burn_drive_scan(); + + private static native DriveInfo burn_drive_scan_and_grab(String adr, + boolean load); + + private static native int burn_drive_add_whitelist(String adr); + + private static native void burn_drive_clear_whitelist(); + + private static native void burn_set_verbosity(int level); + + private static native boolean burn_drive_is_enumerable_adr(String adr); + + private static native String burn_drive_convert_fs_adr(String path); + + private static native boolean burn_abort_def(int patience, String msg) + throws BurnException; + + //TODO not tested at all!! + private static native boolean burn_abort_java(int patience, AbortHandler h) + throws BurnException; + + private static native void burn_set_signal_handling(SignalHandler handler, + int mode); + + private static native void burn_set_default_signal_handling(String msg, + int mode); + + private static native Version burn_version(); + + static { + System.loadLibrary(JNI_LIBRARY_NAME); + } +} diff --git a/java/src/java/org/pykix/libburnia/libburn/BurnException.java b/java/src/java/org/pykix/libburnia/libburn/BurnException.java new file mode 100644 index 0000000..b79e3ea --- /dev/null +++ b/java/src/java/org/pykix/libburnia/libburn/BurnException.java @@ -0,0 +1,39 @@ +/* + * BurnException.java + * + * Copyright (c) 2007 Vreixo Formoso + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * See COPYING file for details. + */ + +package org.pykix.libburnia.libburn; + +/** + * Base class for all library exceptions. + * + * @author Vreixo Formoso + * @since 0.1 + */ +public class BurnException extends Exception { + + public BurnException() { + super(); + } + + public BurnException(String message, Throwable cause) { + super(message, cause); + } + + public BurnException(String message) { + super(message); + } + + public BurnException(Throwable cause) { + super(cause); + } + +} diff --git a/java/src/java/org/pykix/libburnia/libburn/BurnMode.java b/java/src/java/org/pykix/libburnia/libburn/BurnMode.java new file mode 100644 index 0000000..ecc819d --- /dev/null +++ b/java/src/java/org/pykix/libburnia/libburn/BurnMode.java @@ -0,0 +1,101 @@ +/* + * BurnMode.java + * + * Copyright (c) 2007 Vreixo Formoso + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * See COPYING file for details. + */ + +package org.pykix.libburnia.libburn; + +/** + * Burn Mode options. + * + * TODO this is a bitmask on C, I prefer exposing it as a enum in Java + * for now, but I need to think about it. enum is typesafe and more java-like. + * A better option might be creation of 2 enums, one for track mode, another + * for track mode modifier. + * + * TODO comentar bem o uso desta classe + * + * @author Vreixo Formoso + * @since 0.1 + */ +public enum BurnMode { + + /** + * Track mode - mode 0 data + * 0 bytes of user data. it's all 0s. mode 0. get it? HAH + */ + MODE0(1 << 0), + + /** + * Track mode - mode "raw" - all 2352 bytes supplied by app + * FOR DATA TRACKS ONLY! + */ + MODE_RAW(1 << 1), + + /** + * Track mode - mode 1 data + * 2048 bytes user data, and all the LEC money can buy + */ + MODE1(1 << 2), + + /** + * Track mode - mode 2 data + * defaults to formless, 2336 bytes of user data, unprotected + * | with a data form if required. + */ + MODE2(1 << 3), + + /** + * Track mode modifier - Form 1, | with MODE2 for reasonable results + * 2048 bytes of user data, 4 bytes of subheader + */ + FORM1(1 << 4), + + /** + * Track mode modifier - Form 2, | with MODE2 for reasonable results + * lots of user data. not much LEC. + */ + FORM2(1 << 5), + + /** + * Track mode - audio + * 2352 bytes per sector. may be | with 4ch or preemphasis. + * NOT TO BE CONFUSED WITH {@link #MODE_RAW} + * Audio data must be 44100Hz 16bit stereo with no riff or other header at + * beginning. Extra header data will cause pops or clicks. Audio data should + * also be in little-endian byte order. Big-endian audio data causes static. + */ + AUDIO(1 << 6), + + /** Track mode modifier - 4 channel audio. */ + AUDIO_4CH(1 << 7), + + /** Track mode modifier - Digital copy permitted, can be set on any track. */ + COPY(1 << 8), + + /** Track mode modifier - 50/15uS pre-emphasis. */ + PREEMPHASIS(1 << 9), + + /** Input mode modifier - subcodes present packed 16 */ + SUBCODE_P16(1 << 10), + + /** Input mode modifier - subcodes present packed 96 */ + SUBCODE_P96(1 << 11), + + /** Input mode modifier - subcodes present raw 96 */ + SUBCODE_R96 (1 << 12); + + /* for bitmak generation, package protected */ + int bm; + private BurnMode(int bm) { + this.bm = bm; + } + +} diff --git a/java/src/java/org/pykix/libburnia/libburn/BurnSource.java b/java/src/java/org/pykix/libburnia/libburn/BurnSource.java new file mode 100644 index 0000000..400faac --- /dev/null +++ b/java/src/java/org/pykix/libburnia/libburn/BurnSource.java @@ -0,0 +1,72 @@ +/* + * BurnSource.java + * + * Copyright (c) 2007 Vreixo Formoso + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * See COPYING file for details. + */ + +package org.pykix.libburnia.libburn; + +/** + * Data source for tracks on disc. + * + * FIXME think about design of this object. being an interface any user + * can create its own implementation and pass it to libburn, and this will + * not work. + * + * @author Vreixo Formoso + * @since 0.1 + */ +public interface BurnSource { + + /** + * Read data from the source. + * + * @param buffer + * Buffer where data is to be read. Must have at least size bytes. + * @param size + * Number of bytes to be read. + * @return + * Number of bytes actually read. + * @throws IndexOutOfBoundsException + * If size bigger than buffer length + * @throws NullPointerException + * If buffer is null + */ + int read(byte[] buffer, int size); + + /** + * Read subchannel data from the source. + * + * @param buffer + * Buffer where data is to be read. Must have at least size bytes. + * @param size + * Number of bytes to be read. + * @return + * Number of bytes actually read. + * @throws IndexOutOfBoundsException + * If size bigger than buffer length + * @throws NullPointerException + * If buffer is null + */ + int readSub(byte[] buffer, int size); + + /** + * Get the size of the source's data. + * @return + */ + long getSize(); + + /** + * Set the size of the source's data. + * @param bytes + * @return + */ + int setSize(long bytes); + +} diff --git a/java/src/java/org/pykix/libburnia/libburn/Disc.java b/java/src/java/org/pykix/libburnia/libburn/Disc.java new file mode 100644 index 0000000..8647d22 --- /dev/null +++ b/java/src/java/org/pykix/libburnia/libburn/Disc.java @@ -0,0 +1,129 @@ +/* + * Disc.java + * + * Copyright (c) 2007 Vreixo Formoso + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * See COPYING file for details. + */ + +package org.pykix.libburnia.libburn; + +import org.pykix.libburnia.bindings.Proxy; + +/** + * References a whole disc. + * + * @author Vreixo Formoso + * @since 0.1 + */ +public class Disc extends Proxy { + + public static final int POS_END = 100; + + /** + * Create a new disc. + */ + public Disc() { + super( burn_disc_create() ); + } + + Disc(long ptr) { + super(ptr); + } + + /** + * Add a session to disc at a specific position. + * + * @param session + * Session to add to the disc. + * @param pos + * position to add at ({@link #POS_END} is "at the end"). + * @return + * true on success, false on failure. + */ + public boolean addSession(Session session, int pos) { + + if ( pos > POS_END ) { + return false; + } + return burn_disc_add_session( pointerOf(this), pointerOf(session), pos); + } + + /** + * Remove a session from a disc. + * + * @param session + * Session to find and remove. + * @return + * true on success, false on failure, + * for example if session was not previously added to disc. + */ + public boolean removeSession(Session session) { + return burn_disc_remove_session( pointerOf(this), pointerOf(session)); + } + + /** + * Gets an array of all the sessions for the disc. + * + *

+ * THIS IS NO LONGER VALID AFTER YOU ADD OR REMOVE A SESSION. + * + * FIXME same problem as in {@link Session#getTracks()} + * + * @return + * An array with the sessions. + */ + public Session[] getSessions() { + + long[] sessionPtrs = burn_disc_get_sessions(pointerOf(this)); + + Session[] sessions = new Session[sessionPtrs.length]; + + for ( int i = 0; i < sessionPtrs.length; ++i ) { + + long ptr = sessionPtrs[i]; + + Session session = (Session) proxyFor(ptr); + if (session == null) { + session = new Session(ptr); + } + sessions[i] = session; + } + + return sessions; + } + + /** + * Get how much long the disc will be. + * + * @return + * Number of sectors of the disc. + */ + public int getSectors() { + return burn_disc_get_sectors( pointerOf(this) ); + } + + @Override + protected void finalize() throws Throwable { + super.finalize(); + burn_disc_free( pointerOf(this) ); + } + + private static native long burn_disc_create(); + + private static native void burn_disc_free(long d); + + private static native boolean burn_disc_add_session( long d, long s, + int pos); + + private static native boolean burn_disc_remove_session(long d, long s); + + private static native long[] burn_disc_get_sessions(long d); + + private static native int burn_disc_get_sectors(long d); + +} diff --git a/java/src/java/org/pykix/libburnia/libburn/DiscStatus.java b/java/src/java/org/pykix/libburnia/libburn/DiscStatus.java new file mode 100644 index 0000000..47089fe --- /dev/null +++ b/java/src/java/org/pykix/libburnia/libburn/DiscStatus.java @@ -0,0 +1,46 @@ +/* + * DiscStatus.java + * + * Copyright (c) 2007 Vreixo Formoso + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * See COPYING file for details. + */ + +package org.pykix.libburnia.libburn; + +/** + * Possible status' of the drive in regard to the disc in it. + * + * @author Vreixo Formoso + * @since 0.1 + */ +public enum DiscStatus { + + /** The current status is not yet known. */ + UNREADY, + + /** The drive holds a blank disc. */ + BLANK, + + /** There is no disc at all in the drive. */ + EMPTY, + + /** There is an incomplete disc in the drive. */ + APPENDABLE, + + /** There is a disc with data on it in the drive. */ + FULL, + + /* ts A61007 */ + /** The drive was not grabbed when the status was inquired. */ + UNGRABBED, + + /* ts A61020 */ + /** The media seems not to be suitable for burning. */ + UNSUITABLE + +} diff --git a/java/src/java/org/pykix/libburnia/libburn/Drive.java b/java/src/java/org/pykix/libburnia/libburn/Drive.java new file mode 100644 index 0000000..c3e1a92 --- /dev/null +++ b/java/src/java/org/pykix/libburnia/libburn/Drive.java @@ -0,0 +1,737 @@ +/* + * Drive.java + * + * Copyright (c) 2007 Vreixo Formoso + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * See COPYING file for details. + */ + +package org.pykix.libburnia.libburn; + +import org.pykix.libburnia.bindings.Proxy; + +/** + * References a physical drive in the system. + * + * @author Vreixo Formoso + * @since 0.1 + */ +public class Drive extends Proxy { + + Drive(long ptr) { + super(ptr); + } + + /** + * Grab the drive. This must be done before the drive can be used + * (for reading, writing, etc). + * + * @param load + * true to make the drive attempt to load a disc + * (close its tray door, etc). + * @throws BurnException + * if it wasn't possible to grab the drive + */ + public void grab(boolean load) throws BurnException { + if ( !burn_drive_grab(pointerOf(this), load ? 1 : 0) ) { + throw new BurnException("Can't grab the drive"); + } + } + + /** + * Release the drive. This should not be done until the drive is no longer + * busy (see burn_drive_get_status). The drive is (O_EXCL) unlocked. + * + * @param eject + * true to make the drive eject the disc in it. + */ + public void release(boolean eject) { + burn_drive_release( pointerOf(this), eject ? 1 : 0 ); + } + + /** + * Returns what kind of disc the drive is holding. + * + *

+ * This function may need to be called more than once to get a proper + * status from it. + * + * @return + * The status of the drive, or what kind of disc is in it. + */ + public DiscStatus getDiscStatus() { + switch ( burn_disc_get_status( pointerOf(this) ) ) { + case 0: + return DiscStatus.UNREADY; + case 1: + return DiscStatus.BLANK; + case 2: + return DiscStatus.EMPTY; + case 3: + return DiscStatus.APPENDABLE; + case 4: + return DiscStatus.FULL; + case 5: + return DiscStatus.UNGRABBED; + case 6: + return DiscStatus.UNSUITABLE; + default: + throw new RuntimeException("Unexpected value"); + } + } + + /** + * Tells the MMC Profile identifier of the loaded media. The drive must be + * grabbed in order to get a profile other than {@link Profile#NONE}. + * + *

+ * libburn currently writes only to profiles 0x09 "CD-R", 0x0a "CD-RW", + * 0x11 "DVD-R", 0x12 "DVD-RAM", 0x13 "DVD-RW restricted overwrite", + * 0x14 "DVD-RW Sequential Recording" or 0x1a "DVD+RW". + * + *

+ * If enabled by burn_allow_untested_profiles() it also writes to profile + * 0x15 "DVD-R/DL Sequential Recording". + * + * @return + * The profile of the loaded media. + */ + /* + * I've implemented this in a different way that libburn, I prefer returning + * profile as an enum. It has a lot of advantages for the programmer, + * and only one problem: this cannot distinguish between different unknown + * profiles. + */ + public Profile getProfile() { + return Profile.get( burn_disc_get_profile( pointerOf(this) ) ); + } + + /** + * Tells whether a disc can be erased or not. + * + * @return + * true is inserted disc is erasable, + * false if not. + */ + public boolean isErasable() { + return burn_disc_erasable( pointerOf(this) ); + } + + /** + * Returns the progress and status of a drive. + * + * @param progress + * Will be filled with the progress of the operation, + * you can pass null if you don't care + * @return + * the current status of the drive. + */ + public DriveStatus getDriveStatus(Progress progress) { + + switch ( burn_drive_get_status( pointerOf(this), + progress == null ? 0 : pointerOf(progress) ) ) { + + case 0: + return DriveStatus.IDLE; + case 1: + return DriveStatus.SPAWNING; + case 2: + return DriveStatus.READING; + case 3: + return DriveStatus.WRITING; + case 4: + return DriveStatus.WRITING_LEADIN; + case 5: + return DriveStatus.WRITING_LEADOUT; + case 6: + return DriveStatus.ERASING; + case 7: + return DriveStatus.GRABBING; + case 8: + return DriveStatus.WRITING_PREGAP; + case 9: + return DriveStatus.CLOSING_TRACK; + case 10: + return DriveStatus.CLOSING_SESSION; + case 11: + return DriveStatus.FORMATTING; + default: + throw new RuntimeException("Unexpected drive status"); + } + } + + /** + * Erase a disc in the drive. + * + *

+ * The drive must be grabbed successfully BEFORE calling this + * function. Always ensure that the drive reports a status of + * {@link DiscStatus#FULL} or {@link DiscStatus#APPENDABLE} before + * calling this function. An erase operation is not cancellable, as + * control of the operation is passed wholly to the drive and + * there is no way to interrupt it safely. + * + * @see #getDiscStatus() + * + * @param fast + * true to do a fast erase, where only the disc's + * headers are erased; false to erase the entire disc. + * With DVD-RW, fast blanking yields media capable only of DAO. + */ + public void erase(boolean fast) { + burn_disc_erase(pointerOf(this), fast); + } + + /** + * Creates a WriteOpts object for burning to this drive. + * + * @return + * a WriteOpts object + */ + public WriteOpts newWriteOpts() { + return new WriteOpts( burn_write_opts_new(pointerOf(this)) ); + } + + /** + * Return the best possible estimation of the currently available capacity + * of the media. This might depend on particular write option settings. + * For inquiring the space with such a set of options, the drive has to be + * grabbed and {@link DriveStatus#IDLE}. If not, then one will only get a + * canned value from the most recent automatic inquiry (e.g. during last + * drive grabbing). + * + *

+ * An eventual start address from burn_write_opts_set_start_byte() will be + * subtracted from the obtained capacity estimation. Negative results get + * defaulted to 0. + * + * @param opts + * If not null, write parameters to be set on drive + * before query. + * @return + * number of most probably available free bytes. + */ + public long getAvailableSpace(WriteOpts opts) { + return burn_disc_available_space( pointerOf(this), + opts == null ? 0 : pointerOf(opts) ); + } + + /** + * Write a disc in the drive. + * + *

+ * The drive must be grabbed successfully before calling this function. + * Always ensure that the drive reports a status of + * {@link DiscStatus#BLANK} or {@link DiscStatus#APPENDABLE} before + * calling this function. + * + *

+ * Note: write type {@link WriteType#SAO} is currently not capable of + * writing a mix of data and audio tracks. You must use + * {@link WriteType#TAO} for such sessions. + * To be set by {@link WriteOpts#setWriteType(WriteType, BlockTypes)}. + * + * @param o + * The options for the writing operation. + * @param d + * The {@link Disc} object that described the disc to be created. + */ + /* + * ok, this not need to be a member of Drive, but as + * read, erase, etc are also here... + */ + public void write( WriteOpts o, Disc disc) { + burn_disc_write( pointerOf(o), pointerOf(disc) ); + } + + /** + * Format media for use with libburn. This currently applies to DVD-RW + * in state "Sequential Recording" (profile 0014h) which get formatted to + * state "Restricted Overwrite" (profile 0013h). DVD+RW can be "de-iced" + * by setting bit2 of flag. Other media cannot be formatted yet. + * + * @param size + * The size in bytes to be used with the format command. It should + * be divisible by 32*1024. The effect of this parameter may + * depend on the media profile. + * @param flag + * Bitfield for control purposes: + *

    + *
  • bit0= after formatting, write the given number of zero-bytes + * to the media and eventually perform preliminary closing. + *
  • bit1= insist in size 0 even if there is a better default known + *
  • bit2= format to maximum available size + *
  • bit3= -reserved- + *
  • bit4= enforce re-format of (partly) formatted media + *
  • bit7= MMC expert application mode (else libburn tries to + * choose a suitable format type): + *
  • bit8 to bit15 contain the index of the format to use. See + * burn_disc_get_formats(), burn_disc_get_format_descr(). + * Acceptable types are: 0x00, 0x10, 0x11, 0x13, 0x15, 0x26. + * If bit7 is set, bit4 is set automatically. + *
+ */ + public void format(long size, int flag) { + burn_disc_format(pointerOf(this), size, flag); + } + + /** + * Cancel an operation on a drive. + * + *

+ * This will only work when the drive's busy state is + * {@link DriveStatus#READING} or {@link DriveStatus#WRITING}. + * + * @see #getDriveStatus(Progress) + */ + public void cancel() { + burn_drive_cancel( pointerOf(this) ); + } + + /** + * Inquire wether the most recent write run was successful. Reasons for + * non-success may be: rejection of burn parameters, abort during fatal + * errors during write, a call to {@link #cancel()} by the application + * thread. + * + * @return + * true if burn seems to have went well, + * false if burn failed. + */ + public boolean wroteWell() { + return burn_drive_wrote_well( pointerOf(this) ); + } + + /** + * Get the drive's disc object. + * + * @return + * the Disc object or null on failure. + */ + public Disc getDisc() { + + long ptr = burn_drive_get_disc( pointerOf(this) ); + + if ( ptr == 0 ) { + return null; + } + + Disc disc = (Disc) proxyFor(ptr); + if ( disc == null) { + disc = new Disc(ptr); + } + return disc; + } + + /** + * Sets drive read and write speed. + * + * @param read + * Read speed in k/s (0 is max). + * @param write + * Write speed in k/s (0 is max). + */ + public void setSpeed(int read, int write) { + burn_drive_set_speed( pointerOf(this), read, write); + } + + /** + * Creates a ReadOpts object for reading from this drive. + * + * @return + * the ReadOpts object. + */ + public ReadOpts newReadOpts() { + return new ReadOpts( burn_read_opts_new(pointerOf(this)) ); + } + + /** + * Gets the maximum write speed for a drive and eventually loaded media. + * + *

+ * The return value might change by the media type of already loaded media, + * again by call burn_drive_grab() and again by call burn_disc_read_atip(). + * + * @return + * Maximum write speed in K/s. + */ + public int getWriteSpeed() { + return burn_drive_get_write_speed( pointerOf(this) ); + } + + /** + * Gets the minimum write speed for the drive and eventually loaded media. + * + *

+ * The return value might change by the media type of already loaded media, + * again by call burn_drive_grab() and again by call burn_disc_read_atip(). + * + * @return + * Minimum write speed in K/s. + */ + public int getMinWriteSpeed() { + return burn_drive_get_min_write_speed( pointerOf(this) ); + } + + /** + * Gets the maximum read speed for the drive. + * + * @return + * Maximum read speed in K/s. + */ + public int getReadSpeed() { + return burn_drive_get_read_speed( pointerOf(this) ); + } + + /** + * Obtain a copy of the current speed descriptor list. The drive's list + * gets updated on various occasions such as {@link #grab(boolean)} but + * the copy obtained here stays untouched. + * + *

+ * Speeds may appear several times in the list. The list content depends + * much on drive and media type. It seems that .source == 1 applies mostly + * to CD media whereas .source == 2 applies to any media. + * + * @return + * The speed list, may be empty. + * @throws BurnException + * If severe error occurs. + */ + public SpeedDescriptor[] getSpeedList() throws BurnException { + + SpeedDescriptor[] lst = burn_drive_get_speedlist(pointerOf(this)); + + if (lst == null) { + throw new BurnException("Can't get speed list"); + } + return lst; + } + + /** + * WARNING: + * This revives an old bug-like behavior that might be dangerous. + * + * Sets the drive status to {@link DiscStatus#BLANK} if it is + * {@link DiscStatus#UNREADY} or {@link DiscStatus#UNSUITABLE}. + * Thus marking media as writable which actually failed to declare + * themselves either blank or (partially) filled. + * + * @return + * true on success, false if drive is + * in an unsuitable status. + */ + public boolean pretendBlank() { + return burn_disc_pretend_blank( pointerOf(this) ); + } + + /** + * WARNING: + * This overrides the safety measures against unsuitable media. + * + * Sets the drive status to {@link DiscStatus#FULL} if it is + * {@link DiscStatus#UNREADY} or {@link DiscStatus#UNSUITABLE}. + * Thus marking media as blankable which actually failed to declare + * themselves either blank or (partially) filled. + * + * @return + * true on success, false if drive is + * in an unsuitable status. + */ + public boolean pretendFull() { + return burn_disc_pretend_full( pointerOf(this) ); + } + + /** + * Reads ATIP information from inserted media. To be obtained via + * {@link #getWriteSpeed()}, {@link #getMinWriteSpeed()}, + * burn_drive_get_start_end_lba(). The drive must be grabbed for this call. + * + * @return + * true on success, false if no valid ATIP + * info read. + * @throws BurnException + * On a severe error. + */ + public boolean readAtip() throws BurnException { + switch ( burn_disc_read_atip( pointerOf(this) ) ) { + case 1: + return true; + case 0: + return false; + default: + throw new BurnException("Severe error reading ATIP"); + } + } + + /** + * Returns start lba of the media which is currently inserted in the drive. + * The drive has to be grabbed to have hope for reply. + * + *

+ * Shortcomming (not a feature): unless {@link #readAtip()} was called + * only blank media will return valid info. + * + * @return + * the start lba value + * @throws BurnException + * On invalid lba value. + */ + /* + * TODO mmm, I really don't like to throw an Exception here... + */ + public int getStartLba() throws BurnException { + + /* flag is unused yet */ + return burn_drive_get_start_lba(pointerOf(this), 0); + } + + /** + * Returns end lba of the media which is currently inserted in the drive. + * The drive has to be grabbed to have hope for reply. + * + *

+ * Shortcomming (not a feature): unless {@link #readAtip()} was called + * only blank media will return valid info. + * + * @return + * the end lba value + * @throws BurnException + * On invalid lba value. + */ + /* + * TODO mmm, I really don't like to throw an Exception here... + */ + public int getEndLba() throws BurnException { + + /* flag is unused yet */ + return burn_drive_get_end_lba(pointerOf(this), 0); + } + + /** + * Read start lba of a track from media. + * + *

+ * Usually a track lba is obtained from the result of + * {@link Track#getEntry()}. This call retrieves an updated lba, + * and can address the invisible track to come. + * + *

+ * The drive must be grabbed for this call. One may not issue this call + * during ongoing {@link #write(WriteOpts, Disc)} or {@link #erase(boolean)}. + * + * @param o + * If not null, write parameters to be set on drive + * before query + * @param trackno + * 0=next track to come, >0 number of existing track + * @return + * start lba + * @throws BurnException + * On error + */ + public int getTrackLba(WriteOpts o, int trackno) throws BurnException { + return burn_disc_track_lba( pointerOf(this), + o == null ? 0 : pointerOf(o), trackno); + } + + /** + * Read Next Writeable Address of a track from media. + * + *

+ * The drive must be grabbed for this call. One may not issue this call + * during ongoing {@link #write(WriteOpts, Disc)} or {@link #erase(boolean)}. + * + * @param o + * If not null, write parameters to be set on drive + * before query + * @param trackno + * 0=next track to come, >0 number of existing track + * @return + * Next Writeable Address + * @throws BurnException + * If error or non valid nwa + */ + public int getTrackNwa(WriteOpts o, int trackno) throws BurnException { + return burn_disc_track_nwa( pointerOf(this), + o == null ? 0 : pointerOf(o), trackno); + } + + /** + * Read start lba of the first track in the last complete session. + * + *

+ * This is the first parameter of mkisofs option -C. The second parameter + * is nwa as obtained by {@link #getTrackNwa(WriteOpts, int)} with + * trackno 0. + * + * @return + * returns the start address of that track + * @throws BurnException + * on error + */ + public int getMsc1() throws BurnException { + return burn_disc_get_msc1(pointerOf(this)); + } + + /** + * Creates a {@link MultiCaps} with values which are appropriate for the + * drive and the loaded media. The drive must be grabbed for this call. + * + * @param wt + * With {@link WriteType#NONE} the best capabilities of all write modes + * get returned. If set to a write mode like {@link WriteType#SAO} the + * capabilities with that particular mode are returned and the + * {@link MultiCaps#isWritingPossible()} return value is + * false if the desired mode is not possible. + * @return + * The MultiCaps object. + * @throws BurnException + * On error. + */ + public MultiCaps getMultiCaps(WriteType wt) throws BurnException { + + /* flag param unused yet */ + return burn_disc_get_multi_caps(pointerOf(this), + wt.ordinal(), 0); + } + + /** + * TODO not implemented in libburn + * + * Read a disc from the drive and write it to an fd pair. The drive must be + * grabbed successfully BEFORE calling this function. Always ensure that the + * drive reports a status of BURN_DISC_FULL before calling this function. + * + * @param opts + * The options for the read operation. + */ + public void read(ReadOpts opts) { + burn_disc_read( pointerOf(this), pointerOf(opts) ); + } + + /** + * Inquire the formatting status, the associated sizes and the number of + * available formats. The info is media specific and stems from MMC command + * 23h READ FORMAT CAPACITY. See mmc5r03c.pdf 6.24 for background details. + * Media type can be determined via burn_disc_get_profile(). + * + * @return + * + * @throws BurnException + * On failure + */ + public Formats getFormats() throws BurnException { + Formats f = burn_disc_get_formats( pointerOf(this) ); + if ( f != null ) { + return f; + } else { + throw new BurnException("Can't get formats"); + } + } + + /** + * Inquire parameters of an available media format. + * + * @param index + * he index of the format item. Beginning with 0 up to reply + * parameter from {@link #getFormats()} : + * {@link Formats#getNumFormats()} - 1 + * @return + * @throws BurnException + * On error + */ + public FormatDesc getFormatDescr(int index) throws BurnException { + FormatDesc fd = burn_disc_get_format_descr(pointerOf(this), index); + if ( fd == null ) { + throw new BurnException("Can't get format desc"); + } + return fd; + } + + private static native boolean burn_drive_grab(long drive, int load); + + private static native void burn_drive_release(long drive, int eject); + + private static native int burn_disc_get_status(long drive); + + private static native short burn_disc_get_profile(long d); + + private static native boolean burn_disc_erasable(long d); + + private static native int burn_drive_get_status(long drive, long p); + + private static native void burn_disc_erase(long drive, boolean fast); + + private static native long burn_write_opts_new(long drive); + + private static native long burn_disc_available_space(long d, long o); + + private static native void burn_disc_write(long o, long disc); + + private static native void burn_disc_format(long drive, long size, int flag); + + private static native void burn_drive_cancel(long drive); + + private static native boolean burn_drive_wrote_well(long d); + + private static native long burn_drive_get_disc(long d); + + private static native void burn_drive_set_speed(long d, int r, int w); + + private static native int burn_drive_get_write_speed(long d); + + private static native int burn_drive_get_min_write_speed(long d); + + private static native int burn_drive_get_read_speed(long d); + + private static native long burn_read_opts_new(long drive); + + private static native SpeedDescriptor[] burn_drive_get_speedlist(long d); + + private static native boolean burn_disc_pretend_blank(long drive); + + private static native boolean burn_disc_pretend_full(long drive); + + private static native int burn_disc_read_atip(long drive); + + /* + * These two functions are wrapping for the single C function: + * int burn_drive_get_start_end_lba(struct burn_drive *drive, + * int *start_lba, int *end_lba, int flag); + */ + private static native int burn_drive_get_start_lba(long drive, int flag) + throws BurnException; + + private static native int burn_drive_get_end_lba(long drive, int flag) + throws BurnException; + + /* + * These two functions are wrapping for the single C function: + * int burn_disc_track_lba_nwa(struct burn_drive *d, + * struct burn_write_opts *o, int trackno, int *lba, int *nwa); + */ + private static native int burn_disc_track_lba(long d, long o, int trackno) + throws BurnException; + + private static native int burn_disc_track_nwa(long d, long o, int trackno) + throws BurnException; + + private static native int burn_disc_get_msc1(long d) + throws BurnException; + + private static native MultiCaps burn_disc_get_multi_caps(long d, + int wt, int flag) throws BurnException; + + private static native void burn_disc_read(long d, long o); + + private static native Formats burn_disc_get_formats(long drive); + + private static native FormatDesc burn_disc_get_format_descr(long d, + int index); + +} diff --git a/java/src/java/org/pykix/libburnia/libburn/DriveInfo.java b/java/src/java/org/pykix/libburnia/libburn/DriveInfo.java new file mode 100644 index 0000000..bf7c1aa --- /dev/null +++ b/java/src/java/org/pykix/libburnia/libburn/DriveInfo.java @@ -0,0 +1,311 @@ +/* + * DriveInfo.java + * + * Copyright (c) 2007 Vreixo Formoso + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * See COPYING file for details. + */ + +package org.pykix.libburnia.libburn; + +import java.util.EnumSet; + +/** + * Information on a drive in the system. + * + * @author Vreixo Formoso + * @since 0.1 + */ +/* + * This is not a proxy, but it contains a reference to the + * C burn_drive_info struct it represents. This is only for two + * pair of functions, forget and getAdr, than need that reference. + * + * FIXME in a future it would be a good idea to ensure that this + * reference is part of the drive_infos array, cause otherwise that + * means that this DriveInfo is used after a new scan. + * + * TODO do good java comments to getters + */ +public class DriveInfo { + + /** Name of the vendor of the drive. */ + private String vendor; + + /** Name of the drive. */ + private String product; + + /** Revision of the drive. */ + private String revision; + + /** Location of the drive in the filesystem. */ + /* This is currently the string which is used as persistent + * drive address. But be warned: there is NO GUARANTEE that this + * will stay so. Always use function {@link #getAdr} to + * inquire a persistent address. + */ + private String location; + + /** Can the drive read DVD-RAM discs. */ + private boolean readDvdram; + + /** Can the drive read DVD-R discs. */ + private boolean readDvdr; + + /** Can the drive read DVD-ROM discs. */ + private boolean readDvdrom; + + /** Can the drive read CD-R discs. */ + private boolean readCdr; + + /** Can the drive read CD-RW discs. */ + private boolean readCdrw; + + /** Can the drive write DVD-RAM discs. */ + private boolean writeDvdram; + + /** Can the drive write DVD-R discs. */ + private boolean writeDvdr; + + /** Can the drive write CD-R discs. */ + private boolean writeCdr; + + /** Can the drive write CD-RW discs. */ + private boolean writeCdrw; + + /** Can the drive simulate a write. */ + private boolean writeSimulate; + + /** Can the drive report C2 errors. */ + private boolean c2Errors; + + /** The size of the drive's buffer (in kilobytes). */ + private int bufferSize; + + /** + * The supported block types in tao mode. + * They should be tested with the desired block type. + * + * @see BlockType + */ + private EnumSet taoBlockTypes; + + /** + * The supported block types in sao mode. + * They should be tested with the desired block type. + * + * @see BlockType + */ + private EnumSet saoBlockTypes; + + /** + * The supported block types in raw mode. + * They should be tested with the desired block type. + * + * @see BlockType + */ + private EnumSet rawBlockTypes; + + /** + * The supported block types in packet mode. + * They should be tested with the desired block type. + * + * @see BlockType + */ + private EnumSet packetBlockTypes; + + /** + * The value by which this drive can be indexed when using functions + * in the library. This is the value to pass to all libbburn functions + * that operate on a drive. + */ + private Drive drive; + + /* reference to the C struct */ + private long ptr; + + DriveInfo(long ptr, String vendor, String product, String revision, + String location, boolean readDvdram, boolean readDvdr, + boolean readDvdrom, boolean readCdr, boolean readCdrw, + boolean writeDvdram, boolean writeDvdr, boolean writeCdr, + boolean writeCdrw, boolean writeSimulate, boolean errors, + int bufferSize, int taoBlockTypes, int saoBlockTypes, + int rawBlockTypes, int packetBlockTypes, long drive) { + + super(); + this.ptr = ptr; + this.vendor = vendor; + this.product = product; + this.revision = revision; + this.location = location; + this.readDvdram = readDvdram; + this.readDvdr = readDvdr; + this.readDvdrom = readDvdrom; + this.readCdr = readCdr; + this.readCdrw = readCdrw; + this.writeDvdram = writeDvdram; + this.writeDvdr = writeDvdr; + this.writeCdr = writeCdr; + this.writeCdrw = writeCdrw; + this.writeSimulate = writeSimulate; + c2Errors = errors; + this.bufferSize = bufferSize; + this.taoBlockTypes = blockTypeBitMask2EnumSet(taoBlockTypes); + this.saoBlockTypes = blockTypeBitMask2EnumSet(saoBlockTypes); + this.rawBlockTypes = blockTypeBitMask2EnumSet(rawBlockTypes); + this.packetBlockTypes = blockTypeBitMask2EnumSet(packetBlockTypes); + + //TODO can this lead to duplicate objects?? + this.drive = new Drive(drive); + } + + public int getBufferSize() { + return bufferSize; + } + + public boolean c2Errors() { + return c2Errors; + } + + public Drive getDrive() { + return drive; + } + + public String getLocation() { + return location; + } + + public EnumSet getPacketBlockTypes() { + return packetBlockTypes; + } + + public String getProduct() { + return product; + } + + public EnumSet getRawBlockTypes() { + return rawBlockTypes; + } + + public boolean readCdr() { + return readCdr; + } + + public boolean readCdrw() { + return readCdrw; + } + + public boolean readDvdr() { + return readDvdr; + } + + public boolean readDvdram() { + return readDvdram; + } + + public boolean readDvdrom() { + return readDvdrom; + } + + public String getRevision() { + return revision; + } + + public EnumSet getSaoBlockTypes() { + return saoBlockTypes; + } + + public EnumSet getTaoBlockTypes() { + return taoBlockTypes; + } + + public String getVendor() { + return vendor; + } + + public boolean writeCdr() { + return writeCdr; + } + + public boolean writeCdrw() { + return writeCdrw; + } + + public boolean writeDvdr() { + return writeDvdr; + } + + public boolean writeDvdram() { + return writeDvdram; + } + + public boolean writeSimulate() { + return writeSimulate; + } + + /** + * Release memory about a single drive and any exclusive lock on it. + * Become unable to inquire or grab it. + * Expect FATAL consequences if you try. + * + * @param force + * controls degree of permissible drive usage at the moment this + * function is called, and the amount of automatically provided + * drive shutdown : + * 0= drive must be ungrabbed and BURN_DRIVE_IDLE + * 1= try to release drive resp. accept BURN_DRIVE_GRABBING + * Use these two only. Further values are to be defined. + * @return + * 1 on success, 2 if drive was already forgotten, + * 0 if not permissible, < 0 on other failures, + * + * TODO throw exceptions instead of these return values + */ + public int forget(int force) { + return burn_drive_info_forget(ptr, force); + } + + /** + * Inquire the persistent address of the given drive. + * + * @return + * The persistent address of the drive. + * @throws BurnException + * If address can't be getted, what means a libburn + * internal problem. + */ + public String getAdr() throws BurnException { + String adr = burn_drive_get_adr(ptr); + if ( adr == null ) { + throw new BurnException("Internal libray error"); + } + return adr; + } + + @Override + public String toString() { + return vendor + " " + product + " " + revision + " / " + location; + } + + private static native int burn_drive_info_forget(long di, int force); + + private static native String burn_drive_get_adr(long drive_info); + + private EnumSet blockTypeBitMask2EnumSet(int bm) { + + EnumSet blockTypes = EnumSet.noneOf(BlockType.class); + + for ( BlockType bt : EnumSet.allOf(BlockType.class) ) { + if ( (bm & bt.code) != 0 ) { + blockTypes.add(bt); + } + } + + return blockTypes; + } + +} diff --git a/java/src/java/org/pykix/libburnia/libburn/DriveStatus.java b/java/src/java/org/pykix/libburnia/libburn/DriveStatus.java new file mode 100644 index 0000000..614c6ed --- /dev/null +++ b/java/src/java/org/pykix/libburnia/libburn/DriveStatus.java @@ -0,0 +1,63 @@ +/* + * DriveStatus.java + * + * Copyright (c) 2007 Vreixo Formoso + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * See COPYING file for details. + */ + +package org.pykix.libburnia.libburn; + +/** + * Possible busy states for a drive. + * + * @author Vreixo Formoso + * @since 0.1 + */ +public enum DriveStatus { + + /** The drive is not in an operation. */ + IDLE, + + /** + * The library is spawning the processes to handle a pending + * operation (A read/write/etc is about to start but hasn't quite + * yet). + */ + SPAWNING, + + /** The drive is reading data from a disc. */ + READING, + + /** The drive is writing data to a disc. */ + WRITING, + + /** The drive is writing Lead-In. */ + WRITING_LEADIN, + + /** The drive is writing Lead-Out. */ + WRITING_LEADOUT, + + /** The drive is erasing a disc. */ + ERASING, + + /** The drive is being grabbed. */ + GRABBING, + + /** The drive gets written zeroes before the track payload data. */ + WRITING_PREGAP, + + /** The drive is told to close a track (TAO only). */ + CLOSING_TRACK, + + /** The drive is told to close a session (TAO only). */ + CLOSING_SESSION, + + /** The drive is formatting media. */ + FORMATTING + +} diff --git a/java/src/java/org/pykix/libburnia/libburn/FormatDesc.java b/java/src/java/org/pykix/libburnia/libburn/FormatDesc.java new file mode 100644 index 0000000..bb42323 --- /dev/null +++ b/java/src/java/org/pykix/libburnia/libburn/FormatDesc.java @@ -0,0 +1,58 @@ +/* + * FormatDesc.java + * + * Copyright (c) 2007 Vreixo Formoso + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * See COPYING file for details. + */ + +package org.pykix.libburnia.libburn; + +/** + * + * @author Vreixo Formoso + * @since 0.1 + */ +public class FormatDesc { + + private int type; + private long size; + private int tdp; + + /* to be called from JNI code */ + FormatDesc(int type, long size, int tdp) { + super(); + this.type = type; + this.size = size; + this.tdp = tdp; + } + + /** + * The maximum size in bytes achievable with this format. + */ + public long getSize() { + return size; + } + + /** + * Type Dependent Parameter. See mmc5r03c.pdf. + */ + public int getTdp() { + return tdp; + } + + /** + * The format type. See mmc5r03c.pdf, 6.5, 04h FORMAT UNIT. + * 0x00=full, 0x10=CD-RW/DVD-RW full, 0x11=CD-RW/DVD-RW grow, + * 0x15=DVD-RW quick, 0x13=DVD-RW quick grow, + * 0x26=DVD+RW background + */ + public int getType() { + return type; + } + +} diff --git a/java/src/java/org/pykix/libburnia/libburn/FormatStatus.java b/java/src/java/org/pykix/libburnia/libburn/FormatStatus.java new file mode 100644 index 0000000..22a2047 --- /dev/null +++ b/java/src/java/org/pykix/libburnia/libburn/FormatStatus.java @@ -0,0 +1,28 @@ +/* + * FormatStatus.java + * + * Copyright (c) 2007 Vreixo Formoso + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * See COPYING file for details. + */ + +package org.pykix.libburnia.libburn; + +/** + * Possible formatting status values. + * + * @author Vreixo Formoso + * @since 0.1 + */ +public enum FormatStatus { + + /* C defines begins with 1, add +1 to ordinal() */ + UNFORMATTED, + FORMATTED, + UNKNOWN; + +} diff --git a/java/src/java/org/pykix/libburnia/libburn/Formats.java b/java/src/java/org/pykix/libburnia/libburn/Formats.java new file mode 100644 index 0000000..7faa67d --- /dev/null +++ b/java/src/java/org/pykix/libburnia/libburn/Formats.java @@ -0,0 +1,83 @@ +/* + * Formats.java + * + * Copyright (c) 2007 Vreixo Formoso + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * See COPYING file for details. + */ + +package org.pykix.libburnia.libburn; + +/** + * + * @author Vreixo Formoso + * @since 0.1 + */ +/* + * TODO I really don't like this way of wrapping the burn_disc_get_formats + * return value, maybe an internal class of Burn would be a better idea. + */ +public class Formats { + + private FormatStatus status; + private long size; + private int blSas; + private int numFormats; + + /* to be called from JNI code */ + Formats(int status, long size, int blSas, int numFormats) { + super(); + this.status = FormatStatus.values()[status-1]; + this.size = size; + this.blSas = blSas; + this.numFormats = numFormats; + } + + /** + * Additional info "Block Length/Spare Area Size". + * Expected to be constantly 2048 for non-BD media. + * + * @return + */ + public int getBlSas() { + return blSas; + } + + /** + * The number of available formats. To be used with + * burn_disc_get_format_descr() to obtain such a format + * and eventually with burn_disc_format() to select one. + * + * @return + */ + public int getNumFormats() { + return numFormats; + } + + /** + * The size in bytes associated with status. + * unformatted: the maximum achievable size of the media + * formatted: the currently formatted capacity + * unknown: maximum capacity of drive or of media + * @return + */ + public long getSize() { + return size; + } + + /** + * The current formatting status of the inserted media. + * + * @return + * The format status. Note: {@link FormatStatus#UNKNOWN} is the + * legal status for quick formatted, yet unwritten DVD-RW. + */ + public FormatStatus getStatus() { + return status; + } + +} diff --git a/java/src/java/org/pykix/libburnia/libburn/Message.java b/java/src/java/org/pykix/libburnia/libburn/Message.java new file mode 100644 index 0000000..1afbbe4 --- /dev/null +++ b/java/src/java/org/pykix/libburnia/libburn/Message.java @@ -0,0 +1,128 @@ +/* + * Message.java + * + * Copyright (c) 2007 Vreixo Formoso + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * See COPYING file for details. + */ + +package org.pykix.libburnia.libburn; + +/** + * Message from libburn. + * + *

+ * Only fatal messages are printed to stderr by default. This class allows you + * to change that behavior. + * + *

+ * Indeed, you can also select message queuing, which allows you to retrieve + * the messages. TODO + * + * @author Vreixo Formoso + * @since 0.1 + */ +public class Message { + + /** */ + public enum Severity { + NEVER, FATAL, SORRY, WARNING, HINT, NOTE, UPDATE, DEBUG, ALL + } + + private int errorCode; + private String msgText; + private int osErrno; + private Severity severity; + + /* it's to be called from JNI code */ + Message(int errorCode, String msgText, int osErrno, String severity) { + super(); + this.errorCode = errorCode; + this.msgText = msgText; + this.osErrno = osErrno; + this.severity = Severity.valueOf(severity); + } + + /** + * Get the a unique error code as listed in libburn/libdax_msgs.h + * + * TODO i need to get the errcodes and list it here, maybe as a enum, + * maybe as integer constants!! + */ + public int getErrorCode() { + return errorCode; + } + + /** + * Get a text describing the message + */ + public String getMsgText() { + return msgText; + } + + /** + * Get the eventual errno related to the message. + */ + public int getOsErrno() { + return osErrno; + } + + /** + * Severity related to the message. + */ + public Severity getSeverity() { + return severity; + } + + /** + * Control queueing and stderr printing of messages from libburn. + * + * @param queueSeverity + * Gives the minimum limit for messages to be queued. + * Default: {@link Severity#NEVER}. If you queue messages then you + * must consume them by burn_msgs_obtain(). + * @param printSeverity + * Does the same for messages to be printed directly + * to stderr. Default: {@link Severity#FATAL}. + * @param printId + * A text prefix to be printed before the message. + * @return + * true for success, false for error. + */ + public static boolean setSeverities(Severity queueSeverity, + Severity printSeverity, String printId) { + + return ( burn_msgs_set_severities(queueSeverity.name(), + printSeverity.name(), printId) > 0); + } + + /** + * Obtain the oldest pending libburn message from the queue which has at + * least the given minSeverity. This message and any older message of + * lower severity will get discarded from the queue and is then lost + * forever. + * + * @param minSeverity + * The minimum severity that a message must have to be retrieved. + * To call with minSeverity {@link Severity#NEVER} will discard the + * whole queue. + * @return + * The oldest pending message or null if a message + * with given or higher priority wasn't found. + */ + /* + * TODO this implementation forgets the error that C function can throw!! + */ + public static Message obtain(Severity minSeverity) { + return burn_msgs_obtain( minSeverity.name() ); + } + + private static native int burn_msgs_set_severities(String queueSeverity, + String printSeverity, String printId); + + private static native Message burn_msgs_obtain(String minSeverity); +} diff --git a/java/src/java/org/pykix/libburnia/libburn/Msf.java b/java/src/java/org/pykix/libburnia/libburn/Msf.java new file mode 100644 index 0000000..3e6a21f --- /dev/null +++ b/java/src/java/org/pykix/libburnia/libburn/Msf.java @@ -0,0 +1,140 @@ +/* + * Msf.java + * + * Copyright (c) 2007 Vreixo Formoso + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * See COPYING file for details. + */ + +package org.pykix.libburnia.libburn; + +/** + * Represent a minute-second-frame (MSF) address. + * + * @author Vreixo Formoso + * @since 0.1 + */ +/* + * Due its simplicity, the functions here are implemented in pure Java, + * without really wrapping underlying libburn C functions. + */ +public class Msf { + + /* + * I make this vars public, maybe a get/set would be a better option. + */ + + /** Minute component. */ + public int m; + + /** Second component. */ + public int s; + + /** Frame component. */ + public int f; + + public Msf(int m, int s, int f) { + super(); + this.m = m; + this.s = s; + this.f = f; + } + + /** + * Get the sector count for this MSF. + */ + public int getSectors() { + return msf2Sectors(m, s, f); + } + + /** + * Get the lba for this MSF. + */ + public int getLba() { + return msf2Lba(m, s, f); + } + + /** + * Convert a minute-second-frame (MSF) value to sector count. + * + * @param m + * Minute component. + * @param s + * Second component. + * @param f + * Frame component. + * @return + * The sector count. + */ + public static int msf2Sectors(int m, int s, int f) { + return (m * 60 + s) * 75 + f; + } + + /** + * Convert a sector count to minute-second-frame (MSF). + * + * @param sectors + * The sector count. + * @return + * The MSF. + */ + public static Msf sectors2Msf(int sectors) { + + int m = sectors / (60 * 75); + int s = (sectors - m * 60 * 75) / 75; + int f = sectors - m * 60 * 75 - s * 75; + + return new Msf(m, s, f); + } + + /** + * Convert a minute-second-frame (MSF) value to a lba. + * + * @param m + * Minute component. + * @param s + * Second component. + * @param f + * Frame component. + * @return + * The lba. + */ + public static int msf2Lba(int m, int s, int f) { + if (m < 90) + return (m * 60 + s) * 75 + f - 150; + else + return (m * 60 + s) * 75 + f - 450150; + } + + /** + * Convert an lba to minute-second-frame (MSF). + * + * @param lba + * The lba. + * @return + * The MSF. + */ + public static Msf lba2Msf(int lba) { + + int m, s, f; + + if (lba >= -150) { + m = (lba + 150) / (60 * 75); + s = (lba + 150 - m * 60 * 75) / 75; + f = lba + 150 - m * 60 * 75 - s * 75; + } else { + m = (lba + 450150) / (60 * 75); + s = (lba + 450150 - m * 60 * 75) / 75; + f = lba + 450150 - m * 60 * 75 - s * 75; + } + + return new Msf(m, s, f); + } + + + +} diff --git a/java/src/java/org/pykix/libburnia/libburn/MultiCaps.java b/java/src/java/org/pykix/libburnia/libburn/MultiCaps.java new file mode 100644 index 0000000..45ea777 --- /dev/null +++ b/java/src/java/org/pykix/libburnia/libburn/MultiCaps.java @@ -0,0 +1,243 @@ +/* + * MultiCaps.java + * + * Copyright (c) 2007 Vreixo Formoso + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * See COPYING file for details. + */ + +package org.pykix.libburnia.libburn; + +/** + * + * @author Vreixo Formoso + * @since 0.1 + */ +public class MultiCaps { + + private boolean multiSession; + private boolean multiTrack; + private boolean startAdr; + private long startAlignment; + private long startRangeLow; + private long startRangeHigh; + private int mightDoTao; + private int mightDoSao; + private int mightDoRaw; + private WriteType advisedWriteMode; + private WriteType selectedWriteMode; + private Profile currentProfile; + private boolean cdProfile; + + /* + * this is not part of C burn_multi_caps struct, but is returned + * in burn_disc_get_multi_caps function + */ + private boolean writingPossible; + + /* be to called from JNI code */ + MultiCaps(boolean multiSession, boolean multiTrack, boolean startAdr, + long startAlignment, long startRangeLow, long startRangeHigh, + int mightDoTao, int mightDoSao, int mightDoRaw, + int advisedWriteMode, int selectedWriteMode, short currentProfile, + boolean cdProfile, boolean writingPossible) { + + super(); + this.multiSession = multiSession; + this.multiTrack = multiTrack; + this.startAdr = startAdr; + this.startAlignment = startAlignment; + this.startRangeLow = startRangeLow; + this.startRangeHigh = startRangeHigh; + this.mightDoTao = mightDoTao; + this.mightDoSao = mightDoSao; + this.mightDoRaw = mightDoRaw; + this.advisedWriteMode = WriteType.values()[advisedWriteMode]; + this.selectedWriteMode = WriteType.values()[selectedWriteMode]; + this.currentProfile = Profile.get(currentProfile); + this.cdProfile = cdProfile; + this.writingPossible = writingPossible; + } + + /** + * Get generally advised write mode. + * + *

+ * Not necessarily the one chosen by + * {@link WriteOpts#setAutoWriteType(Disc, int)} + * because the {@link Disc} object might impose particular demands. + */ + public WriteType getAdvisedWriteMode() { + return advisedWriteMode; + } + + /** + * Wether the current profile indicates CD media. + * + * @return + * true = yes, false = no + */ + public boolean isCdProfile() { + return cdProfile; + } + + /** + * Profile which was current when the reply was generated. + */ + public Profile getCurrentProfile() { + return currentProfile; + } + + /** + * Potential availability of RAW write mode. + * + *

+ * With CD media (profiles 0x09 and 0x0a) check also the element + * {@link DriveInfo#getRawBlockTypes()}. + * + * @return + *

    + *
  • 4= needs no size prediction, not to be chosen automatically + *
  • 3= needs size prediction, not to be chosen automatically + *
  • 2= available, no size prediction necessary + *
  • 1= available, needs exact size prediction + *
  • 0= not available + *
+ */ + public int getMightDoRaw() { + return mightDoRaw; + } + + /** + * Potential availability of SAO write mode. + * + *

+ * With CD media (profiles 0x09 and 0x0a) check also the element + * {@link DriveInfo#getSaoBlockTypes()}. + * + * @return + *

    + *
  • 4= needs no size prediction, not to be chosen automatically + *
  • 3= needs size prediction, not to be chosen automatically + *
  • 2= available, no size prediction necessary + *
  • 1= available, needs exact size prediction + *
  • 0= not available + *
+ */ + public int getMightDoSao() { + return mightDoSao; + } + + /** + * Potential availability of TAO write mode. + * + *

+ * With CD media (profiles 0x09 and 0x0a) check also the element + * {@link DriveInfo#getTaoBlockTypes()}. + * + * @return + *

    + *
  • 4= needs no size prediction, not to be chosen automatically + *
  • 3= needs size prediction, not to be chosen automatically + *
  • 2= available, no size prediction necessary + *
  • 1= available, needs exact size prediction + *
  • 0= not available + *
+ */ + public int getMightDoTao() { + return mightDoTao; + } + + /** + * Multi-session capability allows to keep the media appendable after + * writing a session. It also guarantees that the drive will be able + * to predict and use the appropriate Next Writeable Address to place + * the next session on the media without overwriting the existing ones. + * + *

+ * It does not guarantee that the selected write type is able to do + * an appending session after the next session. (E.g. CD SAO is capable + * of multi-session by keeping a disc appendable. But {@link #getMightDoSao()} + * will be 0 afterwards, when checking the appendable media.) + * + * @return + * true= media may be kept appendable by + * {@link WriteOpts#setMulti(boolean)} with true as + * parameter. + * false= media will not be appendable + */ + public boolean isMultiSession() { + return multiSession; + } + + /** + * Multi-track capability allows to write more than one track source + * during a single session. The written tracks can later be found in + * libburn's TOC model with their start addresses and sizes. + * + * @return + * if true, multiple tracks per session are allowed, + * else, only one track per session allowed + */ + public boolean isMultiTrack() { + return multiTrack; + } + + /** + * Write mode as given by parameter wt of burn_disc_get_multi_caps(). + */ + public WriteType getSelectedWriteMode() { + return selectedWriteMode; + } + + /** + * Start-address capability allows to set a non-zero address with + * {@link WriteOpts#setStartByte(long)}. Eventually this has to respect + * {@link #getStartAlignment()} and {@link #getStartRangeRow()}, + * {@link #getStartRangeHigh()} in this structure. + * + * @return + * if true, non-zero start address is allowed, otherwise + * only start address 0 is allowed (to depict the drive's own idea + * about the appropriate write start) + */ + public boolean isStartAdr() { + return startAdr; + } + + /** + * The alignment for start addresses. + * ( start_address % start_alignment ) must be 0. + */ + public long getStartAlignment() { + return startAlignment; + } + + /** + * The highest addressable start address. + */ + public long getStartRangeHigh() { + return startRangeHigh; + } + + /** + * The lowest permissible start address. + */ + public long getStartRangeLow() { + return startRangeLow; + } + + /** + * @return + * If false, writing seems impossible , else writing + * is possible + */ + public boolean isWritingPossible() { + return writingPossible; + } + +} diff --git a/java/src/java/org/pykix/libburnia/libburn/Profile.java b/java/src/java/org/pykix/libburnia/libburn/Profile.java new file mode 100644 index 0000000..a6d5405 --- /dev/null +++ b/java/src/java/org/pykix/libburnia/libburn/Profile.java @@ -0,0 +1,91 @@ +/* + * Profile.java + * + * Copyright (c) 2007 Vreixo Formoso + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * See COPYING file for details. + */ + +package org.pykix.libburnia.libburn; + +import java.util.EnumSet; + +/** + * MMC profile of the loaded media. + * + * @author Vreixo Formoso + * @since 0.1 + */ +public enum Profile { + + NONE((short)0, "No profile"), + NON_REMOVABLE_DISC((short)0x01, "Non-removable disc"), + REMOVABLE_DISC((short)0x02, "Removable disc"), + MO_ERASABLE((short)0x03, "MO Erasable"), + OPTICAL_WRITE_ONCE((short)0x04, "Optical Write Once"), + AS_MO((short)0x05, "AS-MO"), + CD_ROM((short)0x08, "CD-ROM"), + CD_R((short)0x09, "CD-R"), + CD_RW((short)0x0A, "CD-RW"), + DVD_ROM((short)0x10, "DVD-ROM"), + DVD_R_SEQUENCIAL((short)0x11, "DVD-R Sequential Recording"), + DVD_RAM((short)0x12, "DVD-RAM"), + DVD_RW_RESTRICTED_OVERWITE((short)0x13, "DVD-RW Restricted Overwrite"), + DVD_RW_SEQUENCIAL((short)0x14, "DVD-RW Sequential recording"), + DVD_R_DL_SEQUENCIAL((short)0x15, "DVD-R Dual Layer Sequential Recording"), + DVD_R_DL_JUMP((short)0x16, "DVD-R Dual Layer Jump Recording"), + DVD_PLUS_RW((short)0x1A, "DVD+RW"), + DVD_PLUS_R((short)0x1B, "DVD+R"), + DVD_PLUS_RW_DL((short)0x2A, "DVD+RW Dual Layer"), + DVD_PLUS_R_DL((short)0x2B, "DVD+R Dual Layer"), + BD_ROM((short)0x40, "BD-ROM"), + BD_R_SRM((short)0x41, "BD-R SRM"), + BD_R_RRM((short)0x42, "BD-R RRM"), + HD_DVD_ROM((short)0x50, "HD DVD-ROM"), + HD_DVD_R((short)0x51, "HD DVD-R"), + HD_DVD_RAM((short)0x52, "HD DVD-RAM"), + UNKNOWN((short)0xFFFF, "Unknown Profile"); + + private final short code; + private final String name; + + private Profile(final short code, final String name) { + this.code = code; + this.name = name; + } + + /** + * Get the Profile Number as of mmc5r03c.pdf, table 89. + * + * @return + * The profile number. + */ + public short getCode() { + return code; + } + + /** + * Get the Profile Name (e.g "CD-RW"). + * + * @return + * the profile name + */ + public String getName() { + return name; + } + + static Profile get(short code) { + EnumSet set = EnumSet.allOf(Profile.class); + for ( Profile prof : set ) { + if ( prof.getCode() == code) { + return prof; + } + } + return UNKNOWN; + } + +} diff --git a/java/src/java/org/pykix/libburnia/libburn/Progress.java b/java/src/java/org/pykix/libburnia/libburn/Progress.java new file mode 100644 index 0000000..2a0f5ff --- /dev/null +++ b/java/src/java/org/pykix/libburnia/libburn/Progress.java @@ -0,0 +1,164 @@ +/* + * Progress.java + * + * Copyright (c) 2007 Vreixo Formoso + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * See COPYING file for details. + */ + +package org.pykix.libburnia.libburn; + +import org.pykix.libburnia.bindings.Proxy; + +/** + * Operation progress report. All values are 0 based indices. + * + * @author Vreixo Formoso + * @since 0.1 + */ +/* + * I've implemented this as a proxy, because I think is a good option given + * the normal usage of this object. The 3 considered options are: + * - One option is implement this as a pure Java option, created in JNI + * with a copy of the C struct and returned back to Java. This involves + * creation of a object each time the progress is retrieved, so it's not + * a good option. + * - Implement this as a proxy. C code can pass directly the proxied C struct + * so is a fast operation. The problem is that consult of Progress values + * involves a JNI call. + * - Another option, maybe better, is treat this as a Java option whose fields + * are updated from JNI code. + * For now, the proxy options seems a good enought approach. + */ +public class Progress extends Proxy { + + /** + * Create a new Progress object. + * + *

+ * This can be used with {@link Drive#getDriveStatus(Progress)} to + * get the progress of a burn operation. + */ + public Progress() { + super( burn_progress_new() ); + } + + /** Get the total number of sessions. */ + public int getSessions() { + return burn_progress_sessions( pointerOf(this) ); + } + + /** Get current session. */ + public int getSession() { + return burn_progress_session( pointerOf(this) ); + } + + /** Get the total number of tracks. */ + public int getTracks() { + return burn_progress_tracks( pointerOf(this) ); + } + + /** Get current track. */ + public int getTrack() { + return burn_progress_track( pointerOf(this) ); + } + + /** Get the total number of indices. */ + public int getIndices() { + return burn_progress_indices( pointerOf(this) ); + } + + /** Get current index. */ + public int getIndex() { + return burn_progress_index( pointerOf(this) ); + } + + /** Get the starting logical block address. */ + public int getStartSector() { + return burn_progress_start_sector( pointerOf(this) ); + } + + /** + * On write: The number of sectors. + * On blank: 0x10000 as upper limit for relative progress steps. + */ + public int getSectors() { + return burn_progress_sectors( pointerOf(this) ); + } + + /** + * On write: The current sector being processed. + * On blank: Relative progress steps 0 to 0x10000. + */ + public int getSector() { + return burn_progress_sector( pointerOf(this) ); + } + + /** + * Get the capacity of the drive buffer. + */ + public int getBufferCapacity() { + return burn_progress_buffer_capacity( pointerOf(this) ); + } + + /** + * Get the free space in the drive buffer (might be slightly outdated). + */ + public int getBufferAvailable() { + return burn_progress_buffer_available( pointerOf(this) ); + } + + /** Get the number of bytes sent to the drive buffer. */ + public long getBufferedBytes() { + return burn_progress_buffered_bytes( pointerOf(this) ); + } + + /** + * The minimum number of buffered bytes. (Caution: Before surely + * one buffer size of bytes was processed, this value is -1.) + */ + public int getBufferMinFill() { + return burn_progress_buffer_min_fill( pointerOf(this) ); + } + + @Override + protected void finalize() throws Throwable { + super.finalize(); + burn_progress_free( pointerOf(this) ); + } + + private static native long burn_progress_new(); + + private static native void burn_progress_free(long p); + + private static native int burn_progress_sessions(long p); + + private static native int burn_progress_session(long p); + + private static native int burn_progress_tracks(long p); + + private static native int burn_progress_track(long p); + + private static native int burn_progress_indices(long p); + + private static native int burn_progress_index(long p); + + private static native int burn_progress_start_sector(long p); + + private static native int burn_progress_sectors(long p); + + private static native int burn_progress_sector(long p); + + private static native int burn_progress_buffer_capacity(long p); + + private static native int burn_progress_buffer_available(long p); + + private static native long burn_progress_buffered_bytes(long p); + + private static native int burn_progress_buffer_min_fill(long p); + +} diff --git a/java/src/java/org/pykix/libburnia/libburn/ReadOpts.java b/java/src/java/org/pykix/libburnia/libburn/ReadOpts.java new file mode 100644 index 0000000..ed7b3a7 --- /dev/null +++ b/java/src/java/org/pykix/libburnia/libburn/ReadOpts.java @@ -0,0 +1,141 @@ +/* + * ReadOpts.java + * + * Copyright (c) 2007 Vreixo Formoso + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * See COPYING file for details. + */ + +package org.pykix.libburnia.libburn; + +import org.pykix.libburnia.bindings.Proxy; + +/** + * + * @author Vreixo Formoso + * @since 0.1 + */ +public class ReadOpts extends Proxy { + + ReadOpts(long ptr) { + super(ptr); + } + + /** + * Sets whether to read in raw mode or not. + * + * @param rawMode + * If true, reading will be done in raw mode, so that + * everything in the data tracks on the disc is read, including + * headers. + */ + public void setRaw(boolean rawMode) { + burn_read_opts_set_raw(pointerOf(this), rawMode); + } + + /** + * Sets whether to report c2 errors or not. + * + * @param c2errors + * If true, report c2 errors. + */ + public void setC2errors(boolean c2errors) { + burn_read_opts_set_c2errors(pointerOf(this), c2errors); + } + + /** + * Sets whether to read subcodes from audio tracks or not. + * + * @param subcodesAudio + * If true, read subcodes from audio tracks on the disc. + */ + public void readSubcodesAudio(boolean subcodesAudio) { + burn_read_opts_read_subcodes_audio(pointerOf(this), subcodesAudio); + } + + /** + * Sets whether to read subcodes from data tracks or not. + * + * @param subcodesData + * If true, read subcodes from data tracks on the disc. + */ + public void readSubcodesData(boolean subcodesData) { + burn_read_opts_read_subcodes_data(pointerOf(this), subcodesData); + } + + /** + * Sets whether to recover errors if possible. + * + * @param her + * If true, attempt to recover errors if possible. + */ + public void setHardwareErrorRecovery(boolean her) { + burn_read_opts_set_hardware_error_recovery(pointerOf(this), her); + } + + /** + * Sets whether to report recovered errors or not. + * + * @param rre + * If true, recovered errors will be reported. + */ + public void reportRecoveredErrors(boolean rre) { + burn_read_opts_report_recovered_errors(pointerOf(this), rre); + } + + /** + * Sets whether blocks with unrecoverable errors should be read or not. + * + * @param tdb + * If true, blocks with unrecoverable errors will still + * be read. + */ + public void transferDamagedBlocks(boolean tdb) { + burn_read_opts_transfer_damaged_blocks(pointerOf(this), tdb); + } + + /** + * Sets the number of retries to attempt when trying to correct an error. + * + * @param r + * The number of retries to attempt when correcting an error. + */ + public void setHardwareErrorRetries(int r) { + burn_read_opts_set_hardware_error_retries(pointerOf(this), r); + } + + @Override + protected void finalize() throws Throwable { + super.finalize(); + burn_read_opts_free( pointerOf(this) ); + } + + private static native void burn_read_opts_free(long opts); + + private static native void burn_read_opts_set_raw(long opts, boolean raw); + + private static native void burn_read_opts_set_c2errors(long opts, + boolean c2errors); + + private static native void burn_read_opts_read_subcodes_audio(long opts, + boolean subcodesAudio); + + private static native void burn_read_opts_read_subcodes_data(long opts, + boolean subcodesData); + + private static native void burn_read_opts_set_hardware_error_recovery( + long opts, boolean hardware_error_recovery); + + private static native void burn_read_opts_report_recovered_errors( + long opts, boolean report_recovered_errors); + + private static native void burn_read_opts_transfer_damaged_blocks( + long opts, boolean transfer_damaged_blocks); + + private static native void burn_read_opts_set_hardware_error_retries( + long opts, int hardware_error_retries); +} diff --git a/java/src/java/org/pykix/libburnia/libburn/ScsiAdr.java b/java/src/java/org/pykix/libburnia/libburn/ScsiAdr.java new file mode 100644 index 0000000..1088ba0 --- /dev/null +++ b/java/src/java/org/pykix/libburnia/libburn/ScsiAdr.java @@ -0,0 +1,106 @@ +/* + * ScsiAdr.java + * + * Copyright (c) 2007 Vreixo Formoso + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * See COPYING file for details. + */ + +package org.pykix.libburnia.libburn; + +/** + * SCSI address. + * + * @author Vreixo Formoso + * @since 0.1 + */ +public class ScsiAdr { + + /** "Bus Number" (something like a virtual controller) */ + public int busNo; + + /** "Host Number" (something like half a virtual controller) */ + public int hostNo; + + /** "Channel Number" (other half of "Host Number"). */ + public int channelNo; + + /** "Target Number" or "SCSI Id" (a device). */ + public int targetNo; + + /** "Logical Unit Number" (a sub device). */ + public int lunNo; + + /** + * Creates a new SCSI address. + * + * Note: bus and (host,channel) are supposed to be redundant. + * + * @param busNo + * @param hostNo + * @param channelNo + * @param targetNo + * @param lunNo + */ + public ScsiAdr(int busNo, int hostNo, int channelNo, int targetNo, + int lunNo) { + super(); + this.busNo = busNo; + this.hostNo = hostNo; + this.channelNo = channelNo; + this.targetNo = targetNo; + this.lunNo = lunNo; + } + + /** + * Try to convert a given SCSI address of bus,host,channel,target,lun into + * a persistent drive address. If a SCSI address component parameter is < 0 + * then it is not decisive and the first enumerated address which matches + * the >= 0 parameters is taken as result. + * + * @param adr + * SCSI adr to conver + * @return + * The persistent drive address + * @throws BurnException + * On error. + */ + public static String converScsiAdr(ScsiAdr adr) throws BurnException { + return burn_drive_convert_scsi_adr(adr.busNo, adr.hostNo, adr.channelNo, + adr.targetNo, adr.lunNo); + } + + /** + * Try to obtain bus,host,channel,target,lun from path. If there is an SCSI + * address at all, then this call should succeed with a persistent + * drive address obtained via {@link DriveInfo#getAdr()}. It is also supposed + * to succeed with any device file of a (possibly emulated) SCSI device. + * + * @param path + * + * @return + * @throws BurnException + * On error + */ + public static ScsiAdr obtainScsiAdr(String path) throws BurnException { + return burn_drive_obtain_scsi_adr(path); + } + + @Override + public String toString() { + return "busNo=" + busNo + ", hostNo=" + hostNo + ", channelNo=" + + channelNo + ", targetNo=" + targetNo + " ,lunNo=" + lunNo; + } + + private native static String burn_drive_convert_scsi_adr(int bus_no, + int host_no, int channel_no, int target_no, int lun_no) + throws BurnException; + + private native static ScsiAdr burn_drive_obtain_scsi_adr(String path) + throws BurnException; + +} diff --git a/java/src/java/org/pykix/libburnia/libburn/Session.java b/java/src/java/org/pykix/libburnia/libburn/Session.java new file mode 100644 index 0000000..822c552 --- /dev/null +++ b/java/src/java/org/pykix/libburnia/libburn/Session.java @@ -0,0 +1,182 @@ +/* + * Session.java + * + * Copyright (c) 2007 Vreixo Formoso + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * See COPYING file for details. + */ + +package org.pykix.libburnia.libburn; + +import org.pykix.libburnia.bindings.Proxy; + +/** + * References a single session on a disc. + * + * @author Vreixo Formoso + * @since 0.1 + */ +public class Session extends Proxy { + + public static final int POS_END = 100; + + /** wether is needed to free or not the session when no more needed */ + private boolean free; + + /** + * Create a new session. + */ + public Session() { + super( burn_session_create() ); + free = true; + } + + /* package protected */ + Session(long ptr) { + super(ptr); + free = false; + } + + /** + * Add a track to session at specified position. + * + * @param track + * Track to insert in session. + * @param pos + * position to add at ({@link #POS_END} is "at the end") + * @return + * true if success, false if track can't + * be added. + */ + public boolean addTrack(Track track, int pos) { + + if ( pos > POS_END ) { + return false; + } + + return burn_session_add_track( pointerOf(this), pointerOf(track), pos); + } + + /** + * Remove a track from this session. + * + * @param track + * Track to find and remove. + * @return + * true if success, false for failure, + * for example if track was not previously added to this session. + */ + public boolean removeTrack(Track track) { + return burn_session_remove_track( pointerOf(this), pointerOf(track) ); + } + + /** + * Hide the first track in the "pre gap" of the disc. + * + * @param onoff + * true to enable hiding, false to disable. + */ + public void hideFirstTrack(boolean onoff) { + burn_session_hide_first_track( pointerOf(this), onoff ? 1 : 0 ); + } + + /** + * Tells how long the session will be on disc. + * + * @return + * Number of sectors the session will need. + */ + public int getSectors() { + return burn_session_get_sectors( pointerOf(this) ); + } + + /** + * Gets a copy of the {@link TocEntry} structure associated with the + * session's lead out. + * + * @return + * A {@link TocEntry} object. + */ + public TocEntry getLeadoutEntry() { + return burn_session_get_leadout_entry( pointerOf(this) ); + } + + /** + * Gets an array of all the tracks for a session. + * + *

+ * THIS IS NO LONGER VALID AFTER YOU ADD OR REMOVE A TRACK + * + * FIXME when a track is removed, its C struct can be deleted, thus + * the java object is no longer valid. If we still have a reference + * for the track originally created, the C struct is not deleted because + * we have a reference to it. For now, this behavior is not so bad... + * + * @return + * An array with all the tracks. + */ + public Track[] getTracks() { + + long[] tracksPtrs = burn_session_get_tracks( pointerOf(this) ); + + Track[] tracks = new Track[tracksPtrs.length]; + + for ( int i = 0; i < tracksPtrs.length; ++i ) { + + long ptr = tracksPtrs[i]; + + Track track = (Track) proxyFor(ptr); + if (track == null) { + track = new Track(ptr); + } + tracks[i] = track; + } + + return tracks; + } + + /** + * Returns whether the first track of a session is hidden in the pregap. + * + * @return + * true if the first track is hidden, false + * otherwise + */ + public boolean isHideFirstTrack() { + return burn_session_get_hidefirst( pointerOf(this) ); + } + + @Override + protected void finalize() throws Throwable { + super.finalize(); + + if ( free ) { + burn_session_free( pointerOf(this) ); + } + } + + private static native long burn_session_create(); + + private static native void burn_session_free(long s); + + private static native boolean burn_session_add_track(long s, long t, + int pos); + + private static native boolean burn_session_remove_track(long s, long t); + + private static native void burn_session_hide_first_track(long s, + int onoff); + + private static native int burn_session_get_sectors(long s); + + private static native TocEntry burn_session_get_leadout_entry(long s); + + private static native long[] burn_session_get_tracks(long s); + + private static native boolean burn_session_get_hidefirst(long session); + +} diff --git a/java/src/java/org/pykix/libburnia/libburn/SessionFormat.java b/java/src/java/org/pykix/libburnia/libburn/SessionFormat.java new file mode 100644 index 0000000..c9bebc7 --- /dev/null +++ b/java/src/java/org/pykix/libburnia/libburn/SessionFormat.java @@ -0,0 +1,35 @@ +/* + * SessionFormat.java + * + * Copyright (c) 2007 Vreixo Formoso + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * See COPYING file for details. + */ + +package org.pykix.libburnia.libburn; + +/** + * + * @author Vreixo Formoso + * @since 0.1 + */ +public enum SessionFormat { + + /** Session format for normal audio or data discs */ + CDROM(0), + + /** Session format for obsolete CD-I discs */ + CDI(0x10), + + /** Session format for CDROM-XA discs */ + CDXA(0x20); + + int code; + private SessionFormat(int code) { + this.code = code; + } +} diff --git a/java/src/java/org/pykix/libburnia/libburn/Source.java b/java/src/java/org/pykix/libburnia/libburn/Source.java new file mode 100644 index 0000000..d1509de --- /dev/null +++ b/java/src/java/org/pykix/libburnia/libburn/Source.java @@ -0,0 +1,166 @@ +/* + * Source.java + * + * Copyright (c) 2007 Vreixo Formoso + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * See COPYING file for details. + */ + +package org.pykix.libburnia.libburn; + +import java.util.EnumSet; + +import org.pykix.libburnia.bindings.Proxy; +import org.pykix.libburnia.libisofs.Ecma119ExtensionFlag; +import org.pykix.libburnia.libisofs.IsoVolSet; + +/** + * + * FIXME move here the newECma119 source + * FIXME create java.io.File versions. + * + * @author Vreixo Formoso + * @since 0.1 + */ +public final class Source extends Proxy implements BurnSource { + + /** + * Creates a data source for an image file (and maybe subcode file). + * + * @param path + * Path for the image file. + * @param subpath + * Path for the subcode file, or null. + */ + public Source(String path, String subpath) { + super( burn_file_source_new(path, subpath) ); + } + + /** + * Creates a data source for an image file (a track) from an open + * readable file descriptor, an eventually open readable subcodes file + * descriptor and eventually a fixed size in bytes. + * + *

+ * You must take care that Unix file descriptor used by this constructor + * are not used by Java standard classes, so you must use your own + * functions/libraries to get these fds. + * + * @param datafd + * The source of data. + * @param subfd + * The eventual source for subcodes. Not used if -1. + * @param size + * The eventual fixed size of eventually both fds. + * If this value is 0, the size will be determined from datafd. + */ + public Source(int datafd, int subfd, long size) { + super( burn_fd_source_new(datafd, subfd, size) ); + } + + /** + * Creates a data source from a ISO Volume Set. + * + * TODO. The volume set used to create the libburn_source can _not_ be + * modified until the libburn_source is freed. This is difficul to implement + * in Java, because user can't know when a object is actually freed, so + * for now IsoVolSet should not be modified anyway after call this. + * + * @param volset + * The volume set to use as source. + * @param volnum + * The volume in the set which you want to write (usually 0) + * @param level + * ISO level to write at. + * @param flags + * Which extensions to support. + */ + public Source(IsoVolSet volset, int volnum, int level, + EnumSet flags) { + + super( newEcma119Source(volset, volnum, level, flags) ); + } + + /** + * {@inheritDoc} + */ + public int read(byte[] buffer, int size) { + + if ( buffer.length < size ) { + throw new IndexOutOfBoundsException("size bigger than buffer length"); + } + + return read( pointerOf(this), buffer, size); + } + + /** + * {@inheritDoc} + */ + public int readSub(byte[] buffer, int size) { + + if ( buffer.length < size ) { + throw new IndexOutOfBoundsException("size bigger than buffer length"); + } + + return read_sub( pointerOf(this), buffer, size); + } + + /** + * {@inheritDoc} + */ + public long getSize() { + return get_size(pointerOf(this)); + } + + /** + * {@inheritDoc} + */ + public int setSize(long bytes) { + return set_size(pointerOf(this), bytes); + } + + @Override + protected void finalize() throws Throwable { + super.finalize(); + burn_source_free(pointerOf(this)); + } + + private static long newEcma119Source(IsoVolSet volset, int volnum, int level, + EnumSet flags) { + + int f = 0; + + if ( flags.contains(Ecma119ExtensionFlag.ROCKRIDGE) ) { + f |= (1 << 0); + } + + if ( flags.contains(Ecma119ExtensionFlag.JOLIET) ) { + f |= (1 << 1); + } + + return iso_source_new_ecma119(pointerOf(volset), volnum, level, f); + + } + + private static native long burn_file_source_new(String path, String subpath); + + private static native long burn_fd_source_new(int datafd, int subfd, + long size); + + private static native long iso_source_new_ecma119(long volumeset, + int volnum, int level, int flags); + + private static native int read(long ptr, byte [] buffer, int size); + + private static native int read_sub(long ptr, byte [] buffer, int size); + + private static native long get_size(long ptr); + + private static native int set_size(long ptr, long bytes); + + private static native void burn_source_free(long s); +} diff --git a/java/src/java/org/pykix/libburnia/libburn/SourceStatus.java b/java/src/java/org/pykix/libburnia/libburn/SourceStatus.java new file mode 100644 index 0000000..9e4983c --- /dev/null +++ b/java/src/java/org/pykix/libburnia/libburn/SourceStatus.java @@ -0,0 +1,32 @@ +/* + * SourceStatus.java + * + * Copyright (c) 2007 Vreixo Formoso + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * See COPYING file for details. + */ + +package org.pykix.libburnia.libburn; + +/** + * Possible data source return values. + * + * @author Vreixo Formoso + * @since 0.1 + */ +public enum SourceStatus { + + /** The source is ok. */ + OK, + + /** The source is at end of file. */ + EOF, + + /** The source is unusable. */ + FAILED + +} diff --git a/java/src/java/org/pykix/libburnia/libburn/SpeedDescriptor.java b/java/src/java/org/pykix/libburnia/libburn/SpeedDescriptor.java new file mode 100644 index 0000000..dbb464d --- /dev/null +++ b/java/src/java/org/pykix/libburnia/libburn/SpeedDescriptor.java @@ -0,0 +1,127 @@ +/* + * SpeedDescriptor.java + * + * Copyright (c) 2007 Vreixo Formoso + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * See COPYING file for details. + */ + +package org.pykix.libburnia.libburn; + +/** + * Description of a speed capability as reported by the drive in conjunction + * with eventually loaded media. There can be more than one such object per + * drive. + * + *

+ * This list is set up by {@link Burn#scan()} and gets updated by + * {@link Drive#grab(boolean)}. A copy may be obtained by + * burn_drive_get_speedlist(). + * + *

+ * For technical background info see SCSI specs MMC and SPC: + * mode page 2Ah (from SPC 5Ah MODE SENSE) , mmc3r10g.pdf , 6.3.11 Table 364 + * ACh GET PERFORMANCE, Type 03h , mmc5r03c.pdf , 6.8.5.3 Table 312 + * + * @author Vreixo Formoso + * @since 0.1 + */ +public class SpeedDescriptor { + + private int source; + private Profile profile; + private int endlba; + private int writeSpeed; + private int readSpeed; + private int wrc; + private boolean exact; + private boolean mrw; + + /* to be called from JNI code */ + SpeedDescriptor(int source, short profile, int endlba, int writeSpeed, + int readSpeed, int wrc, boolean exact, boolean mrw) { + super(); + this.source = source; + this.profile = Profile.get(profile == -1 ? 0 : profile); + this.endlba = endlba; + this.writeSpeed = writeSpeed; + this.readSpeed = readSpeed; + this.wrc = wrc; + this.exact = exact; + this.mrw = mrw; + } + + /** + * The attributed capacity of appropriate media in logical block units + * i.e. 2352 raw bytes or 2048 data bytes. -1 = capacity unknown. + */ + public int getEndlba() { + return endlba; + } + + /** + * true if drive promises reported performance over full + * media. + */ + public boolean isExact() { + return exact; + } + + /** + * true if suitable for mixture of read and write + */ + public boolean isMrw() { + return mrw; + } + + /** + * The media type that was current at the time of report. + * + * @return + * Same as {@link Drive#getProfile()}, {@link Profile#NONE} if + * no media was loaded. + */ + public Profile getProfile() { + return profile; + } + + /** + * Read speed is given in 1000 bytes/s , 0 = invalid. The numbers + * are supposed to be usable with {@link Drive#setSpeed(int, int)} + */ + public int getReadSpeed() { + return readSpeed; + } + + /** + * Get where this info comes from. + * + * @return + * 0 = misc , 1 = mode page 2Ah , 2 = ACh GET PERFORMANCE + */ + public int getSource() { + return source; + } + + /** + * Expert info from ACh GET PERFORMANCE and/or mode page 2Ah. + * Expect values other than 0 or 1 to get a meaning in future. + * Rotational control: 0 = CLV/default , 1 = CAV + */ + public int getWrc() { + return wrc; + } + + /** + * Write speed is given in 1000 bytes/s , 0 = invalid. The numbers + * are supposed to be usable with {@link Drive#setSpeed(int, int)} + */ + public int getWriteSpeed() { + return writeSpeed; + } + +} diff --git a/java/src/java/org/pykix/libburnia/libburn/TocEntry.java b/java/src/java/org/pykix/libburnia/libburn/TocEntry.java new file mode 100644 index 0000000..eba5831 --- /dev/null +++ b/java/src/java/org/pykix/libburnia/libburn/TocEntry.java @@ -0,0 +1,176 @@ +/* + * TocEntry.java + * + * Copyright (c) 2007 Vreixo Formoso + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * See COPYING file for details. + */ + +package org.pykix.libburnia.libburn; + +/** + * Information about a track on a disc - this is from the q sub channel of + * the lead-in area of a disc. The documentation here is very terse. + * See a document such as mmc3 for proper information. + * + * @author Vreixo Formoso + * @since 0.1 + */ +/* + * Note that this class is not a Proxy. Information is kept on Java side, + * and propertly copied form or to C struct when needed. + * + * FIXME: I take all C "unsigned char" as byte, but in some cases an int + * is a better option. + * + * TODO: define setters?? + */ +public class TocEntry { + + /** Session the track is in */ + private byte session; + + /** Type of data. for this struct to be valid, it must be 1 */ + private byte adr; + + /** Type of data in the track */ + private byte control; + + /** Zero. Always. Really. */ + private byte tno; + + /** Track number or special information */ + private byte point; + private byte min; + private byte sec; + private byte frame; + private byte zero; + + /** Track start time minutes for normal tracks */ + private byte pmin; + + /** Track start time seconds for normal tracks */ + private byte psec; + + /** Track start time frames for normal tracks */ + private byte pframe; + + /* + * Indicates wether extension data are valid and eventually override + * older elements in this structure: + * bit0= DVD extension is valid + */ + private byte extensionsValid; + + /* ts A70201 : DVD extension. + * If invalid the members are guaranteed to be 0. + */ + /* Tracks and session numbers are 16 bit. Here are the high bytes. */ + private byte sessionMsb; + + private byte pointMsb; + + /* pmin, psec, and pframe may be too small if DVD extension is valid */ + private int startLba; + + /* min, sec, and frame may be too small if DVD extension is valid */ + private int trackBlocks; + + public TocEntry(byte session, byte adr, byte control, byte tno, + byte point, byte min, byte sec, byte frame, byte zero, byte pmin, + byte psec, byte pframe, byte extensionsValid, byte sessionMsb, + byte pointMsb, int startLba, int trackBlocks) { + + super(); + this.session = session; + this.adr = adr; + this.control = control; + this.tno = tno; + this.point = point; + this.min = min; + this.sec = sec; + this.frame = frame; + this.zero = zero; + this.pmin = pmin; + this.psec = psec; + this.pframe = pframe; + this.extensionsValid = extensionsValid; + this.sessionMsb = sessionMsb; + this.pointMsb = pointMsb; + this.startLba = startLba; + this.trackBlocks = trackBlocks; + } + + public byte getAdr() { + return adr; + } + + public byte getControl() { + return control; + } + + public byte getExtensionsValid() { + return extensionsValid; + } + + public byte getFrame() { + return frame; + } + + public byte getMin() { + return min; + } + + public byte getPframe() { + return pframe; + } + + public byte getPmin() { + return pmin; + } + + public byte getPoint() { + return point; + } + + public byte getPointMsb() { + return pointMsb; + } + + public byte getPsec() { + return psec; + } + + public byte getSec() { + return sec; + } + + public byte getSession() { + return session; + } + + public byte getSessionMsb() { + return sessionMsb; + } + + public int getStartLba() { + return startLba; + } + + public byte getTno() { + return tno; + } + + public int getTrackBlocks() { + return trackBlocks; + } + + public byte getZero() { + return zero; + } + +} diff --git a/java/src/java/org/pykix/libburnia/libburn/Track.java b/java/src/java/org/pykix/libburnia/libburn/Track.java new file mode 100644 index 0000000..14b3130 --- /dev/null +++ b/java/src/java/org/pykix/libburnia/libburn/Track.java @@ -0,0 +1,294 @@ +/* + * Track.java + * + * Copyright (c) 2007 Vreixo Formoso + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * See COPYING file for details. + */ + +package org.pykix.libburnia.libburn; + +import java.util.EnumSet; + +import org.pykix.libburnia.bindings.Proxy; + +/** + * References a single track on a disc. + * + * @author Vreixo Formoso + * @since 0.1 + */ +public class Track extends Proxy { + + /** wether is needed to free or not the track when no more needed */ + private boolean free; + + /** + * Create a new Track, to use in TAO recording or to put in a + * {@link Session} + */ + public Track() { + super( burn_track_create() ); + free = true; + } + + /* package protected */ + Track(long ptr) { + super(ptr); + free = false; + } + + /** + * Define the data in a track. + * + * @param offset + * The number of 0s to write before start of data. + * @param tail + * The number of extra 0s to write after data. + * @param pad + * If true, the lib should pad the last sector with 0s + * if the track isn't exactly sector sized. (otherwise the lib will + * begin reading from the next track) + * @param mode + * data format + */ + public void defineData(int offset, int tail, boolean pad, + EnumSet mode) { + + int modebm = 0; + for ( BurnMode m : mode ) { + modebm |= m.bm; + } + + burn_track_define_data( pointerOf(this), offset, tail, pad, modebm ); + } + + /** + * Define wether a track shall swap bytes of its input stream. + * + * @param swapSourceBytes + * false to do not swap, true to swap byte + * pairs + */ + public void setByteSwap(boolean swapSourceBytes) { + burn_track_set_byte_swap( pointerOf(this), swapSourceBytes ? 1 : 0); + } + + /** + * Set the ISRC details for the track. + * + * @param country + * the 2 char country code. Each character must be only numbers or + * letters. + * @param owner + * 3 char owner code. Each character must be only numbers + * or letters. + * @param year + * 2 digit year. A number in 0-99 (Yep, not Y2K friendly). + * @param serial + * 5 digit serial number. A number in 0-99999. + * @throws IllegalArgumentException + * If some of restrictions given above are wrong. + * + * TODO add more restriction checks in java code. We need to check that + * characters are valid. + */ + public void setIsrc(String country, String owner, int year, int serial) { + + if ( country.length() != 2 ) { + throw new IllegalArgumentException("Country must be 2 characters " + + "length"); + } + + if ( owner.length() != 3 ) { + throw new IllegalArgumentException("owner must be 3 characters " + + "length"); + } + + if ( (year > 99) || (year < 0) ) { + throw new IllegalArgumentException("year must be a number in 0-99"); + } + + if ( (serial > 99999) || (serial < 0) ) { + throw new IllegalArgumentException("99999 must be a number in " + + "0-99999"); + } + + burn_track_set_isrc( pointerOf(this), country, owner, (byte)year, serial ); + + } + + /** + * Disable ISRC parameters for the track. + */ + public void clearIsrc() { + burn_track_clear_isrc( pointerOf(this) ); + } + + /** + * Set the track's data source. + * + * @param src + * The data source to use for the contents of the track. + * @return + * A status code stating if the source is ready for use for + * writing the track, or if an error occured + */ + public SourceStatus setSource(BurnSource src) { + + long ptr; + if (src instanceof Proxy) { + Proxy source = (Proxy) src; + ptr = pointerOf(source); + } else { + //FIXME add support for java-based sources + throw new ClassCastException("Only Proxy sources supported"); + } + + int s = burn_track_set_source( pointerOf(this), ptr); + switch (s) { + case 0: + return SourceStatus.OK; + case 1: + return SourceStatus.EOF; + case 2: + return SourceStatus.FAILED; + default: + throw new RuntimeException("Unexpected return state"); + } + } + + /** + * Set a default track size to be used only if the track turns out to be of + * unpredictable length and if the effective write type demands a fixed + * size. + * + *

+ * This can be useful to enable write types CD SAO or DVD DAO together with + * a track source like stdin. If the track source delivers fewer bytes than + * announced then the track will be padded up with zeros. + * + * @param size + * The size to set in bytes + * @return + * true on success, false if failure + */ + public boolean setDefaultSize(long size) { + return burn_track_set_default_size( pointerOf(this), size); + } + + /** + * Tells how long the track will be on disc. + * Not reliable with tracks of undefined length. Should never + * be called in this case. + * + * @return + * Number of sectors the track will need. + */ + public int getSectors() { + return burn_track_get_sectors( pointerOf(this) ); + } + + /** + * Gets a copy of the {@link TocEntry} structure associated with the track. + * + * @return + * A {@link TocEntry} object. + */ + public TocEntry getEntry() { + return burn_track_get_entry( pointerOf(this) ); + } + + /** + * Gets the mode of the track. + * + * @return + * The track's mode + */ + public EnumSet getMode() { + + int modebm = burn_track_get_mode( pointerOf(this) ); + + EnumSet mode = EnumSet.noneOf(BurnMode.class); + + for ( BurnMode m : EnumSet.allOf(BurnMode.class) ) { + + if ( (modebm & m.bm) != 0 ) { + mode.add(m); + } + } + + return mode; + } + + /** + * Tells how many source bytes have been read by the track during burn. + * + * @return + * Bytes already read. + */ + public long getReadBytes() { + return burn_track_get_read_bytes( pointerOf(this) ); + } + + /** + * Tells how many source bytes have been written by the track during burn. + * + * @return + * Bytes already written. + */ + public long getWrittenBytes() { + return burn_track_get_written_bytes( pointerOf(this) ); + } + + @Override + protected void finalize() throws Throwable { + super.finalize(); + + /* + * When retrieved from Session.getTrack we haven't to + * free the C object because we don't own a reference + */ + if ( free ) { + burn_track_free( pointerOf(this) ); + } + } + + private static native long burn_track_create(); + + private static native void burn_track_free(long t); + + private static native void burn_track_define_data(long t, int offset, + int tail, boolean pad, int mode); + + private static native int burn_track_set_byte_swap(long t, + int swapSourceBytes); + + private static native void burn_track_set_isrc(long t, String country, + String owner, byte year, int serial); + + private static native void burn_track_clear_isrc(long t); + + private static native int burn_track_set_source(long t, long s); + + private static native boolean burn_track_set_default_size(long t, long size); + + private static native int burn_track_get_sectors(long t); + + private static native TocEntry burn_track_get_entry(long t); + + private static native int burn_track_get_mode(long track); + + /* + * The two methods are the java version of the single libburn method + * int burn_track_get_counters(struct burn_track *t, + * off_t *read_bytes, off_t *written_bytes); + */ + private static native long burn_track_get_read_bytes(long t); + private static native long burn_track_get_written_bytes(long t); + +} diff --git a/java/src/java/org/pykix/libburnia/libburn/WriteOpts.java b/java/src/java/org/pykix/libburnia/libburn/WriteOpts.java new file mode 100644 index 0000000..7f5292c --- /dev/null +++ b/java/src/java/org/pykix/libburnia/libburn/WriteOpts.java @@ -0,0 +1,281 @@ +/* + * WriteOpts.java + * + * Copyright (c) 2007 Vreixo Formoso + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * See COPYING file for details. + */ + +package org.pykix.libburnia.libburn; + +import org.pykix.libburnia.bindings.Proxy; + +/** + * References a set of write parameters. + * + *

+ * To get a new WriteOpts object, you have to call + * {@link Drive#newWriteOpts()} method. + * + * @author Vreixo Formoso + * @since 0.1 + */ +public class WriteOpts extends Proxy { + + /* package protected */ + WriteOpts(long ptr) { + super(ptr); + } + + /** + * Sets the write type for the WriteOpts. + * + *

+ * Note: write type {@link WriteType#SAO} is currently not capable of + * writing a mix of data and audio tracks. You must use + * {@link WriteType#TAO} for such sessions. + * + * @param writeType + * The write type to use. + * @param blockType + * The block type to use. + * @return + * true on success, false on failure. + */ + public boolean setWriteType( WriteType writeType, BlockType blockType ) { + + int bt = blockType.code; + int wt = writeType.ordinal(); + + return burn_write_opts_set_write_type( pointerOf(this), wt, bt); + } + + /** + * As an alternative to {@link #setWriteType(WriteType, BlockType)} + * this function tries to find a suitable write type and block type for a + * given write job described by this opts and disc. To be used after all + * other setups have been made, i.e. immediately before + * {@link Drive#write(WriteOpts, Disc)}. + * + * @param disc + * The already composed session and track model. + * @param flag + * Bitfield for control purposes: + * bit0= do not choose type but check the one that is already set + * bit1= do not issue error messages via burn_msgs queue + * (is automatically set with bit0) + * @return + * Chosen write type or {@link WriteType#NONE} on failure. + */ + /* + * TODO a C returning field, reasons, is forgeting by this implementation + */ + public WriteType setAutoWriteType(Disc disc, int flag) { + + int wt = burn_write_opts_auto_write_type( pointerOf(this), + pointerOf(disc), flag); + + return WriteType.values()[wt]; + } + + /** + * Sets the simulate value for the WriteOpts object. + * + * @param sim + * If true, the drive will perform a simulation + * instead of a burn + * @return + * true on success, false on failure. + */ + public boolean setSimulate(boolean sim) { + return burn_write_opts_set_simulate( pointerOf(this), sim ); + } + + /** + * Controls buffer underrun prevention. + * + * @param underrunProof + * if true, buffer underrun protection is enabled + * @return + * true on success, false on failure. + */ + public boolean setUnderrunProof(boolean underrunProof) { + return burn_write_opts_set_underrun_proof( pointerOf(this), + underrunProof); + } + + /** + * Sets whether to use OPC (Optical Power Calibration) + * or not with this WriteOpts object. + * + * @param opc + * if true , OPC will be performed at + * start of burn. + */ + public void setPerformOpc(boolean opc) { + burn_write_opts_set_perform_opc( pointerOf(this), opc ); + } + + /** + * Sets the multi flag which eventually marks the emerging session as not + * being the last one and thus creating a {@link DiscStatus#APPENDABLE} + * media. + * + * @param multi + * If true media will be appendable, if + * false media will be closed (default) + */ + public void setMulti(boolean multi) { + burn_write_opts_set_multi( pointerOf(this), multi ); + } + + /** + * Eventually makes libburn ignore the failure of some conformance checks: + * + *

    + *
  • the check wether CD write+block type is supported by the drive. + *
+ * + * @param force + * if true ignore above checks, otherwise refuse work on + * failed check. + */ + public void setForce(boolean force) { + burn_write_opts_set_force( pointerOf(this), force ? 1 : 0 ); + } + + /** + * Sets a start address for writing to media and write modes which allow to + * choose this address at all (DVD+RW, DVD-RAM, formatted DVD-RW only for + * now). The address is given in bytes. If it is not -1 then a write run + * will fail if choice of start address is not supported or if the block + * alignment of the address is not suitable for media and write mode. + * (Alignment to 32 kB blocks is advised with DVD media.) + * + * @param value + * The address in bytes (-1 = start at default address). + */ + public void setStartByte(long value) { + burn_write_opts_set_start_byte( pointerOf(this), value ); + } + + /** + * Sets the session format for a disc. + * + * @param format + * The session format to set. + */ + public void setFormat(SessionFormat format) { + burn_write_opts_set_format( pointerOf(this), format.code ); + } + + public void setHasMediaCatalog(boolean hasMediaCatalog) { + burn_write_opts_set_has_mediacatalog( pointerOf(this), hasMediaCatalog ); + } + + public void setMediaCatalog(String mediaCatalog) { + burn_write_opts_set_mediacatalog( pointerOf(this), mediaCatalog ); + } + + /** + * Examines a completed setup for {@link Drive#write(WriteOpts, Disc)} + * wether it is permissible with drive and media. + * + *

+ * This function is called by {@link Drive#write(WriteOpts, Disc)} but + * an application might be interested in this check in advance. + * + * @param disc + * The descrition of the disc to be created + * @param silent + * true to not issue error messages , false + * to report problems + * @throws BurnException + * on failure, a list of rejection reason statements can be getted + * as exception msg. + */ + public void precheckWrite(Disc disc, boolean silent) throws BurnException { + burn_precheck_write(pointerOf(this), pointerOf(disc), silent ? 1 : 0); + } + + /** + * Caution: still immature and likely to change. Problems arose with + * sequential DVD-RW on one drive. + * + * Controls wether the whole available space of the media shall be filled + * up by the last track of the last session. + * + * @param fillUpMedia + * true to fill up by last track, false to + * not fill up + */ + public void setFillUp(boolean fillUpMedia) { + burn_write_opts_set_fillup( pointerOf(this), fillUpMedia); + } + + /** + * Supplies toc entries for writing - not normally required for CD + * mastering. + * + * @param entries + * Toc entries. + */ + public void setTocEntries(TocEntry[] entries) { + burn_write_opts_set_toc_entries( pointerOf(this), entries.length, + entries); + } + + @Override + protected void finalize() throws Throwable { + super.finalize(); + burn_write_opts_free( pointerOf(this) ); + } + + private static native void burn_write_opts_free(long opts); + + private static native boolean burn_write_opts_set_write_type(long opts, + int writeType, int blockType); + + private static native int burn_write_opts_auto_write_type(long opts, + long disc, int flag); + + private static native boolean burn_write_opts_set_simulate(long opts, + boolean sim); + + private static native boolean burn_write_opts_set_underrun_proof(long opts, + boolean underrun_proof); + + private static native void burn_write_opts_set_perform_opc(long opts, + boolean opc); + + private static native void burn_write_opts_set_multi(long opts, + boolean multi); + + private static native void burn_write_opts_set_force(long opts, int useForce); + + private static native void burn_write_opts_set_start_byte(long opts, + long value); + + private static native void burn_write_opts_set_format(long opts, int format); + + private static native void burn_write_opts_set_has_mediacatalog( + long opts, boolean has_mediacatalog); + + private static native void burn_write_opts_set_mediacatalog( + long opts, String mediacatalog); + + private static native void burn_precheck_write(long o, long disc, + int silent) throws BurnException; + + private static native void burn_write_opts_set_fillup(long opts, + boolean fill_up_media); + + //TODO untested and enought complex to have some bugs!! + private static native void burn_write_opts_set_toc_entries(long opts, + int count, TocEntry[] entries); + +} diff --git a/java/src/java/org/pykix/libburnia/libburn/WriteType.java b/java/src/java/org/pykix/libburnia/libburn/WriteType.java new file mode 100644 index 0000000..c12ef54 --- /dev/null +++ b/java/src/java/org/pykix/libburnia/libburn/WriteType.java @@ -0,0 +1,66 @@ +/* + * WriteType.java + * + * Copyright (c) 2007 Vreixo Formoso + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * See COPYING file for details. + */ + +package org.pykix.libburnia.libburn; + +/** + * Possible disc writing style/modes. + * + * @author Vreixo Formoso + * @since 0.1 + */ +public enum WriteType { + + /** + * Packet writing. + * currently unsupported, (for DVD Incremental Streaming use TAO) + */ + PACKET, + + /** + *

    + *
  • With CD: Track At Once recording + * 2s gaps between tracks, no fonky lead-ins + * + *
  • With sequential DVD-R[W]: Incremental Streaming + *
  • With DVD-RAM/+RW: Random Writeable (used sequentially) + *
  • With overwriteable DVD-RW: Rigid Restricted Overwrite + *
+ */ + TAO, + + /** + *
    + *
  • With CD: Session At Once + * Block type MUST be BURN_BLOCK_SAO + * ts A70122: Currently not capable of mixing data and audio tracks. + *
  • With sequential DVD-R[W]: Disc-at-once, DAO + * Single session, single track, fixed size mandatory, (-dvd-compat) + */ + SAO, + + /** + * With CD: Raw disc at once recording. + * all subcodes must be provided by lib or user + * only raw block types are supported + */ + RAW, + + /** + * In replies this indicates that not any writing will work. + * As parameter for inquiries it indicates that no particular write + * mode shall is specified. + * Do not use for setting a write mode for burning. It won't work. + */ + NONE + +} diff --git a/java/src/java/org/pykix/libburnia/libisofs/Ecma119ExtensionFlag.java b/java/src/java/org/pykix/libburnia/libisofs/Ecma119ExtensionFlag.java new file mode 100644 index 0000000..0e23d32 --- /dev/null +++ b/java/src/java/org/pykix/libburnia/libisofs/Ecma119ExtensionFlag.java @@ -0,0 +1,26 @@ +/* + * Ecma119ExtensionFlag.java + * + * Copyright (c) 2007 Vreixo Formoso + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * See COPYING file for details. + */ + +package org.pykix.libburnia.libisofs; + +/** + * Extensions to ISO filesystem. + * + * FIXME move to libburn package, only used there + * + * @author Vreixo Formoso + * @since 0.1 + */ +public enum Ecma119ExtensionFlag { + ROCKRIDGE, + JOLIET +} diff --git a/java/src/java/org/pykix/libburnia/libisofs/IsoExclude.java b/java/src/java/org/pykix/libburnia/libisofs/IsoExclude.java new file mode 100644 index 0000000..3eaa8dd --- /dev/null +++ b/java/src/java/org/pykix/libburnia/libisofs/IsoExclude.java @@ -0,0 +1,62 @@ +/* + * IsoExclude.java + * + * Copyright (c) 2007 Vreixo Formoso + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * See COPYING file for details. + */ + +package org.pykix.libburnia.libisofs; + +/** + * Manages files to be excluded when added directories recursively. + * + * FIXME I'm not very sure about to put this in its own class. + * TODO add java.io.File methods + * + * @author Vreixo Formoso + * @since 0.1 + */ +public class IsoExclude { + + /** + * Add the path of a file or directory to ignore when adding a + * directory recursively. + * + * @param path + * The path, on the local filesystem, of the file. + */ + public static void addPath(String path) { + iso_exclude_add_path(path); + } + + /** + * Remove a path that was set to be ignored when adding a directory + * recusively. + * + * @param path + * The path, on the local filesystem, of the file. + */ + public static void removePath(String path) { + iso_exclude_remove_path(path); + } + + /** + * Remove all paths that were set to be ignored when adding a + * directory recusively. + */ + public static void empty() { + iso_exclude_empty(); + } + + private static native void iso_exclude_add_path(String path); + + private static native void iso_exclude_remove_path(String path); + + private static native void iso_exclude_empty(); + +} diff --git a/java/src/java/org/pykix/libburnia/libisofs/IsoTreeNode.java b/java/src/java/org/pykix/libburnia/libisofs/IsoTreeNode.java new file mode 100644 index 0000000..1f920b6 --- /dev/null +++ b/java/src/java/org/pykix/libburnia/libisofs/IsoTreeNode.java @@ -0,0 +1,232 @@ +/* + * IsoTreeNode.java + * + * Copyright (c) 2007 Vreixo Formoso + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * See COPYING file for details. + */ + +package org.pykix.libburnia.libisofs; + +import java.io.File; +import java.io.FileNotFoundException; + +import org.pykix.libburnia.bindings.Proxy; + +/** + * A node in the filesystem tree. + * + * @author Vreixo Formoso + * @since 0.1 + */ +public class IsoTreeNode extends Proxy { + + /* + * Package protected + */ + IsoTreeNode(long ptr) { + super(ptr); + } + + /** + * Add a file to this node (have to be a directory). + * + * @param path + * The path, on the local filesystem, of the file. Have to be not a + * directory, but a file. + * @return + * An IsoTreeNode whose path is path and whose parent + * is this node. + * @throws FileNotFoundException + * If path not exists or is not a file. + */ + public IsoTreeNode addNode(String path) throws FileNotFoundException { + return addNode(this, new File(path)); + } + + /** + * Add a file to this node (have to be a directory). + * + * @param path + * The path, on the local filesystem, of the file. Have to be not a + * directory, but a file. + * @return + * An IsoTreeNode whose path is path and whose parent + * is this node. + * @throws FileNotFoundException + * If path not exists or is not a file. + */ + public IsoTreeNode addNode(File path) throws FileNotFoundException { + return addNode(this, path); + } + + /** + * Recursively add an existing directory as a child of this node, that have + * to be a directory. + * Warning: when using this, you'll lose files or subdirectories objects. + * If you want to have all files and directories objects, + * use {@link #addNode(File)} and {@link #addNewDir(String)} + * + * @param path + * The path, on the local filesystem, of the directory to add. + * @return + * The new created node or null. + * @throws FileNotFoundException + * If path not exists or is not a directory + */ + public IsoTreeNode raddDir(String path) throws FileNotFoundException { + return raddDir(this, new File(path)); + } + + /** + * Recursively add an existing directory as a child of this node, that have + * to be a directory. + * Warning: when using this, you'll lose files or subdirectories objects. + * If you want to have all files and directories objects, + * use {@link #addNode(File)} and {@link #addNewDir(String)} + * + * @param path + * The path, on the local filesystem, of the directory to add. + * @return + * The new created node or null. + * @throws FileNotFoundException + * If path not exists or is not a directory + */ + public IsoTreeNode raddDir(File path) throws FileNotFoundException { + return raddDir(this, path); + } + + /* this function is for testing purposes mainly */ + void print(int spaces) { + iso_tree_print( pointerOf(this), spaces); + } + + /** + * Set the name of the node (using the current locale). + * + * @param name + * Name to set + */ + public void setName(String name) { + iso_tree_node_set_name( pointerOf(this), name); + } + + /** + * Creates a new directory as a child of this node (have to be a + * directory). + * + * @param name + * Name of the directory to create. Must be a unique name among + * all node children, and mustn't contain '/' characters. + * @return + * The newly created directory. + */ + public IsoTreeNode addNewDir(String name) { + return addNewDir(this, name); + } + + /** + * Add a file to a directory. + * + * @param parent + * Node to which add file. Can be null, but if + * not it must be a directory. + * @param path + * The path, on the local filesystem, of the file. Have to be non-dir + * @return + * An IsoTreeNode whose path is path and whose parent + * is parent. + * @throws FileNotFoundException + * If path not exists or is not a file + */ + public static IsoTreeNode addNode(IsoTreeNode parent, File path) + throws FileNotFoundException { + + long pptr = (parent == null) ? 0 : pointerOf(parent); + + /* extra check */ + if ( !path.exists() ) { + throw new FileNotFoundException(path.getPath()); + } + if ( !path.isFile() ) { + throw new FileNotFoundException(path + " is not a file"); + } + + long ptr = iso_tree_add_node(pptr, path.getPath()); + + return (ptr == 0) ? null : new IsoTreeNode(ptr); + } + + /** + * Recursively add an existing directory to the tree. + * Warning: when using this, you'll lose files or subdirectories objects. + * If you want to have all files and directories objects, + * use {@link #addNode(File)} and {@link #addNewDir(String)}. + * + * @param parent + * Node to which add file. Can be null, but if + * not it must be a directory. + * @param path + * The path, on the local filesystem, of the directory to add. + * @return + * The new created node or null. + * @throws FileNotFoundException + * If path not exists or is not a directory + */ + public static IsoTreeNode raddDir(IsoTreeNode parent, File path) + throws FileNotFoundException { + + long pptr = (parent == null) ? 0 : pointerOf(parent); + + /* extra check */ + if ( !path.exists() ) { + throw new FileNotFoundException(path.getPath()); + } + if ( !path.isDirectory() ) { + throw new FileNotFoundException(path + " is not a directory"); + } + + long ptr = iso_tree_radd_dir(pptr, path.getPath()); + + return (ptr == 0) ? null : new IsoTreeNode(ptr); + } + + /** + * Creates a new, empty directory on the volume. + * + * @param parent + * Directory in which add the new dir, or null + * @param name + * Name of the directory to create. Must be a unique name among + * the children and files belonging to parent, and mustn't + * contain '/' characters. + * @return + * The newly created directory. + */ + public static IsoTreeNode addNewDir(IsoTreeNode parent, String name) { + + long pptr = (parent == null) ? 0 : pointerOf(parent); + + long ptr = iso_tree_add_new_dir(pptr, name); + + return (ptr == 0) ? null : new IsoTreeNode(ptr); + } + + private static native long iso_tree_add_node(long parent, String path); + + private static native long iso_tree_radd_dir(long parent, String path); + + private static native void iso_tree_print(long root, int spaces); + + private static native void iso_tree_node_set_name(long file, String name); + + private static native long iso_tree_add_new_dir(long parent, String name); + + static { + System.loadLibrary("java-libburn-0.1"); + } +} diff --git a/java/src/java/org/pykix/libburnia/libisofs/IsoVolSet.java b/java/src/java/org/pykix/libburnia/libisofs/IsoVolSet.java new file mode 100644 index 0000000..b4bddd3 --- /dev/null +++ b/java/src/java/org/pykix/libburnia/libisofs/IsoVolSet.java @@ -0,0 +1,60 @@ +/* + * IsoVolSet.java + * + * Copyright (c) 2007 Vreixo Formoso + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * See COPYING file for details. + */ + +package org.pykix.libburnia.libisofs; + +import org.pykix.libburnia.bindings.Proxy; +import org.pykix.libburnia.libburn.BurnSource; +import org.pykix.libburnia.libburn.Source; + +/** + * A set of data volumes. + * + *

    + * You will need an IsoVolSet object to create an ISO image + * from a {@link IsoVolume}. + * + *

    + * For actually burn (or write to a file) the image, you will need to create + * a new {@link Source} with this Volume Set. + * + * @see BurnSource + * @see Source + * @see IsoVolume + * + * @author Vreixo Formoso + * @since 0.1 + */ +public class IsoVolSet extends Proxy { + + /** + * Create a new Volume Set consisting of only one volume. + * @param volume + * The first and only volume for the volset to contain. + * @param volsetId + * The Volume Set ID. + */ + public IsoVolSet(IsoVolume volume, String volsetId) { + super( iso_volset_new( pointerOf(volume), volsetId) ); + } + + @Override + protected void finalize() throws Throwable { + super.finalize(); + iso_volset_free( pointerOf(this) ); + } + + private static native void iso_volset_free(long volume); + + private static native long iso_volset_new(long volume, String volsetId); + +} diff --git a/java/src/java/org/pykix/libburnia/libisofs/IsoVolume.java b/java/src/java/org/pykix/libburnia/libisofs/IsoVolume.java new file mode 100644 index 0000000..f7371e7 --- /dev/null +++ b/java/src/java/org/pykix/libburnia/libisofs/IsoVolume.java @@ -0,0 +1,290 @@ +/* + * IsoVolume.java + * + * Copyright (c) 2007 Vreixo Formoso + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * See COPYING file for details. + */ + +package org.pykix.libburnia.libisofs; + +import java.io.File; +import java.io.FileNotFoundException; + +import org.pykix.libburnia.bindings.Proxy; +import org.pykix.libburnia.libburn.BurnSource; + +/** + * ISO-9660 Data volume. + * + *

    + * This is the primary object to keep track of files and directory to be + * recorded in an ISO-9660 image. + * + *

    + * To create an ISO image, you have to create a IsoVolume + * object and add files and/or directories to it. After doing so, you will + * want to get a {@link BurnSource} to actually write the image to a file or + * disc. To do this, you have to create an {@link IsoVolSet} with this object. + * + * @see IsoVolSet + * + * TODO current implementation forces user to keep a reference to this + * object while still having a reference to an IsoTreeNode from this. This + * is because of automatic memory management. Underlying iso_volume is + * deleted when Java object gets out of scope, and this causes all iso_tree_node + * to be also deleted, thus invalidating java objects. Without + * modifying libburnia code, the only way to solve this (I think) is add a ref + * from each IsoTreeNode. Because of space efficience and normal library usage + * I think current solution is better. + * When added to IsoVolSet there is no problem if this + * goes out of scope (while keeping ref. to IsoVolSet), because ref count + * is incremented and underlying object is not deleted. + * + * @author Vreixo Formoso + * @since 0.1 + */ +public class IsoVolume extends Proxy { + + /** + * Create a new volume. + * + * @param volumeId + * Id for the volume, can be null if you wish to set it later. + * @param publisherId + * Id for the publish, can be null if you wish to set it later. + * @param dataPreparerId + * Id for the data prepared, can be null if you wish to set it later. + */ + public IsoVolume(String volumeId, String publisherId, + String dataPreparerId) { + + super( iso_volume_new(volumeId, publisherId, dataPreparerId) ); + } + + /** + * Create a new volume. + * + * @param volumeId + * @param publisherId + * @param dataPreparerId + * @param root + */ + public IsoVolume(String volumeId, String publisherId, + String dataPreparerId, IsoTreeNode root) { + + super( iso_volume_new_with_root(volumeId, publisherId, dataPreparerId, + pointerOf(root)) ); + } + + /** + * Get the root directory. + * @return + */ + public IsoTreeNode getRoot() { + + long ptr = iso_volume_get_root( pointerOf(this) ); + + if (ptr == 0) { + return null; + } + + IsoTreeNode node = (IsoTreeNode) proxyFor(ptr); + + if (node == null) { + node = new IsoTreeNode(ptr); + } + /* + * FIXME a problem here is that if this IsoVolume gets out of + * scope, C iso_volume will be freed, thus deleting the + * iso_tree_node, and ptr is pointing to an invalid C object, which + * can lead to problems. This can also happen in C code if an user + * explicity free the iso_volume, but in Java is really a problem + * because the automatic memory management + */ + return node; + } + + /** + * Fill in the volume identifier. + * @param volumeId + */ + public void setVolumeId(String volumeId) { + iso_volume_set_volume_id(pointerOf(this), volumeId); + } + + /** + * Fill in the publisher. + * @param publisherId + */ + public void setPublisherId(String publisherId) { + iso_volume_set_publisher_id(pointerOf(this), publisherId); + } + + /** + * Fill in the data preparer. + * @param dataPreparerId + */ + public void setDataPreparerId(String dataPreparerId) { + iso_volume_set_data_preparer_id(pointerOf(this), dataPreparerId); + } + + /** + * Locate a node by its path on disc. + * + * @param path + * The path, in the image, of the file. + * @return + * The node found or null. + */ + /* + * Take care that this is really a wrapp for iso_tree_volume_path_to_node + */ + public IsoTreeNode getNode(String path) { + + long ptr = iso_tree_volume_path_to_node(pointerOf(this), path); + + if (ptr == 0) { + return null; + } + + //FIXME same problems as in getRoot + return (ptr == 0) ? null : new IsoTreeNode(ptr); + } + + /** + * Add a file or a directory (recursively) to the volume by specifying + * its path on the volume. + * + * @param discPath + * The path on the disc at which to add the file/directory. + * @param path + * The path, on the local filesystem, of the file. + * @return + * The node for the file or null if the parent doesn't + * exists on the disc. + */ + public IsoTreeNode addPath(String discPath, String path) { + + long ptr = iso_tree_volume_add_path(pointerOf(this), discPath, path); + + if (ptr == 0) { + return null; + } + + IsoTreeNode node = (IsoTreeNode) proxyFor(ptr); + + if (node == null) { + node = new IsoTreeNode(ptr); + } + //FIXME same problems as in getRoot + return node; + } + + /** + * Like {@link #addPath(String, String) addPath}, but local path is + * passed as a {@link File} + * + * @param discPath + * The path on the disc at which to add the file/directory. + * @param path + * The path, on the local filesystem, of the file. + * @return + * The node for the file or null if the parent doesn't + * exists on the disc. + * @throws FileNotFoundException + * If passed local path does not exist + */ + public IsoTreeNode addPath(String discPath, File path) + throws FileNotFoundException { + + if ( !path.exists() ) { + throw new FileNotFoundException(path.getPath()); + } + + long ptr = iso_tree_volume_add_path(pointerOf(this), discPath, + path.getPath()); + + if (ptr == 0) { + return null; + } + + IsoTreeNode node = (IsoTreeNode) proxyFor(ptr); + + if (node == null) { + node = new IsoTreeNode(ptr); + } + //FIXME same problems as in getRoot + return node; + } + + /** + * Creates a new, empty directory on the volume. + * + * @param discPath + * The path on the volume at which to add the directory. + * @return + * The newly created directory or null. + */ + public IsoTreeNode addNewDir(String discPath) { + + long ptr = iso_tree_volume_add_new_dir(pointerOf(this), discPath); + + if (ptr == 0) { + return null; + } + + IsoTreeNode node = (IsoTreeNode) proxyFor(ptr); + + if (node == null) { + node = new IsoTreeNode(ptr); + } + //FIXME same problems as in getRoot + return node; + } + + @Override + protected void finalize() throws Throwable { + super.finalize(); + + /* free underlying C object */ + iso_volume_free( pointerOf(this) ); + } + + private static native long iso_volume_new(String volumeId, + String publisherId, String dataPreparerId); + + private static native long iso_volume_new_with_root(String volumeId, + String publisherId, String dataPreparerId, long root); + + private static native void iso_volume_free(long volume); + + private static native long iso_volume_get_root(long volume); + + private static native void iso_volume_set_volume_id(long volume, + String volumeId); + + private static native void iso_volume_set_publisher_id(long volume, + String publisherId); + + private static native void iso_volume_set_data_preparer_id(long volume, + String data_preparer_id); + + private static native long iso_tree_volume_path_to_node(long volume, + String path); + + private static native long iso_tree_volume_add_path(long volume, + String discPath, String path); + + private static native long iso_tree_volume_add_new_dir(long volume, + String discPath); + + static { + System.loadLibrary("java-libburn-0.1"); + } + +} diff --git a/java/src/jni/libburn/BindingsUtil.c b/java/src/jni/libburn/BindingsUtil.c new file mode 100644 index 0000000..04072ef --- /dev/null +++ b/java/src/jni/libburn/BindingsUtil.c @@ -0,0 +1,123 @@ +/* + * BindingsUtil.c + * + * Copyright (c) 2007 Vreixo Formoso + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * See COPYING file for details. + */ + +#include "BindingsUtil.h" + +#define JAVA_LIBBURN_JNI_VERSION JNI_VERSION_1_4 + +static JavaVM* cachedJavaVM; + +JNIEXPORT jint JNICALL +JNI_OnLoad +( + JavaVM *jvm, + void *reserved +) +{ + if (jvm == NULL) { + perror("null JavaVM pointer"); + } + cachedJavaVM = jvm; + return JAVA_LIBBURN_JNI_VERSION; +} + +/** + * Creates a new TocEntry java class from a burn_toc_entry C struct + */ +jobject java_libburn_toc_entry_c2java +( + JNIEnv *env, struct burn_toc_entry *entry +) +{ + static jclass tocEntryCls = NULL; + static jmethodID cid = NULL; + jobject result; + + if ( tocEntryCls == NULL ) { + tocEntryCls = (*env)->FindClass(env, "org/pykix/libburnia/libburn/TocEntry"); + if ( tocEntryCls == NULL ) { + return NULL; + } + } + + if ( cid == NULL ) { + cid = (*env)->GetMethodID(env, tocEntryCls, "", "(BBBBBBBBBBBBBBBII)V"); + if (cid == NULL) { + return NULL; /* exception thrown */ + } + } + + result = (*env)->NewObject(env, tocEntryCls, cid, entry->session, entry->adr, entry->control, + entry->tno, entry->point, entry->min, entry->sec, entry->frame, entry->zero, entry->pmin, + entry->psec, entry->pframe, entry->extensions_valid, entry->session_msb, + entry->point_msb, entry->start_lba, entry->track_blocks); + + return result; +} + + +void java_libburn_throw_burn_exception +( + JNIEnv *env, const char *msg +) +{ + static jclass cls = NULL; + + if ( cls == NULL) { + cls = (*env)->FindClass(env, "org/pykix/libburnia/libburn/BurnException"); + } + (*env)->ThrowNew(env, cls, msg); +} + +jclass java_libburn_find_class +( + JNIEnv *env, const char *name +) +{ + jclass localRefCls = (*env)->FindClass(env, name); + if (localRefCls == NULL) { + return NULL; /* exception thrown */ + } + + jclass globalRef = (*env)->NewWeakGlobalRef(env, localRefCls); + + (*env)->DeleteLocalRef(env, localRefCls); + + return globalRef; //can be NULL on error, need to be checked!! +} + +JNIEnv* java_libburn_get_env() +{ + JNIEnv* env; + jint result; + + result = (*cachedJavaVM)->GetEnv(cachedJavaVM, (void **) &env, JAVA_LIBBURN_JNI_VERSION); + if ( result != JNI_OK) { + switch (result) { + case JNI_EDETACHED: + perror("[DEBUG] Current thread is not attached. Attaching..."); + + JavaVMAttachArgs args; + args.version = JAVA_LIBBURN_JNI_VERSION; + args.name = "Signal handler callback"; + args.group = NULL; + (*cachedJavaVM)->AttachCurrentThread(cachedJavaVM, (void **)&env, &args); + return env; + break; + case JNI_EVERSION: + g_error("Specified version is not supported."); + break; + } + return NULL; + } + return env; +} diff --git a/java/src/jni/libburn/BindingsUtil.h b/java/src/jni/libburn/BindingsUtil.h new file mode 100644 index 0000000..db88f56 --- /dev/null +++ b/java/src/jni/libburn/BindingsUtil.h @@ -0,0 +1,37 @@ +/* + * BindingsUtil.h + * + * Copyright (c) 2007 Vreixo Formoso + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * See COPYING file for details. + */ + +#include +#include "libburn.h" + + +#ifndef _Bindings_Util +#define _Bindings_Util + +/** + * Creates a new TocEntry java class from a burn_toc_entry C struct + */ +jobject java_libburn_toc_entry_c2java(JNIEnv *env, struct burn_toc_entry *entry); + +/** throws a new BurnException */ +void java_libburn_throw_burn_exception(JNIEnv *env, const char *msg); + +/** + * Get a reference for a class. + * Reference is a global weak ref, so it can be cached. + */ +jclass java_libburn_find_class(JNIEnv *env, const char *name); + +/** get a JNIEnv */ +JNIEnv* java_libburn_get_env(); + +#endif diff --git a/java/src/jni/libburn/Burn.c b/java/src/jni/libburn/Burn.c new file mode 100644 index 0000000..c0f3cca --- /dev/null +++ b/java/src/jni/libburn/Burn.c @@ -0,0 +1,521 @@ +/* + * Burn.c + * + * Copyright (c) 2007 Vreixo Formoso + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * See COPYING file for details. + */ + +#include "org_pykix_libburnia_libburn_Burn.h" +#include "BindingsUtil.h" + +#include "libburn.h" + +static struct burn_drive_info *drive_infos = NULL; + +static int java_libburn_signal_handler(void *handle, int signum, int flag); +static int java_libburn_pacifier_func(void *handle, int patience, int elapsed); + +/* + * Class: org_pykix_libburnia_libburn_Burn + * Method: burn_initialize + * Signature: ()I + */ +JNIEXPORT jint JNICALL +Java_org_pykix_libburnia_libburn_Burn_burn_1initialize +( + JNIEnv *env, jclass cls +) +{ + return burn_initialize(); +} + +/* + * Class: org_pykix_libburnia_libburn_Burn + * Method: burn_finish + * Signature: ()V + */ +JNIEXPORT void JNICALL +Java_org_pykix_libburnia_libburn_Burn_burn_1finish +( + JNIEnv *env, jclass cls +) +{ + if ( drive_infos != NULL ) { + /* if we have a drive array, it must be freed before finish */ + burn_drive_info_free(drive_infos); + } + burn_finish(); +} + +/* + * Class: org_pykix_libburnia_libburn_Burn + * Method: burn_preset_device_open + * Signature: (III)V + */ +JNIEXPORT void JNICALL +Java_org_pykix_libburnia_libburn_Burn_burn_1preset_1device_1open +( JNIEnv *env, jclass cls, jint exclusive, jint blocking, jint abort) +{ + burn_preset_device_open(exclusive, blocking, abort); +} + +/* + * Class: org_pykix_libburnia_libburn_Burn + * Method: burn_allow_untested_profiles + * Signature: (Z)V + */ +JNIEXPORT void JNICALL +Java_org_pykix_libburnia_libburn_Burn_burn_1allow_1untested_1profiles +( + JNIEnv *env, jclass cls, jboolean yes +) +{ + burn_allow_untested_profiles(yes); +} + +/* + * Class: org_pykix_libburnia_libburn_Burn + * Method: burn_drive_scan + * Signature: ()[Lorg/pykix/libburnia/libburn/DriveInfo; + */ +JNIEXPORT jobjectArray JNICALL +Java_org_pykix_libburnia_libburn_Burn_burn_1drive_1scan +( + JNIEnv *env, jclass cls +) +{ + unsigned int n_drives; + static jclass driveInfoCls = NULL; + static jmethodID cid = NULL; + jobjectArray result; + int i; + + if ( drive_infos != NULL ) { + /* if we already have a drive array, it must be freed before scan again */ + burn_drive_info_free(drive_infos); + } + + while ( !burn_drive_scan(&drive_infos, &n_drives) ) { + usleep(1002); + } + + if ( n_drives <= 0 ) { + return NULL; + } + + if ( driveInfoCls == NULL ) { + driveInfoCls = java_libburn_find_class(env, "org/pykix/libburnia/libburn/DriveInfo"); + if ( driveInfoCls == NULL ) { + return NULL; + } + } + + if ( cid == NULL ) { + cid = (*env)->GetMethodID(env, driveInfoCls, "", + "(JLjava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZZZZZZZZZZZIIIIIJ)V"); + if (cid == NULL) { + return NULL; /* exception thrown */ + } + } + + result = (*env)->NewObjectArray(env, n_drives, driveInfoCls, NULL); + + for ( i = 0; i < n_drives; ++i ) { + + struct burn_drive_info* drive = &(drive_infos[i]); + + jstring vendor = (*env)->NewStringUTF(env, drive->vendor); + jstring product = (*env)->NewStringUTF(env, drive->product); + jstring revision = (*env)->NewStringUTF(env, drive->revision); + jstring location = (*env)->NewStringUTF(env, drive->location); + + jobject jdrive = (*env)->NewObject(env, driveInfoCls, cid, (jlong) drive, vendor, product, + revision, location, drive->read_dvdram, drive->read_dvdr, drive->read_dvdrom, + drive->read_cdr, drive->read_cdrw, drive->write_dvdram, + drive->write_dvdr, drive->write_cdr, drive->write_cdrw, + drive->write_simulate, drive->c2_errors, drive->buffer_size, + drive->tao_block_types, drive->sao_block_types, drive->raw_block_types, + drive->packet_block_types, drive->drive); + + if (jdrive == NULL) { + return NULL; /* out of memory error thrown */ + } + + (*env)->SetObjectArrayElement(env, result, i, jdrive); + (*env)->DeleteLocalRef(env, vendor); + (*env)->DeleteLocalRef(env, product); + (*env)->DeleteLocalRef(env, revision); + (*env)->DeleteLocalRef(env, location); + } + + return result; +} + +/* + * Class: org_pykix_libburnia_libburn_Burn + * Method: burn_drive_scan_and_grab + * Signature: (Ljava/lang/String;Z)Lorg/pykix/libburnia/libburn/DriveInfo; + */ +JNIEXPORT jobject JNICALL +Java_org_pykix_libburnia_libburn_Burn_burn_1drive_1scan_1and_1grab +( + JNIEnv *env, jclass cls, jstring adr, jboolean load +) +{ + + const char* cadr; + static jclass driveInfoCls = NULL; + static jmethodID cid = NULL; + + if ( drive_infos != NULL ) { + /* if we already have a drive array, it must be freed before scan again */ + burn_drive_info_free(drive_infos); + } + + cadr = (*env)->GetStringUTFChars(env, adr, NULL); + if ( cadr == NULL ) { + return NULL; /* OutOfMemoryError already thrown */ + } + + if ( burn_drive_scan_and_grab(&drive_infos, (char *)cadr, load) != 1 ) { + (*env)->ReleaseStringUTFChars(env, adr, cadr); + return NULL; + } + + if ( driveInfoCls == NULL ) { + driveInfoCls = java_libburn_find_class(env, "org/pykix/libburnia/libburn/DriveInfo"); + if ( driveInfoCls == NULL ) { + return NULL; + } + } + + if ( cid == NULL ) { + cid = (*env)->GetMethodID(env, driveInfoCls, "", + "(JLjava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZZZZZZZZZZZIIIIIJ)V"); + if (cid == NULL) { + return NULL; /* exception thrown */ + } + } + + struct burn_drive_info* drive = &(drive_infos[0]); + + jstring vendor = (*env)->NewStringUTF(env, drive->vendor); + jstring product = (*env)->NewStringUTF(env, drive->product); + jstring revision = (*env)->NewStringUTF(env, drive->revision); + jstring location = (*env)->NewStringUTF(env, drive->location); + + jobject jdrive = (*env)->NewObject(env, driveInfoCls, cid, (jlong) drive, vendor, product, + revision, location, drive->read_dvdram, drive->read_dvdr, drive->read_dvdrom, + drive->read_cdr, drive->read_cdrw, drive->write_dvdram, + drive->write_dvdr, drive->write_cdr, drive->write_cdrw, + drive->write_simulate, drive->c2_errors, drive->buffer_size, + drive->tao_block_types, drive->sao_block_types, drive->raw_block_types, + drive->packet_block_types, drive->drive); + + (*env)->DeleteLocalRef(env, vendor); + (*env)->DeleteLocalRef(env, product); + (*env)->DeleteLocalRef(env, revision); + (*env)->DeleteLocalRef(env, location); + (*env)->ReleaseStringUTFChars(env, adr, cadr); + + return jdrive; +} + +/* + * Class: org_pykix_libburnia_libburn_Burn + * Method: burn_drive_add_whitelist + * Signature: (Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL +Java_org_pykix_libburnia_libburn_Burn_burn_1drive_1add_1whitelist +( + JNIEnv *env, jclass cls, jstring adr +) +{ + const char* cadr; + int res; + + cadr = (*env)->GetStringUTFChars(env, adr, NULL); + if ( cadr == NULL ) { + return -1; /* OutOfMemoryError already thrown */ + } + + res = burn_drive_add_whitelist( (char *) adr); + + (*env)->ReleaseStringUTFChars(env, adr, cadr); + + return res; +} + +/* + * Class: org_pykix_libburnia_libburn_Burn + * Method: burn_drive_clear_whitelist + * Signature: ()V + */ +JNIEXPORT void JNICALL +Java_org_pykix_libburnia_libburn_Burn_burn_1drive_1clear_1whitelist +( + JNIEnv *env, jclass cls +) +{ + burn_drive_clear_whitelist(); +} + +/* + * Class: org_pykix_libburnia_libburn_Burn + * Method: burn_set_verbosity + * Signature: (I)V + */ +JNIEXPORT void JNICALL +Java_org_pykix_libburnia_libburn_Burn_burn_1set_1verbosity +( + JNIEnv *env, jclass cls, jint level +) +{ + burn_set_verbosity(level); +} + +/* + * Class: org_pykix_libburnia_libburn_Burn + * Method: burn_drive_is_enumerable_adr + * Signature: (Ljava/lang/String;)Z + */ +JNIEXPORT jboolean JNICALL +Java_org_pykix_libburnia_libburn_Burn_burn_1drive_1is_1enumerable_1adr +( + JNIEnv *env, jclass cls, jstring adr +) +{ + const char* cadr; + int res; + + cadr = (*env)->GetStringUTFChars(env, adr, NULL); + if ( cadr == NULL ) { + return 0; /* OutOfMemoryError already thrown */ + } + + res = burn_drive_is_enumerable_adr( (char *) adr); + + (*env)->ReleaseStringUTFChars(env, adr, cadr); + + return res; +} + +/* + * Class: org_pykix_libburnia_libburn_Burn + * Method: burn_drive_convert_fs_adr + * Signature: (Ljava/lang/String;)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL +Java_org_pykix_libburnia_libburn_Burn_burn_1drive_1convert_1fs_1adr +( + JNIEnv *env, jclass cls, jstring path +) +{ + const char* cpath; + char adr[BURN_DRIVE_ADR_LEN]; + + cpath = (*env)->GetStringUTFChars(env, path, NULL); + if ( cpath == NULL ) { + return NULL; /* OutOfMemoryError already thrown */ + } + + if ( burn_drive_convert_fs_adr( (char *) cpath, adr) != 1) { + (*env)->ReleaseStringUTFChars(env, path, cpath); + return NULL; + } + + (*env)->ReleaseStringUTFChars(env, path, cpath); + + return (*env)->NewStringUTF(env, adr); +} + +/* + * Class: org_pykix_libburnia_libburn_Burn + * Method: burn_abort_def + * Signature: (ILjava/lang/String;)Z + */ +JNIEXPORT jboolean JNICALL +Java_org_pykix_libburnia_libburn_Burn_burn_1abort_1def +( + JNIEnv *env, jclass cls, jint patience, jstring msg +) +{ + const char *message; + int res; + + message = (*env)->GetStringUTFChars(env, msg, NULL); + if ( message == NULL ) { + return 0; /* OutOfMemoryError already thrown */ + } + + res = burn_abort(patience, burn_abort_pacifier, (void *) message); + + (*env)->ReleaseStringUTFChars(env, msg, message); + + if ( res < 0 ) { + java_libburn_throw_burn_exception(env, "Can't abort"); + } + return res; +} + +/* + * Class: org_pykix_libburnia_libburn_Burn + * Method: burn_abort_java + * Signature: (ILorg/pykix/libburnia/libburn/Burn$AbortHandler;)Z + */ +JNIEXPORT jboolean JNICALL +Java_org_pykix_libburnia_libburn_Burn_burn_1abort_1java +( + JNIEnv *env, jclass cls, jint patience, jobject handler +) +{ + + int res = burn_abort(patience, java_libburn_pacifier_func, (void *) handler); + + if ( res < 0 ) { + java_libburn_throw_burn_exception(env, "Can't abort"); + } + return res; +} + +static int java_libburn_pacifier_func +( + void *handle, int patience, int elapsed +) +{ + /* call back to java */ + JNIEnv *env; + jclass handlerCls; + + env = java_libburn_get_env(); + + if ( env == NULL ) { + perror("Ups, can't call back to abort java pacifier.\n"); + return -1; + } + + handlerCls = (*env)->FindClass(env, "org/pykix/libburnia/libburn/Burn$AbortHandler"); + if ( handlerCls == NULL ) { + perror("Ups, java handler not found.\n"); + return -1; + } + + jmethodID mid = (*env)->GetMethodID(env, handlerCls, "abortPacifier", "(II)I"); + if ( mid == NULL ) { + perror("Ups, method not found.\n"); + return -1; + } + return (*env)->CallIntMethod(env, (jobject) handle, mid, patience, elapsed); +} + +/* + * Class: org_pykix_libburnia_libburn_Burn + * Method: burn_set_signal_handling + * Signature: (Lorg/pykix/libburnia/libburn/Burn$SignalHandler;I)V + */ +JNIEXPORT void JNICALL Java_org_pykix_libburnia_libburn_Burn_burn_1set_1signal_1handling +( + JNIEnv *env, jclass cls, jobject handler, jint mode +) +{ + jobject sh =(*env)->NewGlobalRef(env, handler); + burn_set_signal_handling( sh, java_libburn_signal_handler, mode); +} + +/* + * Class: org_pykix_libburnia_libburn_Burn + * Method: burn_set_default_signal_handling + * Signature: (Ljava/lang/String;I)V + */ +JNIEXPORT void JNICALL +Java_org_pykix_libburnia_libburn_Burn_burn_1set_1default_1signal_1handling +( + JNIEnv *env, jclass cls, jstring msg, jint mode +) +{ + const char *message = NULL; + + if (msg != NULL) { + message = (*env)->GetStringUTFChars(env, msg, NULL); + if ( message == NULL ) { + return; /* OutOfMemoryError already thrown */ + } + } + + burn_set_signal_handling((void *) message, NULL, mode); + + (*env)->ReleaseStringUTFChars(env, msg, message); +} + +static int java_libburn_signal_handler(void *handle, int signum, int flag) +{ + /* call back to java */ + JNIEnv *env; + jclass handlerCls; + + env = java_libburn_get_env(); + + if ( env == NULL ) { + perror("Ups, can't call back to java handler, just aborting... please wait\n"); + burn_abort(5, NULL, NULL); + return -1; + } + + handlerCls = (*env)->FindClass(env, "org/pykix/libburnia/libburn/Burn$SignalHandler"); + if ( handlerCls == NULL ) { + perror("Ups, java handler not found, just aborting... please wait\n"); + burn_abort(5, NULL, NULL); + return -1; + } + + jmethodID mid = (*env)->GetMethodID(env, handlerCls, "handleSignal", "(II)I"); + if ( mid == NULL ) { + perror("Ups, method not found, just aborting... please wait\n"); + burn_abort(5, NULL, NULL); + return -1; + } + return (*env)->CallIntMethod(env, (jobject) handle, mid, signum, flag); +} + +/* + * Class: org_pykix_libburnia_libburn_Burn + * Method: burn_version + * Signature: ()Lorg/pykix/libburnia/libburn/Burn$Version; + */ +JNIEXPORT jobject JNICALL +Java_org_pykix_libburnia_libburn_Burn_burn_1version +( + JNIEnv *env, jclass cls +) +{ + int major; + int minor; + int micro; + static jclass versionCls = NULL; + static jmethodID cid = NULL; + + if ( versionCls == NULL ) { + versionCls = java_libburn_find_class(env, "org/pykix/libburnia/libburn/Burn$Version"); + if ( versionCls == NULL ) { + return NULL; + } + } + + if ( cid == NULL ) { + cid = (*env)->GetMethodID(env, versionCls, "", "(III)V"); + if (cid == NULL) { + return NULL; /* exception thrown */ + } + } + + burn_version(&major, &minor, µ); + + return (*env)->NewObject(env, versionCls, cid, major, minor, micro); +} + diff --git a/java/src/jni/libburn/Disc.c b/java/src/jni/libburn/Disc.c new file mode 100644 index 0000000..bf24cd9 --- /dev/null +++ b/java/src/jni/libburn/Disc.c @@ -0,0 +1,123 @@ +/* + * Disc.c + * + * Copyright (c) 2007 Vreixo Formoso + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * See COPYING file for details. + */ + +#include "org_pykix_libburnia_libburn_Disc.h" +#include "BindingsUtil.h" + +#include "libburn.h" + + +/* + * Class: org_pykix_libburnia_libburn_Disc + * Method: burn_disc_create + * Signature: ()J + */ +JNIEXPORT jlong JNICALL +Java_org_pykix_libburnia_libburn_Disc_burn_1disc_1create +( + JNIEnv *env, jclass cls +) +{ + return (jlong) burn_disc_create(); +} + +/* + * Class: org_pykix_libburnia_libburn_Disc + * Method: burn_disc_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL +Java_org_pykix_libburnia_libburn_Disc_burn_1disc_1free +( + JNIEnv *env, jclass cls, jlong d +) +{ + burn_disc_free( (struct burn_disc *) d); +} + +/* + * Class: org_pykix_libburnia_libburn_Disc + * Method: burn_disc_add_session + * Signature: (JJI)Z + */ +JNIEXPORT jboolean JNICALL +Java_org_pykix_libburnia_libburn_Disc_burn_1disc_1add_1session +( + JNIEnv *env, jclass cls, jlong d, jlong s, jint pos +) +{ + return burn_disc_add_session( (struct burn_disc *) d, + (struct burn_session *) s, pos); +} + +/* + * Class: org_pykix_libburnia_libburn_Disc + * Method: burn_disc_remove_session + * Signature: (JJ)Z + */ +JNIEXPORT jboolean JNICALL +Java_org_pykix_libburnia_libburn_Disc_burn_1disc_1remove_1session +( + JNIEnv *env, jclass cls, jlong d, jlong s +) +{ + return burn_disc_remove_session( (struct burn_disc *) d, (struct burn_session *) s); +} + +/* + * Class: org_pykix_libburnia_libburn_Disc + * Method: burn_disc_get_sessions + * Signature: (J)[J + */ +JNIEXPORT jlongArray JNICALL +Java_org_pykix_libburnia_libburn_Disc_burn_1disc_1get_1sessions +( + JNIEnv *env, jclass cls, jlong d +) +{ + int num; + struct burn_session **sessions; + int i; + + sessions = burn_disc_get_sessions( (struct burn_disc *) d, &num); + + /* create C array to store the pointers */ + jlong cresult[num]; + + for ( i = 0; i < num; ++i ) { + struct burn_session *session = sessions[i]; + cresult[i] = (jlong) session; + } + + /* move the pointer to a Java array */ + jlongArray result = (*env)->NewLongArray(env, num); + if ( result == NULL) { + return NULL; /* exception already thrown */ + } + (*env)->SetLongArrayRegion(env, result, 0, num, cresult); + + return result; +} + +/* + * Class: org_pykix_libburnia_libburn_Disc + * Method: burn_disc_get_sectors + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_org_pykix_libburnia_libburn_Disc_burn_1disc_1get_1sectors +( + JNIEnv *env, jclass cls, jlong d +) +{ + return burn_disc_get_sectors( (struct burn_disc *) d); +} diff --git a/java/src/jni/libburn/Drive.c b/java/src/jni/libburn/Drive.c new file mode 100644 index 0000000..bcc2a4d --- /dev/null +++ b/java/src/jni/libburn/Drive.c @@ -0,0 +1,672 @@ +/* + * Drive.c + * + * Copyright (c) 2007 Vreixo Formoso + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * See COPYING file for details. + */ + +#include "org_pykix_libburnia_libburn_Drive.h" +#include "BindingsUtil.h" + +#include "libburn.h" + + +/* + * Class: org_pykix_libburnia_libburn_Drive + * Method: burn_drive_grab + * Signature: (JI)Z + */ +JNIEXPORT jboolean JNICALL +Java_org_pykix_libburnia_libburn_Drive_burn_1drive_1grab +( + JNIEnv *env, jclass cls, jlong drive, jint load +) +{ + return burn_drive_grab( (struct burn_drive *) drive, load); +} + +/* + * Class: org_pykix_libburnia_libburn_Drive + * Method: burn_drive_release + * Signature: (JI)V + */ +JNIEXPORT void JNICALL +Java_org_pykix_libburnia_libburn_Drive_burn_1drive_1release +( + JNIEnv *env, jclass cls, jlong drive, jint eject +) +{ + burn_drive_release( (struct burn_drive *) drive, eject); +} + +/* + * Class: org_pykix_libburnia_libburn_Drive + * Method: burn_disc_get_status + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_org_pykix_libburnia_libburn_Drive_burn_1disc_1get_1status +( + JNIEnv *env, jclass cls, jlong drive +) +{ + return burn_disc_get_status( (struct burn_drive *) drive ); +} + +/* + * Class: org_pykix_libburnia_libburn_Drive + * Method: burn_disc_get_profile + * Signature: (J)S + */ +JNIEXPORT jshort JNICALL +Java_org_pykix_libburnia_libburn_Drive_burn_1disc_1get_1profile +( + JNIEnv *env, jclass cls, jlong d +) +{ + int pno; + char name[80]; + + if ( burn_disc_get_profile( (struct burn_drive *) d, &pno, name) ) { + return (jshort) pno; + } else { + return 0; //no profile + } +} + +/* + * Class: org_pykix_libburnia_libburn_Drive + * Method: burn_disc_erasable + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL +Java_org_pykix_libburnia_libburn_Drive_burn_1disc_1erasable +( + JNIEnv *env, jclass cls, jlong d +) +{ + return burn_disc_erasable( (struct burn_drive *) d); +} + +/* + * Class: org_pykix_libburnia_libburn_Drive + * Method: burn_drive_get_status + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL +Java_org_pykix_libburnia_libburn_Drive_burn_1drive_1get_1status +( + JNIEnv *env, jclass cls, jlong drive, jlong p +) +{ + return burn_drive_get_status( (struct burn_drive *)drive, (struct burn_progress *) p); +} + +/* + * Class: org_pykix_libburnia_libburn_Drive + * Method: burn_disc_erase + * Signature: (JZ)V + */ +JNIEXPORT void JNICALL +Java_org_pykix_libburnia_libburn_Drive_burn_1disc_1erase +( + JNIEnv *env, jclass cls, jlong drive, jboolean fast +) +{ + burn_disc_erase( (struct burn_drive *) drive, fast); +} + +/* + * Class: org_pykix_libburnia_libburn_Drive + * Method: burn_write_opts_new + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_org_pykix_libburnia_libburn_Drive_burn_1write_1opts_1new +( + JNIEnv *env, jclass cls, jlong drive +) +{ + return (jlong) burn_write_opts_new( (struct burn_drive *) drive); +} + +/* + * Class: org_pykix_libburnia_libburn_Drive + * Method: burn_disc_available_space + * Signature: (JJ)J + */ +JNIEXPORT jlong JNICALL +Java_org_pykix_libburnia_libburn_Drive_burn_1disc_1available_1space +( + JNIEnv *env, jclass cls, jlong d, jlong o +) +{ + + return burn_disc_available_space( (struct burn_drive *) d, + (struct burn_write_opts *) o); +} + +/* + * Class: org_pykix_libburnia_libburn_Drive + * Method: burn_disc_write + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL +Java_org_pykix_libburnia_libburn_Drive_burn_1disc_1write +( + JNIEnv *env, jclass cls, jlong o, jlong disc +) +{ + burn_disc_write( (struct burn_write_opts *) o, (struct burn_disc *) disc); +} + +/* + * Class: org_pykix_libburnia_libburn_Drive + * Method: burn_disc_format + * Signature: (JJI)V + */ +JNIEXPORT void JNICALL +Java_org_pykix_libburnia_libburn_Drive_burn_1disc_1format +( + JNIEnv *env, jclass cls, jlong drive, jlong size, jint flag +) +{ + burn_disc_format( (struct burn_drive *) drive, size, flag); +} + +/* + * Class: org_pykix_libburnia_libburn_Drive + * Method: burn_drive_cancel + * Signature: (J)V + */ +JNIEXPORT void JNICALL +Java_org_pykix_libburnia_libburn_Drive_burn_1drive_1cancel +( + JNIEnv *env, jclass cls, jlong d +) +{ + burn_drive_cancel( (struct burn_drive *) d ); +} + +/* + * Class: org_pykix_libburnia_libburn_Drive + * Method: burn_drive_wrote_well + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL +Java_org_pykix_libburnia_libburn_Drive_burn_1drive_1wrote_1well +( + JNIEnv *env, jclass cls, jlong d +) +{ + return burn_drive_wrote_well( (struct burn_drive *) d ); +} + +/* + * Class: org_pykix_libburnia_libburn_Drive + * Method: burn_drive_get_disc + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_org_pykix_libburnia_libburn_Drive_burn_1drive_1get_1disc +( + JNIEnv *env, jclass cls, jlong d +) +{ + return (jlong) burn_drive_get_disc( (struct burn_drive *) d ); +} + +/* + * Class: org_pykix_libburnia_libburn_Drive + * Method: burn_drive_set_speed + * Signature: (JII)V + */ +JNIEXPORT void JNICALL +Java_org_pykix_libburnia_libburn_Drive_burn_1drive_1set_1speed +( + JNIEnv *env, jclass cls, jlong d, jint r , jint w +) +{ + burn_drive_set_speed( (struct burn_drive *) d, r, w); +} + +/* + * Class: org_pykix_libburnia_libburn_Drive + * Method: burn_drive_get_write_speed + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_org_pykix_libburnia_libburn_Drive_burn_1drive_1get_1write_1speed +( + JNIEnv *env, jclass cls, jlong drive +) +{ + return burn_drive_get_write_speed( (struct burn_drive *) drive); +} + +/* + * Class: org_pykix_libburnia_libburn_Drive + * Method: burn_drive_get_min_write_speed + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_org_pykix_libburnia_libburn_Drive_burn_1drive_1get_1min_1write_1speed +( + JNIEnv *env, jclass cls, jlong drive +) +{ + return burn_drive_get_min_write_speed( (struct burn_drive *) drive); +} + +/* + * Class: org_pykix_libburnia_libburn_Drive + * Method: burn_drive_get_read_speed + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_org_pykix_libburnia_libburn_Drive_burn_1drive_1get_1read_1speed +( + JNIEnv *env, jclass cls, jlong drive +) +{ + return burn_drive_get_read_speed( (struct burn_drive *) drive); +} + + +/* + * Class: org_pykix_libburnia_libburn_Drive + * Method: burn_read_opts_new + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_org_pykix_libburnia_libburn_Drive_burn_1read_1opts_1new +( + JNIEnv *env, jclass cls, jlong drive +) +{ + return (jlong) burn_read_opts_new( (struct burn_drive *) drive); +} + +/* + * Class: org_pykix_libburnia_libburn_Drive + * Method: burn_drive_get_speedlist + * Signature: (J)[Lorg/pykix/libburnia/libburn/SpeedDescriptor; + */ +JNIEXPORT jobjectArray JNICALL +Java_org_pykix_libburnia_libburn_Drive_burn_1drive_1get_1speedlist +( + JNIEnv *env, jclass cls, jlong d +) +{ + struct burn_speed_descriptor *list; + int count = 0; + static jclass speedDescCls = NULL; + static jmethodID cid = NULL; + jobjectArray result; + + if ( speedDescCls == NULL ) { + speedDescCls = java_libburn_find_class(env, "org/pykix/libburnia/libburn/SpeedDescriptor"); + if ( speedDescCls == NULL ) { + return NULL; + } + } + + if ( cid == NULL ) { + cid = (*env)->GetMethodID(env, speedDescCls, "", "(ISIIIIZZ)V"); + if (cid == NULL) { + return NULL; /* exception thrown */ + } + } + + int res = burn_drive_get_speedlist((struct burn_drive *) d, &list); + + if ( res < 0 ) { + return NULL; //error + } + + /* count speed descs */ + if ( res != 0) { + + /* no empty list */ + count = 1; + struct burn_speed_descriptor *sd = list; + while ( (sd = sd->next) != NULL) { + count++; + } + } + + result = (*env)->NewObjectArray(env, count, speedDescCls, NULL); + + int i; + struct burn_speed_descriptor *csd = list; + for ( i = 0; i < count; ++i ) { + jobject sd = (*env)->NewObject(env, speedDescCls, cid, csd->source, + (jshort) csd->profile_loaded, csd->end_lba, csd->write_speed, + csd->read_speed, csd->wrc, csd->exact, csd->mrw); + + if (sd == NULL) { + return NULL; /* out of memory error thrown */ + } + + (*env)->SetObjectArrayElement(env, result, i, sd); + csd = csd->next; + } + + /* free speed list returned by libburn */ + burn_drive_free_speedlist( &list ); + + return result; +} + +/* + * Class: org_pykix_libburnia_libburn_Drive + * Method: burn_disc_pretend_blank + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL +Java_org_pykix_libburnia_libburn_Drive_burn_1disc_1pretend_1blank +( + JNIEnv *env, jclass cls, jlong d +) +{ + return burn_disc_pretend_blank( (struct burn_drive *) d); +} + +/* + * Class: org_pykix_libburnia_libburn_Drive + * Method: burn_disc_pretend_full + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL +Java_org_pykix_libburnia_libburn_Drive_burn_1disc_1pretend_1full +( + JNIEnv *env, jclass cls, jlong d +) +{ + return burn_disc_pretend_full( (struct burn_drive *) d); +} + +/* + * Class: org_pykix_libburnia_libburn_Drive + * Method: burn_disc_read_atip + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_org_pykix_libburnia_libburn_Drive_burn_1disc_1read_1atip +( + JNIEnv *env, jclass cls, jlong d +) +{ + return burn_disc_read_atip( (struct burn_drive *) d ); +} + +/* + * Class: org_pykix_libburnia_libburn_Drive + * Method: burn_drive_get_start_lba + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL +Java_org_pykix_libburnia_libburn_Drive_burn_1drive_1get_1start_1lba +( + JNIEnv *env, jclass cls, jlong d, jint flag +) +{ + int start_lba, end_lba; + + if ( burn_drive_get_start_end_lba( (struct burn_drive *) d, + &start_lba, &end_lba, flag) == 1 ) { + + /* valid values */ + return start_lba; + } else { + /* invalid, throw exception */ + java_libburn_throw_burn_exception(env, "Can't get valid LBA value"); + } +} + +/* + * Class: org_pykix_libburnia_libburn_Drive + * Method: burn_drive_get_end_lba + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL +Java_org_pykix_libburnia_libburn_Drive_burn_1drive_1get_1end_1lba +( + JNIEnv *env, jclass cls, jlong d, jint flag +) +{ + int start_lba, end_lba; + + if ( burn_drive_get_start_end_lba( (struct burn_drive *) d, + &start_lba, &end_lba, flag) == 1 ) { + + /* valid values */ + return end_lba; + } else { + /* invalid, throw exception */ + java_libburn_throw_burn_exception(env, "Can't get valid LBA value"); + return -1; + } +} + +/* + * Class: org_pykix_libburnia_libburn_Drive + * Method: burn_disc_track_lba + * Signature: (JJI)I + */ +JNIEXPORT jint JNICALL +Java_org_pykix_libburnia_libburn_Drive_burn_1disc_1track_1lba +( + JNIEnv *env, jclass cls, jlong d, jlong o, jint trackno +) +{ + int lba, nwa; + + int res = burn_disc_track_lba_nwa( (struct burn_drive *) d, (struct burn_write_opts *) o, + trackno, &lba, &nwa); + + if ( res < 0 ) { + java_libburn_throw_burn_exception(env, "Can't get Track LBA"); + return -1; + } else { + return lba; + } +} + +/* + * Class: org_pykix_libburnia_libburn_Drive + * Method: burn_disc_track_nwa + * Signature: (JJI)I + */ +JNIEXPORT jint JNICALL +Java_org_pykix_libburnia_libburn_Drive_burn_1disc_1track_1nwa +( + JNIEnv *env, jclass cls, jlong d, jlong o, jint trackno +) +{ + int lba, nwa; + + int res = burn_disc_track_lba_nwa( (struct burn_drive *) d, (struct burn_write_opts *) o, + trackno, &lba, &nwa); + + switch (res) { + case 1: + return nwa; + case 0: + java_libburn_throw_burn_exception(env, "Track nwa is not valid"); + return -1; + default: + java_libburn_throw_burn_exception(env, "Can't get Track nwa"); + return -1; + } +} + +/* + * Class: org_pykix_libburnia_libburn_Drive + * Method: burn_disc_get_msc1 + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_org_pykix_libburnia_libburn_Drive_burn_1disc_1get_1msc1 +( + JNIEnv *env, jclass cls, jlong d +) +{ + int start_lba; + if ( burn_disc_get_msc1( (struct burn_drive *) d, &start_lba) == 1 ) { + return start_lba; + } else { + java_libburn_throw_burn_exception(env, "Can't get msc1"); + return -1; + } +} + +/* + * Class: org_pykix_libburnia_libburn_Drive + * Method: burn_disc_get_multi_caps + * Signature: (JII)Lorg/pykix/libburnia/libburn/MultiCaps; + */ +JNIEXPORT jobject JNICALL +Java_org_pykix_libburnia_libburn_Drive_burn_1disc_1get_1multi_1caps +( + JNIEnv *env, jclass cls, jlong d, jint wt, jint flag +) +{ + struct burn_multi_caps *caps; + static jclass multiCapsCls = NULL; + static jmethodID cid = NULL; + + int res = burn_disc_get_multi_caps( (struct burn_drive *) d, wt, &caps, flag); + + if ( res < 0 ) { + java_libburn_throw_burn_exception(env, "Can't get multi caps"); + //TODO is needed the free of caps??? + return NULL; + } + + if ( multiCapsCls == NULL ) { + multiCapsCls = java_libburn_find_class(env, "org/pykix/libburnia/libburn/MultiCaps"); + if ( multiCapsCls == NULL ) { + return NULL; + } + + } + + if ( cid == NULL ) { + cid = (*env)->GetMethodID(env, multiCapsCls, "", "(ZZZJJJIIIIISZZ)V"); + if (cid == NULL) { + return NULL; /* exception thrown */ + } + } + + jobject mc = (*env)->NewObject(env, multiCapsCls, cid, caps->multi_session, caps->multi_track, + caps->start_adr, caps->start_alignment, caps->start_range_low, caps->start_range_high, + caps->might_do_tao, caps->might_do_sao, caps->might_do_raw, caps->advised_write_mode, + caps->selected_write_mode, caps->current_profile, caps->current_is_cd_profile, res); + + burn_disc_free_multi_caps(&caps); + + return mc; +} + +/* + * Class: org_pykix_libburnia_libburn_Drive + * Method: burn_disc_read + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL +Java_org_pykix_libburnia_libburn_Drive_burn_1disc_1read +( + JNIEnv *env, jclass cls, jlong d, jlong o +) +{ + burn_disc_read( (struct burn_drive *) d, (const struct burn_read_opts *) o); +} + +/* + * Class: org_pykix_libburnia_libburn_Drive + * Method: burn_disc_get_formats + * Signature: (J)Lorg/pykix/libburnia/libburn/Formats; + */ +JNIEXPORT jobject JNICALL +Java_org_pykix_libburnia_libburn_Drive_burn_1disc_1get_1formats +( + JNIEnv *env, jclass cls, jlong d +) +{ + int status; + off_t size; + unsigned bl_sas; + int num_formats; + static jclass formatsCls = NULL; + static jmethodID cid = NULL; + + if ( burn_disc_get_formats( (struct burn_drive *) d, &status, &size, + &bl_sas, &num_formats) != 1 ) { + return NULL; + } + + if ( formatsCls == NULL ) { + formatsCls = java_libburn_find_class(env, "org/pykix/libburnia/libburn/Formats"); + if ( formatsCls == NULL ) { + return NULL; + } + + } + + if ( cid == NULL ) { + cid = (*env)->GetMethodID(env, formatsCls, "", "(IJII)V"); + if (cid == NULL) { + return NULL; /* exception thrown */ + } + } + + return (*env)->NewObject(env, formatsCls, cid, status, size, bl_sas, num_formats); +} + +/* + * Class: org_pykix_libburnia_libburn_Drive + * Method: burn_disc_get_format_descr + * Signature: (JI)Lorg/pykix/libburnia/libburn/FormatDesc; + */ +JNIEXPORT jobject JNICALL +Java_org_pykix_libburnia_libburn_Drive_burn_1disc_1get_1format_1descr +( + JNIEnv *env, jclass cls, jlong d, jint index +) +{ + int type; + off_t size; + unsigned tdp; + static jclass formatDescCls = NULL; + static jmethodID cid = NULL; + + if ( burn_disc_get_format_descr( (struct burn_drive *) d, index, + &type, &size, &tdp) != 1 ) { + return NULL; + } + + if ( formatDescCls == NULL ) { + formatDescCls = java_libburn_find_class(env, "org/pykix/libburnia/libburn/FormatDesc"); + if ( formatDescCls == NULL ) { + return NULL; + } + + } + + if ( cid == NULL ) { + cid = (*env)->GetMethodID(env, formatDescCls, "", "(IJI)V"); + if (cid == NULL) { + return NULL; /* exception thrown */ + } + } + + return (*env)->NewObject(env, formatDescCls, cid, type, size, tdp); +} + + diff --git a/java/src/jni/libburn/DriveInfo.c b/java/src/jni/libburn/DriveInfo.c new file mode 100644 index 0000000..ebcd525 --- /dev/null +++ b/java/src/jni/libburn/DriveInfo.c @@ -0,0 +1,49 @@ +/* + * DriveInfo.c + * + * Copyright (c) 2007 Vreixo Formoso + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * See COPYING file for details. + */ + +#include "org_pykix_libburnia_libburn_DriveInfo.h" + +#include "libburn.h" + +/* + * Class: org_pykix_libburnia_libburn_DriveInfo + * Method: burn_drive_info_forget + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL +Java_org_pykix_libburnia_libburn_DriveInfo_burn_1drive_1info_1forget +( + JNIEnv *env, jclass cls, jlong d, jint force +) +{ + return burn_drive_info_forget( (struct burn_drive_info *) d, force); +} + +/* + * Class: org_pykix_libburnia_libburn_DriveInfo + * Method: burn_drive_get_adr + * Signature: (J)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL +Java_org_pykix_libburnia_libburn_DriveInfo_burn_1drive_1get_1adr +( + JNIEnv *env, jclass cls, jlong d +) +{ + char adr[BURN_DRIVE_ADR_LEN]; + + if ( burn_drive_get_adr( (struct burn_drive_info *) d, adr) <= 0 ) { + return NULL; + } + + return (*env)->NewStringUTF(env, adr); +} diff --git a/java/src/jni/libburn/Message.c b/java/src/jni/libburn/Message.c new file mode 100644 index 0000000..b1f6488 --- /dev/null +++ b/java/src/jni/libburn/Message.c @@ -0,0 +1,111 @@ +/* + * Message.c + * + * Copyright (c) 2007 Vreixo Formoso + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * See COPYING file for details. + */ + +#include "org_pykix_libburnia_libburn_Message.h" + +#include "libburn.h" + + +/* + * Class: org_pykix_libburnia_libburn_Message + * Method: burn_msgs_set_severities + * Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL +Java_org_pykix_libburnia_libburn_Message_burn_1msgs_1set_1severities +( + JNIEnv *env, jclass cls, jstring queueSev, jstring printSev, jstring printId +) +{ + int res; + const char *queue_severity; + const char *print_severity; + const char *print_id; + + queue_severity = (*env)->GetStringUTFChars(env, queueSev, NULL); + if ( queue_severity == NULL ) { + return -1; /* OutOfMemoryError already thrown */ + } + + print_severity = (*env)->GetStringUTFChars(env, printSev, NULL); + if ( print_severity == NULL ) { + return -1; /* OutOfMemoryError already thrown */ + } + + print_id = (*env)->GetStringUTFChars(env, printId, NULL); + if ( print_id == NULL ) { + return -1; /* OutOfMemoryError already thrown */ + } + + + res = burn_msgs_set_severities( (char *) queue_severity, + (char *) print_severity, (char *) print_id); + + (*env)->ReleaseStringUTFChars(env, queueSev, queue_severity); + (*env)->ReleaseStringUTFChars(env, printSev, print_severity); + (*env)->ReleaseStringUTFChars(env, printId, print_id); + + return res; +} + +/* + * Class: org_pykix_libburnia_libburn_Message + * Method: burn_msgs_obtain + * Signature: (Ljava/lang/String;)Lorg/pykix/libburnia/libburn/Message; + */ +JNIEXPORT jobject JNICALL +Java_org_pykix_libburnia_libburn_Message_burn_1msgs_1obtain +( + JNIEnv *env, jclass cls, jstring minSev +) +{ + + const char *minimum_severity; + int error_code; + int os_errno; + char msg_text[BURN_MSGS_MESSAGE_LEN]; + char severity[80]; + static jmethodID cid = NULL; + + minimum_severity = (*env)->GetStringUTFChars(env, minSev, NULL); + if ( minimum_severity == NULL ) { + return NULL; /* OutOfMemoryError already thrown */ + } + + if ( cid == NULL ) { + cid = (*env)->GetMethodID(env, cls, "", "(ILjava/lang/String;ILjava/lang/String;)V"); + if (cid == NULL) { + return NULL; /* exception thrown */ + } + } + + int res = burn_msgs_obtain( (char *) minimum_severity, &error_code, msg_text, + &os_errno, severity); + + jobject message = NULL; + if ( res == 1 ) { + + jstring msgText = (*env)->NewStringUTF(env, msg_text); + jstring sev = (*env)->NewStringUTF(env, severity); + + message = (*env)->NewObject(env, cls, cid, error_code, msgText, os_errno, sev); + + (*env)->DeleteLocalRef(env, msgText); + (*env)->DeleteLocalRef(env, sev); + } + + (*env)->ReleaseStringUTFChars(env, minSev, minimum_severity); + + return message; +} + + diff --git a/java/src/jni/libburn/Progress.c b/java/src/jni/libburn/Progress.c new file mode 100644 index 0000000..9007934 --- /dev/null +++ b/java/src/jni/libburn/Progress.c @@ -0,0 +1,229 @@ +/* + * Progress.c + * + * Copyright (c) 2007 Vreixo Formoso + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * See COPYING file for details. + */ + +#include "org_pykix_libburnia_libburn_Progress.h" + +#include +#include "libburn.h" + +/* + * Class: org_pykix_libburnia_libburn_Progress + * Method: burn_progress_new + * Signature: ()J + */ +JNIEXPORT jlong JNICALL +Java_org_pykix_libburnia_libburn_Progress_burn_1progress_1new +( + JNIEnv *env, jclass cls +) +{ + //FIXME: sizeof(struct burn_progress) == 52, but if we alloc less + //than 53 bytes code breaks, I don't known the reason!!! + //return (jlong) calloc(1, sizeof(struct burn_progress) ); + return (jlong) calloc(1, 54 ); +} + +/* + * Class: org_pykix_libburnia_libburn_Progress + * Method: burn_progress_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL +Java_org_pykix_libburnia_libburn_Progress_burn_1progress_1free +( + JNIEnv *env, jclass cls, jlong p +) +{ + free( (void *) p ); +} + +/* + * Class: org_pykix_libburnia_libburn_Progress + * Method: burn_progress_sessions + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_org_pykix_libburnia_libburn_Progress_burn_1progress_1sessions +( + JNIEnv *env, jclass cls, jlong p +) +{ + return ((struct burn_progress*) p)->sessions; +} + +/* + * Class: org_pykix_libburnia_libburn_Progress + * Method: burn_progress_session + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_org_pykix_libburnia_libburn_Progress_burn_1progress_1session +( + JNIEnv *env, jclass cls, jlong p +) +{ + return ((struct burn_progress*) p)->session; +} + + +/* + * Class: org_pykix_libburnia_libburn_Progress + * Method: burn_progress_tracks + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_org_pykix_libburnia_libburn_Progress_burn_1progress_1tracks +( + JNIEnv *env, jclass cls, jlong p +) +{ + return ((struct burn_progress*) p)->tracks; +} + + +/* + * Class: org_pykix_libburnia_libburn_Progress + * Method: burn_progress_track + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_org_pykix_libburnia_libburn_Progress_burn_1progress_1track +( + JNIEnv *env, jclass cls, jlong p +) +{ + return ((struct burn_progress*) p)->track; +} + + +/* + * Class: org_pykix_libburnia_libburn_Progress + * Method: burn_progress_indices + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_org_pykix_libburnia_libburn_Progress_burn_1progress_1indices +( + JNIEnv *env, jclass cls, jlong p +) +{ + return ((struct burn_progress*) p)->indices; +} + + +/* + * Class: org_pykix_libburnia_libburn_Progress + * Method: burn_progress_index + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_org_pykix_libburnia_libburn_Progress_burn_1progress_1index +( + JNIEnv *env, jclass cls, jlong p +) +{ + return ((struct burn_progress*) p)->index; +} + + +/* + * Class: org_pykix_libburnia_libburn_Progress + * Method: burn_progress_start_sector + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_org_pykix_libburnia_libburn_Progress_burn_1progress_1start_1sector +( + JNIEnv *env, jclass cls, jlong p +) +{ + return ((struct burn_progress*) p)->start_sector; +} + + +/* + * Class: org_pykix_libburnia_libburn_Progress + * Method: burn_progress_sectors + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_org_pykix_libburnia_libburn_Progress_burn_1progress_1sectors +( + JNIEnv *env, jclass cls, jlong p +) +{ + return ((struct burn_progress*) p)->sectors; +} + + +/* + * Class: org_pykix_libburnia_libburn_Progress + * Method: burn_progress_sector + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_org_pykix_libburnia_libburn_Progress_burn_1progress_1sector +( + JNIEnv *env, jclass cls, jlong p +) +{ + return ((struct burn_progress*) p)->sector; +} + + +/* + * Class: org_pykix_libburnia_libburn_Progress + * Method: burn_progress_buffer_capacity + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_org_pykix_libburnia_libburn_Progress_burn_1progress_1buffer_1capacity +( + JNIEnv *env, jclass cls, jlong p +) +{ + return ((struct burn_progress*) p)->buffer_capacity; +} + + +/* + * Class: org_pykix_libburnia_libburn_Progress + * Method: burn_progress_buffer_available + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_org_pykix_libburnia_libburn_Progress_burn_1progress_1buffer_1available +( + JNIEnv *env, jclass cls, jlong p +) +{ + return ((struct burn_progress*) p)->buffer_available; +} + + +/* + * Class: org_pykix_libburnia_libburn_Progress + * Method: burn_progress_buffered_bytes + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_pykix_libburnia_libburn_Progress_burn_1progress_1buffered_1bytes +( + JNIEnv *env, jclass cls, jlong p +) +{ + return ((struct burn_progress*) p)->buffered_bytes; +} + + +/* + * Class: org_pykix_libburnia_libburn_Progress + * Method: burn_progress_buffer_min_fill + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_org_pykix_libburnia_libburn_Progress_burn_1progress_1buffer_1min_1fill +( + JNIEnv *env, jclass cls, jlong p +) +{ + return ((struct burn_progress*) p)->buffer_min_fill; +} + diff --git a/java/src/jni/libburn/ReadOpts.c b/java/src/jni/libburn/ReadOpts.c new file mode 100644 index 0000000..275c663 --- /dev/null +++ b/java/src/jni/libburn/ReadOpts.c @@ -0,0 +1,135 @@ +/* + * ReadOpts.c + * + * Copyright (c) 2007 Vreixo Formoso + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * See COPYING file for details. + */ + +#include "org_pykix_libburnia_libburn_ReadOpts.h" + +#include "libburn.h" + + +/* + * Class: org_pykix_libburnia_libburn_ReadOpts + * Method: burn_read_opts_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_pykix_libburnia_libburn_ReadOpts_burn_1read_1opts_1free +( + JNIEnv *env, jclass cls, jlong opts +) +{ + burn_read_opts_free( (struct burn_read_opts *) opts); +} + +/* + * Class: org_pykix_libburnia_libburn_ReadOpts + * Method: burn_read_opts_set_raw + * Signature: (JZ)V + */ +JNIEXPORT void JNICALL +Java_org_pykix_libburnia_libburn_ReadOpts_burn_1read_1opts_1set_1raw +( + JNIEnv *env, jclass cls, jlong opts, jboolean yes +) +{ + burn_read_opts_set_raw( (struct burn_read_opts *) opts, yes); +} + +/* + * Class: org_pykix_libburnia_libburn_ReadOpts + * Method: burn_read_opts_set_c2errors + * Signature: (JZ)V + */ +JNIEXPORT void JNICALL Java_org_pykix_libburnia_libburn_ReadOpts_burn_1read_1opts_1set_1c2errors +( + JNIEnv *env, jclass cls, jlong opts, jboolean yes +) +{ + burn_read_opts_set_c2errors( (struct burn_read_opts *) opts, yes); +} + +/* + * Class: org_pykix_libburnia_libburn_ReadOpts + * Method: burn_read_opts_read_subcodes_audio + * Signature: (JZ)V + */ +JNIEXPORT void JNICALL Java_org_pykix_libburnia_libburn_ReadOpts_burn_1read_1opts_1read_1subcodes_1audio +( + JNIEnv *env, jclass cls, jlong opts, jboolean yes +) +{ + burn_read_opts_read_subcodes_audio( (struct burn_read_opts *) opts, yes); +} + +/* + * Class: org_pykix_libburnia_libburn_ReadOpts + * Method: burn_read_opts_read_subcodes_data + * Signature: (JZ)V + */ +JNIEXPORT void JNICALL Java_org_pykix_libburnia_libburn_ReadOpts_burn_1read_1opts_1read_1subcodes_1data +( + JNIEnv *env, jclass cls, jlong opts, jboolean yes +) +{ + burn_read_opts_read_subcodes_data( (struct burn_read_opts *) opts, yes); +} + +/* + * Class: org_pykix_libburnia_libburn_ReadOpts + * Method: burn_read_opts_set_hardware_error_recovery + * Signature: (JZ)V + */ +JNIEXPORT void JNICALL Java_org_pykix_libburnia_libburn_ReadOpts_burn_1read_1opts_1set_1hardware_1error_1recovery +( + JNIEnv *env, jclass cls, jlong opts, jboolean yes +) +{ + burn_read_opts_set_hardware_error_recovery( (struct burn_read_opts *) opts, yes); +} + +/* + * Class: org_pykix_libburnia_libburn_ReadOpts + * Method: burn_read_opts_report_recovered_errors + * Signature: (JZ)V + */ +JNIEXPORT void JNICALL Java_org_pykix_libburnia_libburn_ReadOpts_burn_1read_1opts_1report_1recovered_1errors +( + JNIEnv *env, jclass cls, jlong opts, jboolean yes +) +{ + burn_read_opts_report_recovered_errors( (struct burn_read_opts *) opts, yes); +} + +/* + * Class: org_pykix_libburnia_libburn_ReadOpts + * Method: burn_read_opts_transfer_damaged_blocks + * Signature: (JZ)V + */ +JNIEXPORT void JNICALL Java_org_pykix_libburnia_libburn_ReadOpts_burn_1read_1opts_1transfer_1damaged_1blocks +( + JNIEnv *env, jclass cls, jlong opts, jboolean yes +) +{ + burn_read_opts_transfer_damaged_blocks( (struct burn_read_opts *) opts, yes); +} + +/* + * Class: org_pykix_libburnia_libburn_ReadOpts + * Method: burn_read_opts_set_hardware_error_retries + * Signature: (JI)V + */ +JNIEXPORT void JNICALL Java_org_pykix_libburnia_libburn_ReadOpts_burn_1read_1opts_1set_1hardware_1error_1retries +( + JNIEnv *env, jclass cls, jlong opts, jint r +) +{ + burn_read_opts_set_hardware_error_retries( (struct burn_read_opts *) opts, r); +} + diff --git a/java/src/jni/libburn/ScsiAdr.c b/java/src/jni/libburn/ScsiAdr.c new file mode 100644 index 0000000..b50352b --- /dev/null +++ b/java/src/jni/libburn/ScsiAdr.c @@ -0,0 +1,91 @@ +/* + * ScsiAdr.c + * + * Copyright (c) 2007 Vreixo Formoso + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * See COPYING file for details. + */ + +#include "org_pykix_libburnia_libburn_ScsiAdr.h" +#include "BindingsUtil.h" + +#include "libburn.h" + + +/* + * Class: org_pykix_libburnia_libburn_ScsiAdr + * Method: burn_drive_convert_scsi_adr + * Signature: (IIIII)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL +Java_org_pykix_libburnia_libburn_ScsiAdr_burn_1drive_1convert_1scsi_1adr +( + JNIEnv *env, jclass cls, jint bus_no, jint host_no, jint channel_no, + jint target_no, jint lun_no +) +{ + char adr[BURN_DRIVE_ADR_LEN]; + + if ( burn_drive_convert_scsi_adr(bus_no, host_no, channel_no, + target_no, lun_no, adr) != 1 ) { + java_libburn_throw_burn_exception(env, "Can't convert SCSI adr"); + return NULL; + } + return (*env)->NewStringUTF(env, adr); +} + +/* + * Class: org_pykix_libburnia_libburn_ScsiAdr + * Method: burn_drive_obtain_scsi_adr + * Signature: (Ljava/lang/String;)Lorg/pykix/libburnia/libburn/ScsiAdr; + */ +JNIEXPORT jobject JNICALL +Java_org_pykix_libburnia_libburn_ScsiAdr_burn_1drive_1obtain_1scsi_1adr +( + JNIEnv *env, jclass cls, jstring path +) +{ + const char* cpath; + int bus_no; + int host_no; + int channel_no; + int target_no; + int lun_no; + static jclass scsiAdrCls = NULL; + static jmethodID cid = NULL; + + cpath = (*env)->GetStringUTFChars(env, path, NULL); + if ( cpath == NULL ) { + return NULL; /* OutOfMemoryError already thrown */ + } + + if ( burn_drive_obtain_scsi_adr( (char *) path, &bus_no, &host_no, + &channel_no, &target_no, &lun_no) != 1 ) { + (*env)->ReleaseStringUTFChars(env, path, cpath); + java_libburn_throw_burn_exception(env, "Can't convert SCSI adr"); + return NULL; + } + + (*env)->ReleaseStringUTFChars(env, path, cpath); + + if ( scsiAdrCls == NULL ) { + scsiAdrCls = java_libburn_find_class(env, "org/pykix/libburnia/libburn/ScsiAdr"); + if ( scsiAdrCls == NULL ) { + return NULL; + } + } + + if ( cid == NULL ) { + cid = (*env)->GetMethodID(env, scsiAdrCls, "", "(IIIII)V"); + if (cid == NULL) { + return NULL; /* exception thrown */ + } + } + + return (*env)->NewObject(env, scsiAdrCls, cid, bus_no, host_no, + channel_no, target_no, lun_no); +} diff --git a/java/src/jni/libburn/Session.c b/java/src/jni/libburn/Session.c new file mode 100644 index 0000000..52e837e --- /dev/null +++ b/java/src/jni/libburn/Session.c @@ -0,0 +1,168 @@ +/* + * Session.c + * + * Copyright (c) 2007 Vreixo Formoso + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * See COPYING file for details. + */ + +#include "org_pykix_libburnia_libburn_Session.h" + +#include "libburn.h" +#include "BindingsUtil.h" + +/* + * Class: org_pykix_libburnia_libburn_Session + * Method: burn_session_create + * Signature: ()J + */ +JNIEXPORT jlong JNICALL +Java_org_pykix_libburnia_libburn_Session_burn_1session_1create +( + JNIEnv *env, jclass cls +) +{ + return (jlong) burn_session_create(); +} + +/* + * Class: org_pykix_libburnia_libburn_Session + * Method: burn_session_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL +Java_org_pykix_libburnia_libburn_Session_burn_1session_1free +( + JNIEnv *env, jclass cls, jlong s +) +{ + burn_session_free( (struct burn_session *) s); +} + +/* + * Class: org_pykix_libburnia_libburn_Session + * Method: burn_session_add_track + * Signature: (JJI)Z + */ +JNIEXPORT jboolean JNICALL +Java_org_pykix_libburnia_libburn_Session_burn_1session_1add_1track +( + JNIEnv *env, jclass cls, jlong s, jlong t, jint pos +) +{ + return burn_session_add_track( (struct burn_session *) s, + (struct burn_track *) t, pos); +} + +/* + * Class: org_pykix_libburnia_libburn_Session + * Method: burn_session_remove_track + * Signature: (JJ)Z + */ +JNIEXPORT jboolean JNICALL +Java_org_pykix_libburnia_libburn_Session_burn_1session_1remove_1track +( + JNIEnv *env, jclass cls, jlong s, jlong t +) +{ + return burn_session_remove_track( (struct burn_session *) s, (struct burn_track *) t); +} + +/* + * Class: org_pykix_libburnia_libburn_Session + * Method: burn_session_hide_first_track + * Signature: (JI)V + */ +JNIEXPORT void JNICALL +Java_org_pykix_libburnia_libburn_Session_burn_1session_1hide_1first_1track +( + JNIEnv *env, jclass cls, jlong s, jint onoff +) +{ + burn_session_hide_first_track( (struct burn_session *) s, onoff ); +} + +/* + * Class: org_pykix_libburnia_libburn_Session + * Method: burn_session_get_sectors + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_org_pykix_libburnia_libburn_Session_burn_1session_1get_1sectors +( + JNIEnv *env, jclass cls, jlong s +) +{ + return burn_session_get_sectors( (struct burn_session *) s); +} + +/* + * Class: org_pykix_libburnia_libburn_Session + * Method: burn_session_get_leadout_entry + * Signature: (J)Lorg/pykix/libburnia/libburn/TocEntry; + */ +JNIEXPORT jobject JNICALL +Java_org_pykix_libburnia_libburn_Session_burn_1session_1get_1leadout_1entry +( + JNIEnv *env, jclass cls, jlong s +) +{ + struct burn_toc_entry entry; + + burn_session_get_leadout_entry( (struct burn_session *) s, &entry); + + return java_libburn_toc_entry_c2java(env, &entry); +} + +/* + * Class: org_pykix_libburnia_libburn_Session + * Method: burn_session_get_tracks + * Signature: (J)[J + */ +JNIEXPORT jlongArray JNICALL +Java_org_pykix_libburnia_libburn_Session_burn_1session_1get_1tracks +( + JNIEnv *env, jclass cls, jlong s +) +{ + int num; + struct burn_track **tracks; + int i; + + tracks = burn_session_get_tracks( (struct burn_session *) s, &num); + + /* create C array to store the pointers */ + jlong cresult[num]; + + for ( i = 0; i < num; ++i ) { + struct burn_track *track = tracks[i]; + cresult[i] = (jlong) track; + } + + /* move the pointer to a Java array */ + jlongArray result = (*env)->NewLongArray(env, num); + if ( result == NULL) { + return NULL; /* exception already thrown */ + } + (*env)->SetLongArrayRegion(env, result, 0, num, cresult); + + return result; +} + +/* + * Class: org_pykix_libburnia_libburn_Session + * Method: burn_session_get_hidefirst + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL +Java_org_pykix_libburnia_libburn_Session_burn_1session_1get_1hidefirst +( + JNIEnv *env, jclass cls, jlong s +) +{ + return burn_session_get_hidefirst( (struct burn_session *) s); +} + diff --git a/java/src/jni/libburn/Source.c b/java/src/jni/libburn/Source.c new file mode 100644 index 0000000..beb4241 --- /dev/null +++ b/java/src/jni/libburn/Source.c @@ -0,0 +1,182 @@ +/* + * Source.c + * + * Copyright (c) 2007 Vreixo Formoso + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * See COPYING file for details. + */ + +#include "org_pykix_libburnia_libburn_Source.h" + +#include "libburn.h" +#include "libisofs.h" + +/* + * Class: org_pykix_libburnia_libburn_Source + * Method: burn_file_source_new + * Signature: (Ljava/lang/String;Ljava/lang/String;)J + */ +JNIEXPORT jlong JNICALL Java_org_pykix_libburnia_libburn_Source_burn_1file_1source_1new +( + JNIEnv *env, jclass cls, jstring path, jstring subPath +) +{ + const char *cpath = NULL; + const char *subpath = NULL; + struct burn_source *src; + + cpath = (*env)->GetStringUTFChars(env, path, NULL); + if ( cpath == NULL ) { + return (jlong) 0; /* OutOfMemoryError already thrown */ + } + if ( subPath != NULL ) { + subpath = (*env)->GetStringUTFChars(env, subPath, NULL); + if (subpath == NULL) { + return (jlong) 0; /* OutOfMemoryError already thrown */ + } + } + + src = burn_file_source_new(cpath, subpath); + + (*env)->ReleaseStringUTFChars(env, path, cpath); + (*env)->ReleaseStringUTFChars(env, subPath, subpath); + + return (jlong) src; +} + +/* + * Class: org_pykix_libburnia_libburn_Source + * Method: burn_fd_source_new + * Signature: (IIJ)J + */ +JNIEXPORT jlong JNICALL +Java_org_pykix_libburnia_libburn_Source_burn_1fd_1source_1new +( + JNIEnv *env, jclass cls, jint datafd, jint subfd, jlong size +) +{ + return (jlong) burn_fd_source_new(datafd, subfd, size); +} + +/* + * Class: org_pykix_libburnia_libburn_Source + * Method: iso_source_new_ecma119 + * Signature: (JIII)J + */ +JNIEXPORT jlong JNICALL Java_org_pykix_libburnia_libburn_Source_iso_1source_1new_1ecma119 +( + JNIEnv *env, jclass cls, jlong volumeset, jint volnum, jint level, jint flags) +{ + + return (jlong) iso_source_new_ecma119 ( (struct iso_volset *) volumeset, volnum, level, flags); +} + +/* + * Class: org_pykix_libburnia_libburn_Source + * Method: read + * Signature: (J[BI)I + */ +JNIEXPORT jint JNICALL Java_org_pykix_libburnia_libburn_Source_read +( + JNIEnv *env, jclass cls, jlong burnSource, jbyteArray byteBuffer, jint size +) +{ + struct burn_source *source; + jbyte *buffer = NULL; + + source = (struct burn_source *) burnSource; + + buffer = (*env)->GetByteArrayElements(env, byteBuffer, NULL); + if (buffer == NULL) { + return -1; /* exception occurred */ + } + + int n = source->read(source, buffer, size); + + (*env)->ReleaseByteArrayElements(env, byteBuffer, buffer, 0); + + return n; +} + +/* + * Class: org_pykix_libburnia_libburn_Source + * Method: read_sub + * Signature: (J[BI)I + */ +JNIEXPORT jint JNICALL Java_org_pykix_libburnia_libburn_Source_read_1sub +( + JNIEnv *env, jclass cls, jlong burnSource, jbyteArray byteBuffer, jint size +) +{ + struct burn_source *source; + jbyte *buffer = NULL; + + source = (struct burn_source *) burnSource; + + buffer = (*env)->GetByteArrayElements(env, byteBuffer, NULL); + if (buffer == NULL) { + return -1; /* exception occurred */ + } + + int n = source->read_sub(source, buffer, size); + + (*env)->ReleaseByteArrayElements(env, byteBuffer, buffer, 0); + + return n; +} + +/* + * Class: org_pykix_libburnia_libburn_Source + * Method: get_size + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_pykix_libburnia_libburn_Source_get_1size +( + JNIEnv *env, jclass cls, jlong burnSource +) +{ + struct burn_source *source; + + source = (struct burn_source *) burnSource; + + off_t size = source->get_size(source); + + return size; +} + +/* + * Class: org_pykix_libburnia_libburn_Source + * Method: set_size + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL Java_org_pykix_libburnia_libburn_Source_set_1size +( + JNIEnv *env, jclass cls, jlong burnSource, jlong size +) +{ + struct burn_source *source; + + source = (struct burn_source *) burnSource; + + int n = source->set_size(source, size); + + return n; +} + +/* + * Class: org_pykix_libburnia_libburn_Source + * Method: burn_source_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_pykix_libburnia_libburn_Source_burn_1source_1free +( + JNIEnv *env, jclass cls, jlong s +) +{ + burn_source_free( (struct burn_source *) s); +} + diff --git a/java/src/jni/libburn/Track.c b/java/src/jni/libburn/Track.c new file mode 100644 index 0000000..049af80 --- /dev/null +++ b/java/src/jni/libburn/Track.c @@ -0,0 +1,223 @@ +/* + * Track.c + * + * Copyright (c) 2007 Vreixo Formoso + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * See COPYING file for details. + */ + +#include "org_pykix_libburnia_libburn_Track.h" +#include "BindingsUtil.h" + +#include "libburn.h" + +/* + * Class: org_pykix_libburnia_libburn_Track + * Method: burn_track_create + * Signature: ()J + */ +JNIEXPORT jlong JNICALL +Java_org_pykix_libburnia_libburn_Track_burn_1track_1create +( + JNIEnv *env, jclass cls +) +{ + return (jlong) burn_track_create(); +} + +/* + * Class: org_pykix_libburnia_libburn_Track + * Method: burn_track_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL +Java_org_pykix_libburnia_libburn_Track_burn_1track_1free +( + JNIEnv *env, jclass cls, jlong t +) +{ + burn_track_free( (struct burn_track *) t ); +} + +/* + * Class: org_pykix_libburnia_libburn_Track + * Method: burn_track_define_data + * Signature: (JIIZI)V + */ +JNIEXPORT void JNICALL +Java_org_pykix_libburnia_libburn_Track_burn_1track_1define_1data +( + JNIEnv *env, jclass cls, jlong t, jint offset, jint tail, jboolean pad, jint mode +) +{ + burn_track_define_data( (struct burn_track *) t, offset, tail, pad, mode); +} + +/* + * Class: org_pykix_libburnia_libburn_Track + * Method: burn_track_set_byte_swap + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL +Java_org_pykix_libburnia_libburn_Track_burn_1track_1set_1byte_1swap +( + JNIEnv *env, jclass cls, jlong t, jint swapSourceBytes +) +{ + return burn_track_set_byte_swap( (struct burn_track *) t, swapSourceBytes); +} + +/* + * Class: org_pykix_libburnia_libburn_Track + * Method: burn_track_set_isrc + * Signature: (JLjava/lang/String;Ljava/lang/String;BI)V + */ +JNIEXPORT void JNICALL +Java_org_pykix_libburnia_libburn_Track_burn_1track_1set_1isrc +( + JNIEnv *env, jclass cls, jlong t, jstring country, jstring owner, jbyte year, jint serial +) +{ + const char *ccountry; + const char *cowner; + + ccountry = (*env)->GetStringUTFChars(env, country, NULL); + if ( ccountry == NULL ) { + return; /* OutOfMemoryError already thrown */ + } + + cowner = (*env)->GetStringUTFChars(env, owner, NULL); + if ( cowner == NULL ) { + return; /* OutOfMemoryError already thrown */ + } + + burn_track_set_isrc( (struct burn_track *) t, (char *) ccountry, (char *) cowner, year, serial); + + (*env)->ReleaseStringUTFChars(env, country, ccountry); + (*env)->ReleaseStringUTFChars(env, owner, cowner); +} + +/* + * Class: org_pykix_libburnia_libburn_Track + * Method: burn_track_clear_isrc + * Signature: (J)V + */ +JNIEXPORT void JNICALL +Java_org_pykix_libburnia_libburn_Track_burn_1track_1clear_1isrc +( + JNIEnv *env, jclass cls, jlong t +) +{ + burn_track_clear_isrc( (struct burn_track *) t); +} + +/* + * Class: org_pykix_libburnia_libburn_Track + * Method: burn_track_set_source + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL +Java_org_pykix_libburnia_libburn_Track_burn_1track_1set_1source +( + JNIEnv *env, jclass cls, jlong t, jlong s +) +{ + return burn_track_set_source( (struct burn_track *) t, (struct burn_source *) s); +} + +/* + * Class: org_pykix_libburnia_libburn_Track + * Method: burn_track_set_default_size + * Signature: (JJ)Z + */ +JNIEXPORT jboolean JNICALL +Java_org_pykix_libburnia_libburn_Track_burn_1track_1set_1default_1size +( + JNIEnv *env, jclass cls, jlong t, jlong size +) +{ + return burn_track_set_default_size( (struct burn_track *) t, size); +} + +/* + * Class: org_pykix_libburnia_libburn_Track + * Method: burn_track_get_sectors + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_org_pykix_libburnia_libburn_Track_burn_1track_1get_1sectors +( + JNIEnv *env, jclass cls, jlong t +) +{ + return burn_track_get_sectors( (struct burn_track *) t); +} + +/* + * Class: org_pykix_libburnia_libburn_Track + * Method: burn_track_get_entry + * Signature: (J)Lorg/pykix/libburnia/libburn/TocEntry; + */ +JNIEXPORT jobject JNICALL +Java_org_pykix_libburnia_libburn_Track_burn_1track_1get_1entry +( + JNIEnv *env, jclass cls, jlong t +) +{ + struct burn_toc_entry entry; + + burn_track_get_entry( (struct burn_track *) t, &entry); + + return java_libburn_toc_entry_c2java(env, &entry); +} + +/* + * Class: org_pykix_libburnia_libburn_Track + * Method: burn_track_get_mode + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_org_pykix_libburnia_libburn_Track_burn_1track_1get_1mode +( + JNIEnv *env, jclass cls, jlong t +) +{ + return burn_track_get_mode( (struct burn_track *) t ); +} + +/* + * Class: org_pykix_libburnia_libburn_Track + * Method: burn_track_get_read_bytes + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_org_pykix_libburnia_libburn_Track_burn_1track_1get_1read_1bytes +( + JNIEnv *env, jclass cls, jlong t +) +{ + off_t r, w; + burn_track_get_counters( (struct burn_track *) t, &r, &w); + return r; +} + +/* + * Class: org_pykix_libburnia_libburn_Track + * Method: burn_track_get_written_bytes + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_org_pykix_libburnia_libburn_Track_burn_1track_1get_1written_1bytes +( + JNIEnv *env, jclass cls, jlong t +) +{ + off_t r, w; + burn_track_get_counters( (struct burn_track *) t, &r, &w); + return w; +} + diff --git a/java/src/jni/libburn/WriteOpts.c b/java/src/jni/libburn/WriteOpts.c new file mode 100644 index 0000000..aabf8a9 --- /dev/null +++ b/java/src/jni/libburn/WriteOpts.c @@ -0,0 +1,304 @@ +/* + * WriteOpts.c + * + * Copyright (c) 2007 Vreixo Formoso + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * See COPYING file for details. + */ + +#include "org_pykix_libburnia_libburn_WriteOpts.h" +#include "BindingsUtil.h" + +#include "libburn.h" + + +/* + * Class: org_pykix_libburnia_libburn_WriteOpts + * Method: burn_write_opts_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_pykix_libburnia_libburn_WriteOpts_burn_1write_1opts_1free +( + JNIEnv *env, jclass cls, jlong opts +) +{ + burn_write_opts_free( (struct burn_write_opts *) opts); +} + +/* + * Class: org_pykix_libburnia_libburn_WriteOpts + * Method: burn_write_opts_set_write_type + * Signature: (JII)Z + */ +JNIEXPORT jboolean JNICALL +Java_org_pykix_libburnia_libburn_WriteOpts_burn_1write_1opts_1set_1write_1type +( + JNIEnv *env, jclass cls, jlong opts, jint write_type, jint block_type +) +{ + return burn_write_opts_set_write_type( (struct burn_write_opts *) opts, + write_type, block_type); +} + +/* + * Class: org_pykix_libburnia_libburn_WriteOpts + * Method: burn_write_opts_auto_write_type + * Signature: (JJI)I + */ +JNIEXPORT jint JNICALL +Java_org_pykix_libburnia_libburn_WriteOpts_burn_1write_1opts_1auto_1write_1type +( + JNIEnv *env, jclass cls, jlong opts, jlong disc, jint flag +) +{ + char reasons[BURN_REASONS_LEN]; + + return burn_write_opts_auto_write_type( (struct burn_write_opts *) opts, + (struct burn_disc *) disc, reasons, flag); +} + +/* + * Class: org_pykix_libburnia_libburn_WriteOpts + * Method: burn_write_opts_set_simulate + * Signature: (JZ)Z + */ +JNIEXPORT jboolean JNICALL +Java_org_pykix_libburnia_libburn_WriteOpts_burn_1write_1opts_1set_1simulate +( + JNIEnv *env, jclass cls, jlong opts, jboolean sim +) +{ + return burn_write_opts_set_simulate( (struct burn_write_opts *) opts, sim); +} + +/* + * Class: org_pykix_libburnia_libburn_WriteOpts + * Method: burn_write_opts_set_underrun_proof + * Signature: (JZ)Z + */ +JNIEXPORT jboolean JNICALL +Java_org_pykix_libburnia_libburn_WriteOpts_burn_1write_1opts_1set_1underrun_1proof +( + JNIEnv *env, jclass cls, jlong opts, jboolean underrun_proof +) +{ + return burn_write_opts_set_underrun_proof( (struct burn_write_opts *) opts, underrun_proof); +} + +/* + * Class: org_pykix_libburnia_libburn_WriteOpts + * Method: burn_write_opts_set_perform_opc + * Signature: (JZ)V + */ +JNIEXPORT void JNICALL +Java_org_pykix_libburnia_libburn_WriteOpts_burn_1write_1opts_1set_1perform_1opc +( + JNIEnv *env, jclass cls, jlong opts, jboolean opc +) +{ + burn_write_opts_set_perform_opc( (struct burn_write_opts *) opts, opc); +} + +/* + * Class: org_pykix_libburnia_libburn_WriteOpts + * Method: burn_write_opts_set_multi + * Signature: (JZ)V + */ +JNIEXPORT void JNICALL +Java_org_pykix_libburnia_libburn_WriteOpts_burn_1write_1opts_1set_1multi +( + JNIEnv *env, jclass cls, jlong opts, jboolean multi +) +{ + burn_write_opts_set_multi( (struct burn_write_opts *) opts, multi); +} + +/* + * Class: org_pykix_libburnia_libburn_WriteOpts + * Method: burn_write_opts_set_force + * Signature: (JI)V + */ +JNIEXPORT void JNICALL +Java_org_pykix_libburnia_libburn_WriteOpts_burn_1write_1opts_1set_1force +( + JNIEnv *env, jclass cls, jlong opts, jint use_force +) +{ + burn_write_opts_set_force( (struct burn_write_opts *) opts, use_force); +} + +/* + * Class: org_pykix_libburnia_libburn_WriteOpts + * Method: burn_write_opts_set_start_byte + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL +Java_org_pykix_libburnia_libburn_WriteOpts_burn_1write_1opts_1set_1start_1byte +( + JNIEnv *env, jclass cls, jlong opts, jlong value +) +{ + burn_write_opts_set_start_byte( (struct burn_write_opts *) opts, value); +} + +/* + * Class: org_pykix_libburnia_libburn_WriteOpts + * Method: burn_write_opts_set_format + * Signature: (JI)V + */ +JNIEXPORT void JNICALL +Java_org_pykix_libburnia_libburn_WriteOpts_burn_1write_1opts_1set_1format +( + JNIEnv *env, jclass cls, jlong opts, jint format +) +{ + burn_write_opts_set_format( (struct burn_write_opts *) opts, format); +} + +/* + * Class: org_pykix_libburnia_libburn_WriteOpts + * Method: burn_write_opts_set_has_mediacatalog + * Signature: (JZ)V + */ +JNIEXPORT void JNICALL +Java_org_pykix_libburnia_libburn_WriteOpts_burn_1write_1opts_1set_1has_1mediacatalog +( + JNIEnv *env, jclass cls, jlong opts, jboolean has_mediacatalog +) +{ + burn_write_opts_set_has_mediacatalog( (struct burn_write_opts *)opts, has_mediacatalog); +} + +/* + * Class: org_pykix_libburnia_libburn_WriteOpts + * Method: burn_write_opts_set_mediacatalog + * Signature: (JLjava/lang/String;)V + */ +JNIEXPORT void JNICALL +Java_org_pykix_libburnia_libburn_WriteOpts_burn_1write_1opts_1set_1mediacatalog +( + JNIEnv *env, jclass cls, jlong opts, jstring mediaCatalog +) +{ + const char *mediacatalog; + + mediacatalog = (*env)->GetStringUTFChars(env, mediaCatalog, NULL); + if ( mediacatalog == NULL ) { + return; /* OutOfMemoryError already thrown */ + } + + burn_write_opts_set_mediacatalog( (struct burn_write_opts *) opts, (unsigned char*) mediacatalog); + + (*env)->ReleaseStringUTFChars(env, mediaCatalog, mediacatalog); +} + +/* + * Class: org_pykix_libburnia_libburn_WriteOpts + * Method: burn_precheck_write + * Signature: (JJI)V + */ +JNIEXPORT void JNICALL +Java_org_pykix_libburnia_libburn_WriteOpts_burn_1precheck_1write +( + JNIEnv *env, jclass cls, jlong o, jlong disc, jint silent +) +{ + char reasons[BURN_REASONS_LEN]; + + if ( burn_precheck_write( (struct burn_write_opts *) o, (struct burn_disc *) disc, + reasons, silent) != 1 ) { + + java_libburn_throw_burn_exception(env, reasons); + } +} + +/* + * Class: org_pykix_libburnia_libburn_WriteOpts + * Method: burn_write_opts_set_fillup + * Signature: (JZ)V + */ +JNIEXPORT void JNICALL +Java_org_pykix_libburnia_libburn_WriteOpts_burn_1write_1opts_1set_1fillup +( + JNIEnv *env, jclass cls, jlong o, jboolean fill_up +) +{ + burn_write_opts_set_fillup( (struct burn_write_opts *) o, fill_up); +} + +/* + * Class: org_pykix_libburnia_libburn_WriteOpts + * Method: burn_write_opts_set_toc_entries + * Signature: (JI[Lorg/pykix/libburnia/libburn/TocEntry;)V + */ +JNIEXPORT void JNICALL +Java_org_pykix_libburnia_libburn_WriteOpts_burn_1write_1opts_1set_1toc_1entries +( + JNIEnv *env, jclass cls, jlong o, jint count, jobjectArray ents +) +{ + struct burn_toc_entry entries[count]; + static jclass tocEntryCls = NULL; + static jfieldID sessionid, adrid, controlid, pointid, minid, secid, + frameid, zeroid, pminid, psecid, pframeid, extvid, smsbid, pmsbid, + slbaid, blocksid; + int i; + + if ( tocEntryCls == NULL ) { + tocEntryCls = java_libburn_find_class(env, "org/pykix/libburnia/libburn/TocEntry"); + if ( tocEntryCls == NULL ) { + return; + } + + /* TODO: check for NULL?? */ + sessionid = (*env)->GetFieldID(env, cls, "session", "B"); + adrid = (*env)->GetFieldID(env, cls, "adr", "B"); + controlid = (*env)->GetFieldID(env, cls, "control", "B"); + pointid = (*env)->GetFieldID(env, cls, "point", "B"); + minid = (*env)->GetFieldID(env, cls, "min", "B"); + secid = (*env)->GetFieldID(env, cls, "sec", "B"); + frameid = (*env)->GetFieldID(env, cls, "frame", "B"); + zeroid = (*env)->GetFieldID(env, cls, "zero", "B"); + pminid = (*env)->GetFieldID(env, cls, "pmin", "B"); + psecid = (*env)->GetFieldID(env, cls, "psec", "B"); + pframeid = (*env)->GetFieldID(env, cls, "pframe", "B"); + extvid = (*env)->GetFieldID(env, cls, "extensionsValid", "B"); + smsbid = (*env)->GetFieldID(env, cls, "sessionMsb", "B"); + pmsbid = (*env)->GetFieldID(env, cls, "pointMsb", "B"); + slbaid = (*env)->GetFieldID(env, cls, "startLba", "I"); + blocksid = (*env)->GetFieldID(env, cls, "trackBlocks", "I"); + } + + for ( i = 0; i < count; ++i ) { + + struct burn_toc_entry entry = entries[i]; + jobject obj = (*env)->GetObjectArrayElement(env, ents, i); + + entry.session = (*env)->GetByteField(env, obj, sessionid); + entry.adr = (*env)->GetByteField(env, obj, adrid); + entry.control = (*env)->GetByteField(env, obj, controlid); + entry.tno = 0; //tno is always 0 + entry.point = (*env)->GetByteField(env, obj, pointid); + entry.min = (*env)->GetByteField(env, obj, minid); + entry.sec = (*env)->GetByteField(env, obj, secid); + entry.frame = (*env)->GetByteField(env, obj, frameid); + entry.zero = (*env)->GetByteField(env, obj, zeroid); + entry.pmin = (*env)->GetByteField(env, obj, pminid); + entry.psec = (*env)->GetByteField(env, obj, psecid); + entry.pframe = (*env)->GetByteField(env, obj, pframeid); + entry.extensions_valid = (*env)->GetByteField(env, obj, extvid); + entry.session_msb = (*env)->GetByteField(env, obj, smsbid); + entry.point_msb = (*env)->GetByteField(env, obj, pmsbid); + entry.start_lba = (*env)->GetIntField(env, obj, slbaid); + entry.track_blocks = (*env)->GetIntField(env, obj, blocksid); + } + + burn_write_opts_set_toc_entries( (struct burn_write_opts *) o, + count, entries); + +} + diff --git a/java/src/jni/libisofs/IsoExclude.c b/java/src/jni/libisofs/IsoExclude.c new file mode 100644 index 0000000..e34bf5f --- /dev/null +++ b/java/src/jni/libisofs/IsoExclude.c @@ -0,0 +1,74 @@ +/* + * IsoTreeNode.c + * + * Copyright (c) 2007 Vreixo Formoso + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * See COPYING file for details. + */ + +#include "org_pykix_libburnia_libisofs_IsoExclude.h" + +#include "libisofs.h" + +/* + * Class: org_pykix_libburnia_libisofs_IsoExclude + * Method: iso_exclude_add_path + * Signature: (Ljava/lang/String;)V + */ +JNIEXPORT void JNICALL +Java_org_pykix_libburnia_libisofs_IsoExclude_iso_1exclude_1add_1path +( + JNIEnv *env, jclass cls, jstring path +) +{ + const char *cpath; + + cpath = (*env)->GetStringUTFChars(env, path, NULL); + if ( cpath == NULL ) { + return; /* OutOfMemoryError already thrown */ + } + + iso_exclude_add_path(cpath); + + (*env)->ReleaseStringUTFChars(env, path, cpath); +} + +/* + * Class: org_pykix_libburnia_libisofs_IsoExclude + * Method: iso_exclude_remove_path + * Signature: (Ljava/lang/String;)V + */ +JNIEXPORT void JNICALL +Java_org_pykix_libburnia_libisofs_IsoExclude_iso_1exclude_1remove_1path +( + JNIEnv *env, jclass cls, jstring path +) +{ + const char *cpath; + + cpath = (*env)->GetStringUTFChars(env, path, NULL); + if ( cpath == NULL ) { + return; /* OutOfMemoryError already thrown */ + } + + iso_exclude_remove_path(cpath); + + (*env)->ReleaseStringUTFChars(env, path, cpath); +} +/* + * Class: org_pykix_libburnia_libisofs_IsoExclude + * Method: iso_exclude_empty + * Signature: ()V + */ +JNIEXPORT void JNICALL +Java_org_pykix_libburnia_libisofs_IsoExclude_iso_1exclude_1empty +( + JNIEnv *env, jclass cls +) +{ + iso_exclude_empty(); +} diff --git a/java/src/jni/libisofs/IsoTreeNode.c b/java/src/jni/libisofs/IsoTreeNode.c new file mode 100644 index 0000000..b413d13 --- /dev/null +++ b/java/src/jni/libisofs/IsoTreeNode.c @@ -0,0 +1,131 @@ +/* + * IsoTreeNode.c + * + * Copyright (c) 2007 Vreixo Formoso + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * See COPYING file for details. + */ + +#include "org_pykix_libburnia_libisofs_IsoTreeNode.h" + +#include "libisofs.h" + +/* + * Class: org_pykix_libburnia_libisofs_IsoTreeNode + * Method: iso_tree_add_node + * Signature: (JLjava/lang/String;)J + */ +JNIEXPORT jlong JNICALL +Java_org_pykix_libburnia_libisofs_IsoTreeNode_iso_1tree_1add_1node +( + JNIEnv *env, jclass cls, jlong parent, jstring path +) +{ + const char *cpath; + struct iso_tree_node *node; + + cpath = (*env)->GetStringUTFChars(env, path, NULL); + if ( cpath == NULL ) { + return 0; /* OutOfMemoryError already thrown */ + } + + node = iso_tree_add_node( (struct iso_tree_node *) parent, cpath); + + (*env)->ReleaseStringUTFChars(env, path, cpath); + + return (jlong) node; +} + +/* + * Class: org_pykix_libburnia_libisofs_IsoTreeNode + * Method: iso_tree_radd_dir + * Signature: (JLjava/lang/String;)J + */ +JNIEXPORT jlong JNICALL +Java_org_pykix_libburnia_libisofs_IsoTreeNode_iso_1tree_1radd_1dir +( + JNIEnv *env, jclass cls, jlong parent, jstring path +) +{ + const char *cpath; + struct iso_tree_node *node; + + cpath = (*env)->GetStringUTFChars(env, path, NULL); + if ( cpath == NULL ) { + return 0; /* OutOfMemoryError already thrown */ + } + + node = iso_tree_radd_dir( (struct iso_tree_node *) parent, cpath); + + (*env)->ReleaseStringUTFChars(env, path, cpath); + + return (jlong) node; +} + +/* + * Class: org_pykix_libburnia_libisofs_IsoTreeNode + * Method: iso_tree_print + * Signature: (JI)V + */ +JNIEXPORT void JNICALL +Java_org_pykix_libburnia_libisofs_IsoTreeNode_iso_1tree_1print +( + JNIEnv *env, jclass cls, jlong root, jint spaces +) +{ + iso_tree_print( (const struct iso_tree_node *) root, spaces); + fflush(stdout); +} + +/* + * Class: org_pykix_libburnia_libisofs_IsoTreeNode + * Method: iso_tree_node_set_name + * Signature: (JLjava/lang/String;)V + */ +JNIEXPORT void JNICALL +Java_org_pykix_libburnia_libisofs_IsoTreeNode_iso_1tree_1node_1set_1name +( + JNIEnv *env, jclass cls, jlong file, jstring name +) +{ + const char *cname; + + cname = (*env)->GetStringUTFChars(env, name, NULL); + if ( cname == NULL ) { + return; /* OutOfMemoryError already thrown */ + } + + iso_tree_node_set_name( (struct iso_tree_node *) file, cname); + + (*env)->ReleaseStringUTFChars(env, name, cname); +} + +/* + * Class: org_pykix_libburnia_libisofs_IsoTreeNode + * Method: iso_tree_add_new_dir + * Signature: (JLjava/lang/String;)J + */ +JNIEXPORT jlong JNICALL +Java_org_pykix_libburnia_libisofs_IsoTreeNode_iso_1tree_1add_1new_1dir +( + JNIEnv *env, jclass cls, jlong parent, jstring name +) +{ + const char *cname; + struct iso_tree_node *node; + + cname = (*env)->GetStringUTFChars(env, name, NULL); + if ( cname == NULL ) { + return; /* OutOfMemoryError already thrown */ + } + + node = iso_tree_add_new_dir( (struct iso_tree_node *) parent, cname); + + (*env)->ReleaseStringUTFChars(env, name, cname); + + return (jlong) node; +} diff --git a/java/src/jni/libisofs/IsoVolSet.c b/java/src/jni/libisofs/IsoVolSet.c new file mode 100644 index 0000000..ccea449 --- /dev/null +++ b/java/src/jni/libisofs/IsoVolSet.c @@ -0,0 +1,55 @@ +/* + * IsoVolSet.c + * + * Copyright (c) 2007 Vreixo Formoso + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * See COPYING file for details. + */ + +#include "org_pykix_libburnia_libisofs_IsoVolSet.h" + +#include "libisofs.h" + +/* + * Class: org_pykix_libburnia_libisofs_IsoVolSet + * Method: iso_volset_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL +Java_org_pykix_libburnia_libisofs_IsoVolSet_iso_1volset_1free +( + JNIEnv *env, jclass cls, jlong volume +) +{ + iso_volset_free( (struct iso_volset *) volume); +} + +/* + * Class: org_pykix_libburnia_libisofs_IsoVolSet + * Method: iso_volset_new + * Signature: (JLjava/lang/String;)J + */ +JNIEXPORT jlong JNICALL +Java_org_pykix_libburnia_libisofs_IsoVolSet_iso_1volset_1new +( + JNIEnv *env, jclass cls, jlong volume, jstring volsetId +) +{ + const char *volset_id; + struct iso_volset *volset; + + volset_id = (*env)->GetStringUTFChars(env, volsetId, NULL); + if ( volset_id == NULL ) { + return (jlong) 0; /* OutOfMemoryError already thrown */ + } + + volset = iso_volset_new( (struct iso_volume *) volume, volset_id); + + (*env)->ReleaseStringUTFChars(env, volsetId, volset_id); + + return (jlong) volset; +} diff --git a/java/src/jni/libisofs/IsoVolume.c b/java/src/jni/libisofs/IsoVolume.c new file mode 100644 index 0000000..6d69af7 --- /dev/null +++ b/java/src/jni/libisofs/IsoVolume.c @@ -0,0 +1,292 @@ +/* + * IsoVolume.c + * + * Copyright (c) 2007 Vreixo Formoso + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * See COPYING file for details. + */ + +#include "org_pykix_libburnia_libisofs_IsoVolume.h" + +#include "libisofs.h" + +/* + * Class: org_pykix_libburnia_libisofs_IsoVolume + * Method: iso_volume_new + * Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)J + */ +JNIEXPORT jlong JNICALL +Java_org_pykix_libburnia_libisofs_IsoVolume_iso_1volume_1new +( + JNIEnv *env, + jclass cls, + jstring volumeId, + jstring publisherId, + jstring dataPreparerId +) +{ + const char *volume_id = NULL; + const char *publisher_id = NULL; + const char *data_preparer_id = NULL; + + if ( volumeId != NULL ) { + volume_id = (*env)->GetStringUTFChars(env, volumeId, NULL); + if ( volume_id == NULL ) { + return (jlong) 0; /* OutOfMemoryError already thrown */ + } + } + if ( publisherId != NULL ) { + publisher_id = (*env)->GetStringUTFChars(env, publisherId, NULL); + if (publisher_id == NULL) { + return (jlong) 0; /* OutOfMemoryError already thrown */ + } + } + if ( dataPreparerId != NULL ) { + data_preparer_id = (*env)->GetStringUTFChars(env, dataPreparerId, NULL); + if ( data_preparer_id == NULL ) { + return (jlong) 0; /* OutOfMemoryError already thrown */ + } + } + + struct iso_volume *iso = iso_volume_new(volume_id, publisher_id, data_preparer_id); + + (*env)->ReleaseStringUTFChars(env, volumeId, volume_id); + (*env)->ReleaseStringUTFChars(env, publisherId, publisher_id); + (*env)->ReleaseStringUTFChars(env, dataPreparerId, data_preparer_id); + + return (jlong) iso; + +} + +/* + * Class: org_pykix_libburnia_libisofs_IsoVolume + * Method: iso_volume_new_with_root + * Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;J)J + */ +JNIEXPORT jlong JNICALL +Java_org_pykix_libburnia_libisofs_IsoVolume_iso_1volume_1new_1with_1root +( + JNIEnv *env, + jclass cls, + jstring volumeId, + jstring publisherId, + jstring dataPreparerId, + jlong root +) +{ + const char *volume_id = NULL; + const char *publisher_id = NULL; + const char *data_preparer_id = NULL; + struct iso_volume *iso; + + if ( volumeId != NULL ) { + volume_id = (*env)->GetStringUTFChars(env, volumeId, NULL); + if ( volume_id == NULL ) { + return (jlong) 0; /* OutOfMemoryError already thrown */ + } + } + if ( publisherId != NULL ) { + publisher_id = (*env)->GetStringUTFChars(env, publisherId, NULL); + if (publisher_id == NULL) { + return (jlong) 0; /* OutOfMemoryError already thrown */ + } + } + if ( dataPreparerId != NULL ) { + data_preparer_id = (*env)->GetStringUTFChars(env, dataPreparerId, NULL); + if ( data_preparer_id == NULL ) { + return (jlong) 0; /* OutOfMemoryError already thrown */ + } + } + + iso = iso_volume_new_with_root(volume_id, publisher_id, data_preparer_id, + (struct iso_tree_node *) root); + + (*env)->ReleaseStringUTFChars(env, volumeId, volume_id); + (*env)->ReleaseStringUTFChars(env, publisherId, publisher_id); + (*env)->ReleaseStringUTFChars(env, dataPreparerId, data_preparer_id); + + return (jlong) iso; +} + + +/* + * Class: org_pykix_libburnia_libisofs_IsoVolume + * Method: iso_volume_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL +Java_org_pykix_libburnia_libisofs_IsoVolume_iso_1volume_1free +( + JNIEnv *env, jclass cls, jlong volume +) +{ + iso_volume_free( (struct iso_volume *) volume ); +} + +/* + * Class: org_pykix_libburnia_libisofs_IsoVolume + * Method: iso_volume_get_root + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_org_pykix_libburnia_libisofs_IsoVolume_iso_1volume_1get_1root +( + JNIEnv *env, jclass cls, jlong volume +) +{ + //return (jlong) iso_volume_get_root( (struct iso_volume *) volume ); +} + +/* + * Class: org_pykix_libburnia_libisofs_IsoVolume + * Method: iso_volume_set_volume_id + * Signature: (JLjava/lang/String;)V + */ +JNIEXPORT void JNICALL +Java_org_pykix_libburnia_libisofs_IsoVolume_iso_1volume_1set_1volume_1id +( + JNIEnv *env, jclass cls, jlong volume, jstring volumeId +) +{ + const char *volume_id; + volume_id = (*env)->GetStringUTFChars(env, volumeId, NULL); + if ( volume_id == NULL ) { + return; /* OutOfMemoryError already thrown */ + } + + //iso_volume_set_volume_id( (struct iso_volume *) volume, volume_id); + + (*env)->ReleaseStringUTFChars(env, volumeId, volume_id); +} + +/* + * Class: org_pykix_libburnia_libisofs_IsoVolume + * Method: iso_volume_set_publisher_id + * Signature: (JLjava/lang/String;)V + */ +JNIEXPORT void JNICALL +Java_org_pykix_libburnia_libisofs_IsoVolume_iso_1volume_1set_1publisher_1id +( + JNIEnv *env, jclass cls, jlong volume, jstring publisherId +) +{ + const char *publisher_id; + publisher_id = (*env)->GetStringUTFChars(env, publisherId, NULL); + if (publisher_id == NULL) { + return; /* OutOfMemoryError already thrown */ + } + + //iso_volume_set_publisher_id( (struct iso_volume *) volume, publisher_id); + + (*env)->ReleaseStringUTFChars(env, publisherId, publisher_id); +} + +/* + * Class: org_pykix_libburnia_libisofs_IsoVolume + * Method: iso_volume_set_data_preparer_id + * Signature: (JLjava/lang/String;)V + */ +JNIEXPORT void JNICALL +Java_org_pykix_libburnia_libisofs_IsoVolume_iso_1volume_1set_1data_1preparer_1id +( + JNIEnv *env, jclass cls, jlong volume, jstring dataPreparerId +) +{ + const char *data_preparer_id; + data_preparer_id = (*env)->GetStringUTFChars(env, dataPreparerId, NULL); + if ( data_preparer_id == NULL ) { + return; /* OutOfMemoryError already thrown */ + } + + //iso_volume_set_data_preparer_id( (struct iso_volume *) volume, data_preparer_id); + + (*env)->ReleaseStringUTFChars(env, dataPreparerId, data_preparer_id); +} + +/* + * Class: org_pykix_libburnia_libisofs_IsoVolume + * Method: iso_tree_volume_path_to_node + * Signature: (JLjava/lang/String;)J + */ +JNIEXPORT jlong JNICALL +Java_org_pykix_libburnia_libisofs_IsoVolume_iso_1tree_1volume_1path_1to_1node +( + JNIEnv *env, jclass cls, jlong volume, jstring path +) +{ + const char *cpath; + struct iso_tree_node *node; + + cpath = (*env)->GetStringUTFChars(env, path, NULL); + if ( cpath == NULL ) { + return 0; /* OutOfMemoryError already thrown */ + } + + node = iso_tree_volume_path_to_node((struct iso_volume *) volume, cpath); + + (*env)->ReleaseStringUTFChars(env, path, cpath); + + return (jlong) node; +} + +/* + * Class: org_pykix_libburnia_libisofs_IsoVolume + * Method: iso_tree_volume_add_path + * Signature: (JLjava/lang/String;Ljava/lang/String;)J + */ +JNIEXPORT jlong JNICALL +Java_org_pykix_libburnia_libisofs_IsoVolume_iso_1tree_1volume_1add_1path +( + JNIEnv *env, jclass cls, jlong volume, jstring discPath, jstring path +) +{ + const char *disc_path; + const char *cpath; + struct iso_tree_node *node; + + disc_path = (*env)->GetStringUTFChars(env, discPath, NULL); + if ( disc_path == NULL ) { + return 0; /* OutOfMemoryError already thrown */ + } + cpath = (*env)->GetStringUTFChars(env, path, NULL); + if ( cpath == NULL ) { + return 0; /* OutOfMemoryError already thrown */ + } + + node = iso_tree_volume_add_path( (struct iso_volume *) volume, disc_path, path); + + (*env)->ReleaseStringUTFChars(env, path, cpath); + (*env)->ReleaseStringUTFChars(env, discPath, disc_path); + + return (jlong) node; +} + +/* + * Class: org_pykix_libburnia_libisofs_IsoVolume + * Method: iso_tree_volume_add_new_dir + * Signature: (JLjava/lang/String;)J + */ +JNIEXPORT jlong JNICALL +Java_org_pykix_libburnia_libisofs_IsoVolume_iso_1tree_1volume_1add_1new_1dir +( + JNIEnv *env, jclass cls, jlong volume, jstring discPath +) +{ + const char *disc_path; + struct iso_tree_node *node; + + disc_path = (*env)->GetStringUTFChars(env, discPath, NULL); + if ( disc_path == NULL ) { + return 0; /* OutOfMemoryError already thrown */ + } + + node = iso_tree_volume_add_new_dir( (struct iso_volume *) volume, disc_path); + + (*env)->ReleaseStringUTFChars(env, discPath, disc_path); + + return (jlong) node; +} diff --git a/java/src/test/org/pykix/libburnia/test/IsoFsMain.java b/java/src/test/org/pykix/libburnia/test/IsoFsMain.java new file mode 100644 index 0000000..51f1a40 --- /dev/null +++ b/java/src/test/org/pykix/libburnia/test/IsoFsMain.java @@ -0,0 +1,152 @@ +/* + * Main.java + * + * Copyright (c) 2007 Vreixo Formoso + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * See COPYING file for details. + */ + +package org.pykix.libburnia.test; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.EnumSet; + +import org.pykix.libburnia.libburn.BurnSource; +import org.pykix.libburnia.libburn.Source; +import org.pykix.libburnia.libisofs.Ecma119ExtensionFlag; +import org.pykix.libburnia.libisofs.IsoTreeNode; +import org.pykix.libburnia.libisofs.IsoVolSet; +import org.pykix.libburnia.libisofs.IsoVolume; + +public class IsoFsMain { + + private static void usage() { + System.out.println("Main [OPTIONS] DIRECTORY OUTPUT"); + } + + private static void help() + { + System.out.println( + "Options:\n" + + " -J Add Joliet support\n" + + " -R Add Rock Ridge support\n" + + " -L Set the ISO level (1 or 2)\n" + + " -h Print this message" + ); + } + + private static void invalidOption(String opt) { + System.out.println("Invalid option: " + opt + + ". Try Main -h for help"); + usage(); + } + + public static void main(String[] args) throws IOException { + + EnumSet flags = + EnumSet.noneOf(Ecma119ExtensionFlag.class); + int level = 1; + + /* parse cmd line. */ + int i = 0; + while ( i < args.length ) { + String arg = args[i]; + + if ( arg.startsWith("-") ) { + + if (arg.length() > 2) { + invalidOption(arg); + System.exit(1); + } + + char opt = arg.charAt(1); + + switch (opt) { + case 'h': + usage(); + help(); + System.exit(0); + break; + case 'J': + flags.add(Ecma119ExtensionFlag.JOLIET); + break; + case 'R': + flags.add(Ecma119ExtensionFlag.ROCKRIDGE); + break; + case 'L': + /* get level value */ + if ( ++i < args.length ) { + level = Integer.parseInt(args[i]); + } else { + System.out.println("Level number needed"); + usage(); + help(); + System.exit(1); + break; + } + break; + default: + invalidOption(arg); + System.exit(1); + break; + } + i++; + } else { + break; /* exit loop, no more options */ + } + } + + + if (args.length < i + 1) { + System.out.println("Please pass directory from which to build ISO"); + usage(); + System.exit(1); + } + + if (args.length < i + 2) { + System.out.println("Please supply output file"); + usage(); + System.exit(1); + } + + FileOutputStream f = null; + try { + f = new FileOutputStream(args[i+1]); + } catch (FileNotFoundException e) { + System.out.println("error opening output file"); + System.exit(1); + } + + File dir = new File(args[i]); + IsoTreeNode root = null; + try { + root = IsoTreeNode.raddDir(null, dir); + } catch (FileNotFoundException e) { + System.out.println("Input directory not found"); + System.exit(1); + } + + if ( root == null ) { + System.out.println("Error opening input directory."); + System.exit(1); + } + + IsoVolume volume = new IsoVolume("VOLID", "PUBID", "PREPID", root); + IsoVolSet volset = new IsoVolSet( volume, "VOLSETID" ); + BurnSource src = new Source(volset, 0, level, flags); + + byte [] buf = new byte[2048]; + while ( src.read(buf, 2048) == 2048 ) { + f.write(buf); + } + f.close(); + } + +} diff --git a/java/src/test/org/pykix/libburnia/test/Test.java b/java/src/test/org/pykix/libburnia/test/Test.java new file mode 100644 index 0000000..9dca541 --- /dev/null +++ b/java/src/test/org/pykix/libburnia/test/Test.java @@ -0,0 +1,212 @@ +/* + * Test.java + * + * Copyright (c) 2007 Vreixo Formoso + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * See COPYING file for details. + */ + +package org.pykix.libburnia.test; + +import java.util.Arrays; + +import org.pykix.libburnia.libburn.BlockType; +import org.pykix.libburnia.libburn.Burn; +import org.pykix.libburnia.libburn.BurnException; +import org.pykix.libburnia.libburn.BurnSource; +import org.pykix.libburnia.libburn.Disc; +import org.pykix.libburnia.libburn.DiscStatus; +import org.pykix.libburnia.libburn.Drive; +import org.pykix.libburnia.libburn.DriveInfo; +import org.pykix.libburnia.libburn.DriveStatus; +import org.pykix.libburnia.libburn.FormatDesc; +import org.pykix.libburnia.libburn.Formats; +import org.pykix.libburnia.libburn.Message; +import org.pykix.libburnia.libburn.MultiCaps; +import org.pykix.libburnia.libburn.Profile; +import org.pykix.libburnia.libburn.Progress; +import org.pykix.libburnia.libburn.ReadOpts; +import org.pykix.libburnia.libburn.ScsiAdr; +import org.pykix.libburnia.libburn.Session; +import org.pykix.libburnia.libburn.Source; +import org.pykix.libburnia.libburn.SpeedDescriptor; +import org.pykix.libburnia.libburn.Track; +import org.pykix.libburnia.libburn.WriteOpts; +import org.pykix.libburnia.libburn.WriteType; +import org.pykix.libburnia.libburn.Message.Severity; + +public class Test { + + private static int blankDisc(Drive drive, boolean fast) + throws InterruptedException, BurnException { + + DiscStatus state = drive.getDiscStatus(); + Profile profile = drive.getProfile(); + + System.out.println("Disc state: " + state); + + if (profile == Profile.DVD_RW_RESTRICTED_OVERWITE) { + /* formatted DVD-RW will get blanked to sequential state */ + } else if (state == DiscStatus.BLANK) { + System.err.println( + "IDLE: Blank media detected. Will leave it untouched"); + return 2; + } else if (state == DiscStatus.FULL || + state == DiscStatus.APPENDABLE) { + /* this is what libburner is willing to blank */ + } else if (state == DiscStatus.EMPTY) { + System.err.println("FATAL: No media detected in drive"); + return 0; + } else { + System.err.println("FATAL: Unsuitable drive and media state"); + return 0; + } + + if( !drive.isErasable() ) { + System.err.println("FATAL : Media is not of erasable type"); + return 0; + } + + System.out.println("Beginning to " + (fast?"fast":"full") + "-blank media."); + + drive.erase(fast); + + Thread.sleep(1000); + + Progress p = new Progress(); + + while ( drive.getDriveStatus(p) != DriveStatus.IDLE ) { + + System.out.printf("Blanking ( %.1f%% done )\n", + (float) p.getSector() * 100 / p.getSectors() ); + Thread.sleep(1000); + } + + System.out.println("Done"); + return 1; + + } + + private static int writeImage(Drive drive, String path) + throws InterruptedException, BurnException { + + WriteOpts wo = drive.newWriteOpts(); + + wo.setMulti(true); + wo.setWriteType(WriteType.SAO, BlockType.MODE2_OK); + + BurnSource src = new Source(path, null); + + Disc disc = new Disc(); + Session s = new Session(); + Track t = new Track(); + t.setSource(src); + s.addTrack(t, 0); + disc.addSession(s, 0); + + wo.precheckWrite(disc, false); + + drive.write(wo, disc); + + Thread.sleep(1000); + + Progress p = new Progress(); + + while ( drive.getDriveStatus(p) != DriveStatus.IDLE ) { + + System.out.printf("Blanking ( %.1f%% done )\n", + (float) p.getSector() * 100 / p.getSectors() ); + Thread.sleep(1000); + } + + return 0; + } + + public static void main(String[] args) throws BurnException, InterruptedException { + + Burn.initialize(); +// Message.setSeverities(Severity.ALL, Severity.ALL, "Test: "); + +// DriveInfo[] drives = Burn.scan(); +// Drive drive = drives[0].getDrive(); + +// drive.grab(true); + + System.out.println(Burn.convertFsAdr("/dev/sr0")); + + DriveInfo info = Burn.scanAndGrab("/dev/sg1", true); + + Drive drive = info.getDrive(); + +// ScsiAdr ad = ScsiAdr.obtainScsiAdr(info.getAdr()); +// System.out.println(Burn.getVersion()); +// Burn.setSignalHandler( new Burn.SignalHandler() { +// public int handleSignal(int signum, int flag) { +// System.err.println("handled signal " + signum); +// System.err.flush(); +// return -1; +// } +// }, 0); + + Formats fs = drive.getFormats(); + + System.out.println("blsas = " + fs.getBlSas() + + ", size = " + fs.getSize() + + ", status = " + fs.getStatus()); + + FormatDesc fd = drive.getFormatDescr(0); + + System.out.println(" Type = " + fd.getType() + + ", size = " + fd.getSize() ); + +// WriteOpts wo = drive.newWriteOpts(); +// +// System.out.println(drive.getAvailableSpace(wo)); + +// drive.readAtip(); +// +// MultiCaps mc = drive.getMultiCaps(WriteType.SAO); +// +// System.out.println( mc.getCurrentProfile() ); +// +// mc = drive.getMultiCaps(WriteType.SAO); +// System.out.println( mc.isWritingPossible() ); + +// System.out.println( drive.getTrackNwa(null, 2) ); + +// SpeedDescriptor[] sl = drive.getSpeedList(); +// +// for ( SpeedDescriptor sd : sl ) { +// System.out.println( sd.getWriteSpeed() + " " + sd.getSource() ); +// } +// +// Message msg; +// while ( (msg = Message.obtain(Severity.ALL)) != null ) { +// System.out.println(msg.getMsgText()); +// } + +// blankDisc(drive, true); +// writeImage(drive, "/home/metalpain/image.iso"); + +// ReadOpts opts = drive.newReadOpts(); + +// System.out.println( drive.getWriteSpeed() ); + +// long i = 0; +// while( i++ < 10000000000L) { +// //System.out.print("aa"); +// } + + drive.release(false); + +// drives[0].forget(0); + info.forget(0); + + Burn.finish(); + } + +}